summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--qtcreator.pri6
-rw-r--r--qtcreator.qbs8
-rw-r--r--share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml2
-rw-r--r--share/qtcreator/templates/wizards/plaincapp/qbs/wizard.xml2
-rw-r--r--share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml2
-rw-r--r--share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml2
-rw-r--r--share/qtcreator/welcomescreen/widgets/SessionItem.qml25
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp2
-rw-r--r--src/libs/3rdparty/cplusplus/Control.cpp2
-rw-r--r--src/libs/3rdparty/cplusplus/Parser.cpp21
-rw-r--r--src/libs/cplusplus/LookupContext.cpp27
-rw-r--r--src/libs/extensionsystem/pluginerroroverview.cpp2
-rw-r--r--src/libs/libs.qbs1
-rw-r--r--src/libs/qmljs/qmljs-lib.pri6
-rw-r--r--src/libs/qmljs/qmljs.qbs1
-rw-r--r--src/libs/qmljs/qmljsbind.cpp10
-rw-r--r--src/libs/qmljs/qmljsbundle.cpp8
-rw-r--r--src/libs/qmljs/qmljsbundle.h8
-rw-r--r--src/libs/qmljs/qmljsdescribevalue.cpp13
-rw-r--r--src/libs/qmljs/qmljsdialect.cpp331
-rw-r--r--src/libs/qmljs/qmljsdialect.h174
-rw-r--r--src/libs/qmljs/qmljsdocument.cpp104
-rw-r--r--src/libs/qmljs/qmljsdocument.h18
-rw-r--r--src/libs/qmljs/qmljsimportdependencies.cpp6
-rw-r--r--src/libs/qmljs/qmljsimportdependencies.h5
-rw-r--r--src/libs/qmljs/qmljsinterpreter.cpp81
-rw-r--r--src/libs/qmljs/qmljsinterpreter.h54
-rw-r--r--src/libs/qmljs/qmljslink.cpp2
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp234
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.h38
-rw-r--r--src/libs/qmljs/qmljsscopechain.cpp2
-rw-r--r--src/libs/qmljs/qmljsviewercontext.cpp38
-rw-r--r--src/libs/qmljs/qmljsviewercontext.h7
-rw-r--r--src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs77
-rw-r--r--src/libs/utils/algorithm.h79
-rw-r--r--src/libs/utils/ansiescapecodehandler.cpp36
-rw-r--r--src/libs/utils/buildablehelperlibrary.cpp18
-rw-r--r--src/libs/utils/consoleprocess_unix.cpp4
-rw-r--r--src/libs/utils/environment.cpp26
-rw-r--r--src/libs/utils/environment.h7
-rw-r--r--src/libs/utils/pathchooser.cpp4
-rw-r--r--src/libs/utils/stringutils.cpp2
-rw-r--r--src/libs/utils/stringutils.h8
-rw-r--r--src/libs/utils/stylehelper.cpp150
-rw-r--r--src/libs/utils/stylehelper.h2
-rw-r--r--src/libs/utils/textfieldcheckbox.cpp65
-rw-r--r--src/libs/utils/textfieldcheckbox.h69
-rw-r--r--src/libs/utils/textfieldcombobox.cpp87
-rw-r--r--src/libs/utils/textfieldcombobox.h63
-rw-r--r--src/libs/utils/uncommentselection.cpp35
-rw-r--r--src/libs/utils/uncommentselection.h6
-rw-r--r--src/libs/utils/utils-lib.pri4
-rw-r--r--src/libs/utils/utils.qbs4
-rw-r--r--src/plugins/analyzerbase/analyzerutils.cpp10
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.cpp21
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.h11
-rw-r--r--src/plugins/android/android.pro36
-rw-r--r--src/plugins/android/android.qbs39
-rw-r--r--src/plugins/android/android_dependencies.pri1
-rw-r--r--src/plugins/android/android_global.h41
-rw-r--r--src/plugins/android/androidanalyzesupport.h4
-rw-r--r--src/plugins/android/androidbuildapkstep.cpp325
-rw-r--r--src/plugins/android/androidbuildapkstep.h117
-rw-r--r--src/plugins/android/androidbuildapkwidget.cpp256
-rw-r--r--src/plugins/android/androidbuildapkwidget.h83
-rw-r--r--src/plugins/android/androidbuildapkwidget.ui261
-rw-r--r--src/plugins/android/androidconfigurations.cpp37
-rw-r--r--src/plugins/android/androidconfigurations.h13
-rw-r--r--src/plugins/android/androidconstants.h5
-rw-r--r--src/plugins/android/androiddebugsupport.cpp25
-rw-r--r--src/plugins/android/androiddebugsupport.h4
-rw-r--r--src/plugins/android/androiddeployconfiguration.cpp27
-rw-r--r--src/plugins/android/androiddeployconfiguration.h7
-rw-r--r--src/plugins/android/androiddeployqtstep.cpp382
-rw-r--r--src/plugins/android/androiddeployqtstep.h69
-rw-r--r--src/plugins/android/androiddeployqtwidget.cpp282
-rw-r--r--src/plugins/android/androiddeployqtwidget.h27
-rw-r--r--src/plugins/android/androiddeployqtwidget.ui353
-rw-r--r--src/plugins/android/androiddeploystep.cpp501
-rw-r--r--src/plugins/android/androiddeploystep.h161
-rw-r--r--src/plugins/android/androiddeploystepfactory.cpp114
-rw-r--r--src/plugins/android/androiddeploystepwidget.cpp136
-rw-r--r--src/plugins/android/androiddeploystepwidget.ui113
-rw-r--r--src/plugins/android/androiddevice.h5
-rw-r--r--src/plugins/android/androidglobal.h20
-rw-r--r--src/plugins/android/androidmanager.cpp915
-rw-r--r--src/plugins/android/androidmanager.h98
-rw-r--r--src/plugins/android/androidmanifestdocument.cpp7
-rw-r--r--src/plugins/android/androidmanifestdocument.h6
-rw-r--r--src/plugins/android/androidmanifesteditor.cpp2
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.cpp34
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.h7
-rw-r--r--src/plugins/android/androidpackagecreationfactory.cpp112
-rw-r--r--src/plugins/android/androidpackagecreationstep.cpp883
-rw-r--r--src/plugins/android/androidpackagecreationstep.h156
-rw-r--r--src/plugins/android/androidpackagecreationwidget.cpp394
-rw-r--r--src/plugins/android/androidpackagecreationwidget.h121
-rw-r--r--src/plugins/android/androidpackagecreationwidget.ui323
-rw-r--r--src/plugins/android/androidplugin.cpp15
-rw-r--r--src/plugins/android/androidqtsupport.h73
-rw-r--r--src/plugins/android/androidqtversion.cpp13
-rw-r--r--src/plugins/android/androidrunconfiguration.cpp73
-rw-r--r--src/plugins/android/androidrunconfiguration.h28
-rw-r--r--src/plugins/android/androidruncontrol.cpp1
-rw-r--r--src/plugins/android/androidruncontrol.h4
-rw-r--r--src/plugins/android/androidrunfactories.cpp98
-rw-r--r--src/plugins/android/androidrunfactories.h31
-rw-r--r--src/plugins/android/androidrunner.cpp1
-rw-r--r--src/plugins/android/androidrunner.h4
-rw-r--r--src/plugins/android/androidtoolchain.cpp12
-rw-r--r--src/plugins/android/avddialog.h3
-rw-r--r--src/plugins/android/javaeditor.cpp24
-rw-r--r--src/plugins/android/javaeditor.h6
-rw-r--r--src/plugins/bazaar/bazaarcontrol.cpp4
-rw-r--r--src/plugins/bazaar/bazaarplugin.cpp242
-rw-r--r--src/plugins/bazaar/bazaarplugin.h7
-rw-r--r--src/plugins/bazaar/constants.h32
-rw-r--r--src/plugins/beautifier/abstractsettings.cpp6
-rw-r--r--src/plugins/bineditor/bineditorplugin.cpp2
-rw-r--r--src/plugins/bookmarks/bookmark.cpp10
-rw-r--r--src/plugins/bookmarks/bookmark.h5
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.cpp54
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.h14
-rw-r--r--src/plugins/bookmarks/bookmarksplugin.cpp28
-rw-r--r--src/plugins/bookmarks/bookmarksplugin.h4
-rw-r--r--src/plugins/clangcodemodel/clangcodemodelplugin.cpp8
-rw-r--r--src/plugins/clangcodemodel/clangcompletion.cpp2
-rw-r--r--src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp33
-rw-r--r--src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h16
-rw-r--r--src/plugins/clangcodemodel/semanticmarker.h2
-rw-r--r--src/plugins/clangcodemodel/test/completiontesthelper.cpp2
-rw-r--r--src/plugins/classview/classviewmanager.cpp19
-rw-r--r--src/plugins/classview/classviewmanager.h1
-rw-r--r--src/plugins/classview/classviewnavigationwidgetfactory.cpp45
-rw-r--r--src/plugins/classview/classviewnavigationwidgetfactory.h23
-rw-r--r--src/plugins/classview/classviewplugin.cpp5
-rw-r--r--src/plugins/clearcase/activityselector.cpp2
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp4
-rw-r--r--src/plugins/clearcase/clearcasesettings.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp5
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditor.cpp30
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditor.h6
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp267
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.h19
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectconstants.h1
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp11
-rw-r--r--src/plugins/cmakeprojectmanager/cmakesettingspage.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/makestep.cpp3
-rw-r--r--src/plugins/coreplugin/actionmanager/commandmappings.cpp2
-rw-r--r--src/plugins/coreplugin/core.qrc5
-rw-r--r--src/plugins/coreplugin/coreconstants.h7
-rw-r--r--src/plugins/coreplugin/coreplugin.cpp3
-rw-r--r--src/plugins/coreplugin/coreplugin.pro3
-rw-r--r--src/plugins/coreplugin/coreplugin.qbs3
-rw-r--r--src/plugins/coreplugin/dialogs/externaltoolconfig.cpp6
-rw-r--r--src/plugins/coreplugin/dialogs/newdialog.cpp2
-rw-r--r--src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp4
-rw-r--r--src/plugins/coreplugin/dialogs/settingsdialog.cpp2
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp13
-rw-r--r--src/plugins/coreplugin/editmode.cpp5
-rw-r--r--src/plugins/coreplugin/editormanager/documentmodel.cpp33
-rw-r--r--src/plugins/coreplugin/editormanager/editorarea.cpp54
-rw-r--r--src/plugins/coreplugin/editormanager/editorarea.h (renamed from src/plugins/texteditor/basetextmark.h)36
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp2971
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.h110
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager_p.h230
-rw-r--r--src/plugins/coreplugin/editormanager/editorview.cpp61
-rw-r--r--src/plugins/coreplugin/editormanager/ieditorfactory.cpp9
-rw-r--r--src/plugins/coreplugin/editormanager/ieditorfactory.h16
-rw-r--r--src/plugins/coreplugin/editormanager/openeditorsview.cpp37
-rw-r--r--src/plugins/coreplugin/editormanager/openeditorsview.h7
-rw-r--r--src/plugins/coreplugin/editormanager/openeditorswindow.cpp4
-rw-r--r--src/plugins/coreplugin/editortoolbar.cpp10
-rw-r--r--src/plugins/coreplugin/externaltool.cpp11
-rw-r--r--src/plugins/coreplugin/externaltool.h4
-rw-r--r--src/plugins/coreplugin/featureprovider.h22
-rw-r--r--src/plugins/coreplugin/fileutils.cpp4
-rw-r--r--src/plugins/coreplugin/find/findtoolbar.cpp11
-rw-r--r--src/plugins/coreplugin/generalsettings.cpp16
-rw-r--r--src/plugins/coreplugin/idocumentfactory.h4
-rw-r--r--src/plugins/coreplugin/images/arrowdown.pngbin362 -> 177 bytes
-rw-r--r--src/plugins/coreplugin/images/arrowdown@2x.pngbin205 -> 231 bytes
-rw-r--r--src/plugins/coreplugin/images/arrowup.pngbin352 -> 183 bytes
-rw-r--r--src/plugins/coreplugin/images/arrowup@2x.pngbin203 -> 232 bytes
-rw-r--r--src/plugins/coreplugin/images/button_close.pngbin291 -> 209 bytes
-rw-r--r--src/plugins/coreplugin/images/button_close@2x.pngbin378 -> 314 bytes
-rw-r--r--src/plugins/coreplugin/images/find.pngbin737 -> 0 bytes
-rw-r--r--src/plugins/coreplugin/images/findnext.pngbin828 -> 0 bytes
-rw-r--r--src/plugins/coreplugin/images/inputfield.pngbin379 -> 293 bytes
-rw-r--r--src/plugins/coreplugin/images/inputfield@2x.pngbin0 -> 529 bytes
-rw-r--r--src/plugins/coreplugin/images/inputfield_disabled.pngbin379 -> 332 bytes
-rw-r--r--src/plugins/coreplugin/images/inputfield_disabled@2x.pngbin0 -> 597 bytes
-rw-r--r--src/plugins/coreplugin/images/locked.pngbin310 -> 331 bytes
-rw-r--r--src/plugins/coreplugin/images/locked@2x.pngbin495 -> 613 bytes
-rw-r--r--src/plugins/coreplugin/images/panel_button.pngbin472 -> 376 bytes
-rw-r--r--src/plugins/coreplugin/images/panel_button_checked.pngbin434 -> 367 bytes
-rw-r--r--src/plugins/coreplugin/images/panel_button_checked_hover.pngbin483 -> 358 bytes
-rw-r--r--src/plugins/coreplugin/images/panel_button_hover.pngbin518 -> 375 bytes
-rw-r--r--src/plugins/coreplugin/images/panel_button_pressed.pngbin466 -> 399 bytes
-rw-r--r--src/plugins/coreplugin/images/panel_manage_button.pngbin1087 -> 312 bytes
-rw-r--r--src/plugins/coreplugin/images/progressbar.pngbin420 -> 213 bytes
-rw-r--r--src/plugins/coreplugin/images/progressbar@2x.pngbin0 -> 529 bytes
-rw-r--r--src/plugins/coreplugin/inavigationwidgetfactory.cpp50
-rw-r--r--src/plugins/coreplugin/inavigationwidgetfactory.h26
-rw-r--r--src/plugins/coreplugin/iwizardfactory.cpp46
-rw-r--r--src/plugins/coreplugin/iwizardfactory.h8
-rw-r--r--src/plugins/coreplugin/locator/executefilter.cpp4
-rw-r--r--src/plugins/coreplugin/locator/locatorwidget.cpp3
-rw-r--r--src/plugins/coreplugin/mainwindow.cpp23
-rw-r--r--src/plugins/coreplugin/manhattanstyle.cpp10
-rw-r--r--src/plugins/coreplugin/navigationsubwidget.cpp2
-rw-r--r--src/plugins/coreplugin/outputpanemanager.cpp24
-rw-r--r--src/plugins/coreplugin/outputpanemanager.h4
-rw-r--r--src/plugins/coreplugin/progressmanager/progressbar.cpp66
-rw-r--r--src/plugins/coreplugin/progressmanager/progressbar.h1
-rw-r--r--src/plugins/coreplugin/progressmanager/progressmanager.cpp7
-rw-r--r--src/plugins/coreplugin/progressmanager/progressmanager_win.cpp8
-rw-r--r--src/plugins/coreplugin/sidebarwidget.cpp2
-rw-r--r--src/plugins/coreplugin/styleanimator.cpp12
-rw-r--r--src/plugins/coreplugin/variablemanager.cpp10
-rw-r--r--src/plugins/cpaster/cpasterplugin.cpp6
-rw-r--r--src/plugins/cppeditor/cppcanonicalsymbol.cpp2
-rw-r--r--src/plugins/cppeditor/cppcanonicalsymbol.h6
-rw-r--r--src/plugins/cppeditor/cppcodemodelinspectordialog.cpp18
-rw-r--r--src/plugins/cppeditor/cppdocumentationcommenthelper.cpp4
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp229
-rw-r--r--src/plugins/cppeditor/cppeditor.h28
-rw-r--r--src/plugins/cppeditor/cppeditorconstants.h2
-rw-r--r--src/plugins/cppeditor/cppeditoroutline.cpp10
-rw-r--r--src/plugins/cppeditor/cppeditoroutline.h6
-rw-r--r--src/plugins/cppeditor/cppeditorplugin.cpp18
-rw-r--r--src/plugins/cppeditor/cppeditorplugin.h8
-rw-r--r--src/plugins/cppeditor/cppeditortestcase.cpp6
-rw-r--r--src/plugins/cppeditor/cppeditortestcase.h8
-rw-r--r--src/plugins/cppeditor/cppelementevaluator.cpp4
-rw-r--r--src/plugins/cppeditor/cppelementevaluator.h2
-rw-r--r--src/plugins/cppeditor/cppfollowsymbolundercursor.cpp16
-rw-r--r--src/plugins/cppeditor/cppfollowsymbolundercursor.h6
-rw-r--r--src/plugins/cppeditor/cppfunctiondecldeflink.cpp6
-rw-r--r--src/plugins/cppeditor/cppfunctiondecldeflink.h8
-rw-r--r--src/plugins/cppeditor/cpphighlighter.h2
-rw-r--r--src/plugins/cppeditor/cpphoverhandler.cpp2
-rw-r--r--src/plugins/cppeditor/cpphoverhandler.h4
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy.cpp39
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy.h9
-rw-r--r--src/plugins/cppeditor/cpplocalrenaming.cpp8
-rw-r--r--src/plugins/cppeditor/cppoutline.cpp4
-rw-r--r--src/plugins/cppeditor/cppoutline.h4
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp2
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.h2
-rw-r--r--src/plugins/cppeditor/cppquickfixassistant.cpp6
-rw-r--r--src/plugins/cppeditor/cppquickfixassistant.h8
-rw-r--r--src/plugins/cppeditor/cppquickfixes.cpp2
-rw-r--r--src/plugins/cppeditor/cppsnippetprovider.cpp4
-rw-r--r--src/plugins/cppeditor/cpptypehierarchy.cpp54
-rw-r--r--src/plugins/cppeditor/cpptypehierarchy.h23
-rw-r--r--src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp4
-rw-r--r--src/plugins/cppeditor/fileandtokenactions_test.cpp46
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp6
-rw-r--r--src/plugins/cpptools/cppcodestylesettingspage.cpp6
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp55
-rw-r--r--src/plugins/cpptools/cppcompletionassist.cpp2
-rw-r--r--src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp24
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp2
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.h2
-rw-r--r--src/plugins/cpptools/cpptoolsplugin.cpp18
-rw-r--r--src/plugins/cpptools/cpptoolsplugin.h4
-rw-r--r--src/plugins/cpptools/stringtable.cpp14
-rw-r--r--src/plugins/cvs/checkoutwizard.cpp2
-rw-r--r--src/plugins/cvs/cvsconstants.h6
-rw-r--r--src/plugins/cvs/cvscontrol.cpp4
-rw-r--r--src/plugins/cvs/cvsplugin.cpp186
-rw-r--r--src/plugins/cvs/cvsplugin.h1
-rw-r--r--src/plugins/cvs/settingspage.cpp2
-rw-r--r--src/plugins/debugger/breakhandler.cpp13
-rw-r--r--src/plugins/debugger/breakpointmarker.cpp8
-rw-r--r--src/plugins/debugger/breakpointmarker.h4
-rw-r--r--src/plugins/debugger/breakwindow.cpp12
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp51
-rw-r--r--src/plugins/debugger/cdb/cdbengine.h2
-rw-r--r--src/plugins/debugger/cdb/cdboptionspage.cpp20
-rw-r--r--src/plugins/debugger/commonoptionspage.cpp72
-rw-r--r--src/plugins/debugger/debuggercore.h31
-rw-r--r--src/plugins/debugger/debuggerengine.cpp26
-rw-r--r--src/plugins/debugger/debuggerengine.h4
-rw-r--r--src/plugins/debugger/debuggermainwindow.cpp4
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp194
-rw-r--r--src/plugins/debugger/debuggerrunner.cpp4
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.cpp27
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.h6
-rw-r--r--src/plugins/debugger/disassembleragent.cpp30
-rw-r--r--src/plugins/debugger/gdb/coregdbadapter.cpp75
-rw-r--r--src/plugins/debugger/gdb/coregdbadapter.h9
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp80
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h2
-rw-r--r--src/plugins/debugger/gdb/gdboptionspage.cpp46
-rw-r--r--src/plugins/debugger/gdb/gdbplainengine.cpp2
-rw-r--r--src/plugins/debugger/gdb/remotegdbserveradapter.cpp8
-rw-r--r--src/plugins/debugger/lldb/lldbengine.cpp32
-rw-r--r--src/plugins/debugger/lldb/lldbengine.h2
-rw-r--r--src/plugins/debugger/loadcoredialog.cpp10
-rw-r--r--src/plugins/debugger/logwindow.cpp18
-rw-r--r--src/plugins/debugger/moduleswindow.cpp9
-rw-r--r--src/plugins/debugger/pdb/pdbengine.cpp8
-rw-r--r--src/plugins/debugger/pdb/pdbengine.h2
-rw-r--r--src/plugins/debugger/qml/qmlcppengine.cpp4
-rw-r--r--src/plugins/debugger/qml/qmlcppengine.h2
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp9
-rw-r--r--src/plugins/debugger/qml/qmlengine.h6
-rw-r--r--src/plugins/debugger/qml/qmlinspectoradapter.cpp7
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp31
-rw-r--r--src/plugins/debugger/qml/qmllivetextpreview.cpp4
-rw-r--r--src/plugins/debugger/qml/qmlv8debuggerclient.cpp2
-rw-r--r--src/plugins/debugger/registerwindow.cpp7
-rw-r--r--src/plugins/debugger/snapshotwindow.cpp2
-rw-r--r--src/plugins/debugger/sourceagent.cpp23
-rw-r--r--src/plugins/debugger/sourcefileswindow.cpp6
-rw-r--r--src/plugins/debugger/sourceutils.cpp2
-rw-r--r--src/plugins/debugger/sourceutils.h4
-rw-r--r--src/plugins/debugger/stackhandler.cpp9
-rw-r--r--src/plugins/debugger/stackwindow.cpp23
-rw-r--r--src/plugins/debugger/threadswindow.cpp4
-rw-r--r--src/plugins/debugger/watchhandler.cpp32
-rw-r--r--src/plugins/debugger/watchwindow.cpp21
-rw-r--r--src/plugins/designer/cpp/cpp.pri9
-rw-r--r--src/plugins/designer/designer.qbs3
-rw-r--r--src/plugins/designer/designer_dependencies.pri1
-rw-r--r--src/plugins/designer/designerconstants.h2
-rw-r--r--src/plugins/designer/designerxmleditorwidget.cpp7
-rw-r--r--src/plugins/designer/designerxmleditorwidget.h4
-rw-r--r--src/plugins/designer/formeditorplugin.cpp4
-rw-r--r--src/plugins/designer/formeditorw.cpp2
-rw-r--r--src/plugins/designer/formtemplatewizardpage.cpp84
-rw-r--r--src/plugins/designer/formwindoweditor.cpp3
-rw-r--r--src/plugins/designer/formwindoweditor.h10
-rw-r--r--src/plugins/designer/formwindowfile.cpp2
-rw-r--r--src/plugins/designer/formwindowfile.h5
-rw-r--r--src/plugins/designer/qtcreatorintegration.cpp24
-rw-r--r--src/plugins/designer/qtdesignerformclasscodegenerator.cpp94
-rw-r--r--src/plugins/designer/qtdesignerformclasscodegenerator.h30
-rw-r--r--src/plugins/diffeditor/diffeditor.cpp6
-rw-r--r--src/plugins/diffeditor/selectabletexteditorwidget.cpp3
-rw-r--r--src/plugins/diffeditor/sidebysidediffeditorwidget.cpp14
-rw-r--r--src/plugins/diffeditor/unifieddiffeditorwidget.cpp2
-rw-r--r--src/plugins/emacskeys/emacskeysplugin.cpp2
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp12
-rw-r--r--src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp89
-rw-r--r--src/plugins/genericprojectmanager/cppmodelmanagerhelper.h64
-rw-r--r--src/plugins/genericprojectmanager/genericprojectfileseditor.cpp19
-rw-r--r--src/plugins/genericprojectmanager/genericprojectfileseditor.h7
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.pro6
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.qbs12
-rw-r--r--src/plugins/genericprojectmanager/genericprojectplugin.cpp2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectplugin.h5
-rw-r--r--src/plugins/genericprojectmanager/genericprojectplugin_test.cpp110
-rw-r--r--src/plugins/git/changeselectiondialog.cpp4
-rw-r--r--src/plugins/git/changeselectiondialog.h4
-rw-r--r--src/plugins/git/gerrit/gerritmodel.cpp4
-rw-r--r--src/plugins/git/gerrit/gerritplugin.cpp23
-rw-r--r--src/plugins/git/gerrit/gerritplugin.h2
-rw-r--r--src/plugins/git/gitclient.cpp35
-rw-r--r--src/plugins/git/gitclient.h4
-rw-r--r--src/plugins/git/giteditor.cpp58
-rw-r--r--src/plugins/git/giteditor.h6
-rw-r--r--src/plugins/git/gitplugin.cpp577
-rw-r--r--src/plugins/git/gitplugin.h79
-rw-r--r--src/plugins/git/gitsettings.cpp4
-rw-r--r--src/plugins/git/gitsettings.h2
-rw-r--r--src/plugins/git/mergetool.cpp10
-rw-r--r--src/plugins/git/remotedialog.cpp4
-rw-r--r--src/plugins/glsleditor/glsleditor.cpp108
-rw-r--r--src/plugins/glsleditor/glsleditor.h18
-rw-r--r--src/plugins/glsleditor/glsleditoreditable.cpp15
-rw-r--r--src/plugins/glsleditor/glsleditoreditable.h7
-rw-r--r--src/plugins/glsleditor/glsleditorfactory.cpp6
-rw-r--r--src/plugins/glsleditor/glsleditorplugin.cpp2
-rw-r--r--src/plugins/glsleditor/glsleditorplugin.h2
-rw-r--r--src/plugins/glsleditor/glslhighlighter.cpp2
-rw-r--r--src/plugins/glsleditor/glslhighlighter.h2
-rw-r--r--src/plugins/glsleditor/glslhoverhandler.cpp7
-rw-r--r--src/plugins/glsleditor/glslhoverhandler.h4
-rw-r--r--src/plugins/help/helpplugin.cpp2
-rw-r--r--src/plugins/help/helpwidget.cpp2
-rw-r--r--src/plugins/help/openpageswidget.cpp2
-rw-r--r--src/plugins/imageviewer/imageview.cpp6
-rw-r--r--src/plugins/ios/iosconfigurations.cpp2
-rw-r--r--src/plugins/macros/texteditormacrohandler.cpp4
-rw-r--r--src/plugins/macros/texteditormacrohandler.h4
-rw-r--r--src/plugins/mercurial/mercurialclient.cpp2
-rw-r--r--src/plugins/mercurial/mercurialcontrol.cpp4
-rw-r--r--src/plugins/perforce/perforceconstants.h20
-rw-r--r--src/plugins/perforce/perforceplugin.cpp439
-rw-r--r--src/plugins/perforce/perforcesettings.cpp3
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/plugins/plugins.qbs1
-rw-r--r--src/plugins/projectexplorer/abstractmsvctoolchain.cpp12
-rw-r--r--src/plugins/projectexplorer/allprojectsfind.cpp5
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.cpp12
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.h1
-rw-r--r--src/plugins/projectexplorer/buildsettingspropertiespage.cpp39
-rw-r--r--src/plugins/projectexplorer/buildsettingspropertiespage.h19
-rw-r--r--src/plugins/projectexplorer/buildsteplist.cpp9
-rw-r--r--src/plugins/projectexplorer/buildstepspage.cpp9
-rw-r--r--src/plugins/projectexplorer/codestylesettingspropertiespage.cpp30
-rw-r--r--src/plugins/projectexplorer/codestylesettingspropertiespage.h17
-rw-r--r--src/plugins/projectexplorer/customtoolchain.cpp16
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardpage.cpp112
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardpage.h50
-rw-r--r--src/plugins/projectexplorer/dependenciespanel.cpp34
-rw-r--r--src/plugins/projectexplorer/dependenciespanel.h15
-rw-r--r--src/plugins/projectexplorer/deploymentdata.h10
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicemanager.cpp9
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp4
-rw-r--r--src/plugins/projectexplorer/doubletabwidget.cpp19
-rw-r--r--src/plugins/projectexplorer/doubletabwidget.h3
-rw-r--r--src/plugins/projectexplorer/editorconfiguration.cpp74
-rw-r--r--src/plugins/projectexplorer/editorconfiguration.h6
-rw-r--r--src/plugins/projectexplorer/editorsettingspropertiespage.cpp30
-rw-r--r--src/plugins/projectexplorer/editorsettingspropertiespage.h15
-rw-r--r--src/plugins/projectexplorer/environmentitemswidget.cpp2
-rw-r--r--src/plugins/projectexplorer/foldernavigationwidget.cpp28
-rw-r--r--src/plugins/projectexplorer/foldernavigationwidget.h5
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp39
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.h4
-rw-r--r--src/plugins/projectexplorer/kit.cpp39
-rw-r--r--src/plugins/projectexplorer/kit.h9
-rw-r--r--src/plugins/projectexplorer/kitfeatureprovider.h (renamed from src/plugins/qtsupport/qtfeatureprovider.h)18
-rw-r--r--src/plugins/projectexplorer/kitinformation.cpp36
-rw-r--r--src/plugins/projectexplorer/kitinformation.h67
-rw-r--r--src/plugins/projectexplorer/kitmanager.cpp110
-rw-r--r--src/plugins/projectexplorer/kitmanager.h21
-rw-r--r--src/plugins/projectexplorer/kitmanagerconfigwidget.cpp2
-rw-r--r--src/plugins/projectexplorer/kitmodel.cpp24
-rw-r--r--src/plugins/projectexplorer/localapplicationrunconfiguration.cpp4
-rw-r--r--src/plugins/projectexplorer/miniprojecttargetselector.cpp24
-rw-r--r--src/plugins/projectexplorer/msvctoolchain.cpp10
-rw-r--r--src/plugins/projectexplorer/panelswidget.cpp210
-rw-r--r--src/plugins/projectexplorer/panelswidget.h61
-rw-r--r--src/plugins/projectexplorer/processparameters.cpp4
-rw-r--r--src/plugins/projectexplorer/project.cpp39
-rw-r--r--src/plugins/projectexplorer/project.h10
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp144
-rw-r--r--src/plugins/projectexplorer/projectexplorer.pro12
-rw-r--r--src/plugins/projectexplorer/projectexplorer.qbs5
-rw-r--r--src/plugins/projectexplorer/projectexplorerconstants.h3
-rw-r--r--src/plugins/projectexplorer/projectfilewizardextension.cpp292
-rw-r--r--src/plugins/projectexplorer/projectfilewizardextension.h2
-rw-r--r--src/plugins/projectexplorer/projectmacroexpander.h2
-rw-r--r--src/plugins/projectexplorer/projectnodes.cpp8
-rw-r--r--src/plugins/projectexplorer/projectnodes.h1
-rw-r--r--src/plugins/projectexplorer/projectpanelfactory.cpp97
-rw-r--r--src/plugins/projectexplorer/projectpanelfactory.h105
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.cpp84
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.h12
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.cpp15
-rw-r--r--src/plugins/projectexplorer/projectwindow.cpp304
-rw-r--r--src/plugins/projectexplorer/projectwindow.h35
-rw-r--r--src/plugins/projectexplorer/projectwizardpage.cpp303
-rw-r--r--src/plugins/projectexplorer/projectwizardpage.h33
-rw-r--r--src/plugins/projectexplorer/propertiespanel.cpp2
-rw-r--r--src/plugins/projectexplorer/propertiespanel.h (renamed from src/plugins/projectexplorer/iprojectproperties.h)47
-rw-r--r--src/plugins/projectexplorer/runsettingspropertiespage.cpp40
-rw-r--r--src/plugins/projectexplorer/runsettingspropertiespage.h13
-rw-r--r--src/plugins/projectexplorer/selectablefilesmodel.cpp23
-rw-r--r--src/plugins/projectexplorer/session.cpp41
-rw-r--r--src/plugins/projectexplorer/session.h1
-rw-r--r--src/plugins/projectexplorer/settingsaccessor.cpp284
-rw-r--r--src/plugins/projectexplorer/settingsaccessor.h2
-rw-r--r--src/plugins/projectexplorer/target.cpp32
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.cpp43
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.h1
-rw-r--r--src/plugins/projectexplorer/targetsetuppage.cpp92
-rw-r--r--src/plugins/projectexplorer/targetsetuppage.h12
-rw-r--r--src/plugins/projectexplorer/task.cpp4
-rw-r--r--src/plugins/projectexplorer/task.h8
-rw-r--r--src/plugins/projectexplorer/taskhub.cpp15
-rw-r--r--src/plugins/projectexplorer/toolchainmanager.cpp7
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.cpp59
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.h2
-rw-r--r--src/plugins/projectexplorer/unconfiguredprojectpanel.cpp39
-rw-r--r--src/plugins/projectexplorer/unconfiguredprojectpanel.h16
-rw-r--r--src/plugins/pythoneditor/pythoneditor.cpp11
-rw-r--r--src/plugins/pythoneditor/pythoneditor.h5
-rw-r--r--src/plugins/pythoneditor/pythoneditorfactory.cpp8
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.h2
-rw-r--r--src/plugins/pythoneditor/pythoneditorwidget.cpp31
-rw-r--r--src/plugins/pythoneditor/pythoneditorwidget.h13
-rw-r--r--src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp5
-rw-r--r--src/plugins/qbsprojectmanager/qbsbuildconfiguration.h2
-rw-r--r--src/plugins/qbsprojectmanager/qbsbuildstep.cpp6
-rw-r--r--src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui6
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp2
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp12
-rw-r--r--src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp16
-rw-r--r--src/plugins/qmakeandroidsupport/QmakeAndroidSupport.pluginspec.in17
-rw-r--r--src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.cpp (renamed from src/plugins/android/androidextralibrarylistmodel.cpp)2
-rw-r--r--src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.h (renamed from src/plugins/android/androidextralibrarylistmodel.h)5
-rw-r--r--src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.cpp (renamed from src/plugins/android/androidpackageinstallationfactory.cpp)11
-rw-r--r--src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.h (renamed from src/plugins/android/androidpackageinstallationfactory.h)4
-rw-r--r--src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp (renamed from src/plugins/android/androidpackageinstallationstep.cpp)39
-rw-r--r--src/plugins/qmakeandroidsupport/androidpackageinstallationstep.h (renamed from src/plugins/android/androidpackageinstallationstep.h)11
-rw-r--r--src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.cpp69
-rw-r--r--src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.h58
-rw-r--r--src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp (renamed from src/plugins/android/createandroidmanifestwizard.cpp)47
-rw-r--r--src/plugins/qmakeandroidsupport/createandroidmanifestwizard.h (renamed from src/plugins/android/createandroidmanifestwizard.h)8
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp297
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.h (renamed from src/plugins/android/androiddeploystepfactory.h)53
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.cpp193
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.h (renamed from src/plugins/android/androidpackagecreationfactory.h)60
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.ui149
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp139
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h73
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp149
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h78
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp135
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupport.h (renamed from src/plugins/android/androiddeploystepwidget.h)43
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro36
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs49
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupport_dependencies.pri16
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupport_global.h41
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.cpp70
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.h53
-rw-r--r--src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp17
-rw-r--r--src/plugins/qmakeprojectmanager/profileeditor.cpp28
-rw-r--r--src/plugins/qmakeprojectmanager/profileeditor.h5
-rw-r--r--src/plugins/qmakeprojectmanager/profilehoverhandler.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/profilehoverhandler.h4
-rw-r--r--src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.cpp9
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp19
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.h3
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp14
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectimporter.h2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp5
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs1
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager_dependencies.pri2
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.cpp13
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp10
-rw-r--r--src/plugins/qmldesigner/components/importmanager/importlabel.cpp4
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocument.cpp4
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocument.h2
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp6
-rw-r--r--src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp4
-rw-r--r--src/plugins/qmldesigner/designmodewidget.cpp4
-rw-r--r--src/plugins/qmldesigner/designmodewidget.h2
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.cpp6
-rw-r--r--src/plugins/qmljseditor/qmlexpressionundercursor.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljscompletionassist.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp27
-rw-r--r--src/plugins/qmljseditor/qmljseditor.h2
-rw-r--r--src/plugins/qmljseditor/qmljseditoreditable.cpp14
-rw-r--r--src/plugins/qmljseditor/qmljseditoreditable.h6
-rw-r--r--src/plugins/qmljseditor/qmljseditorplugin.h2
-rw-r--r--src/plugins/qmljseditor/qmljsfindreferences.cpp6
-rw-r--r--src/plugins/qmljseditor/qmljshoverhandler.cpp5
-rw-r--r--src/plugins/qmljseditor/qmljshoverhandler.h6
-rw-r--r--src/plugins/qmljseditor/qmljsquickfixassist.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljssemantichighlighter.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljssnippetprovider.cpp4
-rw-r--r--src/plugins/qmljseditor/qmltaskmanager.cpp4
-rw-r--r--src/plugins/qmljseditor/quicktoolbar.cpp2
-rw-r--r--src/plugins/qmljstools/qmlconsolepane.cpp4
-rw-r--r--src/plugins/qmljstools/qmljsbundleprovider.cpp26
-rw-r--r--src/plugins/qmljstools/qmljscodestylesettingspage.cpp6
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.cpp20
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.h5
-rw-r--r--src/plugins/qmljstools/qmljsrefactoringchanges.cpp2
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp2
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp54
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.h3
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.cpp106
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.h2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectmanager.qbs1
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri1
-rw-r--r--src/plugins/qnx/bardescriptoreditor.cpp2
-rw-r--r--src/plugins/qnx/bardescriptoreditorwidget.cpp20
-rw-r--r--src/plugins/qnx/bardescriptoreditorwidget.h7
-rw-r--r--src/plugins/qnx/blackberryapplicationrunner.cpp4
-rw-r--r--src/plugins/qnx/blackberrycreatepackagestep.cpp5
-rw-r--r--src/plugins/qnx/blackberrydeploystep.cpp6
-rw-r--r--src/plugins/qnx/blackberrydeviceconnection.cpp4
-rw-r--r--src/plugins/qnx/blackberryrunconfigurationfactory.cpp2
-rw-r--r--src/plugins/qnx/blackberrysigningutils.cpp2
-rw-r--r--src/plugins/qnx/cascadesimport/projectfileconverter.cpp4
-rw-r--r--src/plugins/qnx/qnxbaseconfiguration.cpp2
-rw-r--r--src/plugins/qnx/qnxplugin.cpp8
-rw-r--r--src/plugins/qnx/qnxtoolchain.cpp2
-rw-r--r--src/plugins/qtsupport/codegensettings.cpp84
-rw-r--r--src/plugins/qtsupport/codegensettings.h67
-rw-r--r--src/plugins/qtsupport/codegensettingspage.cpp (renamed from src/plugins/designer/cpp/cppsettingspage.cpp)65
-rw-r--r--src/plugins/qtsupport/codegensettingspage.h (renamed from src/plugins/designer/cpp/cppsettingspage.h)33
-rw-r--r--src/plugins/qtsupport/codegensettingspagewidget.ui (renamed from src/plugins/designer/cpp/cppsettingspagewidget.ui)4
-rw-r--r--src/plugins/qtsupport/customexecutablerunconfiguration.cpp6
-rw-r--r--src/plugins/qtsupport/exampleslistmodel.cpp18
-rw-r--r--src/plugins/qtsupport/qtkitconfigwidget.cpp5
-rw-r--r--src/plugins/qtsupport/qtkitinformation.cpp54
-rw-r--r--src/plugins/qtsupport/qtkitinformation.h37
-rw-r--r--src/plugins/qtsupport/qtoptionspage.cpp15
-rw-r--r--src/plugins/qtsupport/qtparser.cpp16
-rw-r--r--src/plugins/qtsupport/qtsupport.pro6
-rw-r--r--src/plugins/qtsupport/qtsupport.qbs6
-rw-r--r--src/plugins/qtsupport/qtsupportconstants.h7
-rw-r--r--src/plugins/qtsupport/qtsupportplugin.cpp6
-rw-r--r--src/plugins/qtsupport/qtversionmanager.cpp40
-rw-r--r--src/plugins/qtsupport/uicodemodelsupport.cpp7
-rw-r--r--src/plugins/subversion/checkoutwizard.cpp2
-rw-r--r--src/plugins/subversion/settingspage.cpp2
-rw-r--r--src/plugins/subversion/subversionclient.h4
-rw-r--r--src/plugins/subversion/subversionconstants.h6
-rw-r--r--src/plugins/subversion/subversioncontrol.cpp4
-rw-r--r--src/plugins/subversion/subversionplugin.cpp107
-rw-r--r--src/plugins/subversion/subversionplugin.h3
-rw-r--r--src/plugins/tasklist/tasklistplugin.cpp2
-rw-r--r--src/plugins/texteditor/basefilefind.cpp6
-rw-r--r--src/plugins/texteditor/basehoverhandler.cpp19
-rw-r--r--src/plugins/texteditor/basehoverhandler.h12
-rw-r--r--src/plugins/texteditor/basetextdocument.cpp183
-rw-r--r--src/plugins/texteditor/basetextdocument.h32
-rw-r--r--src/plugins/texteditor/basetextdocumentlayout.cpp199
-rw-r--r--src/plugins/texteditor/basetextdocumentlayout.h15
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp1675
-rw-r--r--src/plugins/texteditor/basetexteditor.h476
-rw-r--r--src/plugins/texteditor/basetexteditor_p.h130
-rw-r--r--src/plugins/texteditor/basetexteditor_test.cpp6
-rw-r--r--src/plugins/texteditor/basetextmark.cpp154
-rw-r--r--src/plugins/texteditor/codeassist/codeassistant.cpp2
-rw-r--r--src/plugins/texteditor/codestyleeditor.cpp6
-rw-r--r--src/plugins/texteditor/findincurrentfile.cpp5
-rw-r--r--src/plugins/texteditor/findinopenfiles.cpp5
-rw-r--r--src/plugins/texteditor/itexteditor.cpp96
-rw-r--r--src/plugins/texteditor/itexteditor.h156
-rw-r--r--src/plugins/texteditor/itextmark.cpp142
-rw-r--r--src/plugins/texteditor/linenumberfilter.cpp2
-rw-r--r--src/plugins/texteditor/outlinefactory.cpp27
-rw-r--r--src/plugins/texteditor/outlinefactory.h6
-rw-r--r--src/plugins/texteditor/plaintexteditor.cpp200
-rw-r--r--src/plugins/texteditor/plaintexteditor.h99
-rw-r--r--src/plugins/texteditor/plaintexteditorfactory.cpp29
-rw-r--r--src/plugins/texteditor/refactoringchanges.cpp4
-rw-r--r--src/plugins/texteditor/snippets/snippeteditor.cpp7
-rw-r--r--src/plugins/texteditor/snippets/snippetssettingspage.cpp4
-rw-r--r--src/plugins/texteditor/texteditor.pro12
-rw-r--r--src/plugins/texteditor/texteditor.qbs12
-rw-r--r--src/plugins/texteditor/texteditorplugin.cpp24
-rw-r--r--src/plugins/texteditor/texteditorplugin.h7
-rw-r--r--src/plugins/texteditor/texteditorsettings.cpp6
-rw-r--r--src/plugins/texteditor/textmark.cpp261
-rw-r--r--src/plugins/texteditor/textmark.h (renamed from src/plugins/texteditor/itextmark.h)59
-rw-r--r--src/plugins/texteditor/textmarkregistry.h (renamed from src/plugins/texteditor/basetextmarkregistry.h)12
-rw-r--r--src/plugins/valgrind/callgrindtextmark.cpp4
-rw-r--r--src/plugins/valgrind/callgrindtextmark.h4
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp30
-rw-r--r--src/plugins/valgrind/callgrindtool.h3
-rw-r--r--src/plugins/valgrind/memchecktool.cpp13
-rw-r--r--src/plugins/valgrind/memchecktool.h3
-rw-r--r--src/plugins/vcsbase/basevcseditorfactory.cpp2
-rw-r--r--src/plugins/vcsbase/command.cpp37
-rw-r--r--src/plugins/vcsbase/command.h5
-rw-r--r--src/plugins/vcsbase/vcsbaseclient.cpp22
-rw-r--r--src/plugins/vcsbase/vcsbaseclientsettings.cpp5
-rw-r--r--src/plugins/vcsbase/vcsbaseclientsettings.h4
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp33
-rw-r--r--src/plugins/vcsbase/vcsbaseoutputwindow.cpp7
-rw-r--r--src/plugins/vcsbase/vcsbaseoutputwindow.h6
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.cpp2
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.h3
-rw-r--r--src/plugins/winrt/winrtpackagedeploymentstep.cpp2
-rw-r--r--src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp2
-rw-r--r--src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri12
-rw-r--r--src/tools/icons/qtcreatoricons.svg741
-rw-r--r--src/tools/qtcreatorcrashhandler/crashhandler.cpp5
-rw-r--r--src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro8
-rw-r--r--tests/auto/debugger/tst_dumpers.cpp2
-rw-r--r--tests/auto/qml/codemodel/check/tst_check.cpp2
-rw-r--r--tests/auto/qml/codemodel/codemodel.pro3
-rw-r--r--tests/auto/qml/codemodel/codemodel.qbs2
-rw-r--r--tests/auto/qml/codemodel/importscheck/001_flatQmlOnly/GaussianDirectionalBlur.qml287
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Blend.qml478
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/BrightnessContrast.qml207
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ColorOverlay.qml155
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Colorize.qml294
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ConicalGradient.qml342
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Desaturate.qml155
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DirectionalBlur.qml289
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Displace.qml217
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DropShadow.qml403
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/FastBlur.qml496
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GammaAdjust.qml193
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GaussianBlur.qml295
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Glow.qml307
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/HueSaturation.qml300
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/InnerShadow.qml385
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LevelAdjust.qml472
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LinearGradient.qml346
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/MaskedBlur.qml282
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/OpacityMask.qml154
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialBlur.qml312
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialGradient.qml439
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RectangularGlow.qml288
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RecursiveBlur.qml350
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ThresholdMask.qml226
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ZoomBlur.qml302
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastGlow.qml393
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml413
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml332
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml287
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml98
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml155
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml104
-rw-r--r--tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/SourceProxy.qml136
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Blend.qml478
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml207
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml155
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml294
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml342
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml155
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml289
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Displace.qml217
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml403
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml496
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml193
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml295
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Glow.qml307
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml300
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml385
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml472
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml346
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml282
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml154
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml312
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml439
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml288
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml350
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml226
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml302
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml393
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml413
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml332
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml287
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml98
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml155
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml104
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml136
-rw-r--r--tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/qmldir25
-rw-r--r--tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/plugins.qmltypes5623
-rw-r--r--tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/qmldir4
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ApplicationWindow.qml193
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/BusyIndicator.qml76
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Button.qml120
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/CheckBox.qml184
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ComboBox.qml562
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/GroupBox.qml226
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Label.qml91
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Menu.qml152
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/MenuBar.qml276
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/AbstractCheckable.qml149
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/BasicButton.qml233
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ColumnMenuContent.qml160
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Control.qml93
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FastGlow.qml393
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FocusFrame.qml68
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentItem.qml234
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentScroller.qml74
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ModalPopupBehavior.qml135
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollBar.qml234
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollViewHelper.qml216
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/SourceProxy.qml137
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackView.js68
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackViewSlideDelegate.qml138
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Style.qml59
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TabBar.qml308
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TableViewSelection.qml197
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TextSingleton.qml44
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/qmldir22
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js63
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ProgressBar.qml155
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/RadioButton.qml96
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ScrollView.qml318
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Slider.qml299
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SpinBox.qml339
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SplitView.qml504
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackView.qml963
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewDelegate.qml69
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewTransition.qml60
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StatusBar.qml145
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml117
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ButtonStyle.qml177
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml196
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml233
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml51
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml148
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuBarStyle.qml76
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuStyle.qml220
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml232
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml177
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml398
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SliderStyle.qml234
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml207
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/StatusBarStyle.qml114
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SwitchStyle.qml163
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TabViewStyle.qml190
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TableViewStyle.qml142
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextAreaStyle.qml99
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextFieldStyle.qml162
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolBarStyle.qml110
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml110
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml42
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml62
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml91
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml121
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml55
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml76
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml77
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuStyle.qml112
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml61
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml94
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml46
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml94
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SliderStyle.qml66
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml136
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml64
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml46
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml115
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml115
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml60
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml88
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml65
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml64
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/qmldir2
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/qmldir17
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Switch.qml153
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Tab.qml74
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TabView.qml270
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml1016
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableViewColumn.qml122
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextArea.qml764
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextField.qml609
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolBar.qml151
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolButton.qml68
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/plugins.qmltypes1889
-rw-r--r--tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/qmldir4
-rw-r--r--tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/plugins.qmltypes1889
-rw-r--r--tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/qmldir4
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ApplicationWindow.qml193
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/BusyIndicator.qml76
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Button.qml120
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/CheckBox.qml184
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ComboBox.qml562
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/GroupBox.qml226
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Label.qml91
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Menu.qml152
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/MenuBar.qml276
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/AbstractCheckable.qml149
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/BasicButton.qml233
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ColumnMenuContent.qml160
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Control.qml93
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FastGlow.qml393
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FocusFrame.qml68
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentItem.qml234
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentScroller.qml74
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ModalPopupBehavior.qml135
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollBar.qml234
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollViewHelper.qml216
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/SourceProxy.qml137
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackView.js68
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackViewSlideDelegate.qml138
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Style.qml59
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TabBar.qml308
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TableViewSelection.qml197
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TextSingleton.qml44
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/qmldir22
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/style.js63
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ProgressBar.qml155
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/RadioButton.qml96
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ScrollView.qml318
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Slider.qml299
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SpinBox.qml339
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SplitView.qml504
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackView.qml963
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewDelegate.qml69
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewTransition.qml60
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StatusBar.qml145
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml117
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ButtonStyle.qml177
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml196
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml233
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml51
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml148
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml76
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuStyle.qml220
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml232
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml177
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml398
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SliderStyle.qml234
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml207
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml114
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SwitchStyle.qml163
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TabViewStyle.qml190
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TableViewStyle.qml142
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml99
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml162
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml110
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml110
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml42
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml62
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml91
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml121
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml55
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml76
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml77
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuStyle.qml112
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml61
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml94
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml46
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml94
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SliderStyle.qml66
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml136
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml64
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml46
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml115
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml115
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml60
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml88
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml65
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml64
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/qmldir2
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/qmldir17
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Switch.qml153
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Tab.qml74
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TabView.qml270
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableView.qml1016
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableViewColumn.qml122
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextArea.qml764
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextField.qml609
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolBar.qml151
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolButton.qml68
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/plugins.qmltypes1889
-rw-r--r--tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/qmldir4
-rw-r--r--tests/auto/qml/codemodel/importscheck/base/QtQuick.2/plugins.qmltypes5623
-rw-r--r--tests/auto/qml/codemodel/importscheck/base/QtQuick.2/qmldir4
-rw-r--r--tests/auto/qml/codemodel/importscheck/importscheck.pro19
-rw-r--r--tests/auto/qml/codemodel/importscheck/importscheck.qbs16
-rw-r--r--tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp247
-rw-r--r--tests/auto/qtcprocess/tst_qtcprocess.cpp2
-rw-r--r--tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp145
-rw-r--r--tests/auto/utils_stringutils/tst_stringutils.cpp2
-rw-r--r--tests/genericprojectmanager/testdata_simpleproject/main.cpp3
-rw-r--r--tests/genericprojectmanager/testdata_simpleproject/simpleproject.config1
-rw-r--r--tests/genericprojectmanager/testdata_simpleproject/simpleproject.creator1
-rw-r--r--tests/genericprojectmanager/testdata_simpleproject/simpleproject.files1
-rw-r--r--tests/genericprojectmanager/testdata_simpleproject/simpleproject.includes0
963 files changed, 84330 insertions, 15111 deletions
diff --git a/.gitignore b/.gitignore
index 1faf39d51c..e507a19e1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,7 @@ Thumbs.db
# qtcreator generated files
*.pro.user*
+*.creator.user*
*.qbs.user*
*.qmlproject.user*
*.pluginspec
diff --git a/qtcreator.pri b/qtcreator.pri
index 4b4d0bc241..249f5cf80b 100644
--- a/qtcreator.pri
+++ b/qtcreator.pri
@@ -1,9 +1,9 @@
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
QTCREATOR_PRI_INCLUDED = 1
-QTCREATOR_VERSION = 3.1.84
-QTCREATOR_COMPAT_VERSION = 3.1.84
-BINARY_ARTIFACTS_BRANCH = 3.2
+QTCREATOR_VERSION = 3.2.81
+QTCREATOR_COMPAT_VERSION = 3.2.81
+BINARY_ARTIFACTS_BRANCH = master
# enable c++11
isEqual(QT_MAJOR_VERSION, 5) {
diff --git a/qtcreator.qbs b/qtcreator.qbs
index 0efe98001b..7993328ffa 100644
--- a/qtcreator.qbs
+++ b/qtcreator.qbs
@@ -4,12 +4,12 @@ Project {
minimumQbsVersion: "1.3"
property bool withAutotests: qbs.buildVariant === "debug"
property string ide_version_major: '3'
- property string ide_version_minor: '1'
- property string ide_version_release: '84'
+ property string ide_version_minor: '2'
+ property string ide_version_release: '81'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
property string ide_compat_version_major: '3'
- property string ide_compat_version_minor: '1'
- property string ide_compat_version_release: '84'
+ property string ide_compat_version_minor: '2'
+ property string ide_compat_version_release: '81'
property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release
property path ide_source_tree: path
property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin"
diff --git a/share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml b/share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml
index 5adb425465..ee2ca572e3 100644
--- a/share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml
+++ b/share/qtcreator/templates/wizards/plaincapp/cmake/wizard.xml
@@ -30,7 +30,7 @@
****************************************************************************/
-->
<wizard version="1" kind="project" firstpage="10" id="S.Plain C (CMake)" category="I.Projects"
- platformIndependent="true" featuresRequired="CMake.CMakeSupport">
+ platformIndependent="true" featuresRequired="Plugin.CMakeProjectManager">
<icon>../common/console.png</icon>
<description>Creates a plain C project using CMake, not using the Qt library.</description>
<displayname>Plain C Project (CMake Build)</displayname>;
diff --git a/share/qtcreator/templates/wizards/plaincapp/qbs/wizard.xml b/share/qtcreator/templates/wizards/plaincapp/qbs/wizard.xml
index bee1e595c4..bd50d0a7f8 100644
--- a/share/qtcreator/templates/wizards/plaincapp/qbs/wizard.xml
+++ b/share/qtcreator/templates/wizards/plaincapp/qbs/wizard.xml
@@ -30,7 +30,7 @@
****************************************************************************/
-->
<wizard version="1" kind="project" firstpage="10" id="S.Plain C (Qbs)" category="I.Projects"
- platformIndependent="true" featuresRequired="Qbs.QbsSupport">
+ platformIndependent="true" featuresRequired="Plugin.QbsProjectManager">
<icon>../common/console.png</icon>
<description>Creates a plain C project using qbs.</description>
<displayname>Plain C Project (Qbs Build)</displayname>;
diff --git a/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml b/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml
index 3b7869e934..ce0cedd52c 100644
--- a/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml
+++ b/share/qtcreator/templates/wizards/plaincppapp/cmake/wizard.xml
@@ -30,7 +30,7 @@
****************************************************************************/
-->
<wizard version="1" kind="project" firstpage="10" id="S.Plain C++ (CMake)" category="I.Projects"
- platformIndependent="true" featuresRequired="CMake.CMakeSupport">
+ platformIndependent="true" featuresRequired="Plugin.CMakeProjectManager">
<icon>../common/console.png</icon>
<description>Creates a plain C++ project using CMake, not using the Qt library.</description>
<displayname>Plain C++ Project (CMake Build)</displayname>;
diff --git a/share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml b/share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml
index 2879207deb..9c345e28a8 100644
--- a/share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml
+++ b/share/qtcreator/templates/wizards/plaincppapp/qbs/wizard.xml
@@ -30,7 +30,7 @@
****************************************************************************/
-->
<wizard version="1" kind="project" firstpage="10" id="S.Plain C++ (Qbs)" category="I.Projects"
- platformIndependent="true" featuresRequired="Qbs.QbsSupport">
+ platformIndependent="true" featuresRequired="Plugin.QbsProjectManager">
<icon>../common/console.png</icon>
<description>Creates a plain (non-Qt) C++ project using qbs.</description>
<displayname>Plain C++ Project (Qbs Build)</displayname>;
diff --git a/share/qtcreator/welcomescreen/widgets/SessionItem.qml b/share/qtcreator/welcomescreen/widgets/SessionItem.qml
index fe7639f027..14c582d688 100644
--- a/share/qtcreator/welcomescreen/widgets/SessionItem.qml
+++ b/share/qtcreator/welcomescreen/widgets/SessionItem.qml
@@ -174,7 +174,6 @@ Item {
x: 6
width: parent.width -12
spacing: 4
- visible: !defaultSession
Image { source: "images/icons/clone.png" }
LinkedText {
@@ -184,18 +183,34 @@ Item {
}
}
- Text { width: 16; text: " "; }
- Image { source: "images/icons/rename.png" }
+ Text {
+ visible: !defaultSession
+ width: 16;
+ text: " ";
+ }
+ Image {
+ visible: !defaultSession
+ source: "images/icons/rename.png"
+ }
LinkedText {
+ visible: !defaultSession
text: qsTr("Rename")
onClicked: {
root.model.renameSession(sessionName);
}
}
- Text { width: 16; text: " "; visible: y === 0}
- Image { source: "images/icons/delete.png" }
+ Text {
+ visible: y === 0 && !defaultSession
+ width: 16;
+ text: " ";
+ }
+ Image {
+ visible: !defaultSession
+ source: "images/icons/delete.png"
+ }
LinkedText {
+ visible: !defaultSession
text: qsTr("Delete")
onClicked: {
root.model.deleteSession(sessionName);
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp
index 604bafe26b..8665bfc8cf 100644
--- a/src/libs/3rdparty/cplusplus/Bind.cpp
+++ b/src/libs/3rdparty/cplusplus/Bind.cpp
@@ -1882,7 +1882,7 @@ bool Bind::visit(SimpleDeclarationAST *ast)
}
else if (declTy.isAuto()) {
const ExpressionAST *initializer = it->value->initializer;
- if (!initializer)
+ if (!initializer && declaratorId)
translationUnit()->error(location(declaratorId->name, ast->firstToken()), "auto-initialized variable must have an initializer");
else {
unsigned startOfExpression = initializer->firstToken();
diff --git a/src/libs/3rdparty/cplusplus/Control.cpp b/src/libs/3rdparty/cplusplus/Control.cpp
index 02686f152e..8402809f7f 100644
--- a/src/libs/3rdparty/cplusplus/Control.cpp
+++ b/src/libs/3rdparty/cplusplus/Control.cpp
@@ -217,6 +217,8 @@ public:
, objcRetainId(0)
, objcCopyId(0)
, objcNonatomicId(0)
+ , cpp11Override(0)
+ , cpp11Final(0)
, processor(0)
{}
diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp
index a8ee2d9fbd..bcd70fbb36 100644
--- a/src/libs/3rdparty/cplusplus/Parser.cpp
+++ b/src/libs/3rdparty/cplusplus/Parser.cpp
@@ -57,7 +57,7 @@ public:
fputc('-', stderr);
++depth;
- fprintf(stderr, " %s, ahead: '%s' (%d) - block-errors: %d\n", name, spell, idx, blocked);
+ fprintf(stderr, " %s, ahead: '%s' (%u) - block-errors: %d\n", name, spell, idx, blocked);
}
~DebugRule()
@@ -2725,6 +2725,25 @@ bool Parser::parseBraceOrEqualInitializer0x(ExpressionAST *&node)
return false;
}
+/*
+ initializer-clause:
+ assignment-expression
+ braced-init-list
+ designated-initializer
+
+ If the next token is a T_LBRACKET, it could be the begin of either
+
+ * a C++11 lambda-introducer (parsed by parseAssignmentExpression)
+ * or a C99 designator (parsed by parseDesignatedInitializer).
+
+ Because currently C99 and C++11 Support is activated at the same time,
+ first try to parse the assignment-expression. If this fails, try to
+ parse a designated-initializer.
+
+ TODO:
+ As soon as there will be only "one active language", parse either
+ the assignment-expression or the designated-initializer, not both.
+ */
bool Parser::parseInitializerClause0x(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 6cc6db4226..3828babe79 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -88,6 +88,19 @@ static void path_helper(Symbol *symbol, QList<const Name *> *names)
}
}
+static bool isNestedInstantiationEnclosingTemplate(
+ ClassOrNamespace *nestedClassOrNamespaceInstantiation,
+ ClassOrNamespace *enclosingTemplateClassInstantiation)
+{
+ while (enclosingTemplateClassInstantiation) {
+ if (enclosingTemplateClassInstantiation == nestedClassOrNamespaceInstantiation)
+ return false;
+ enclosingTemplateClassInstantiation = enclosingTemplateClassInstantiation->parent();
+ }
+
+ return true;
+}
+
namespace CPlusPlus {
static inline bool compareName(const Name *name, const Name *other)
@@ -1084,6 +1097,10 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac
Subst subst(_control.data());
if (_factory->expandTemplates()) {
+ const TemplateNameId *templSpecId
+ = templateSpecialization->name()->asTemplateNameId();
+ const unsigned templSpecArgumentCount = templSpecId ?
+ templSpecId->templateArgumentCount() : 0;
Clone cloner(_control.data());
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
const TypenameArgument *tParam
@@ -1098,6 +1115,12 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac
templId->templateArgumentAt(i):
cloner.type(tParam->type(), &subst);
+ if (i < templSpecArgumentCount
+ && templSpecId->templateArgumentAt(i)->isPointerType()) {
+ if (PointerType *pointerType = ty->asPointerType())
+ ty = pointerType->elementType();
+ }
+
subst.bind(cloner.name(name, &subst), ty);
}
@@ -1272,6 +1295,10 @@ void ClassOrNamespace::NestedClassInstantiator::instantiate(ClassOrNamespace *en
}
}
+ if (isNestedInstantiationEnclosingTemplate(nestedClassOrNamespaceInstantiation,
+ enclosingTemplateClass)) {
+ nestedClassOrNamespaceInstantiation->_parent = enclosingTemplateClassInstantiation;
+ }
instantiate(nestedClassOrNamespace, nestedClassOrNamespaceInstantiation);
enclosingTemplateClassInstantiation->_classOrNamespaces[nestedName] =
diff --git a/src/libs/extensionsystem/pluginerroroverview.cpp b/src/libs/extensionsystem/pluginerroroverview.cpp
index 52b95dccc6..0142d04aea 100644
--- a/src/libs/extensionsystem/pluginerroroverview.cpp
+++ b/src/libs/extensionsystem/pluginerroroverview.cpp
@@ -70,7 +70,7 @@ void PluginErrorOverview::showDetails(QListWidgetItem *item)
PluginSpec *spec = item->data(Qt::UserRole).value<PluginSpec *>();
m_ui->pluginError->setText(spec->errorString());
} else {
- m_ui->pluginError->setText(QString());
+ m_ui->pluginError->clear();
}
}
diff --git a/src/libs/libs.qbs b/src/libs/libs.qbs
index 8bff7f99a2..a997225e81 100644
--- a/src/libs/libs.qbs
+++ b/src/libs/libs.qbs
@@ -11,6 +11,7 @@ Project {
"qmleditorwidgets/qmleditorwidgets.qbs",
"qmljs/qmljs.qbs",
"qmldebug/qmldebug.qbs",
+ "qtcreatorcdbext/qtcreatorcdbext.qbs",
"ssh/ssh.qbs",
"utils/process_stub.qbs",
"utils/process_ctrlc_stub.qbs",
diff --git a/src/libs/qmljs/qmljs-lib.pri b/src/libs/qmljs/qmljs-lib.pri
index f4e1d88f97..756bed8ec4 100644
--- a/src/libs/qmljs/qmljs-lib.pri
+++ b/src/libs/qmljs/qmljs-lib.pri
@@ -44,7 +44,8 @@ HEADERS += \
$$PWD/qmljsconstants.h \
$$PWD/qmljsimportdependencies.h \
$$PWD/qmljsviewercontext.h \
- $$PWD/qmljsdescribevalue.h
+ $$PWD/qmljsdescribevalue.h \
+ $$PWD/qmljsdialect.h
SOURCES += \
$$PWD/qmljsbind.cpp \
@@ -80,7 +81,8 @@ SOURCES += \
$$PWD/qmljsqrcparser.cpp \
$$PWD/qmljsimportdependencies.cpp \
$$PWD/qmljsviewercontext.cpp \
- $$PWD/qmljsdescribevalue.cpp
+ $$PWD/qmljsdescribevalue.cpp \
+ $$PWD/qmljsdialect.cpp
RESOURCES += \
diff --git a/src/libs/qmljs/qmljs.qbs b/src/libs/qmljs/qmljs.qbs
index 68ebcd51c0..1bd85d4e56 100644
--- a/src/libs/qmljs/qmljs.qbs
+++ b/src/libs/qmljs/qmljs.qbs
@@ -41,6 +41,7 @@ QtcLibrary {
"qmljsimportdependencies.cpp", "qmljsimportdependencies.h",
"qmljsindenter.cpp", "qmljsindenter.h",
"qmljsinterpreter.cpp", "qmljsinterpreter.h",
+ "qmljsdialect.cpp", "qmljsdialect.h",
"qmljslineinfo.cpp", "qmljslineinfo.h",
"qmljslink.cpp", "qmljslink.h",
"qmljsmodelmanagerinterface.cpp", "qmljsmodelmanagerinterface.h",
diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp
index cc7bb31bd3..56ed80d856 100644
--- a/src/libs/qmljs/qmljsbind.cpp
+++ b/src/libs/qmljs/qmljsbind.cpp
@@ -202,18 +202,18 @@ bool Bind::visit(UiImport *ast)
const QString importId = ast->importId.toString();
ImportInfo import = ImportInfo::moduleImport(toString(ast->importUri), version,
importId, ast);
- if (_doc->language() == Language::Qml) {
+ if (_doc->language() == Dialect::Qml) {
const QString importStr = import.name() + importId;
if (ModelManagerInterface::instance()) {
QmlLanguageBundles langBundles = ModelManagerInterface::instance()->extendedBundles();
- QmlBundle qq1 = langBundles.bundleForLanguage(Language::QmlQtQuick1);
- QmlBundle qq2 = langBundles.bundleForLanguage(Language::QmlQtQuick2);
+ QmlBundle qq1 = langBundles.bundleForLanguage(Dialect::QmlQtQuick1);
+ QmlBundle qq2 = langBundles.bundleForLanguage(Dialect::QmlQtQuick2);
bool isQQ1 = qq1.supportedImports().contains(importStr);
bool isQQ2 = qq2.supportedImports().contains(importStr);
if (isQQ1 && ! isQQ2)
- _doc->setLanguage(Language::QmlQtQuick1);
+ _doc->setLanguage(Dialect::QmlQtQuick1);
if (isQQ2 && ! isQQ1)
- _doc->setLanguage(Language::QmlQtQuick2);
+ _doc->setLanguage(Dialect::QmlQtQuick2);
}
}
_imports += import;
diff --git a/src/libs/qmljs/qmljsbundle.cpp b/src/libs/qmljs/qmljsbundle.cpp
index 28b1d951d3..a775a2f86c 100644
--- a/src/libs/qmljs/qmljsbundle.cpp
+++ b/src/libs/qmljs/qmljsbundle.cpp
@@ -288,14 +288,14 @@ bool QmlBundle::readFrom(QString path, QStringList *errors)
return errs.isEmpty();
}
-QmlBundle QmlLanguageBundles::bundleForLanguage(Language::Enum l) const
+QmlBundle QmlLanguageBundles::bundleForLanguage(Dialect l) const
{
if (m_bundles.contains(l))
return m_bundles.value(l);
return QmlBundle();
}
-void QmlLanguageBundles::mergeBundleForLanguage(Language::Enum l, const QmlBundle &bundle)
+void QmlLanguageBundles::mergeBundleForLanguage(Dialect l, const QmlBundle &bundle)
{
if (bundle.isEmpty())
return;
@@ -305,14 +305,14 @@ void QmlLanguageBundles::mergeBundleForLanguage(Language::Enum l, const QmlBundl
m_bundles.insert(l,bundle);
}
-QList<Language::Enum> QmlLanguageBundles::languages() const
+QList<Dialect> QmlLanguageBundles::languages() const
{
return m_bundles.keys();
}
void QmlLanguageBundles::mergeLanguageBundles(const QmlLanguageBundles &o)
{
- foreach (Language::Enum l, o.languages())
+ foreach (Dialect l, o.languages())
mergeBundleForLanguage(l, o.bundleForLanguage(l));
}
diff --git a/src/libs/qmljs/qmljsbundle.h b/src/libs/qmljs/qmljsbundle.h
index 3026c66ffd..d5d88bb431 100644
--- a/src/libs/qmljs/qmljsbundle.h
+++ b/src/libs/qmljs/qmljsbundle.h
@@ -100,12 +100,12 @@ private:
class QMLJS_EXPORT QmlLanguageBundles
{
public:
- QmlBundle bundleForLanguage(Language::Enum l) const;
- void mergeBundleForLanguage(Language::Enum l, const QmlBundle &bundle);
- QList<Language::Enum> languages() const;
+ QmlBundle bundleForLanguage(Dialect l) const;
+ void mergeBundleForLanguage(Dialect l, const QmlBundle &bundle);
+ QList<Dialect> languages() const;
void mergeLanguageBundles(const QmlLanguageBundles &);
private:
- QHash<Language::Enum,QmlBundle> m_bundles;
+ QHash<Dialect,QmlBundle> m_bundles;
};
} // namespace QmlJS
diff --git a/src/libs/qmljs/qmljsdescribevalue.cpp b/src/libs/qmljs/qmljsdescribevalue.cpp
index c0c8f2785f..9213646a84 100644
--- a/src/libs/qmljs/qmljsdescribevalue.cpp
+++ b/src/libs/qmljs/qmljsdescribevalue.cpp
@@ -187,9 +187,18 @@ public:
return true;
}
- bool processProperty(const QString &name, const Value *value) QTC_OVERRIDE
+ bool processProperty(const QString &name, const Value *value, const PropertyInfo &pInfo) QTC_OVERRIDE
{
- return dump(name, value);
+ d.dumpNewline();
+ d.dump(name);
+ d.openContext(":");
+ d.dump("<");
+ d.dump(pInfo.toString());
+ d.dump(">");
+ d.dumpNewline(); // avoid?
+ value->accept(&d);
+ d.closeContext("");
+ return true;
}
bool processEnumerator(const QString &name, const Value *value) QTC_OVERRIDE
{
diff --git a/src/libs/qmljs/qmljsdialect.cpp b/src/libs/qmljs/qmljsdialect.cpp
new file mode 100644
index 0000000000..2641f6bf7c
--- /dev/null
+++ b/src/libs/qmljs/qmljsdialect.cpp
@@ -0,0 +1,331 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "qmljsdialect.h"
+
+namespace QmlJS {
+
+
+bool Dialect::isQmlLikeLanguage() const
+{
+ switch (m_dialect) {
+ case Dialect::Qml:
+ case Dialect::QmlQtQuick1:
+ case Dialect::QmlQtQuick2:
+ case Dialect::QmlQbs:
+ case Dialect::QmlProject:
+ case Dialect::QmlTypeInfo:
+ case Dialect::AnyLanguage:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool Dialect::isFullySupportedLanguage() const
+{
+ switch (m_dialect) {
+ case Dialect::JavaScript:
+ case Dialect::Json:
+ case Dialect::Qml:
+ case Dialect::QmlQtQuick1:
+ case Dialect::QmlQtQuick2:
+ return true;
+ case Dialect::NoLanguage:
+ case Dialect::AnyLanguage:
+ case Dialect::QmlQbs:
+ case Dialect::QmlProject:
+ case Dialect::QmlTypeInfo:
+ break;
+ }
+ return false;
+}
+
+bool Dialect::isQmlLikeOrJsLanguage() const
+{
+ switch (m_dialect) {
+ case Dialect::Qml:
+ case Dialect::QmlQtQuick1:
+ case Dialect::QmlQtQuick2:
+ case Dialect::QmlQbs:
+ case Dialect::QmlProject:
+ case Dialect::QmlTypeInfo:
+ case Dialect::JavaScript:
+ case Dialect::AnyLanguage:
+ return true;
+ default:
+ return false;
+ }
+}
+
+QString Dialect::toString() const
+{
+ switch (m_dialect) {
+ case Dialect::JavaScript:
+ return QLatin1String("JavaScript");
+ case Dialect::Json:
+ return QLatin1String("Json");
+ case Dialect::Qml:
+ return QLatin1String("Qml");
+ case Dialect::QmlQtQuick1:
+ return QLatin1String("QmlQtQuick1");
+ case Dialect::QmlQtQuick2:
+ return QLatin1String("QmlQtQuick2");
+ case Dialect::NoLanguage:
+ return QLatin1String("NoLanguage");
+ case Dialect::AnyLanguage:
+ return QLatin1String("AnyLanguage");
+ case Dialect::QmlQbs:
+ return QLatin1String("QmlQbs");
+ case Dialect::QmlProject:
+ return QLatin1String("QmlProject");
+ case Dialect::QmlTypeInfo:
+ break;
+ }
+ return QLatin1String("QmlTypeInfo");
+}
+
+bool Dialect::operator ==(const Dialect &o) const {
+ return m_dialect == o.m_dialect;
+}
+
+bool Dialect::operator <(const Dialect &o) const {
+ return m_dialect < o.m_dialect;
+}
+
+Dialect Dialect::mergeLanguages(const Dialect &l1, const Dialect &l2)
+{
+ if (l1 == Dialect::NoLanguage)
+ return l2;
+ if (l2 == Dialect::NoLanguage)
+ return l1;
+ QList<Dialect> ll1 = l1.companionLanguages();
+ QList<Dialect> ll2 = l2.companionLanguages();
+ bool i1 = ll1.contains(l2);
+ bool i2 = ll2.contains(l1);
+ if (i1 && i2) {
+ if (ll1.size() > ll2.size())
+ return l1;
+ if (ll2.size() > ll1.size())
+ return l2;
+ if (l1 < l2)
+ return l1;
+ return l2;
+ }
+ if (i1 && !i2)
+ return l1;
+ if (i2 && !i1)
+ return l2;
+ QList<Dialect> qmlLangs = Dialect(Qml).companionLanguages();
+ if (qmlLangs.contains(l1) && qmlLangs.contains(l2))
+ return Dialect::Qml;
+ return Dialect::AnyLanguage;
+}
+
+void Dialect::mergeLanguage(const Dialect &l2) {
+ *this = mergeLanguages(*this, l2);
+}
+
+bool Dialect::restrictLanguage(const Dialect &l2)
+{
+ if (*this == l2)
+ return true;
+ QList<Dialect> ll1 = companionLanguages();
+ QList<Dialect> ll2 = l2.companionLanguages();
+ bool i1 = ll1.contains(l2);
+ bool i2 = ll2.contains(*this);
+ if (i1 && i2) {
+ if (ll1.size() < ll2.size())
+ return true;
+ if (ll2.size() < ll1.size()) {
+ *this = l2;
+ return true;
+ }
+ if (m_dialect < l2.m_dialect)
+ return true;
+ *this = l2;
+ return true;
+ }
+ if (i1 && !i2) {
+ *this = l2;
+ return true;
+ }
+ if (i2 && !i1)
+ return true;
+ QList<Dialect> qmlLangs = Dialect(Qml).companionLanguages();
+ if (qmlLangs.contains(*this) && qmlLangs.contains(l2))
+ *this = Dialect::Qml;
+ *this = Dialect::AnyLanguage;
+ return false;
+}
+
+QList<Dialect> Dialect::companionLanguages() const
+{
+ QList<Dialect> langs;
+ langs << *this;
+ switch (m_dialect) {
+ case Dialect::JavaScript:
+ case Dialect::Json:
+ case Dialect::QmlProject:
+ case Dialect::QmlTypeInfo:
+ break;
+ case Dialect::QmlQbs:
+ langs << Dialect::JavaScript;
+ break;
+ case Dialect::Qml:
+ langs << Dialect::QmlQtQuick1 << Dialect::QmlQtQuick2 << Dialect::JavaScript;
+ break;
+ case Dialect::QmlQtQuick1:
+ case Dialect::QmlQtQuick2:
+ langs << Dialect::Qml << Dialect::JavaScript;
+ break;
+ case Dialect::AnyLanguage:
+ langs << Dialect::JavaScript << Dialect::Json << Dialect::QmlProject << Dialect:: QmlQbs
+ << Dialect::QmlTypeInfo << Dialect::QmlQtQuick1 << Dialect::QmlQtQuick2
+ << Dialect::Qml;
+ break;
+ case Dialect::NoLanguage:
+ return QList<Dialect>(); // return at least itself?
+ }
+ if (*this != Dialect::AnyLanguage)
+ langs << Dialect::AnyLanguage;
+ return langs;
+}
+
+uint qHash(const Dialect &o)
+{
+ return uint(o.dialect());
+}
+
+QDebug operator << (QDebug &dbg, const Dialect &dialect)
+{
+ dbg << dialect.toString();
+ return dbg;
+}
+
+PathAndLanguage::PathAndLanguage(const Utils::FileName &path, Dialect language)
+ : m_path(path), m_language(language)
+{ }
+
+bool PathAndLanguage::operator ==(const PathAndLanguage &other) const
+{
+ return path() == other.path() && language() == other.language();
+}
+
+bool PathAndLanguage::operator <(const PathAndLanguage &other) const
+{
+ if (path() < other.path())
+ return true;
+ if (path() > other.path())
+ return false;
+ if (language() == other.language())
+ return false;
+ bool i1 = other.language().companionLanguages().contains(language());
+ bool i2 = language().companionLanguages().contains(other.language());
+ if (i1 && !i2)
+ return true;
+ if (i2 && !i1)
+ return false;
+ return language() < other.language();
+}
+
+QDebug operator << (QDebug &dbg, const PathAndLanguage &pathAndLanguage)
+{
+ dbg << "{ path:" << pathAndLanguage.path() << " language:" << pathAndLanguage.language().toString() << "}";
+ return dbg;
+}
+
+bool PathsAndLanguages::maybeInsert(const PathAndLanguage &pathAndLanguage) {
+ for (int i = 0; i < m_list.size(); ++i) {
+ PathAndLanguage currentElement = m_list.at(i);
+ if (currentElement.path() == pathAndLanguage.path()) {
+ int j = i;
+ do {
+ if (pathAndLanguage.language() < currentElement.language()) {
+ if (currentElement.language() == pathAndLanguage.language())
+ return false;
+ break;
+ }
+ ++j;
+ if (j == m_list.length())
+ break;
+ currentElement = m_list.at(j);
+ } while (currentElement.path() == pathAndLanguage.path());
+ m_list.insert(j, pathAndLanguage);
+ return true;
+ }
+ }
+ m_list.append(pathAndLanguage);
+ return true;
+}
+
+void PathsAndLanguages::compact() {
+ int oldCompactionPlace = 0;
+ Utils::FileName oldPath = m_list.first().path();
+ QList<PathAndLanguage> compactedList;
+ bool restrictFailed = false;
+ for (int i = 1; i < m_list.length(); ++i) {
+ Utils::FileName newPath = m_list.at(i).path();
+ if (newPath == oldPath) {
+ int newCompactionPlace = i - 1;
+ compactedList << m_list.mid(oldCompactionPlace, newCompactionPlace - oldCompactionPlace);
+ LanguageMerger merger;
+ merger.merge(m_list.at(i - 1).language());
+ do {
+ merger.merge(m_list.at(i).language());
+ if (++i == m_list.length())
+ break;
+ newPath = m_list.at(i).path();
+ } while (newPath == oldPath);
+ oldCompactionPlace = i;
+ compactedList << PathAndLanguage(oldPath, merger.mergedLanguage());
+ if (merger.restrictFailed())
+ restrictFailed = true;
+ }
+ oldPath = newPath;
+ }
+ if (oldCompactionPlace == 0)
+ return;
+ compactedList << m_list.mid(oldCompactionPlace);
+ if (restrictFailed)
+ qCWarning(qmljsLog) << "failed to restrict PathAndLanguages " << m_list;
+ m_list = compactedList;
+}
+
+void LanguageMerger::merge(Dialect l)
+{
+ bool restrictSuccedeed = m_specificLanguage.restrictLanguage(l);
+ m_specificLanguage.mergeLanguage(m_minimalSpecificLanguage);
+ if (!restrictSuccedeed) {
+ m_minimalSpecificLanguage = m_specificLanguage;
+ m_restrictFailed = true;
+ }
+}
+
+} // namespace QmlJS
diff --git a/src/libs/qmljs/qmljsdialect.h b/src/libs/qmljs/qmljsdialect.h
new file mode 100644
index 0000000000..3ee6f26c12
--- /dev/null
+++ b/src/libs/qmljs/qmljsdialect.h
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QMLJSDIALECT_H
+#define QMLJSDIALECT_H
+
+#include "qmljsconstants.h"
+
+#include <utils/fileutils.h>
+
+#include <QString>
+
+namespace QmlJS {
+
+class QMLJS_EXPORT Dialect {
+public:
+ enum Enum
+ {
+ NoLanguage = 0,
+ JavaScript = 1,
+ Json = 2,
+ Qml = 3,
+ QmlQtQuick1 = 4,
+ QmlQtQuick2 = 5,
+ QmlQbs = 6,
+ QmlProject = 7,
+ QmlTypeInfo = 8,
+ AnyLanguage = 9,
+ };
+ Dialect(Enum dialect = NoLanguage)
+ : m_dialect(dialect)
+ { }
+ static Dialect mergeLanguages(const Dialect &l1, const Dialect &l2);
+
+ bool isQmlLikeLanguage() const;
+ bool isFullySupportedLanguage() const;
+ bool isQmlLikeOrJsLanguage() const;
+ QList<Dialect> companionLanguages() const;
+ bool restrictLanguage(const Dialect &l2);
+ QString toString() const;
+ bool operator ==(const Dialect &o) const;
+ bool operator !=(const Dialect &o) const {
+ return !(*this == o);
+ }
+ bool operator <(const Dialect &o) const;
+ Enum dialect() const {
+ return m_dialect;
+ }
+ void mergeLanguage(const Dialect &l2);
+private:
+ Enum m_dialect;
+};
+
+QMLJS_EXPORT uint qHash(const Dialect &o);
+
+QMLJS_EXPORT QDebug operator << (QDebug &dbg, const Dialect &dialect);
+
+class QMLJS_EXPORT PathAndLanguage {
+public:
+ PathAndLanguage(const Utils::FileName &path = Utils::FileName(), Dialect language = Dialect::AnyLanguage);
+ PathAndLanguage(const PathAndLanguage &o)
+ : m_path(o.path()), m_language(o.language())
+ { }
+ Utils::FileName path() const {
+ return m_path;
+ }
+ Dialect language() const {
+ return m_language;
+ }
+ bool operator ==(const PathAndLanguage &other) const;
+ bool operator < (const PathAndLanguage &other) const;
+private:
+ Utils::FileName m_path;
+ Dialect m_language;
+};
+
+// tries to find the "most specific" language still compatible with all requested ones
+class QMLJS_EXPORT LanguageMerger
+{
+public:
+ LanguageMerger()
+ : m_specificLanguage(Dialect::AnyLanguage),
+ m_minimalSpecificLanguage(Dialect::NoLanguage),
+ m_restrictFailed(false)
+ { }
+
+ void merge(Dialect l);
+
+ Dialect mergedLanguage() const {
+ return m_specificLanguage;
+ }
+ bool restrictFailed() const {
+ return m_restrictFailed;
+ }
+private:
+ Dialect m_specificLanguage;
+ Dialect m_minimalSpecificLanguage;
+ bool m_restrictFailed;
+};
+
+
+QMLJS_EXPORT QDebug operator << (QDebug &dbg, const PathAndLanguage &pathAndLanguage);
+
+class QMLJS_EXPORT PathsAndLanguages
+{
+public:
+ explicit PathsAndLanguages()
+ { }
+ explicit PathsAndLanguages(const QList<PathAndLanguage> &list)
+ : m_list(list)
+ { }
+ PathsAndLanguages(const PathsAndLanguages &o)
+ : m_list(o.m_list)
+ { }
+
+ bool maybeInsert(const Utils::FileName &path, Dialect language = Dialect::AnyLanguage) {
+ return maybeInsert(PathAndLanguage(path, language));
+ }
+
+ bool maybeInsert(const PathAndLanguage &pathAndLanguage);
+
+ PathAndLanguage at(int i) const {
+ return m_list.at(i);
+ }
+ int size() const {
+ return m_list.size();
+ }
+ int length() const {
+ return m_list.length();
+ }
+ void clear() {
+ m_list.clear();
+ }
+ // foreach support
+ typedef QList<PathAndLanguage>::const_iterator const_iterator;
+ const_iterator begin() const {
+ return m_list.begin();
+ }
+ const_iterator end() const {
+ return m_list.end();
+ }
+ void compact();
+private:
+ QList<PathAndLanguage> m_list;
+};
+
+} // namespace QmlJS
+#endif // QMLJSDIALECT_H
diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp
index cf7fd70bd1..4987dd1a25 100644
--- a/src/libs/qmljs/qmljsdocument.cpp
+++ b/src/libs/qmljs/qmljsdocument.cpp
@@ -88,93 +88,7 @@ using namespace QmlJS::AST;
threads finish and new information becomes available.
*/
-
-bool Document::isQmlLikeLanguage(Language::Enum language)
-{
- switch (language) {
- case Language::Qml:
- case Language::QmlQtQuick1:
- case Language::QmlQtQuick2:
- case Language::QmlQbs:
- case Language::QmlProject:
- case Language::QmlTypeInfo:
- case Language::AnyLanguage:
- return true;
- default:
- return false;
- }
-}
-
-bool Document::isFullySupportedLanguage(Language::Enum language)
-{
- switch (language) {
- case Language::JavaScript:
- case Language::Json:
- case Language::Qml:
- case Language::QmlQtQuick1:
- case Language::QmlQtQuick2:
- return true;
- case Language::NoLanguage:
- case Language::AnyLanguage:
- case Language::QmlQbs:
- case Language::QmlProject:
- case Language::QmlTypeInfo:
- break;
- }
- return false;
-}
-
-bool Document::isQmlLikeOrJsLanguage(Language::Enum language)
-{
- switch (language) {
- case Language::Qml:
- case Language::QmlQtQuick1:
- case Language::QmlQtQuick2:
- case Language::QmlQbs:
- case Language::QmlProject:
- case Language::QmlTypeInfo:
- case Language::JavaScript:
- case Language::AnyLanguage:
- return true;
- default:
- return false;
- }
-}
-
-QList<Language::Enum> Document::companionLanguages(Language::Enum language)
-{
- QList<Language::Enum> langs;
- langs << language;
- switch (language) {
- case Language::JavaScript:
- case Language::Json:
- case Language::QmlProject:
- case Language::QmlTypeInfo:
- break;
- case Language::QmlQbs:
- langs << Language::JavaScript;
- break;
- case Language::Qml:
- langs << Language::QmlQtQuick1 << Language::QmlQtQuick2 << Language::JavaScript;
- break;
- case Language::QmlQtQuick1:
- case Language::QmlQtQuick2:
- langs << Language::Qml << Language::JavaScript;
- break;
- case Language::AnyLanguage:
- langs << Language::JavaScript << Language::Json << Language::QmlProject << Language:: QmlQbs
- << Language::QmlTypeInfo << Language::QmlQtQuick1 << Language::QmlQtQuick2
- << Language::Qml;
- break;
- case Language::NoLanguage:
- return QList<Language::Enum>(); // return at least itself?
- }
- if (language != Language::AnyLanguage)
- langs << Language::AnyLanguage;
- return langs;
-}
-
-Document::Document(const QString &fileName, Language::Enum language)
+Document::Document(const QString &fileName, Dialect language)
: _engine(0)
, _ast(0)
, _bind(0)
@@ -186,7 +100,7 @@ Document::Document(const QString &fileName, Language::Enum language)
QFileInfo fileInfo(fileName);
_path = QDir::cleanPath(fileInfo.absolutePath());
- if (isQmlLikeLanguage(language)) {
+ if (language.isQmlLikeLanguage()) {
_componentName = fileInfo.baseName();
if (! _componentName.isEmpty()) {
@@ -207,7 +121,7 @@ Document::~Document()
delete _engine;
}
-Document::MutablePtr Document::create(const QString &fileName, Language::Enum language)
+Document::MutablePtr Document::create(const QString &fileName, Dialect language)
{
Document::MutablePtr doc(new Document(fileName, language));
doc->_ptr = doc;
@@ -221,15 +135,15 @@ Document::Ptr Document::ptr() const
bool Document::isQmlDocument() const
{
- return isQmlLikeLanguage(_language);
+ return _language.isQmlLikeLanguage();
}
-Language::Enum Document::language() const
+Dialect Document::language() const
{
return _language;
}
-void Document::setLanguage(Language::Enum l)
+void Document::setLanguage(Dialect l)
{
_language = l;
}
@@ -357,7 +271,7 @@ bool Document::parse_helper(int startToken)
Parser parser(_engine);
QString source = _source;
- lexer.setCode(source, /*line = */ 1, /*qmlMode = */isQmlLikeLanguage(_language));
+ lexer.setCode(source, /*line = */ 1, /*qmlMode = */_language.isQmlLikeLanguage());
CollectDirectives collectDirectives(path());
_engine->setDirectives(&collectDirectives);
@@ -539,7 +453,7 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info)
if (!info.wasFound()) return;
CoreImport cImport;
cImport.importId = path;
- cImport.language = Language::AnyLanguage;
+ cImport.language = Dialect::AnyLanguage;
QSet<ImportKey> packages;
foreach (const ModuleApiInfo &moduleInfo, info.moduleApis()) {
ImportKey iKey(ImportType::Library, moduleInfo.uri, moduleInfo.version.majorVersion(),
@@ -638,7 +552,7 @@ QmlJS::ImportDependencies *Snapshot::importDependencies()
Document::MutablePtr Snapshot::documentFromSource(
const QString &code, const QString &fileName,
- Language::Enum language) const
+ Dialect language) const
{
Document::MutablePtr newDoc = Document::create(fileName, language);
diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h
index 1a0a331de9..9a02be006b 100644
--- a/src/libs/qmljs/qmljsdocument.h
+++ b/src/libs/qmljs/qmljsdocument.h
@@ -35,6 +35,7 @@
#include <languageutils/fakemetaobject.h>
+#include "qmljsdialect.h"
#include "parser/qmldirparser_p.h"
#include "parser/qmljsengine_p.h"
#include "qmljs_global.h"
@@ -52,24 +53,19 @@ class QMLJS_EXPORT Document
public:
typedef QSharedPointer<const Document> Ptr;
typedef QSharedPointer<Document> MutablePtr;
-
- static bool isQmlLikeLanguage(Language::Enum languge);
- static bool isFullySupportedLanguage(Language::Enum language);
- static bool isQmlLikeOrJsLanguage(Language::Enum language);
- static QList<Language::Enum> companionLanguages(Language::Enum language);
protected:
- Document(const QString &fileName, Language::Enum language);
+ Document(const QString &fileName, Dialect language);
public:
~Document();
- static MutablePtr create(const QString &fileName, Language::Enum language);
+ static MutablePtr create(const QString &fileName, Dialect language);
Document::Ptr ptr() const;
bool isQmlDocument() const;
- Language::Enum language() const;
- void setLanguage(Language::Enum l);
+ Dialect language() const;
+ void setLanguage(Dialect l);
QString importId() const;
QByteArray fingerprint() const;
@@ -117,7 +113,7 @@ private:
QWeakPointer<Document> _ptr;
QByteArray _fingerprint;
int _editorRevision;
- Language::Enum _language;
+ Dialect _language;
bool _parsedCorrectly;
// for documentFromSource
@@ -246,7 +242,7 @@ public:
Document::MutablePtr documentFromSource(const QString &code,
const QString &fileName,
- Language::Enum language) const;
+ Dialect language) const;
};
} // namespace QmlJS
diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp
index dd3e2e70b8..4b39016c94 100644
--- a/src/libs/qmljs/qmljsimportdependencies.cpp
+++ b/src/libs/qmljs/qmljsimportdependencies.cpp
@@ -509,10 +509,10 @@ bool operator !=(const Export &i1, const Export &i2)
return !(i1 == i2);
}
-CoreImport::CoreImport() : language(Language::Qml) { }
+CoreImport::CoreImport() : language(Dialect::Qml) { }
CoreImport::CoreImport(const QString &importId, const QList<Export> &possibleExports,
- Language::Enum language, const QByteArray &fingerprint)
+ Dialect language, const QByteArray &fingerprint)
: importId(importId), possibleExports(possibleExports), language(language),
fingerprint(fingerprint)
{ }
@@ -787,7 +787,7 @@ void ImportDependencies::addExport(const QString &importId, const ImportKey &imp
{
if (!m_coreImports.contains(importId)) {
CoreImport newImport(importId);
- newImport.language = Language::AnyLanguage;
+ newImport.language = Dialect::AnyLanguage;
newImport.possibleExports.append(Export(importKey, requiredPath, false, typeName));
m_coreImports.insert(newImport.importId, newImport);
m_importCache[importKey].append(importId);
diff --git a/src/libs/qmljs/qmljsimportdependencies.h b/src/libs/qmljs/qmljsimportdependencies.h
index 8a412b754e..cabd0df9af 100644
--- a/src/libs/qmljs/qmljsimportdependencies.h
+++ b/src/libs/qmljs/qmljsimportdependencies.h
@@ -31,6 +31,7 @@
#define QMLJSIMPORTCACHE_H
#include "qmljsviewercontext.h"
+#include "qmljsdialect.h"
#include <languageutils/componentversion.h>
#include <utils/qtcoverride.h>
@@ -147,10 +148,10 @@ class QMLJS_EXPORT CoreImport
public:
CoreImport();
CoreImport(const QString &importId, const QList<Export> &possibleExports = QList<Export>(),
- Language::Enum language = Language::Qml, const QByteArray &fingerprint = QByteArray());
+ Dialect language = Dialect::Qml, const QByteArray &fingerprint = QByteArray());
QString importId;
QList<Export> possibleExports;
- Language::Enum language;
+ Dialect language;
QByteArray fingerprint;
bool valid();
};
diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index fbf5725a02..b02fda890b 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -107,7 +107,7 @@ public:
const Value *value() const { return m_value; }
- virtual bool processProperty(const QString &name, const Value *value)
+ virtual bool processProperty(const QString &name, const Value *value, const PropertyInfo &)
{
return process(name, value);
}
@@ -186,6 +186,45 @@ uint qHash(const FakeMetaObjectWithOrigin &fmoo)
return qHash(fmoo.fakeMetaObject);
}
+PropertyInfo::PropertyInfo(uint flags)
+ : flags(flags)
+{ }
+
+QString PropertyInfo::toString() const
+{
+ bool join = false;
+ QString res;
+ if (isReadable()) {
+ res += QLatin1String("Readable");
+ join = true;
+ }
+ if (isWriteable()) {
+ if (join)
+ res += QLatin1String("|");
+ res += QLatin1String("Writeable");
+ join = true;
+ }
+ if (isList()) {
+ if (join)
+ res += QLatin1String("|");
+ res += QLatin1String("ListType");
+ join = true;
+ }
+ if (canBePointer()) {
+ if (join)
+ res += QLatin1String("|");
+ res += QLatin1String("Pointer");
+ join = true;
+ }
+ if (canBeValue()) {
+ if (join)
+ res += QLatin1String("|");
+ res += QLatin1String("Value");
+ join = true;
+ }
+ return res;
+}
+
} // namespace QmlJS
CppComponentValue::CppComponentValue(FakeMetaObject::ConstPtr metaObject, const QString &className,
@@ -303,7 +342,17 @@ void CppComponentValue::processMembers(MemberProcessor *processor) const
continue;
const QString propertyName = prop.name();
- processor->processProperty(propertyName, valueForCppName(prop.typeName()));
+ uint propertyFlags = PropertyInfo::Readable;
+ if (isWritable(propertyName))
+ propertyFlags |= PropertyInfo::Writeable;
+ if (isListProperty(propertyName))
+ propertyFlags |= PropertyInfo::ListType;
+ if (isPointer(propertyName))
+ propertyFlags |= PropertyInfo::PointerType;
+ else
+ propertyFlags |= PropertyInfo::ValueType;
+ processor->processProperty(propertyName, valueForCppName(prop.typeName()),
+ PropertyInfo(propertyFlags));
// every property always has a onXyzChanged slot, even if the NOTIFY
// signal has a different name
@@ -951,7 +1000,7 @@ MemberProcessor::~MemberProcessor()
{
}
-bool MemberProcessor::processProperty(const QString &, const Value *)
+bool MemberProcessor::processProperty(const QString &, const Value *, const PropertyInfo &)
{
return true;
}
@@ -1024,7 +1073,12 @@ void ObjectValue::setPrototype(const Value *prototype)
void ObjectValue::setMember(const QString &name, const Value *value)
{
- m_members[name] = value;
+ m_members[name].value = value;
+}
+
+void ObjectValue::setPropertyInfo(const QString &name, const PropertyInfo &propertyInfo)
+{
+ m_members[name].propertyInfo = propertyInfo;
}
void ObjectValue::removeMember(const QString &name)
@@ -1063,12 +1117,12 @@ bool ObjectValue::checkPrototype(const ObjectValue *, QSet<const ObjectValue *>
void ObjectValue::processMembers(MemberProcessor *processor) const
{
- QHashIterator<QString, const Value *> it(m_members);
+ QHashIterator<QString, PropertyData> it(m_members);
while (it.hasNext()) {
it.next();
- if (! processor->processProperty(it.key(), it.value()))
+ if (! processor->processProperty(it.key(), it.value().value, it.value().propertyInfo))
break;
}
}
@@ -1077,7 +1131,7 @@ const Value *ObjectValue::lookupMember(const QString &name, const Context *conte
const ObjectValue **foundInObject,
bool examinePrototypes) const
{
- if (const Value *m = m_members.value(name)) {
+ if (const Value *m = m_members.value(name).value) {
if (foundInObject)
*foundInObject = this;
return m;
@@ -1849,7 +1903,10 @@ bool ASTObjectValue::getSourceLocation(QString *fileName, int *line, int *column
void ASTObjectValue::processMembers(MemberProcessor *processor) const
{
foreach (ASTPropertyReference *ref, m_properties) {
- processor->processProperty(ref->ast()->name.toString(), ref);
+ uint pFlags = PropertyInfo::Readable;
+ if (!ref->ast()->isReadonlyMember)
+ pFlags |= PropertyInfo::Writeable;
+ processor->processProperty(ref->ast()->name.toString(), ref, PropertyInfo(pFlags));
// ### Should get a different value?
processor->processGeneratedSlot(ref->onChangedSlotName(), ref);
}
@@ -2334,7 +2391,7 @@ void TypeScope::processMembers(MemberProcessor *processor) const
continue;
if (!info.as().isEmpty())
- processor->processProperty(info.as(), import);
+ processor->processProperty(info.as(), import, PropertyInfo(PropertyInfo::Readable));
else
import->processMembers(processor);
}
@@ -2387,7 +2444,7 @@ void JSImportScope::processMembers(MemberProcessor *processor) const
const ImportInfo &info = i.info;
if (info.type() == ImportType::File || info.type() == ImportType::QrcFile)
- processor->processProperty(info.as(), import);
+ processor->processProperty(info.as(), import, PropertyInfo(PropertyInfo::Readable));
}
}
@@ -2513,9 +2570,9 @@ class MemberDumper: public MemberProcessor
public:
MemberDumper() {}
- virtual bool processProperty(const QString &name, const Value *)
+ virtual bool processProperty(const QString &name, const Value *, const PropertyInfo &pInfo)
{
- qCDebug(qmljsLog) << "property: " << name;
+ qCDebug(qmljsLog) << "property: " << name << " flags:" << pInfo.toString();
return true;
}
diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h
index 230d9f03f0..0a374ce7bb 100644
--- a/src/libs/qmljs/qmljsinterpreter.h
+++ b/src/libs/qmljs/qmljsinterpreter.h
@@ -388,6 +388,44 @@ public:
const UrlValue *asUrlValue() const QTC_OVERRIDE;
};
+class PropertyInfo {
+public:
+ enum PropertyFlag {
+ Readable = 1,
+ Writeable = 2,
+ ListType = 4,
+ PointerType= 8,
+ ValueType = 16,
+ PointerOrValue = PointerType|ValueType,
+ Default = Readable|Writeable|PointerOrValue
+ };
+
+ PropertyInfo(uint flags = Default);
+ uint flags;
+ bool isPointer() const {
+ return (flags & PointerOrValue) == PointerType;
+ }
+ bool isValue() const {
+ return (flags & PointerOrValue) == ValueType;
+ }
+ bool canBePointer() const {
+ return (flags & PointerType) != 0;
+ }
+ bool canBeValue() const {
+ return (flags & ValueType) != 0;
+ }
+ bool isReadable() const {
+ return (flags & Readable) != 0;
+ }
+ bool isWriteable() const {
+ return (flags & Writeable) != 0;
+ }
+ bool isList() const {
+ return (flags & ListType) != 0;
+ }
+ QString toString() const;
+};
+
class QMLJS_EXPORT MemberProcessor
{
MemberProcessor(const MemberProcessor &other);
@@ -398,7 +436,8 @@ public:
virtual ~MemberProcessor();
// Returns false to stop the processor.
- virtual bool processProperty(const QString &name, const Value *value);
+ virtual bool processProperty(const QString &name, const Value *value,
+ const PropertyInfo &propertyInfo);
virtual bool processEnumerator(const QString &name, const Value *value);
virtual bool processSignal(const QString &name, const Value *value);
virtual bool processSlot(const QString &name, const Value *value);
@@ -440,6 +479,16 @@ public:
void accept(ValueVisitor *) const QTC_OVERRIDE;
};
+class QMLJS_EXPORT PropertyData {
+public:
+ const Value *value;
+ PropertyInfo propertyInfo;
+ PropertyData(const Value *value = 0,
+ PropertyInfo propertyInfo = PropertyInfo(PropertyInfo::Default))
+ : value(value), propertyInfo(propertyInfo)
+ { }
+};
+
class QMLJS_EXPORT ObjectValue: public Value
{
public:
@@ -462,6 +511,7 @@ public:
virtual void processMembers(MemberProcessor *processor) const;
virtual void setMember(const QString &name, const Value *value);
+ virtual void setPropertyInfo(const QString &name, const PropertyInfo &propertyInfo);
virtual void removeMember(const QString &name);
virtual const Value *lookupMember(const QString &name, const Context *context,
@@ -484,7 +534,7 @@ private:
private:
ValueOwner *m_valueOwner;
- QHash<QString, const Value *> m_members;
+ QHash<QString, PropertyData> m_members;
QString m_className;
QString m_originId;
diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp
index e0006e4b83..76379ed3d7 100644
--- a/src/libs/qmljs/qmljslink.cpp
+++ b/src/libs/qmljs/qmljslink.cpp
@@ -333,7 +333,7 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
->filesInQrcPath(path));
while (iter.hasNext()) {
iter.next();
- if (Document::isQmlLikeLanguage(ModelManagerInterface::guessLanguageOfFile(iter.key()))) {
+ if (ModelManagerInterface::guessLanguageOfFile(iter.key()).isQmlLikeLanguage()) {
Document::Ptr importedDoc = snapshot.document(iter.value().at(0));
if (importedDoc && importedDoc->bind()->rootObjectValue()) {
const QString targetName = QFileInfo(iter.key()).baseName();
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index 281e7461c5..6bfffda64f 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -34,6 +34,7 @@
#include "qmljsmodelmanagerinterface.h"
#include "qmljsplugindumper.h"
#include "qmljstypedescriptionreader.h"
+#include "qmljsdialect.h"
#include <cplusplus/cppmodelmanagerbase.h>
#include <utils/hostosinfo.h>
@@ -113,6 +114,9 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
qRegisterMetaType<QmlJS::Document::Ptr>("QmlJS::Document::Ptr");
qRegisterMetaType<QmlJS::LibraryInfo>("QmlJS::LibraryInfo");
+ qRegisterMetaType<QmlJS::Dialect>("QmlJS::Dialect");
+ qRegisterMetaType<QmlJS::PathAndLanguage>("QmlJS::PathAndLanguage");
+ qRegisterMetaType<QmlJS::PathsAndLanguages>("QmlJS::PathsAndLanguages");
m_defaultProjectInfo.qtImportsPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
@@ -134,39 +138,39 @@ ModelManagerInterface::~ModelManagerInterface()
g_instance = 0;
}
-static QHash<QString, Language::Enum> defaultLanguageMapping()
+static QHash<QString, Dialect> defaultLanguageMapping()
{
- QHash<QString, Language::Enum> res;
- res[QLatin1String("js")] = Language::JavaScript;
- res[QLatin1String("qml")] = Language::Qml;
- res[QLatin1String("qmltypes")] = Language::QmlTypeInfo;
- res[QLatin1String("qmlproject")] = Language::QmlProject;
- res[QLatin1String("json")] = Language::Json;
- res[QLatin1String("qbs")] = Language::QmlQbs;
+ QHash<QString, Dialect> res;
+ res[QLatin1String("js")] = Dialect::JavaScript;
+ res[QLatin1String("qml")] = Dialect::Qml;
+ res[QLatin1String("qmltypes")] = Dialect::QmlTypeInfo;
+ res[QLatin1String("qmlproject")] = Dialect::QmlProject;
+ res[QLatin1String("json")] = Dialect::Json;
+ res[QLatin1String("qbs")] = Dialect::QmlQbs;
return res;
}
-Language::Enum ModelManagerInterface::guessLanguageOfFile(const QString &fileName)
+Dialect ModelManagerInterface::guessLanguageOfFile(const QString &fileName)
{
- QHash<QString, Language::Enum> lMapping;
+ QHash<QString, Dialect> lMapping;
if (instance())
lMapping = instance()->languageForSuffix();
else
lMapping = defaultLanguageMapping();
const QFileInfo info(fileName);
const QString fileSuffix = info.suffix();
- return lMapping.value(fileSuffix, Language::NoLanguage);
+ return lMapping.value(fileSuffix, Dialect::NoLanguage);
}
-QStringList ModelManagerInterface::globPatternsForLanguages(const QList<Language::Enum> languages)
+QStringList ModelManagerInterface::globPatternsForLanguages(const QList<Dialect> languages)
{
- QHash<QString, Language::Enum> lMapping;
+ QHash<QString, Dialect> lMapping;
if (instance())
lMapping = instance()->languageForSuffix();
else
lMapping = defaultLanguageMapping();
QStringList patterns;
- QHashIterator<QString,Language::Enum> i(lMapping);
+ QHashIterator<QString,Dialect> i(lMapping);
while (i.hasNext()) {
i.next();
if (languages.contains(i.value()))
@@ -203,7 +207,7 @@ void ModelManagerInterface::activateScan()
}
}
-QHash<QString, Language::Enum> ModelManagerInterface::languageForSuffix() const
+QHash<QString, Dialect> ModelManagerInterface::languageForSuffix() const
{
return defaultLanguageMapping();
}
@@ -294,7 +298,7 @@ QFuture<void> ModelManagerInterface::refreshSourceFiles(const QStringList &sourc
QFuture<void> result = QtConcurrent::run(&ModelManagerInterface::parse,
workingCopyInternal(), sourceFiles,
- this, Language::Qml,
+ this, Dialect(Dialect::Qml),
emitDocumentOnDiskChanged);
if (m_synchronizer.futures().size() > 10) {
@@ -334,7 +338,7 @@ void ModelManagerInterface::fileChangedOnDisk(const QString &path)
{
QtConcurrent::run(&ModelManagerInterface::parse,
workingCopyInternal(), QStringList() << path,
- this, Language::AnyLanguage, true);
+ this, Dialect(Dialect::AnyLanguage), true);
}
void ModelManagerInterface::removeFiles(const QStringList &files)
@@ -394,8 +398,8 @@ bool pInfoLessThanImports(const ModelManagerInterface::ProjectInfo &p1, const Mo
return true;
if (p1.qtImportsPath > p2.qtImportsPath)
return false;
- QStringList s1 = p1.importPaths;
- QStringList s2 = p2.importPaths;
+ const PathsAndLanguages &s1 = p1.importPaths;
+ const PathsAndLanguages &s2 = p2.importPaths;
if (s1.size() < s2.size())
return true;
if (s1.size() > s2.size())
@@ -403,7 +407,7 @@ bool pInfoLessThanImports(const ModelManagerInterface::ProjectInfo &p1, const Mo
for (int i = 0; i < s1.size(); ++i) {
if (s1.at(i) < s2.at(i))
return true;
- else if (s1.at(i) > s2.at(i))
+ else if (s2.at(i) < s1.at(i))
return false;
}
return false;
@@ -603,9 +607,8 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QSt
res.qtImportsPath = pInfo.qtImportsPath;
if (res.qtQmlPath.isEmpty())
res.qtQmlPath = pInfo.qtQmlPath;
- foreach (const QString &path, pInfo.importPaths)
- if (!res.importPaths.contains(path))
- res.importPaths.append(path);
+ for (int i = 0; i < pInfo.importPaths.size(); ++i)
+ res.importPaths.maybeInsert(pInfo.importPaths.at(i));
}
return res;
}
@@ -643,7 +646,7 @@ void ModelManagerInterface::updateLibraryInfo(const QString &path, const Library
emit libraryInfoUpdated(path, info);
}
-static QStringList filesInDirectoryForLanguages(const QString &path, QList<Language::Enum> languages)
+static QStringList filesInDirectoryForLanguages(const QString &path, QList<Dialect> languages)
{
const QStringList pattern = ModelManagerInterface::globPatternsForLanguages(languages);
QStringList files;
@@ -663,7 +666,7 @@ static void findNewImplicitImports(const Document::Ptr &doc, const Snapshot &sna
if (snapshot.documentsInDirectory(doc->path()).isEmpty()) {
if (! scannedPaths->contains(doc->path())) {
*importedFiles += filesInDirectoryForLanguages(doc->path(),
- Document::companionLanguages(doc->language()));
+ doc->language().companionLanguages());
scannedPaths->insert(doc->path());
}
}
@@ -682,7 +685,7 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho
if (snapshot.documentsInDirectory(importName).isEmpty()) {
if (! scannedPaths->contains(importName)) {
*importedFiles += filesInDirectoryForLanguages(importName,
- Document::companionLanguages(doc->language()));
+ doc->language().companionLanguages());
scannedPaths->insert(importName);
}
}
@@ -696,7 +699,7 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho
QMapIterator<QString,QStringList> dirContents(ModelManagerInterface::instance()->filesInQrcPath(importName));
while (dirContents.hasNext()) {
dirContents.next();
- if (Document::isQmlLikeOrJsLanguage(ModelManagerInterface::guessLanguageOfFile(dirContents.key()))) {
+ if (ModelManagerInterface::guessLanguageOfFile(dirContents.key()).isQmlLikeOrJsLanguage()) {
foreach (const QString &filePath, dirContents.value()) {
if (! snapshot.document(filePath))
*importedFiles += filePath;
@@ -759,7 +762,7 @@ static bool findNewQmlLibraryInPath(const QString &path,
const QString path = QDir::cleanPath(componentFileInfo.absolutePath());
if (! scannedPaths->contains(path)) {
*importedFiles += filesInDirectoryForLanguages(path,
- Document::companionLanguages(Language::AnyLanguage));
+ Dialect(Dialect::AnyLanguage).companionLanguages());
scannedPaths->insert(path);
}
}
@@ -806,7 +809,7 @@ static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snap
importedFiles, scannedPaths, newLibraries, false);
// scan dir and lib imports
- const QStringList importPaths = modelManager->importPaths();
+ const PathsAndLanguages importPaths = modelManager->importPaths();
foreach (const ImportInfo &import, doc->bind()->imports()) {
if (import.type() == ImportType::Directory) {
const QString targetPath = import.path();
@@ -817,8 +820,8 @@ static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snap
if (import.type() == ImportType::Library) {
if (!import.version().isValid())
continue;
- foreach (const QString &importPath, importPaths) {
- const QString targetPath = QDir(importPath).filePath(import.path());
+ foreach (const PathAndLanguage &importPath, importPaths) {
+ const QString targetPath = importPath.path().toFileInfo().dir().filePath(import.path());
findNewQmlLibrary(targetPath, import.version(), snapshot, modelManager,
importedFiles, scannedPaths, newLibraries);
}
@@ -831,7 +834,7 @@ void ModelManagerInterface::parseLoop(QSet<QString> &scannedPaths,
WorkingCopy workingCopy,
QStringList files,
ModelManagerInterface *modelManager,
- Language::Enum mainLanguage,
+ Dialect mainLanguage,
bool emitDocChangedOnDisk,
std::function<bool(qreal)> reportProgress)
{
@@ -841,14 +844,14 @@ void ModelManagerInterface::parseLoop(QSet<QString> &scannedPaths,
const QString fileName = files.at(i);
- Language::Enum language = guessLanguageOfFile(fileName);
- if (language == Language::NoLanguage) {
+ Dialect language = guessLanguageOfFile(fileName);
+ if (language == Dialect::NoLanguage) {
if (fileName.endsWith(QLatin1String(".qrc")))
modelManager->updateQrcFile(fileName);
continue;
}
- if (language == Language::Qml
- && (mainLanguage == Language::QmlQtQuick1 || mainLanguage == Language::QmlQtQuick2))
+ if (language == Dialect::Qml
+ && (mainLanguage == Dialect::QmlQtQuick1 || mainLanguage == Dialect::QmlQtQuick2))
language = mainLanguage;
QString contents;
int documentRevision = 0;
@@ -917,7 +920,7 @@ void ModelManagerInterface::parse(QFutureInterface<void> &future,
WorkingCopy workingCopy,
QStringList files,
ModelManagerInterface *modelManager,
- Language::Enum mainLanguage,
+ Dialect mainLanguage,
bool emitDocChangedOnDisk)
{
FutureReporter reporter(future);
@@ -935,19 +938,23 @@ void ModelManagerInterface::parse(QFutureInterface<void> &future,
struct ScanItem {
QString path;
int depth;
- ScanItem(QString path = QString(), int depth = 0)
- : path(path), depth(depth)
+ Dialect language;
+ ScanItem(QString path = QString(), int depth = 0, Dialect language = Dialect::AnyLanguage)
+ : path(path), depth(depth), language(language)
{ }
};
void ModelManagerInterface::importScan(QFutureInterface<void> &future,
ModelManagerInterface::WorkingCopy workingCopy,
- QStringList paths, ModelManagerInterface *modelManager,
- Language::Enum language,
+ PathsAndLanguages paths, ModelManagerInterface *modelManager,
bool emitDocChangedOnDisk)
{
// paths we have scanned for files and added to the files list
- QSet<QString> scannedPaths = modelManager->m_scannedPaths;
+ QSet<QString> scannedPaths;
+ {
+ QMutexLocker l(&modelManager->m_mutex);
+ scannedPaths = modelManager->m_scannedPaths;
+ }
// libraries we've found while scanning imports
QSet<QString> newLibraries;
@@ -955,11 +962,12 @@ void ModelManagerInterface::importScan(QFutureInterface<void> &future,
pathsToScan.reserve(paths.size());
{
QMutexLocker l(&modelManager->m_mutex);
- foreach (const QString &path, paths) {
- QString cPath = QDir::cleanPath(path);
+ for (int i = 0; i < paths.size(); ++i) {
+ PathAndLanguage pAndL = paths.at(i);
+ QString cPath = QDir::cleanPath(pAndL.path().toString());
if (modelManager->m_scannedPaths.contains(cPath))
continue;
- pathsToScan.append(ScanItem(cPath));
+ pathsToScan.append(ScanItem(cPath, 0, pAndL.language()));
modelManager->m_scannedPaths.insert(cPath);
}
}
@@ -979,14 +987,14 @@ void ModelManagerInterface::importScan(QFutureInterface<void> &future,
&scannedPaths, &newLibraries, true)
&& !libOnly && snapshot.documentsInDirectory(toScan.path).isEmpty())
importedFiles += filesInDirectoryForLanguages(toScan.path,
- Document::companionLanguages(language));
+ toScan.language.companionLanguages());
workDone += 1;
future.setProgressValue(progressRange * workDone / totalWork);
if (!importedFiles.isEmpty()) {
FutureReporter reporter(future, progressRange * pathBudget / (4 * totalWork),
progressRange * workDone / totalWork);
parseLoop(scannedPaths, newLibraries, workingCopy, importedFiles, modelManager,
- language, emitDocChangedOnDisk, reporter); // run in parallel??
+ toScan.language, emitDocChangedOnDisk, reporter); // run in parallel??
importedFiles.clear();
}
workDone += pathBudget / 4 - 1;
@@ -1001,7 +1009,7 @@ void ModelManagerInterface::importScan(QFutureInterface<void> &future,
workDone += 1;
totalWork += pathBudget / 2 * subDirs.size() - pathBudget * 3 / 4 + 1;
foreach (const QString path, subDirs)
- pathsToScan.append(ScanItem(dir.absoluteFilePath(path), toScan.depth + 1));
+ pathsToScan.append(ScanItem(dir.absoluteFilePath(path), toScan.depth + 1, toScan.language));
} else {
workDone += pathBudget * 3 / 4;
}
@@ -1011,12 +1019,12 @@ void ModelManagerInterface::importScan(QFutureInterface<void> &future,
if (future.isCanceled()) {
// assume no work has been done
QMutexLocker l(&modelManager->m_mutex);
- foreach (const QString &path, paths)
- modelManager->m_scannedPaths.remove(path);
+ for (int i = 0; i < paths.size(); ++i)
+ modelManager->m_scannedPaths.remove(paths.at(i).path().toString());
}
}
-QStringList ModelManagerInterface::importPaths() const
+PathsAndLanguages ModelManagerInterface::importPaths() const
{
QMutexLocker l(&m_mutex);
return m_allImportPaths;
@@ -1034,23 +1042,20 @@ QmlLanguageBundles ModelManagerInterface::extendedBundles() const
return m_extendedBundles;
}
-void ModelManagerInterface::maybeScan(const QStringList &importPaths,
- Language::Enum defaultLanguage)
+void ModelManagerInterface::maybeScan(const PathsAndLanguages &importPaths)
{
- QStringList pathToScan;
+ PathsAndLanguages pathToScan;
{
QMutexLocker l(&m_mutex);
- foreach (QString importPath, importPaths)
- if (!m_scannedPaths.contains(importPath)) {
- pathToScan.append(importPath);
- }
+ foreach (const PathAndLanguage &importPath, importPaths)
+ if (!m_scannedPaths.contains(importPath.path().toString()))
+ pathToScan.maybeInsert(importPath);
}
- if (pathToScan.count() > 1) {
+ if (pathToScan.length() > 1) {
QFuture<void> result = QtConcurrent::run(&ModelManagerInterface::importScan,
workingCopyInternal(), pathToScan,
- this, defaultLanguage,
- true);
+ this, true);
if (m_synchronizer.futures().size() > 10) {
QList<QFuture<void> > futures = m_synchronizer.futures();
@@ -1071,33 +1076,37 @@ void ModelManagerInterface::maybeScan(const QStringList &importPaths,
void ModelManagerInterface::updateImportPaths()
{
- QStringList allImportPaths;
+ PathsAndLanguages allImportPaths;
QmlLanguageBundles activeBundles;
QmlLanguageBundles extendedBundles;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> pInfoIter(m_projects);
- QHashIterator<Language::Enum, QmlJS::ViewerContext> vCtxsIter = m_defaultVContexts;
+ QHashIterator<Dialect, QmlJS::ViewerContext> vCtxsIter = m_defaultVContexts;
while (pInfoIter.hasNext()) {
pInfoIter.next();
- foreach (const QString &path, pInfoIter.value().importPaths) {
- const QString canonicalPath = QFileInfo(path).canonicalFilePath();
+ const PathsAndLanguages &iPaths = pInfoIter.value().importPaths;
+ for (int i = 0; i < iPaths.size(); ++i) {
+ PathAndLanguage pAndL = iPaths.at(i);
+ const QString canonicalPath = pAndL.path().toFileInfo().canonicalFilePath();
if (!canonicalPath.isEmpty())
- allImportPaths += canonicalPath;
+ allImportPaths.maybeInsert(Utils::FileName::fromString(canonicalPath),
+ pAndL.language());
}
}
while (vCtxsIter.hasNext()) {
vCtxsIter.next();
- allImportPaths << vCtxsIter.value().paths;
+ foreach (const QString &path, vCtxsIter.value().paths)
+ allImportPaths.maybeInsert(Utils::FileName::fromString(path), vCtxsIter.value().language);
}
pInfoIter.toFront();
while (pInfoIter.hasNext()) {
pInfoIter.next();
activeBundles.mergeLanguageBundles(pInfoIter.value().activeBundle);
- foreach (Language::Enum l, pInfoIter.value().activeBundle.languages()) {
+ foreach (Dialect l, pInfoIter.value().activeBundle.languages()) {
foreach (const QString &path, pInfoIter.value().activeBundle.bundleForLanguage(l)
.searchPaths().stringList()) {
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
if (!canonicalPath.isEmpty())
- allImportPaths += canonicalPath;
+ allImportPaths.maybeInsert(Utils::FileName::fromString(canonicalPath), l);
}
}
}
@@ -1105,28 +1114,29 @@ void ModelManagerInterface::updateImportPaths()
while (pInfoIter.hasNext()) {
pInfoIter.next();
QString pathAtt = pInfoIter.value().qtQmlPath;
- if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
- allImportPaths.append(pathAtt);
+ if (!pathAtt.isEmpty())
+ allImportPaths.maybeInsert(Utils::FileName::fromString(pathAtt), Dialect::QmlQtQuick2);
}
{
QString pathAtt = defaultProjectInfo().qtQmlPath;
- if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
- allImportPaths.append(pathAtt);
+ if (!pathAtt.isEmpty())
+ allImportPaths.maybeInsert(Utils::FileName::fromString(pathAtt), Dialect::QmlQtQuick2);
}
pInfoIter.toFront();
while (pInfoIter.hasNext()) {
pInfoIter.next();
QString pathAtt = pInfoIter.value().qtImportsPath;
- if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
- allImportPaths.append(pathAtt);
+ if (!pathAtt.isEmpty())
+ allImportPaths.maybeInsert(Utils::FileName::fromString(pathAtt), Dialect::QmlQtQuick1);
}
{
QString pathAtt = defaultProjectInfo().qtImportsPath;
- if (!pathAtt.isEmpty() && (allImportPaths.isEmpty() || allImportPaths.last() != pathAtt))
- allImportPaths.append(pathAtt);
+ if (!pathAtt.isEmpty())
+ allImportPaths.maybeInsert(Utils::FileName::fromString(pathAtt), Dialect::QmlQtQuick1);
}
- allImportPaths += m_defaultImportPaths;
- allImportPaths.removeDuplicates();
+ foreach (const QString &path, m_defaultImportPaths)
+ allImportPaths.maybeInsert(Utils::FileName::fromString(path), Dialect::Qml);
+ allImportPaths.compact();
{
QMutexLocker l(&m_mutex);
@@ -1148,7 +1158,7 @@ void ModelManagerInterface::updateImportPaths()
if (!m_shouldScanImports)
return;
- maybeScan(allImportPaths, Language::Qml);
+ maybeScan(allImportPaths);
}
void ModelManagerInterface::loadPluginTypes(const QString &libraryPath, const QString &importPath,
@@ -1294,10 +1304,10 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
ViewerContext res = vCtx;
if (!doc.isNull()
- && ((vCtx.language == Language::AnyLanguage && doc->language() != Language::NoLanguage)
- || (vCtx.language == Language::Qml
- && (doc->language() == Language::QmlQtQuick1
- || doc->language() == Language::QmlQtQuick2))))
+ && ((vCtx.language == Dialect::AnyLanguage && doc->language() != Dialect::NoLanguage)
+ || (vCtx.language == Dialect::Qml
+ && (doc->language() == Dialect::QmlQtQuick1
+ || doc->language() == Dialect::QmlQtQuick2))))
res.language = doc->language();
ProjectInfo info;
if (!doc.isNull())
@@ -1318,17 +1328,17 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
{
foreach (const QString &path, defaultVCtx.paths)
res.maybeAddPath(path);
- switch (res.language) {
- case Language::AnyLanguage:
- case Language::Qml:
+ switch (res.language.dialect()) {
+ case Dialect::AnyLanguage:
+ case Dialect::Qml:
res.maybeAddPath(info.qtQmlPath);
// fallthrough
- case Language::QmlQtQuick1:
+ case Dialect::QmlQtQuick1:
res.maybeAddPath(info.qtImportsPath);
// fallthrough
- case Language::QmlQtQuick2:
+ case Dialect::QmlQtQuick2:
{
- if (res.language == Language::QmlQtQuick2)
+ if (res.language == Dialect::QmlQtQuick2)
res.maybeAddPath(info.qtQmlPath);
QList<ProjectInfo> allProjects;
{
@@ -1336,18 +1346,22 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
allProjects = m_projects.values();
}
std::sort(allProjects.begin(), allProjects.end(), &pInfoLessThanImports);
+ QList<Dialect> languages = res.language.companionLanguages();
foreach (const ProjectInfo &pInfo, allProjects) {
- foreach (const QString &path, pInfo.importPaths)
- res.maybeAddPath(path);
+ for (int i = 0; i< pInfo.importPaths.size(); ++i) {
+ PathAndLanguage pAndL = pInfo.importPaths.at(i);
+ if (languages.contains(pAndL.language()) || pAndL.language().companionLanguages().contains(res.language))
+ res.maybeAddPath(pAndL.path().toString());
+ }
}
break;
}
- case Language::NoLanguage:
- case Language::JavaScript:
- case Language::QmlTypeInfo:
- case Language::Json:
- case Language::QmlQbs:
- case Language::QmlProject:
+ case Dialect::NoLanguage:
+ case Dialect::JavaScript:
+ case Dialect::QmlTypeInfo:
+ case Dialect::Json:
+ case Dialect::QmlQbs:
+ case Dialect::QmlProject:
break;
}
break;
@@ -1358,11 +1372,11 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
case ViewerContext::AddDefaultPaths:
foreach (const QString &path, defaultVCtx.paths)
res.maybeAddPath(path);
- if (res.language == Language::AnyLanguage || res.language == Language::Qml
- || res.language == Language::QmlQtQuick2)
+ if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml
+ || res.language == Dialect::QmlQtQuick2)
res.maybeAddPath(info.qtImportsPath);
- if (res.language == Language::AnyLanguage || res.language == Language::Qml
- || res.language == Language::QmlQtQuick1)
+ if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml
+ || res.language == Dialect::QmlQtQuick1)
res.maybeAddPath(info.qtQmlPath);
break;
}
@@ -1370,15 +1384,15 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
return res;
}
-ViewerContext ModelManagerInterface::defaultVContext(Language::Enum language,
+ViewerContext ModelManagerInterface::defaultVContext(Dialect language,
const Document::Ptr &doc,
bool autoComplete) const
{
if (!doc.isNull()) {
- if (language == Language::AnyLanguage && doc->language() != Language::NoLanguage)
+ if (language == Dialect::AnyLanguage && doc->language() != Dialect::NoLanguage)
language = doc->language();
- else if (language == Language::Qml &&
- (doc->language() == Language::QmlQtQuick1 || doc->language() == Language::QmlQtQuick2))
+ else if (language == Dialect::Qml &&
+ (doc->language() == Dialect::QmlQtQuick1 || doc->language() == Dialect::QmlQtQuick2))
language = doc->language();
}
ViewerContext defaultCtx;
@@ -1399,6 +1413,12 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfo() c
return m_defaultProjectInfo;
}
+ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfoForProject(
+ ProjectExplorer::Project *) const
+{
+ return ModelManagerInterface::ProjectInfo();
+}
+
void ModelManagerInterface::setDefaultVContext(const ViewerContext &vContext)
{
QMutexLocker locker(&m_mutex);
@@ -1415,7 +1435,7 @@ Document::Ptr ModelManagerInterface::ensuredGetDocumentForPath(const QString &fi
{
QmlJS::Document::Ptr document = newestSnapshot().document(filePath);
if (!document) {
- document = QmlJS::Document::create(filePath, QmlJS::Language::Qml);
+ document = QmlJS::Document::create(filePath, QmlJS::Dialect::Qml);
QMutexLocker lock(&m_mutex);
m_newestSnapshot.insert(document);
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h
index ad2a14b81b..d440c78dc9 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.h
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h
@@ -36,9 +36,11 @@
#include "qmljsdocument.h"
#include "qmljsqrcparser.h"
#include "qmljsviewercontext.h"
+#include "qmljsdialect.h"
#include <cplusplus/CppDocument.h>
#include <utils/environment.h>
+#include <utils/fileutils.h>
#include <QFuture>
#include <QFutureSynchronizer>
@@ -93,7 +95,7 @@ public:
public: // attributes
QPointer<ProjectExplorer::Project> project;
QStringList sourceFiles;
- QStringList importPaths;
+ PathsAndLanguages importPaths;
QStringList activeResourceFiles;
QStringList allResourceFiles;
@@ -148,8 +150,8 @@ public:
ModelManagerInterface(QObject *parent = 0);
virtual ~ModelManagerInterface();
- static Language::Enum guessLanguageOfFile(const QString &fileName);
- static QStringList globPatternsForLanguages(const QList<Language::Enum> languages);
+ static Dialect guessLanguageOfFile(const QString &fileName);
+ static QStringList globPatternsForLanguages(const QList<Dialect> languages);
static ModelManagerInterface *instance();
static void writeWarning(const QString &msg);
static WorkingCopy workingCopy();
@@ -182,7 +184,7 @@ public:
void updateQrcFile(const QString &path);
ProjectInfo projectInfoForPath(QString path) const;
- QStringList importPaths() const;
+ PathsAndLanguages importPaths() const;
QmlJS::QmlLanguageBundles activeBundles() const;
QmlJS::QmlLanguageBundles extendedBundles() const;
@@ -193,17 +195,23 @@ public:
LibraryInfo builtins(const Document::Ptr &doc) const;
ViewerContext completeVContext(const ViewerContext &vCtx,
const Document::Ptr &doc = Document::Ptr(0)) const;
- ViewerContext defaultVContext(Language::Enum language = Language::Qml,
+ ViewerContext defaultVContext(Dialect language = Dialect::Qml,
const Document::Ptr &doc = Document::Ptr(0),
bool autoComplete = true) const;
void setDefaultVContext(const ViewerContext &vContext);
virtual ProjectInfo defaultProjectInfo() const;
+ virtual ProjectInfo defaultProjectInfoForProject(ProjectExplorer::Project *project) const;
+
// Blocks until all parsing threads are done. Used for testing.
void joinAllThreads();
QmlJS::Document::Ptr ensuredGetDocumentForPath(const QString &filePath);
-
+ static void importScan(QFutureInterface<void> &future,
+ WorkingCopy workingCopyInternal,
+ PathsAndLanguages paths,
+ ModelManagerInterface *modelManager,
+ bool emitDocChangedOnDisk);
public slots:
virtual void resetCodeModel();
void removeProjectInfo(ProjectExplorer::Project *project);
@@ -221,7 +229,7 @@ protected slots:
virtual void startCppQmlTypeUpdate();
protected:
QMutex *mutex() const;
- virtual QHash<QString,Language::Enum> languageForSuffix() const;
+ virtual QHash<QString,Dialect> languageForSuffix() const;
virtual void writeMessageInternal(const QString &msg) const;
virtual WorkingCopy workingCopyInternal() const;
virtual void addTaskInternal(QFuture<void> result, const QString &msg, const char *taskId) const;
@@ -231,26 +239,20 @@ protected:
static void parseLoop(QSet<QString> &scannedPaths, QSet<QString> &newLibraries,
WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager,
- QmlJS::Language::Enum mainLanguage, bool emitDocChangedOnDisk,
+ QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk,
std::function<bool (qreal)> reportProgress);
static void parse(QFutureInterface<void> &future,
WorkingCopy workingCopyInternal,
QStringList files,
ModelManagerInterface *modelManager,
- QmlJS::Language::Enum mainLanguage,
+ QmlJS::Dialect mainLanguage,
bool emitDocChangedOnDisk);
- static void importScan(QFutureInterface<void> &future,
- WorkingCopy workingCopyInternal,
- QStringList paths,
- ModelManagerInterface *modelManager,
- QmlJS::Language::Enum mainLanguage,
- bool emitDocChangedOnDisk);
static void updateCppQmlTypes(QFutureInterface<void> &interface,
ModelManagerInterface *qmlModelManager,
CPlusPlus::Snapshot snapshot,
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents);
- void maybeScan(const QStringList &importPaths, Language::Enum defaultLanguage);
+ void maybeScan(const PathsAndLanguages &importPaths);
void updateImportPaths();
void loadQmlTypeDescriptionsInternal(const QString &path);
void setDefaultProject(const ProjectInfo &pInfo, ProjectExplorer::Project *p);
@@ -259,11 +261,11 @@ private:
mutable QMutex m_mutex;
QmlJS::Snapshot m_validSnapshot;
QmlJS::Snapshot m_newestSnapshot;
- QStringList m_allImportPaths;
+ PathsAndLanguages m_allImportPaths;
QStringList m_defaultImportPaths;
QmlJS::QmlLanguageBundles m_activeBundles;
QmlJS::QmlLanguageBundles m_extendedBundles;
- QHash<Language::Enum, QmlJS::ViewerContext> m_defaultVContexts;
+ QHash<Dialect, QmlJS::ViewerContext> m_defaultVContexts;
bool m_shouldScanImports;
QSet<QString> m_scannedPaths;
diff --git a/src/libs/qmljs/qmljsscopechain.cpp b/src/libs/qmljs/qmljsscopechain.cpp
index 4113e47cd3..60df0e0b19 100644
--- a/src/libs/qmljs/qmljsscopechain.cpp
+++ b/src/libs/qmljs/qmljsscopechain.cpp
@@ -258,7 +258,7 @@ void ScopeChain::update() const
m_all += m_cppContextProperties;
// the root scope in js files doesn't see instantiating components
- if (m_document->language() != Language::JavaScript || m_jsScopes.count() != 1) {
+ if (m_document->language() != Dialect::JavaScript || m_jsScopes.count() != 1) {
if (m_qmlComponentScope) {
foreach (const QmlComponentChain *parent, m_qmlComponentScope->instantiatingComponents())
collectScopes(parent, &m_all);
diff --git a/src/libs/qmljs/qmljsviewercontext.cpp b/src/libs/qmljs/qmljsviewercontext.cpp
index cec6605145..14482f1158 100644
--- a/src/libs/qmljs/qmljsviewercontext.cpp
+++ b/src/libs/qmljs/qmljsviewercontext.cpp
@@ -40,11 +40,11 @@ namespace QmlJS {
Screen information will also most likely need to be added here.
*/
ViewerContext::ViewerContext()
- : language(Language::Qml), flags(AddAllPaths)
+ : language(Dialect::Qml), flags(AddAllPaths)
{ }
ViewerContext::ViewerContext(QStringList selectors, QStringList paths,
- QmlJS::Language::Enum language,
+ QmlJS::Dialect language,
QmlJS::ViewerContext::Flags flags)
: selectors(selectors), paths(paths), language(language),
flags(flags)
@@ -54,27 +54,27 @@ ViewerContext::ViewerContext(QStringList selectors, QStringList paths,
/*
which languages might be imported in this context
*/
-bool ViewerContext::languageIsCompatible(Language::Enum l) const
+bool ViewerContext::languageIsCompatible(Dialect l) const
{
- if (l == Language::AnyLanguage && language != Language::NoLanguage)
+ if (l == Dialect::AnyLanguage && language != Dialect::NoLanguage)
return true;
- switch (language) {
- case Language::JavaScript:
- case Language::Json:
- case Language::QmlProject:
- case Language::QmlQbs:
- case Language::QmlTypeInfo:
+ switch (language.dialect()) {
+ case Dialect::JavaScript:
+ case Dialect::Json:
+ case Dialect::QmlProject:
+ case Dialect::QmlQbs:
+ case Dialect::QmlTypeInfo:
return language == l;
- case Language::Qml:
- return l == Language::Qml || l == Language::QmlQtQuick1 || l == Language::QmlQtQuick2
- || l == Language::JavaScript;
- case Language::QmlQtQuick1:
- return l == Language::Qml || l == Language::QmlQtQuick1 || l == Language::JavaScript;
- case Language::QmlQtQuick2:
- return l == Language::Qml || l == Language::QmlQtQuick2 || l == Language::JavaScript;
- case Language::AnyLanguage:
+ case Dialect::Qml:
+ return l == Dialect::Qml || l == Dialect::QmlQtQuick1 || l == Dialect::QmlQtQuick2
+ || l == Dialect::JavaScript;
+ case Dialect::QmlQtQuick1:
+ return l == Dialect::Qml || l == Dialect::QmlQtQuick1 || l == Dialect::JavaScript;
+ case Dialect::QmlQtQuick2:
+ return l == Dialect::Qml || l == Dialect::QmlQtQuick2 || l == Dialect::JavaScript;
+ case Dialect::AnyLanguage:
return true;
- case Language::NoLanguage:
+ case Dialect::NoLanguage:
break;
}
return false;
diff --git a/src/libs/qmljs/qmljsviewercontext.h b/src/libs/qmljs/qmljsviewercontext.h
index f4b3639226..1e5c7c262a 100644
--- a/src/libs/qmljs/qmljsviewercontext.h
+++ b/src/libs/qmljs/qmljsviewercontext.h
@@ -32,6 +32,7 @@
#include "qmljs_global.h"
#include "qmljsconstants.h"
+#include "qmljsdialect.h"
#include <QStringList>
@@ -50,15 +51,15 @@ public:
ViewerContext();
ViewerContext(QStringList selectors, QStringList paths,
- Language::Enum language = Language::Qml,
+ Dialect language = Dialect::Qml,
Flags flags = AddAllPaths);
- bool languageIsCompatible(Language::Enum l) const;
+ bool languageIsCompatible(Dialect l) const;
void maybeAddPath(const QString &path);
QStringList selectors;
QStringList paths;
- Language::Enum language;
+ Dialect language;
Flags flags;
};
diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs b/src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs
new file mode 100644
index 0000000000..15dc104f37
--- /dev/null
+++ b/src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs
@@ -0,0 +1,77 @@
+import qbs
+import qbs.File
+import qbs.FileInfo
+
+QtcLibrary {
+ condition: qbs.toolchain.contains("msvc") && cdbPath
+ name: "qtcreatorcdbext"
+ property string cdbPath: {
+ var paths = [
+ qbs.getEnv("CDB_PATH"),
+ qbs.getEnv("ProgramFiles") + "/Debugging Tools For Windows/sdk",
+ qbs.getEnv("ProgramFiles") + "/Debugging Tools For Windows (x86)/sdk",
+ qbs.getEnv("ProgramFiles") + "/Debugging Tools For Windows (x64)/sdk",
+ qbs.getEnv("ProgramFiles") + "/Debugging Tools For Windows 64-bit/sdk",
+ qbs.getEnv("ProgramW6432") + "/Debugging Tools For Windows (x86)/sdk",
+ qbs.getEnv("ProgramW6432") + "/Debugging Tools For Windows (x64)/sdk",
+ qbs.getEnv("ProgramW6432") + "/Debugging Tools For Windows 64-bit/sdk",
+ qbs.getEnv("ProgramFiles") + "/Windows Kits/8.0/Debuggers",
+ qbs.getEnv("ProgramFiles") + "/Windows Kits/8.1/Debuggers",
+ qbs.getEnv("ProgramFiles(x86)") + "/Windows Kits/8.0/Debuggers/inc",
+ qbs.getEnv("ProgramFiles(x86)") + "/Windows Kits/8.1/Debuggers/inc"
+ ];
+ var c = paths.length;
+ for (var i = 0; i < c; ++i) {
+ if (File.exists(paths[i])) {
+ // The inc subdir is just used for detection. See qtcreatorcdbext.pro.
+ return paths[i].endsWith("/inc") ? paths[i].substr(0, paths[i] - 4) : paths[i];
+ }
+ }
+ return undefined;
+ }
+ property string cdbPlatform: qbs.architecture.contains("x86_64") ? "x64" : "x86"
+ cpp.includePaths: [FileInfo.joinPaths(cdbPath, "inc")]
+ cpp.dynamicLibraries: [
+ "user32.lib",
+ FileInfo.joinPaths(cdbPath, "lib", cdbPlatform, "dbgeng.lib")
+ ]
+ cpp.linkerFlags: ["/DEF:" + FileInfo.toWindowsSeparators(
+ FileInfo.joinPaths(product.sourceDirectory,
+ "qtcreatorcdbext.def"))]
+ installDir: {
+ var dirName = name;
+ if (qbs.architecture.contains("x86_64"))
+ dirName += "64";
+ else
+ dirName += "32";
+ return FileInfo.joinPaths(project.ide_library_path, dirName);
+ }
+ files: [
+ "base64.cpp",
+ "base64.h",
+ "common.cpp",
+ "common.h",
+ "containers.cpp",
+ "containers.h",
+ "eventcallback.cpp",
+ "eventcallback.h",
+ "extensioncontext.cpp",
+ "extensioncontext.h",
+ "gdbmihelpers.cpp",
+ "gdbmihelpers.h",
+ "iinterfacepointer.h",
+ "knowntype.h",
+ "outputcallback.cpp",
+ "outputcallback.h",
+ "qtcreatorcdbextension.cpp",
+ "stringutils.cpp",
+ "stringutils.h",
+ "symbolgroup.cpp",
+ "symbolgroup.h",
+ "symbolgroupnode.cpp",
+ "symbolgroupnode.h",
+ "symbolgroupvalue.cpp",
+ "symbolgroupvalue.h",
+ ]
+}
+
diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h
index c1cb7ea894..cbee574a84 100644
--- a/src/libs/utils/algorithm.h
+++ b/src/libs/utils/algorithm.h
@@ -31,6 +31,7 @@
#define ALGORITHM_H
#include <algorithm>
+#include <functional>
#if QT_VERSION < 0x050000
#ifndef Q_REQUIRED_RESULT
@@ -46,6 +47,16 @@
namespace Utils
{
+//////////////////
+// anyOf
+/////////////////
+
+// anyOf taking a member function pointer
+template<typename T, typename R, typename S>
+bool anyOf(const T &container, R (S::*predicate)() const)
+{
+ return std::any_of(container.begin(), container.end(), std::mem_fn(predicate));
+}
template<typename T, typename F>
bool anyOf(const T &container, F predicate)
@@ -53,12 +64,18 @@ bool anyOf(const T &container, F predicate)
return std::any_of(container.begin(), container.end(), predicate);
}
+//////////////////
+// allOf
+/////////////////
template<typename T, typename F>
bool allOf(const T &container, F predicate)
{
return std::all_of(container.begin(), container.end(), predicate);
}
+//////////////////
+// erase
+/////////////////
template<typename T, typename F>
void erase(QList<T> &container, F predicate)
{
@@ -66,6 +83,9 @@ void erase(QList<T> &container, F predicate)
container.end());
}
+//////////////////
+// contains
+/////////////////
template<typename T, typename F>
bool contains(const T &container, F function)
{
@@ -76,6 +96,9 @@ bool contains(const T &container, F function)
return it != end;
}
+//////////////////
+// findOr
+/////////////////
template<typename T, typename F>
typename T::value_type findOr(const T &container, typename T::value_type other, F function)
{
@@ -89,23 +112,64 @@ typename T::value_type findOr(const T &container, typename T::value_type other,
}
template<typename T, typename F>
-typename T::value_type bestElementOr(const T &container, typename T::value_type other, F function)
+int indexOf(const T &container, F function)
{
typename T::const_iterator end = container.end();
typename T::const_iterator begin = container.begin();
- typename T::const_iterator it = std::min_element(begin, end, function);
+ typename T::const_iterator it = std::find_if(begin, end, function);
if (it == end)
- return other;
- return *it;
+ return -1;
+ return it - begin;
+}
+
+template<typename T, typename F>
+typename T::value_type findOrDefault(const T &container, F function)
+{
+ return findOr(container, typename T::value_type(), function);
+}
+
+//////////////////
+// find helpers
+//////////////////
+template<typename R, typename S, typename T>
+auto equal(R (S::*function)() const, T value)
+ -> decltype(std::bind<bool>(std::equal_to<T>(), value, std::bind(function, std::placeholders::_1)))
+{
+ return std::bind<bool>(std::equal_to<T>(), value, std::bind(function, std::placeholders::_1));
+}
+
+//////////////////
+// transform
+/////////////////
+
+// transform taking a member function pointer
+template<typename T, typename R, typename S>
+Q_REQUIRED_RESULT
+auto transform(const QList<T> &container, R (S::*p)() const) -> QList<R>
+{
+ QList<R> result;
+ result.reserve(container.size());
+ std::transform(container.begin(), container.end(),
+ std::back_inserter(result),
+ std::mem_fn(p));
+ return result;
+}
+
+namespace {
+// needed for msvc 2010, that doesn't have a declval
+// can be removed once we stop supporting it
+template<typename T>
+T &&declval();
}
// Note: add overloads for other container types as needed
template<typename T, typename F>
Q_REQUIRED_RESULT
-auto transform(const QList<T> &container, F function) -> QList<decltype(function(T()))>
+auto transform(const QList<T> &container, F function)
+ -> QList<typename std::remove_reference<decltype(function(declval<T>()))>::type>
{
- QList<decltype(function(T()))> result;
+ QList<typename std::remove_reference<decltype(function(declval<T>()))>::type> result;
result.reserve(container.size());
std::transform(container.begin(), container.end(),
std::back_inserter(result),
@@ -113,6 +177,9 @@ auto transform(const QList<T> &container, F function) -> QList<decltype(function
return result;
}
+//////////////////
+// sort
+/////////////////
template <typename Container>
inline void sort(Container &c)
{
diff --git a/src/libs/utils/ansiescapecodehandler.cpp b/src/libs/utils/ansiescapecodehandler.cpp
index 14d5dd8f8e..f2db87cc95 100644
--- a/src/libs/utils/ansiescapecodehandler.cpp
+++ b/src/libs/utils/ansiescapecodehandler.cpp
@@ -168,9 +168,11 @@ QList<FormattedText> AnsiEscapeCodeHandler::parseText(const FormattedText &input
break;
case RgbTextColor:
case RgbBackgroundColor:
+ // See http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
if (++i >= numbers.size())
break;
- if (numbers.at(i).toInt() == 2) {
+ switch (numbers.at(i).toInt()) {
+ case 2:
// RGB set with format: 38;2;<r>;<g>;<b>
if ((i + 3) < numbers.size()) {
(code == RgbTextColor) ?
@@ -183,10 +185,36 @@ QList<FormattedText> AnsiEscapeCodeHandler::parseText(const FormattedText &input
setFormatScope(charFormat);
}
i += 3;
- } else if (numbers.at(i).toInt() == 5) {
- // rgb set with format: 38;5;<i>
- // unsupported because of unclear documentation, so we just skip <i>
+ break;
+ case 5:
+ // 256 color mode with format: 38;5;<i>
+ uint index = numbers.at(i + 1).toInt();
+
+ QColor color;
+ if (index < 8) {
+ // The first 8 colors are standard low-intensity ANSI colors.
+ color = ansiColor(index);
+ } else if (index < 16) {
+ // The next 8 colors are standard high-intensity ANSI colors.
+ color = ansiColor(index - 8).lighter(150);
+ } else if (index < 232) {
+ // The next 216 colors are a 6x6x6 RGB cube.
+ uint o = index - 16;
+ color = QColor((o / 36) * 51, ((o / 6) % 6) * 51, (o % 6) * 51);
+ } else {
+ // The last 24 colors are a greyscale gradient.
+ uint grey = (index - 232) * 11;
+ color = QColor(grey, grey, grey);
+ }
+
+ if (code == RgbTextColor)
+ charFormat.setForeground(color);
+ else
+ charFormat.setBackground(color);
+
+ setFormatScope(charFormat);
++i;
+ break;
}
break;
default:
diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp
index 2e330d55a8..a405c71aee 100644
--- a/src/libs/utils/buildablehelperlibrary.cpp
+++ b/src/libs/utils/buildablehelperlibrary.cpp
@@ -182,13 +182,13 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath,
// Helper: Run a build process with merged stdout/stderr
static inline bool runBuildProcessI(QProcess &proc,
- const QString &binary,
+ const FileName &binary,
const QStringList &args,
int timeoutMS,
bool ignoreNonNullExitCode,
QString *output, QString *errorMessage)
{
- proc.start(binary, args);
+ proc.start(binary.toString(), args);
if (!proc.waitForStarted()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Cannot start process: %1").
@@ -223,7 +223,7 @@ static inline bool runBuildProcessI(QProcess &proc,
// Run a build process with merged stdout/stderr and qWarn about errors.
static bool runBuildProcess(QProcess &proc,
- const QString &binary,
+ const FileName &binary,
const QStringList &args,
int timeoutMS,
bool ignoreNonNullExitCode,
@@ -232,7 +232,7 @@ static bool runBuildProcess(QProcess &proc,
const bool rc = runBuildProcessI(proc, binary, args, timeoutMS, ignoreNonNullExitCode, output, errorMessage);
if (!rc) {
// Fail - reformat error.
- QString cmd = binary;
+ QString cmd = binary.toString();
if (!args.isEmpty()) {
cmd += QLatin1Char(' ');
cmd += args.join(QString(QLatin1Char(' ')));
@@ -262,7 +262,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
arguments.directory));
log->append(newline);
- const QString makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
+ const FileName makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
if (QFileInfo(arguments.directory + QLatin1String("/Makefile")).exists()) {
if (makeFullPath.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
@@ -271,7 +271,8 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
}
const QString cleanTarget = QLatin1String("distclean");
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
- "Running %1 %2...\n").arg(makeFullPath, cleanTarget));
+ "Running %1 %2...\n")
+ .arg(makeFullPath.toUserOutput(), cleanTarget));
if (!runBuildProcess(proc, makeFullPath, QStringList(cleanTarget), 30000, true, log, errorMessage))
return false;
}
@@ -288,7 +289,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
"Running %1 %2 ...\n").arg(arguments.qmakeCommand.toUserOutput(),
qmakeArgs.join(QLatin1String(" "))));
- if (!runBuildProcess(proc, arguments.qmakeCommand.toString(), qmakeArgs, 30000, false, log, errorMessage))
+ if (!runBuildProcess(proc, arguments.qmakeCommand, qmakeArgs, 30000, false, log, errorMessage))
return false;
log->append(newline);
if (makeFullPath.isEmpty()) {
@@ -297,7 +298,8 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
return false;
}
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
- "Running %1 %2 ...\n").arg(makeFullPath, arguments.makeArguments.join(QLatin1String(" "))));
+ "Running %1 %2 ...\n")
+ .arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1String(" "))));
if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120000, false, log, errorMessage))
return false;
return true;
diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp
index 6e338866a3..25834ffd83 100644
--- a/src/libs/utils/consoleprocess_unix.cpp
+++ b/src/libs/utils/consoleprocess_unix.cpp
@@ -372,7 +372,7 @@ QString ConsoleProcess::defaultTerminalEmulator()
const Environment env = Environment::systemEnvironment();
const int terminalCount = int(sizeof(knownTerminals) / sizeof(knownTerminals[0]));
for (int i = 0; i < terminalCount; ++i) {
- QString result = env.searchInPath(QLatin1String(knownTerminals[i].binary));
+ QString result = env.searchInPath(QLatin1String(knownTerminals[i].binary)).toString();
if (!result.isEmpty()) {
result += QLatin1Char(' ');
result += QLatin1String(knownTerminals[i].options);
@@ -388,7 +388,7 @@ QStringList ConsoleProcess::availableTerminalEmulators()
const Environment env = Environment::systemEnvironment();
const int terminalCount = int(sizeof(knownTerminals) / sizeof(knownTerminals[0]));
for (int i = 0; i < terminalCount; ++i) {
- QString terminal = env.searchInPath(QLatin1String(knownTerminals[i].binary));
+ QString terminal = env.searchInPath(QLatin1String(knownTerminals[i].binary)).toString();
if (!terminal.isEmpty()) {
terminal += QLatin1Char(' ');
terminal += QLatin1String(knownTerminals[i].options);
diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp
index 5f2e214762..04e2a75d1f 100644
--- a/src/libs/utils/environment.cpp
+++ b/src/libs/utils/environment.cpp
@@ -214,11 +214,11 @@ void Environment::clear()
m_values.clear();
}
-QString Environment::searchInDirectory(const QStringList &execs, QString directory) const
+FileName Environment::searchInDirectory(const QStringList &execs, QString directory) const
{
const QChar slash = QLatin1Char('/');
if (directory.isEmpty())
- return QString();
+ return FileName();
// Avoid turing / into // on windows which triggers windows to check
// for network drives!
if (!directory.endsWith(slash))
@@ -227,16 +227,16 @@ QString Environment::searchInDirectory(const QStringList &execs, QString directo
foreach (const QString &exec, execs) {
QFileInfo fi(directory + exec);
if (fi.exists() && fi.isFile() && fi.isExecutable())
- return fi.absoluteFilePath();
+ return FileName::fromString(fi.absoluteFilePath());
}
- return QString();
+ return FileName();
}
-QString Environment::searchInPath(const QString &executable,
- const QStringList &additionalDirs) const
+FileName Environment::searchInPath(const QString &executable,
+ const QStringList &additionalDirs) const
{
if (executable.isEmpty())
- return QString();
+ return FileName();
QString exec = QDir::cleanPath(expandVariables(executable));
QFileInfo fi(exec);
@@ -252,7 +252,7 @@ QString Environment::searchInPath(const QString &executable,
QString tmp = executable + ext.toLower();
if (fi.isAbsolute()) {
if (QFile::exists(tmp))
- return tmp;
+ return FileName::fromString(tmp);
} else {
execs << tmp;
}
@@ -261,30 +261,30 @@ QString Environment::searchInPath(const QString &executable,
}
if (fi.isAbsolute())
- return exec;
+ return FileName::fromString(exec);
QSet<QString> alreadyChecked;
foreach (const QString &dir, additionalDirs) {
if (alreadyChecked.contains(dir))
continue;
alreadyChecked.insert(dir);
- QString tmp = searchInDirectory(execs, dir);
+ FileName tmp = searchInDirectory(execs, dir);
if (!tmp.isEmpty())
return tmp;
}
if (executable.indexOf(QLatin1Char('/')) != -1)
- return QString();
+ return FileName();
foreach (const QString &p, path()) {
if (alreadyChecked.contains(p))
continue;
alreadyChecked.insert(p);
- QString tmp = searchInDirectory(execs, QDir::fromNativeSeparators(p));
+ FileName tmp = searchInDirectory(execs, QDir::fromNativeSeparators(p));
if (!tmp.isEmpty())
return tmp;
}
- return QString();
+ return FileName();
}
QStringList Environment::path() const
diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h
index 8527e55eda..300d8cea53 100644
--- a/src/libs/utils/environment.h
+++ b/src/libs/utils/environment.h
@@ -30,6 +30,7 @@
#ifndef UTILS_ENVIRONMENT_H
#define UTILS_ENVIRONMENT_H
+#include "fileutils.h"
#include "hostosinfo.h"
#include "utils_global.h"
@@ -100,8 +101,8 @@ public:
Environment::const_iterator constEnd() const;
Environment::const_iterator constFind(const QString &name) const;
- QString searchInPath(const QString &executable,
- const QStringList &additionalDirs = QStringList()) const;
+ FileName searchInPath(const QString &executable,
+ const QStringList &additionalDirs = QStringList()) const;
QStringList path() const;
QString expandVariables(const QString &input) const;
@@ -111,7 +112,7 @@ public:
bool operator==(const Environment &other) const;
private:
- QString searchInDirectory(const QStringList &execs, QString directory) const;
+ FileName searchInDirectory(const QStringList &execs, QString directory) const;
QMap<QString, QString> m_values;
OsType m_osType;
};
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp
index 25f10a30ca..5966dac7e2 100644
--- a/src/libs/utils/pathchooser.cpp
+++ b/src/libs/utils/pathchooser.cpp
@@ -211,8 +211,8 @@ QString PathChooserPrivate::expandedPath(const QString &input) const
switch (m_acceptingKind) {
case PathChooser::Command:
case PathChooser::ExistingCommand: {
- const QString expanded = m_environment.searchInPath(path, QStringList(m_baseDirectory));
- return expanded.isEmpty() ? path : expanded;
+ const FileName expanded = m_environment.searchInPath(path, QStringList(m_baseDirectory));
+ return expanded.isEmpty() ? path : expanded.toString();
}
case PathChooser::Any:
break;
diff --git a/src/libs/utils/stringutils.cpp b/src/libs/utils/stringutils.cpp
index 10761a9b05..9861aa348e 100644
--- a/src/libs/utils/stringutils.cpp
+++ b/src/libs/utils/stringutils.cpp
@@ -115,7 +115,7 @@ QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path)
return outPath;
}
-int AbstractQtcMacroExpander::findMacro(const QString &str, int *pos, QString *ret)
+int AbstractMacroExpander::findMacro(const QString &str, int *pos, QString *ret)
{
forever {
int openPos = str.indexOf(QLatin1String("%{"), *pos);
diff --git a/src/libs/utils/stringutils.h b/src/libs/utils/stringutils.h
index 4622d7e543..c464363492 100644
--- a/src/libs/utils/stringutils.h
+++ b/src/libs/utils/stringutils.h
@@ -55,7 +55,8 @@ QTCREATOR_UTILS_EXPORT QString commonPath(const QStringList &files);
// If path is not sub of home path, or when running on Windows, returns the input
QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path);
-class QTCREATOR_UTILS_EXPORT AbstractMacroExpander {
+class QTCREATOR_UTILS_EXPORT AbstractMacroExpander
+{
public:
virtual ~AbstractMacroExpander() {}
// Not const, as it may change the state of the expander.
@@ -64,11 +65,6 @@ public:
//! \param pos Position to start scan on input, found position on output
//! \param ret Replacement string on output
//! \return Length of string part to replace, zero if no (further) matches found
- virtual int findMacro(const QString &str, int *pos, QString *ret) = 0;
-};
-
-class QTCREATOR_UTILS_EXPORT AbstractQtcMacroExpander : public AbstractMacroExpander {
-public:
virtual int findMacro(const QString &str, int *pos, QString *ret);
//! Provide a replacement string for an expando
//! \param name The name of the expando
diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp
index 9bb00b1b4e..58c9405af2 100644
--- a/src/libs/utils/stylehelper.cpp
+++ b/src/libs/utils/stylehelper.cpp
@@ -34,6 +34,8 @@
#include <QPixmapCache>
#include <QPainter>
#include <QApplication>
+#include <QFileInfo>
+#include <QCommonStyle>
#include <QStyleOption>
#include <qmath.h>
@@ -273,74 +275,49 @@ static void menuGradientHelper(QPainter *p, const QRect &spanRect, const QRect &
void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option)
{
- // From windowsstyle but modified to enable AA
if (option->rect.width() <= 1 || option->rect.height() <= 1)
return;
+ const qreal devicePixelRatio = painter->device()->devicePixelRatio();
QRect r = option->rect;
int size = qMin(r.height(), r.width());
QPixmap pixmap;
QString pixmapName;
- pixmapName.sprintf("arrow-%s-%d-%d-%d-%lld",
+ pixmapName.sprintf("arrow-%s-%d-%d-%d-%lld-%f",
"$qt_ia",
uint(option->state), element,
- size, option->palette.cacheKey());
+ size, option->palette.cacheKey(),
+ devicePixelRatio);
if (!QPixmapCache::find(pixmapName, pixmap)) {
- int border = size/5;
- int sqsize = 2*(size/2);
- QImage image(sqsize, sqsize, QImage::Format_ARGB32);
- image.fill(Qt::transparent);
- QPainter imagePainter(&image);
- imagePainter.setRenderHint(QPainter::Antialiasing, true);
- imagePainter.translate(0.5, 0.5);
- QPolygon a;
- switch (element) {
- case QStyle::PE_IndicatorArrowUp:
- a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2);
- break;
- case QStyle::PE_IndicatorArrowDown:
- a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2);
- break;
- case QStyle::PE_IndicatorArrowRight:
- a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border);
- break;
- case QStyle::PE_IndicatorArrowLeft:
- a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border);
- break;
- default:
- break;
- }
-
- int bsx = 0;
- int bsy = 0;
+ const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
+ if (!style)
+ return;
- if (option->state & QStyle::State_Sunken) {
- bsx = qApp->style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal);
- bsy = qApp->style()->pixelMetric(QStyle::PM_ButtonShiftVertical);
- }
+ QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
+ image.fill(Qt::transparent);
+ QPainter painter(&image);
- QRect bounds = a.boundingRect();
- int sx = sqsize / 2 - bounds.center().x() - 1;
- int sy = sqsize / 2 - bounds.center().y() - 1;
- imagePainter.translate(sx + bsx, sy + bsy);
+ QStyleOption tweakedOption(*option);
+ tweakedOption.state = QStyle::State_Enabled;
if (!(option->state & QStyle::State_Enabled)) {
- imagePainter.setBrush(option->palette.mid().color());
- imagePainter.setPen(option->palette.mid().color());
+ tweakedOption.palette.setColor(QPalette::ButtonText, option->palette.mid().color());
+ tweakedOption.rect = image.rect();
+ style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);
} else {
- QColor shadow(0, 0, 0, 100);
- imagePainter.translate(0, 1);
- imagePainter.setPen(shadow);
- imagePainter.setBrush(shadow);
- QColor foreGround(255, 255, 255, 210);
- imagePainter.drawPolygon(a);
- imagePainter.translate(0, -1);
- imagePainter.setPen(foreGround);
- imagePainter.setBrush(foreGround);
+ tweakedOption.palette.setColor(QPalette::ButtonText, Qt::black);
+ painter.setOpacity(0.2);
+ tweakedOption.rect = image.rect().adjusted(0, devicePixelRatio, 0, devicePixelRatio);
+ style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);
+
+ tweakedOption.palette.setColor(QPalette::ButtonText, QColor(220, 220, 220));
+ painter.setOpacity(1);
+ tweakedOption.rect = image.rect();
+ style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);
}
- imagePainter.drawPolygon(a);
- imagePainter.end();
+ painter.end();
pixmap = QPixmap::fromImage(image);
+ pixmap.setDevicePixelRatio(devicePixelRatio);
QPixmapCache::insert(pixmapName, pixmap);
}
int xOffset = r.x() + (r.width() - size)/2;
@@ -464,43 +441,51 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
}
// Draws a CSS-like border image where the defined borders are not stretched
+// Unit for rect, left, top, right and bottom is user pixels
void StyleHelper::drawCornerImage(const QImage &img, QPainter *painter, const QRect &rect,
int left, int top, int right, int bottom)
{
- QSize size = img.size();
+ // source rect for drawImage() calls needs to be specified in DIP unit of the image
+ const qreal imagePixelRatio = img.devicePixelRatio();
+ const qreal leftDIP = left * imagePixelRatio;
+ const qreal topDIP = top * imagePixelRatio;
+ const qreal rightDIP = right * imagePixelRatio;
+ const qreal bottomDIP = bottom * imagePixelRatio;
+
+ const QSize size = img.size();
if (top > 0) { //top
- painter->drawImage(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), img,
- QRect(left, 0, size.width() -right - left, top));
+ painter->drawImage(QRectF(rect.left() + left, rect.top(), rect.width() -right - left, top), img,
+ QRectF(leftDIP, 0, size.width() - rightDIP - leftDIP, topDIP));
if (left > 0) //top-left
- painter->drawImage(QRect(rect.left(), rect.top(), left, top), img,
- QRect(0, 0, left, top));
+ painter->drawImage(QRectF(rect.left(), rect.top(), left, top), img,
+ QRectF(0, 0, leftDIP, topDIP));
if (right > 0) //top-right
- painter->drawImage(QRect(rect.left() + rect.width() - right, rect.top(), right, top), img,
- QRect(size.width() - right, 0, right, top));
+ painter->drawImage(QRectF(rect.left() + rect.width() - right, rect.top(), right, top), img,
+ QRectF(size.width() - rightDIP, 0, rightDIP, topDIP));
}
//left
if (left > 0)
- painter->drawImage(QRect(rect.left(), rect.top()+top, left, rect.height() - top - bottom), img,
- QRect(0, top, left, size.height() - bottom - top));
+ painter->drawImage(QRectF(rect.left(), rect.top()+top, left, rect.height() - top - bottom), img,
+ QRectF(0, topDIP, leftDIP, size.height() - bottomDIP - topDIP));
//center
- painter->drawImage(QRect(rect.left() + left, rect.top()+top, rect.width() -right - left,
- rect.height() - bottom - top), img,
- QRect(left, top, size.width() -right -left,
- size.height() - bottom - top));
+ painter->drawImage(QRectF(rect.left() + left, rect.top()+top, rect.width() -right - left,
+ rect.height() - bottom - top), img,
+ QRectF(leftDIP, topDIP, size.width() - rightDIP - leftDIP,
+ size.height() - bottomDIP - topDIP));
if (right > 0) //right
- painter->drawImage(QRect(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), img,
- QRect(size.width() - right, top, right, size.height() - bottom - top));
+ painter->drawImage(QRectF(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), img,
+ QRectF(size.width() - rightDIP, topDIP, rightDIP, size.height() - bottomDIP - topDIP));
if (bottom > 0) { //bottom
- painter->drawImage(QRect(rect.left() +left, rect.top() + rect.height() - bottom,
- rect.width() - right - left, bottom), img,
- QRect(left, size.height() - bottom,
- size.width() - right - left, bottom));
- if (left > 0) //bottom-left
- painter->drawImage(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), img,
- QRect(0, size.height() - bottom, left, bottom));
- if (right > 0) //bottom-right
- painter->drawImage(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), img,
- QRect(size.width() - right, size.height() - bottom, right, bottom));
+ painter->drawImage(QRectF(rect.left() +left, rect.top() + rect.height() - bottom,
+ rect.width() - right - left, bottom), img,
+ QRectF(leftDIP, size.height() - bottomDIP,
+ size.width() - rightDIP - leftDIP, bottomDIP));
+ if (left > 0) //bottom-left
+ painter->drawImage(QRectF(rect.left(), rect.top() + rect.height() - bottom, left, bottom), img,
+ QRectF(0, size.height() - bottomDIP, leftDIP, bottomDIP));
+ if (right > 0) //bottom-right
+ painter->drawImage(QRectF(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), img,
+ QRectF(size.width() - rightDIP, size.height() - bottomDIP, rightDIP, bottomDIP));
}
}
@@ -537,4 +522,17 @@ QLinearGradient StyleHelper::statusBarGradient(const QRect &statusBarRect)
return grad;
}
+QString StyleHelper::dpiSpecificImageFile(const QString &fileName)
+{
+ // See QIcon::addFile()
+ if (qApp->devicePixelRatio() > 1.0) {
+ const QFileInfo fi(fileName);
+ const QString at2xfileName = fi.path() + QLatin1Char('/')
+ + fi.completeBaseName() + QStringLiteral("@2x.") + fi.suffix();
+ if (QFile::exists(at2xfileName))
+ return at2xfileName;
+ }
+ return fileName;
+}
+
} // namespace Utils
diff --git a/src/libs/utils/stylehelper.h b/src/libs/utils/stylehelper.h
index 8be341c21f..4740b733cf 100644
--- a/src/libs/utils/stylehelper.h
+++ b/src/libs/utils/stylehelper.h
@@ -93,6 +93,8 @@ public:
static void tintImage(QImage &img, const QColor &tintColor);
static QLinearGradient statusBarGradient(const QRect &statusBarRect);
+ static QString dpiSpecificImageFile(const QString &fileName);
+
private:
static QColor m_baseColor;
static QColor m_requestedBaseColor;
diff --git a/src/libs/utils/textfieldcheckbox.cpp b/src/libs/utils/textfieldcheckbox.cpp
new file mode 100644
index 0000000000..0439644eca
--- /dev/null
+++ b/src/libs/utils/textfieldcheckbox.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "textfieldcheckbox.h"
+
+namespace Utils {
+
+/*!
+ \class Utils::TextFieldCheckBox
+ \brief The TextFieldCheckBox class is a aheckbox that plays with
+ \c QWizard::registerField.
+
+ Provides a settable 'text' property containing predefined strings for
+ \c true and \c false.
+*/
+
+TextFieldCheckBox::TextFieldCheckBox(const QString &text, QWidget *parent) :
+ QCheckBox(text, parent),
+ m_trueText(QLatin1String("true")), m_falseText(QLatin1String("false"))
+{
+ connect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
+}
+
+QString TextFieldCheckBox::text() const
+{
+ return isChecked() ? m_trueText : m_falseText;
+}
+
+void TextFieldCheckBox::setText(const QString &s)
+{
+ setChecked(s == m_trueText);
+}
+
+void TextFieldCheckBox::slotStateChanged(int cs)
+{
+ emit textChanged(cs == Qt::Checked ? m_trueText : m_falseText);
+}
+
+} // namespace Utils
diff --git a/src/libs/utils/textfieldcheckbox.h b/src/libs/utils/textfieldcheckbox.h
new file mode 100644
index 0000000000..74156b3834
--- /dev/null
+++ b/src/libs/utils/textfieldcheckbox.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef TEXTFIELDCHECKBOX_H
+#define TEXTFIELDCHECKBOX_H
+
+#include "utils_global.h"
+
+#include <QCheckBox>
+
+namespace Utils {
+
+// Documentation inside.
+class QTCREATOR_UTILS_EXPORT TextFieldCheckBox : public QCheckBox {
+ Q_PROPERTY(QString text READ text WRITE setText)
+ Q_PROPERTY(QString trueText READ trueText WRITE setTrueText)
+ Q_PROPERTY(QString falseText READ falseText WRITE setFalseText)
+ Q_OBJECT
+public:
+ explicit TextFieldCheckBox(const QString &text, QWidget *parent = 0);
+
+ QString text() const;
+ void setText(const QString &s);
+
+ void setTrueText(const QString &t) { m_trueText = t; }
+ QString trueText() const { return m_trueText; }
+ void setFalseText(const QString &t) { m_falseText = t; }
+ QString falseText() const { return m_falseText; }
+
+signals:
+ void textChanged(const QString &);
+
+private slots:
+ void slotStateChanged(int);
+
+private:
+ QString m_trueText;
+ QString m_falseText;
+};
+
+} // namespace Utils
+
+#endif // TEXTFIELDCHECKBOX_H
diff --git a/src/libs/utils/textfieldcombobox.cpp b/src/libs/utils/textfieldcombobox.cpp
new file mode 100644
index 0000000000..453b5426b7
--- /dev/null
+++ b/src/libs/utils/textfieldcombobox.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "textfieldcombobox.h"
+
+#include "qtcassert.h"
+
+namespace Utils {
+
+/*!
+ \class Utils::TextFieldComboBox
+ \brief The TextFieldComboBox class is a non-editable combo box for text
+ editing purposes that plays with \c QWizard::registerField (providing a
+ settable 'text' property).
+
+ Allows for a separation of values to be used for wizard fields replacement
+ and display texts.
+*/
+
+TextFieldComboBox::TextFieldComboBox(QWidget *parent) :
+ QComboBox(parent)
+{
+ setEditable(false);
+ connect(this, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(slotCurrentIndexChanged(int)));
+}
+
+QString TextFieldComboBox::text() const
+{
+ return valueAt(currentIndex());
+}
+
+void TextFieldComboBox::setText(const QString &s)
+{
+ const int index = findData(QVariant(s), Qt::UserRole);
+ if (index != -1 && index != currentIndex())
+ setCurrentIndex(index);
+}
+
+void TextFieldComboBox::slotCurrentIndexChanged(int i)
+{
+ emit text4Changed(valueAt(i));
+}
+
+void TextFieldComboBox::setItems(const QStringList &displayTexts,
+ const QStringList &values)
+{
+ QTC_ASSERT(displayTexts.size() == values.size(), return);
+ clear();
+ addItems(displayTexts);
+ const int count = values.count();
+ for (int i = 0; i < count; i++)
+ setItemData(i, QVariant(values.at(i)), Qt::UserRole);
+}
+
+QString TextFieldComboBox::valueAt(int i) const
+{
+ return i >= 0 && i < count() ? itemData(i, Qt::UserRole).toString() : QString();
+}
+
+} // namespace Utils
diff --git a/src/libs/utils/textfieldcombobox.h b/src/libs/utils/textfieldcombobox.h
new file mode 100644
index 0000000000..63aa95ca5a
--- /dev/null
+++ b/src/libs/utils/textfieldcombobox.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef TEXTFIELDCOMBOBOX_H
+#define TEXTFIELDCOMBOBOX_H
+
+#include "utils_global.h"
+
+#include <QComboBox>
+
+namespace Utils {
+
+// Documentation inside.
+class QTCREATOR_UTILS_EXPORT TextFieldComboBox : public QComboBox {
+ Q_PROPERTY(QString text READ text WRITE setText)
+ Q_OBJECT
+public:
+ explicit TextFieldComboBox(QWidget *parent = 0);
+
+ QString text() const;
+ void setText(const QString &s);
+
+ void setItems(const QStringList &displayTexts, const QStringList &values);
+
+signals:
+ void text4Changed(const QString &); // Do not conflict with Qt 3 compat signal.
+
+private slots:
+ void slotCurrentIndexChanged(int);
+
+private:
+ inline QString valueAt(int) const;
+};
+
+} // namespace Utils
+
+#endif // TEXTFIELDCOMBOBOX_H
diff --git a/src/libs/utils/uncommentselection.cpp b/src/libs/utils/uncommentselection.cpp
index 21a4756c50..8cc9752d8f 100644
--- a/src/libs/utils/uncommentselection.cpp
+++ b/src/libs/utils/uncommentselection.cpp
@@ -34,12 +34,30 @@
using namespace Utils;
CommentDefinition::CommentDefinition() :
- isAfterWhiteSpaces(false),
- singleLine(QLatin1String("//")),
- multiLineStart(QLatin1String("/*")),
- multiLineEnd(QLatin1String("*/"))
+ isAfterWhiteSpaces(false)
{}
+void CommentDefinition::setStyle(Style style)
+{
+ switch (style) {
+ case CppStyle:
+ singleLine = QLatin1String("//");
+ multiLineStart = QLatin1String("/*");
+ multiLineEnd = QLatin1String("*/");
+ break;
+ case HashStyle:
+ singleLine = QLatin1String("#");
+ multiLineStart.clear();
+ multiLineEnd.clear();
+ break;
+ }
+}
+
+bool CommentDefinition::isValid() const
+{
+ return hasSingleLineStyle() || hasMultiLineStyle();
+}
+
bool CommentDefinition::hasSingleLineStyle() const
{
return !singleLine.isEmpty();
@@ -50,13 +68,6 @@ bool CommentDefinition::hasMultiLineStyle() const
return !multiLineStart.isEmpty() && !multiLineEnd.isEmpty();
}
-void CommentDefinition::clearCommentStyles()
-{
- singleLine.clear();
- multiLineStart.clear();
- multiLineEnd.clear();
-}
-
static bool isComment(const QString &text, int index,
const QString &commentType)
{
@@ -76,7 +87,7 @@ static bool isComment(const QString &text, int index,
void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &definition)
{
- if (!definition.hasSingleLineStyle() && !definition.hasMultiLineStyle())
+ if (!definition.isValid())
return;
QTextCursor cursor = edit->textCursor();
diff --git a/src/libs/utils/uncommentselection.h b/src/libs/utils/uncommentselection.h
index 14c16cc786..f2bcc90ec3 100644
--- a/src/libs/utils/uncommentselection.h
+++ b/src/libs/utils/uncommentselection.h
@@ -45,11 +45,13 @@ class QTCREATOR_UTILS_EXPORT CommentDefinition
public:
CommentDefinition();
+ enum Style { CppStyle, HashStyle };
+ void setStyle(Style style);
+
+ bool isValid() const;
bool hasSingleLineStyle() const;
bool hasMultiLineStyle() const;
- void clearCommentStyles();
-
public:
bool isAfterWhiteSpaces;
QString singleLine;
diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri
index 630824f98f..0532576a59 100644
--- a/src/libs/utils/utils-lib.pri
+++ b/src/libs/utils/utils-lib.pri
@@ -19,6 +19,8 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/reloadpromptutils.cpp \
$$PWD/settingsselector.cpp \
$$PWD/stringutils.cpp \
+ $$PWD/textfieldcheckbox.cpp \
+ $$PWD/textfieldcombobox.cpp \
$$PWD/filesearch.cpp \
$$PWD/pathchooser.cpp \
$$PWD/pathlisteditor.cpp \
@@ -101,6 +103,8 @@ HEADERS += \
$$PWD/reloadpromptutils.h \
$$PWD/settingsselector.h \
$$PWD/stringutils.h \
+ $$PWD/textfieldcheckbox.h \
+ $$PWD/textfieldcombobox.h \
$$PWD/filesearch.h \
$$PWD/listutils.h \
$$PWD/pathchooser.h \
diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs
index be6094d1d7..0d903c226f 100644
--- a/src/libs/utils/utils.qbs
+++ b/src/libs/utils/utils.qbs
@@ -170,6 +170,10 @@ QtcLibrary {
"synchronousprocess.h",
"tcpportsgatherer.cpp",
"tcpportsgatherer.h",
+ "textfieldcheckbox.cpp",
+ "textfieldcheckbox.h",
+ "textfieldcombobox.cpp",
+ "textfieldcombobox.h",
"textfileformat.cpp",
"textfileformat.h",
"treeviewcombobox.cpp",
diff --git a/src/plugins/analyzerbase/analyzerutils.cpp b/src/plugins/analyzerbase/analyzerutils.cpp
index 125829e844..2aa63e184b 100644
--- a/src/plugins/analyzerbase/analyzerutils.cpp
+++ b/src/plugins/analyzerbase/analyzerutils.cpp
@@ -65,20 +65,16 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
IEditor *editor = EditorManager::currentEditor();
if (!editor)
return 0;
- TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
+ TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
if (!textEditor)
return 0;
- TextEditor::BaseTextEditorWidget *editorWidget = qobject_cast<TextEditor::BaseTextEditorWidget *>(editor->widget());
+ TextEditor::BaseTextEditorWidget *editorWidget = textEditor->editorWidget();
if (!editorWidget)
return 0;
- QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit *>(editor->widget());
- if (!ptEdit)
- return 0;
-
QTextCursor tc;
- tc = ptEdit->textCursor();
+ tc = editorWidget->textCursor();
int line = 0;
int column = 0;
const int pos = tc.position();
diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp
index 7998678884..8f03388949 100644
--- a/src/plugins/analyzerbase/ianalyzertool.cpp
+++ b/src/plugins/analyzerbase/ianalyzertool.cpp
@@ -36,6 +36,27 @@ IAnalyzerTool::IAnalyzerTool(QObject *parent)
: QObject(parent)
{}
+ /// Returns the run mode for this tool.
+ProjectExplorer::RunMode IAnalyzerTool::runMode() const
+{
+ return m_runMode;
+}
+
+void IAnalyzerTool::setRunMode(ProjectExplorer::RunMode mode)
+{
+ m_runMode = mode;
+}
+
+IAnalyzerTool::ToolMode IAnalyzerTool::toolMode() const
+{
+ return m_toolMode;
+}
+
+void IAnalyzerTool::setToolMode(IAnalyzerTool::ToolMode mode)
+{
+ m_toolMode = mode;
+}
+
AnalyzerAction::AnalyzerAction(QObject *parent)
: QAction(parent)
{}
diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h
index 7b37eb419e..baadaa1063 100644
--- a/src/plugins/analyzerbase/ianalyzertool.h
+++ b/src/plugins/analyzerbase/ianalyzertool.h
@@ -67,8 +67,8 @@ class ANALYZER_EXPORT IAnalyzerTool : public QObject
public:
explicit IAnalyzerTool(QObject *parent = 0);
- /// Returns the run mode for this tool.
- virtual ProjectExplorer::RunMode runMode() const = 0;
+ ProjectExplorer::RunMode runMode() const;
+ void setRunMode(ProjectExplorer::RunMode mode);
/**
* The mode in which this tool should preferably be run
@@ -82,7 +82,8 @@ public:
ReleaseMode,
AnyMode
};
- virtual ToolMode toolMode() const = 0;
+ ToolMode toolMode() const;
+ void setToolMode(ToolMode mode);
/// Creates all widgets used by the tool.
/// Returns a control widget which will be shown in the status bar when
@@ -95,6 +96,10 @@ public:
ProjectExplorer::RunConfiguration *runConfiguration) = 0;
virtual void startTool(StartMode mode) = 0;
+
+private:
+ ProjectExplorer::RunMode m_runMode;
+ ToolMode m_toolMode;
};
/**
diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro
index cee247a474..9bb43171f2 100644
--- a/src/plugins/android/android.pro
+++ b/src/plugins/android/android.pro
@@ -6,6 +6,7 @@ else:ANDROID_EXPERIMENTAL_STR="false"
QT += xml network
HEADERS += \
+ androidqtsupport.h \
androidconstants.h \
androidconfigurations.h \
androidmanager.h \
@@ -15,14 +16,6 @@ HEADERS += \
androidsettingspage.h \
androidsettingswidget.h \
androidtoolchain.h \
- androidpackageinstallationstep.h \
- androidpackageinstallationfactory.h \
- androidpackagecreationstep.h \
- androidpackagecreationfactory.h \
- androidpackagecreationwidget.h \
- androiddeploystep.h \
- androiddeploystepwidget.h \
- androiddeploystepfactory.h \
androiderrormessage.h \
androidglobal.h \
androidrunner.h \
@@ -46,9 +39,7 @@ HEADERS += \
androiddeployqtstep.h \
certificatesmodel.h \
androiddeployqtwidget.h \
- createandroidmanifestwizard.h \
androidpotentialkit.h \
- androidextralibrarylistmodel.h \
androidsignaloperation.h \
javaeditor.h \
javaeditorfactory.h \
@@ -56,7 +47,10 @@ HEADERS += \
javaautocompleter.h \
javacompletionassistprovider.h \
javafilewizard.h \
- avddialog.h
+ avddialog.h \
+ android_global.h \
+ androidbuildapkstep.h \
+ androidbuildapkwidget.h
SOURCES += \
androidconfigurations.cpp \
@@ -67,14 +61,6 @@ SOURCES += \
androidsettingspage.cpp \
androidsettingswidget.cpp \
androidtoolchain.cpp \
- androidpackageinstallationstep.cpp \
- androidpackageinstallationfactory.cpp \
- androidpackagecreationstep.cpp \
- androidpackagecreationfactory.cpp \
- androidpackagecreationwidget.cpp \
- androiddeploystep.cpp \
- androiddeploystepwidget.cpp \
- androiddeploystepfactory.cpp \
androiderrormessage.cpp \
androidrunner.cpp \
androiddebugsupport.cpp \
@@ -97,9 +83,7 @@ SOURCES += \
androiddeployqtstep.cpp \
certificatesmodel.cpp \
androiddeployqtwidget.cpp \
- createandroidmanifestwizard.cpp \
androidpotentialkit.cpp \
- androidextralibrarylistmodel.cpp \
androidsignaloperation.cpp \
javaeditor.cpp \
javaeditorfactory.cpp \
@@ -107,16 +91,18 @@ SOURCES += \
javaautocompleter.cpp \
javacompletionassistprovider.cpp \
javafilewizard.cpp \
- avddialog.cpp
+ avddialog.cpp \
+ androidbuildapkstep.cpp \
+ androidbuildapkwidget.cpp
FORMS += \
androidsettingswidget.ui \
- androidpackagecreationwidget.ui \
- androiddeploystepwidget.ui \
addnewavddialog.ui \
androidcreatekeystorecertificate.ui \
androiddevicedialog.ui \
- androiddeployqtwidget.ui
+ androiddeployqtwidget.ui \
+ androidbuildapkwidget.ui
RESOURCES = android.qrc
+
DEFINES += ANDROID_LIBRARY
diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs
index 97bbc4b50c..30ac7a10d7 100644
--- a/src/plugins/android/android.qbs
+++ b/src/plugins/android/android.qbs
@@ -5,21 +5,18 @@ import QtcPlugin
QtcPlugin {
name: "Android"
+ Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] }
+ Depends { name: "AnalyzerBase" }
Depends { name: "Core" }
- Depends { name: "ProjectExplorer" }
- Depends { name: "QmakeProjectManager" }
Depends { name: "Debugger" }
+ Depends { name: "ProjectExplorer" }
Depends { name: "QmlDebug" }
Depends { name: "QtSupport" }
Depends { name: "TextEditor" }
- Depends { name: "AnalyzerBase" }
Depends { name: "Utils" }
- Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] }
-
- property bool enable: false
- pluginspecreplacements: ({"ANDROID_EXPERIMENTAL_STR": (enable ? "false": "true")})
files: [
+ "android_global.h",
"addnewavddialog.ui",
"android.qrc",
"androidanalyzesupport.cpp",
@@ -30,6 +27,11 @@ QtcPlugin {
"androidcreatekeystorecertificate.cpp",
"androidcreatekeystorecertificate.h",
"androidcreatekeystorecertificate.ui",
+ "androidbuildapkstep.cpp",
+ "androidbuildapkstep.h",
+ "androidbuildapkwidget.cpp",
+ "androidbuildapkwidget.h",
+ "androidbuildapkwidget.ui",
"androiddeployqtstep.cpp",
"androiddeployqtstep.h",
"androiddebugsupport.cpp",
@@ -39,13 +41,6 @@ QtcPlugin {
"androiddevicedialog.ui",
"androiddeployconfiguration.cpp",
"androiddeployconfiguration.h",
- "androiddeploystep.cpp",
- "androiddeploystep.h",
- "androiddeploystepfactory.cpp",
- "androiddeploystepfactory.h",
- "androiddeploystepwidget.cpp",
- "androiddeploystepwidget.h",
- "androiddeploystepwidget.ui",
"androiddeployqtwidget.cpp",
"androiddeployqtwidget.h",
"androiddeployqtwidget.ui",
@@ -55,8 +50,6 @@ QtcPlugin {
"androiddevicefactory.h",
"androiderrormessage.h",
"androiderrormessage.cpp",
- "androidextralibrarylistmodel.cpp",
- "androidextralibrarylistmodel.h",
"androidgdbserverkitinformation.cpp",
"androidgdbserverkitinformation.h",
"androidglobal.h",
@@ -70,21 +63,11 @@ QtcPlugin {
"androidmanifesteditorfactory.h",
"androidmanifesteditorwidget.cpp",
"androidmanifesteditorwidget.h",
- "androidpackagecreationfactory.cpp",
- "androidpackagecreationfactory.h",
- "androidpackagecreationstep.cpp",
- "androidpackagecreationstep.h",
- "androidpackagecreationwidget.cpp",
- "androidpackagecreationwidget.h",
- "androidpackagecreationwidget.ui",
- "androidpackageinstallationfactory.cpp",
- "androidpackageinstallationfactory.h",
- "androidpackageinstallationstep.cpp",
- "androidpackageinstallationstep.h",
"androidplugin.cpp",
"androidplugin.h",
"androidpotentialkit.cpp",
"androidpotentialkit.h",
+ "androidqtsupport.h",
"androidqtversion.cpp",
"androidqtversion.h",
"androidqtversionfactory.cpp",
@@ -112,8 +95,6 @@ QtcPlugin {
"avddialog.h",
"certificatesmodel.cpp",
"certificatesmodel.h",
- "createandroidmanifestwizard.cpp",
- "createandroidmanifestwizard.h",
"javaautocompleter.cpp",
"javaautocompleter.h",
"javacompletionassistprovider.cpp",
diff --git a/src/plugins/android/android_dependencies.pri b/src/plugins/android/android_dependencies.pri
index 0064a8319e..94fa4d8f36 100644
--- a/src/plugins/android/android_dependencies.pri
+++ b/src/plugins/android/android_dependencies.pri
@@ -3,7 +3,6 @@ QTC_PLUGIN_DEPENDS += \
coreplugin \
debugger \
projectexplorer \
- qmakeprojectmanager \
qtsupport \
texteditor \
analyzerbase
diff --git a/src/plugins/android/android_global.h b/src/plugins/android/android_global.h
new file mode 100644
index 0000000000..6f96e4190b
--- /dev/null
+++ b/src/plugins/android/android_global.h
@@ -0,0 +1,41 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef ANDROID_GLOBAL_H
+#define ANDROID_GLOBAL_H
+
+#include <qglobal.h>
+
+#if defined(ANDROID_LIBRARY)
+# define ANDROID_EXPORT Q_DECL_EXPORT
+#else
+# define ANDROID_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // ANDROID_GLOBAL_H
diff --git a/src/plugins/android/androidanalyzesupport.h b/src/plugins/android/androidanalyzesupport.h
index 7ea63dd28f..1a0c3b3489 100644
--- a/src/plugins/android/androidanalyzesupport.h
+++ b/src/plugins/android/androidanalyzesupport.h
@@ -37,9 +37,9 @@ namespace Analyzer { class AnalyzerRunControl; }
namespace ProjectExplorer { class RunControl; }
namespace Android {
-namespace Internal {
-
class AndroidRunConfiguration;
+
+namespace Internal {
class AndroidRunner;
class AndroidAnalyzeSupport : public AndroidRunSupport
diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp
new file mode 100644
index 0000000000..c1b6a4cfcf
--- /dev/null
+++ b/src/plugins/android/androidbuildapkstep.cpp
@@ -0,0 +1,325 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "androidbuildapkstep.h"
+#include "androidbuildapkwidget.h"
+#include "androidconfigurations.h"
+#include "androidconstants.h"
+#include "androidmanager.h"
+#include "androidqtsupport.h"
+#include "certificatesmodel.h"
+
+#include "javaparser.h"
+
+#include <coreplugin/fileutils.h>
+#include <coreplugin/icore.h>
+
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/target.h>
+
+#include <qtsupport/qtkitinformation.h>
+
+#include <utils/qtcprocess.h>
+
+#include <QInputDialog>
+#include <QMessageBox>
+
+namespace Android {
+using namespace Internal;
+
+const QLatin1String DeployActionKey("Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction");
+const QLatin1String KeystoreLocationKey("KeystoreLocation");
+const QLatin1String BuildTargetSdkKey("BuildTargetSdk");
+const QLatin1String VerboseOutputKey("VerboseOutput");
+
+AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent, const Core::Id id)
+ : ProjectExplorer::AbstractProcessStep(parent, id),
+ m_deployAction(BundleLibrariesDeployment),
+ m_signPackage(false),
+ m_verbose(false),
+ m_openPackageLocation(false),
+ m_buildTargetSdk(AndroidConfig::apiLevelNameFor(AndroidConfigurations::currentConfig().highestAndroidSdk()))
+{
+ const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ if (version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0))
+ m_deployAction = DebugDeployment;
+ //: AndroidBuildApkStep default display name
+ setDefaultDisplayName(tr("Build Android APK"));
+}
+
+AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent,
+ AndroidBuildApkStep *other)
+ : ProjectExplorer::AbstractProcessStep(parent, other),
+ m_deployAction(other->deployAction()),
+ m_signPackage(other->signPackage()),
+ m_verbose(other->m_verbose),
+ m_openPackageLocation(other->m_openPackageLocation),
+ m_buildTargetSdk(other->m_buildTargetSdk)
+{
+ const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
+ if (m_deployAction == DebugDeployment)
+ m_deployAction = BundleLibrariesDeployment;
+ }
+}
+
+bool AndroidBuildApkStep::init()
+{
+ ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
+
+ if (m_signPackage) {
+ // check keystore and certificate passwords
+ while (!AndroidManager::checkKeystorePassword(m_keystorePath.toString(), m_keystorePasswd)) {
+ if (!keystorePassword())
+ return false; // user canceled
+ }
+
+ while (!AndroidManager::checkCertificatePassword(m_keystorePath.toString(), m_keystorePasswd, m_certificateAlias, m_certificatePasswd)) {
+ if (!certificatePassword())
+ return false; // user canceled
+ }
+
+
+ if (bc->buildType() == ProjectExplorer::BuildConfiguration::Debug)
+ emit addOutput(tr("Warning: Signing a debug package."), BuildStep::ErrorMessageOutput);
+ }
+
+ QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ if (!version)
+ return false;
+
+ JavaParser *parser = new JavaParser;
+ parser->setProjectFileList(target()->project()->files(ProjectExplorer::Project::AllFiles));
+ parser->setSourceDirectory(androidPackageSourceDir());
+ parser->setBuildDirectory(Utils::FileName::fromString(bc->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY)).toString()));
+ setOutputParser(parser);
+
+ m_openPackageLocationForRun = m_openPackageLocation;
+ m_apkPath = AndroidManager::androidQtSupport(target())->apkPath(target(), m_signPackage ? AndroidQtSupport::ReleaseBuildSigned
+ : AndroidQtSupport::DebugBuild).toString();
+
+ bool result = AbstractProcessStep::init();
+ if (!result)
+ return false;
+
+ return true;
+}
+
+void AndroidBuildApkStep::showInGraphicalShell()
+{
+ Core::FileUtils::showInGraphicalShell(Core::ICore::instance()->mainWindow(), m_apkPath);
+}
+
+ProjectExplorer::BuildStepConfigWidget *AndroidBuildApkStep::createConfigWidget()
+{
+ return new AndroidBuildApkWidget(this);
+}
+
+void AndroidBuildApkStep::processFinished(int exitCode, QProcess::ExitStatus status)
+{
+ AbstractProcessStep::processFinished(exitCode, status);
+ if (m_openPackageLocationForRun && status == QProcess::NormalExit && exitCode == 0)
+ QMetaObject::invokeMethod(this, "showInGraphicalShell", Qt::QueuedConnection);
+}
+
+bool AndroidBuildApkStep::fromMap(const QVariantMap &map)
+{
+ AndroidDeployAction defaultDeploy = BundleLibrariesDeployment;
+ const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ if (version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0))
+ defaultDeploy = DebugDeployment;
+
+ m_deployAction = AndroidDeployAction(map.value(DeployActionKey, defaultDeploy).toInt());
+ if ( m_deployAction == DebugDeployment
+ && QtSupport::QtKitInformation::qtVersion(target()->kit())->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
+ m_deployAction = BundleLibrariesDeployment;
+ }
+
+ m_keystorePath = Utils::FileName::fromString(map.value(KeystoreLocationKey).toString());
+ m_signPackage = false; // don't restore this
+ m_buildTargetSdk = map.value(BuildTargetSdkKey).toString();
+ if (m_buildTargetSdk.isEmpty())
+ m_buildTargetSdk = AndroidConfig::apiLevelNameFor(AndroidConfigurations::currentConfig().highestAndroidSdk());
+ m_verbose = map.value(VerboseOutputKey).toBool();
+ return ProjectExplorer::BuildStep::fromMap(map);
+}
+
+QVariantMap AndroidBuildApkStep::toMap() const
+{
+ QVariantMap map = ProjectExplorer::AbstractProcessStep::toMap();
+ map.insert(DeployActionKey, m_deployAction);
+ map.insert(KeystoreLocationKey, m_keystorePath.toString());
+ map.insert(BuildTargetSdkKey, m_buildTargetSdk);
+ map.insert(VerboseOutputKey, m_verbose);
+ return map;
+}
+
+Utils::FileName AndroidBuildApkStep::keystorePath()
+{
+ return m_keystorePath;
+}
+
+QString AndroidBuildApkStep::buildTargetSdk() const
+{
+ return m_buildTargetSdk;
+}
+
+void AndroidBuildApkStep::setBuildTargetSdk(const QString &sdk)
+{
+ m_buildTargetSdk = sdk;
+}
+
+AndroidBuildApkStep::AndroidDeployAction AndroidBuildApkStep::deployAction() const
+{
+ return m_deployAction;
+}
+
+void AndroidBuildApkStep::setDeployAction(AndroidDeployAction deploy)
+{
+ m_deployAction = deploy;
+}
+
+void AndroidBuildApkStep::setKeystorePath(const Utils::FileName &path)
+{
+ m_keystorePath = path;
+ m_certificatePasswd.clear();
+ m_keystorePasswd.clear();
+}
+
+void AndroidBuildApkStep::setKeystorePassword(const QString &pwd)
+{
+ m_keystorePasswd = pwd;
+}
+
+void AndroidBuildApkStep::setCertificateAlias(const QString &alias)
+{
+ m_certificateAlias = alias;
+}
+
+void AndroidBuildApkStep::setCertificatePassword(const QString &pwd)
+{
+ m_certificatePasswd = pwd;
+}
+
+bool AndroidBuildApkStep::signPackage() const
+{
+ return m_signPackage;
+}
+
+void AndroidBuildApkStep::setSignPackage(bool b)
+{
+ m_signPackage = b;
+}
+
+bool AndroidBuildApkStep::openPackageLocation() const
+{
+ return m_openPackageLocation;
+}
+
+void AndroidBuildApkStep::setOpenPackageLocation(bool open)
+{
+ m_openPackageLocation = open;
+}
+
+void AndroidBuildApkStep::setVerboseOutput(bool verbose)
+{
+ m_verbose = verbose;
+}
+
+bool AndroidBuildApkStep::runInGuiThread() const
+{
+ return true;
+}
+
+bool AndroidBuildApkStep::verboseOutput() const
+{
+ return m_verbose;
+}
+
+QAbstractItemModel *AndroidBuildApkStep::keystoreCertificates()
+{
+ QString rawCerts;
+ QProcess keytoolProc;
+ while (!rawCerts.length() || !m_keystorePasswd.length()) {
+ QStringList params;
+ params << QLatin1String("-list") << QLatin1String("-v") << QLatin1String("-keystore") << m_keystorePath.toUserOutput() << QLatin1String("-storepass");
+ if (!m_keystorePasswd.length())
+ keystorePassword();
+ if (!m_keystorePasswd.length())
+ return 0;
+ params << m_keystorePasswd;
+ params << QLatin1String("-J-Duser.language=en");
+ keytoolProc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), params);
+ if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
+ QMessageBox::critical(0, tr("Error"),
+ tr("Failed to run keytool."));
+ return 0;
+ }
+
+ if (keytoolProc.exitCode()) {
+ QMessageBox::critical(0, tr("Error"),
+ tr("Invalid password."));
+ m_keystorePasswd.clear();
+ }
+ rawCerts = QString::fromLatin1(keytoolProc.readAllStandardOutput());
+ }
+ return new CertificatesModel(rawCerts, this);
+}
+
+bool AndroidBuildApkStep::keystorePassword()
+{
+ m_keystorePasswd.clear();
+ bool ok;
+ QString text = QInputDialog::getText(0, tr("Keystore"),
+ tr("Keystore password:"), QLineEdit::Password,
+ QString(), &ok);
+ if (ok && !text.isEmpty()) {
+ m_keystorePasswd = text;
+ return true;
+ }
+ return false;
+}
+
+bool AndroidBuildApkStep::certificatePassword()
+{
+ m_certificatePasswd.clear();
+ bool ok;
+ QString text = QInputDialog::getText(0, tr("Certificate"),
+ tr("Certificate password (%1):").arg(m_certificateAlias), QLineEdit::Password,
+ QString(), &ok);
+ if (ok && !text.isEmpty()) {
+ m_certificatePasswd = text;
+ return true;
+ }
+ return false;
+}
+
+} // namespace Android
diff --git a/src/plugins/android/androidbuildapkstep.h b/src/plugins/android/androidbuildapkstep.h
new file mode 100644
index 0000000000..668f5b4b7e
--- /dev/null
+++ b/src/plugins/android/androidbuildapkstep.h
@@ -0,0 +1,117 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef ANDROIDBUILDAPKSTEP_H
+#define ANDROIDBUILDAPKSTEP_H
+
+#include "android_global.h"
+#include <projectexplorer/abstractprocessstep.h>
+#include <qtsupport/baseqtversion.h>
+
+QT_BEGIN_NAMESPACE
+class QAbstractItemModel;
+QT_END_NAMESPACE
+
+namespace Android {
+
+class ANDROID_EXPORT AndroidBuildApkStep : public ProjectExplorer::AbstractProcessStep
+{
+ Q_OBJECT
+public:
+ AndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, const Core::Id id);
+
+ enum AndroidDeployAction
+ {
+ MinistroDeployment, // use ministro
+ DebugDeployment,
+ BundleLibrariesDeployment
+ };
+
+ bool fromMap(const QVariantMap &map);
+ QVariantMap toMap() const;
+
+ AndroidDeployAction deployAction() const;
+
+ // signing
+ Utils::FileName keystorePath();
+ void setKeystorePath(const Utils::FileName &path);
+ void setKeystorePassword(const QString &pwd);
+ void setCertificateAlias(const QString &alias);
+ void setCertificatePassword(const QString &pwd);
+
+ QAbstractItemModel *keystoreCertificates();
+ bool signPackage() const;
+ void setSignPackage(bool b);
+
+ bool openPackageLocation() const;
+ void setOpenPackageLocation(bool open);
+ bool verboseOutput() const;
+ void setVerboseOutput(bool verbose);
+
+ bool runInGuiThread() const;
+
+ QString buildTargetSdk() const;
+ void setBuildTargetSdk(const QString &sdk);
+public slots:
+ void setDeployAction(AndroidDeployAction deploy);
+
+protected slots:
+ void showInGraphicalShell();
+
+protected:
+ AndroidBuildApkStep(ProjectExplorer::BuildStepList *bc,
+ AndroidBuildApkStep *other);
+ bool keystorePassword();
+ bool certificatePassword();
+
+ bool init();
+ ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
+ bool immutable() const { return true; }
+ void processFinished(int exitCode, QProcess::ExitStatus status);
+ virtual Utils::FileName androidPackageSourceDir() const = 0;
+
+protected:
+ AndroidDeployAction m_deployAction;
+ bool m_signPackage;
+ bool m_verbose;
+ bool m_openPackageLocation;
+ bool m_openPackageLocationForRun;
+ QString m_buildTargetSdk;
+
+ Utils::FileName m_keystorePath;
+ QString m_keystorePasswd;
+ QString m_certificateAlias;
+ QString m_certificatePasswd;
+ QString m_apkPath;
+};
+
+} // namespace Android
+
+#endif // ANDROIDBUILDAPKSTEP_H
diff --git a/src/plugins/android/androidbuildapkwidget.cpp b/src/plugins/android/androidbuildapkwidget.cpp
new file mode 100644
index 0000000000..6bc769d7ca
--- /dev/null
+++ b/src/plugins/android/androidbuildapkwidget.cpp
@@ -0,0 +1,256 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "androidbuildapkstep.h"
+#include "androidbuildapkwidget.h"
+#include "androidconfigurations.h"
+#include "androidcreatekeystorecertificate.h"
+#include "androidmanager.h"
+#include "ui_androidbuildapkwidget.h"
+
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/qtkitinformation.h>
+
+#include <utils/fancylineedit.h>
+#include <utils/pathchooser.h>
+
+#include <QFileDialog>
+
+#include <algorithm>
+
+using namespace Android;
+using namespace Internal;
+
+AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
+ : ProjectExplorer::BuildStepConfigWidget(),
+ m_ui(new Ui::AndroidBuildApkWidget),
+ m_step(step)
+{
+ m_ui->setupUi(this);
+
+ // Target sdk combobox
+ int minApiLevel = 9;
+ QStringList targets = AndroidConfig::apiLevelNamesFor(AndroidConfigurations::currentConfig().sdkTargets(minApiLevel));
+ m_ui->targetSDKComboBox->addItems(targets);
+ m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(AndroidManager::buildTargetSDK(step->target())));
+
+ // deployment option
+ switch (m_step->deployAction()) {
+ case AndroidBuildApkStep::MinistroDeployment:
+ m_ui->ministroOption->setChecked(true);
+ break;
+ case AndroidBuildApkStep::DebugDeployment:
+ m_ui->temporaryQtOption->setChecked(true);
+ break;
+ case AndroidBuildApkStep::BundleLibrariesDeployment:
+ m_ui->bundleQtOption->setChecked(true);
+ break;
+ default:
+ // can't happen
+ break;
+ }
+
+ // signing
+ m_ui->signPackageCheckBox->setChecked(m_step->signPackage());
+ m_ui->KeystoreLocationPathChooser->setExpectedKind(Utils::PathChooser::File);
+ m_ui->KeystoreLocationPathChooser->lineEdit()->setReadOnly(true);
+ m_ui->KeystoreLocationPathChooser->setPath(m_step->keystorePath().toUserOutput());
+ m_ui->KeystoreLocationPathChooser->setInitialBrowsePathBackup(QDir::homePath());
+ m_ui->KeystoreLocationPathChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)"));
+ m_ui->KeystoreLocationPathChooser->setPromptDialogTitle(tr("Select Keystore File"));
+ m_ui->signingDebugWarningIcon->hide();
+ m_ui->signingDebugWarningLabel->hide();
+ signPackageCheckBoxToggled(m_step->signPackage());
+
+ m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput());
+ m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation());
+
+ // target sdk
+ connect(m_ui->targetSDKComboBox, SIGNAL(activated(QString)), SLOT(setTargetSdk(QString)));
+
+ // deployment options
+ connect(m_ui->ministroOption, SIGNAL(clicked()), SLOT(setMinistro()));
+ connect(m_ui->temporaryQtOption, SIGNAL(clicked()), SLOT(setDeployLocalQtLibs()));
+ connect(m_ui->bundleQtOption, SIGNAL(clicked()), SLOT(setBundleQtLibs()));
+ connect(m_ui->ministroOption, SIGNAL(clicked()), SLOT(updateDebugDeploySigningWarning()));
+ connect(m_ui->temporaryQtOption, SIGNAL(clicked()), SLOT(updateDebugDeploySigningWarning()));
+ connect(m_ui->bundleQtOption, SIGNAL(clicked()), SLOT(updateDebugDeploySigningWarning()));
+
+ connect(m_ui->openPackageLocationCheckBox, SIGNAL(toggled(bool)),
+ this, SLOT(openPackageLocationCheckBoxToggled(bool)));
+ connect(m_ui->verboseOutputCheckBox, SIGNAL(toggled(bool)),
+ this, SLOT(verboseOutputCheckBoxToggled(bool)));
+
+ //signing
+ connect(m_ui->signPackageCheckBox, SIGNAL(toggled(bool)),
+ this, SLOT(signPackageCheckBoxToggled(bool)));
+ connect(m_ui->KeystoreCreatePushButton, SIGNAL(clicked()),
+ this, SLOT(createKeyStore()));
+ connect(m_ui->KeystoreLocationPathChooser, SIGNAL(pathChanged(QString)),
+ SLOT(updateKeyStorePath(QString)));
+ connect(m_ui->certificatesAliasComboBox, SIGNAL(activated(QString)),
+ this, SLOT(certificatesAliasComboBoxActivated(QString)));
+ connect(m_ui->certificatesAliasComboBox, SIGNAL(currentIndexChanged(QString)),
+ this, SLOT(certificatesAliasComboBoxCurrentIndexChanged(QString)));
+
+ connect(m_step->buildConfiguration(), SIGNAL(buildTypeChanged()),
+ this, SLOT(updateSigningWarning()));
+
+ updateSigningWarning();
+ updateDebugDeploySigningWarning();
+ QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(step->target()->kit());
+ m_ui->temporaryQtOption->setVisible(qt->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0));
+}
+
+AndroidBuildApkWidget::~AndroidBuildApkWidget()
+{
+ delete m_ui;
+}
+
+QString AndroidBuildApkWidget::displayName() const
+{
+ return tr("<b>Build Android APK</b>");
+}
+
+QString AndroidBuildApkWidget::summaryText() const
+{
+ return displayName();
+}
+
+void AndroidBuildApkWidget::setTargetSdk(const QString &sdk)
+{
+ m_step->setBuildTargetSdk(sdk);
+}
+
+void AndroidBuildApkWidget::setMinistro()
+{
+ m_step->setDeployAction(AndroidBuildApkStep::MinistroDeployment);
+}
+
+void AndroidBuildApkWidget::setDeployLocalQtLibs()
+{
+ m_step->setDeployAction(AndroidBuildApkStep::DebugDeployment);
+}
+
+void AndroidBuildApkWidget::setBundleQtLibs()
+{
+ m_step->setDeployAction(AndroidBuildApkStep::BundleLibrariesDeployment);
+}
+
+void AndroidBuildApkWidget::signPackageCheckBoxToggled(bool checked)
+{
+ m_ui->certificatesAliasComboBox->setEnabled(checked);
+ m_step->setSignPackage(checked);
+ updateSigningWarning();
+ if (!checked)
+ return;
+ if (!m_step->keystorePath().isEmpty())
+ setCertificates();
+}
+
+void AndroidBuildApkWidget::createKeyStore()
+{
+ AndroidCreateKeystoreCertificate d;
+ if (d.exec() != QDialog::Accepted)
+ return;
+ m_ui->KeystoreLocationPathChooser->setPath(d.keystoreFilePath().toUserOutput());
+ m_step->setKeystorePath(d.keystoreFilePath());
+ m_step->setKeystorePassword(d.keystorePassword());
+ m_step->setCertificateAlias(d.certificateAlias());
+ m_step->setCertificatePassword(d.certificatePassword());
+ setCertificates();
+}
+
+void AndroidBuildApkWidget::setCertificates()
+{
+ QAbstractItemModel *certificates = m_step->keystoreCertificates();
+ m_ui->signPackageCheckBox->setChecked(certificates);
+ m_ui->certificatesAliasComboBox->setModel(certificates);
+}
+
+void AndroidBuildApkWidget::updateKeyStorePath(const QString &path)
+{
+ Utils::FileName file = Utils::FileName::fromString(path);
+ m_step->setKeystorePath(file);
+ m_ui->signPackageCheckBox->setChecked(!file.isEmpty());
+ if (!file.isEmpty())
+ setCertificates();
+}
+
+void AndroidBuildApkWidget::certificatesAliasComboBoxActivated(const QString &alias)
+{
+ if (alias.length())
+ m_step->setCertificateAlias(alias);
+}
+
+void AndroidBuildApkWidget::certificatesAliasComboBoxCurrentIndexChanged(const QString &alias)
+{
+ if (alias.length())
+ m_step->setCertificateAlias(alias);
+}
+
+void AndroidBuildApkWidget::openPackageLocationCheckBoxToggled(bool checked)
+{
+ m_step->setOpenPackageLocation(checked);
+}
+
+void AndroidBuildApkWidget::verboseOutputCheckBoxToggled(bool checked)
+{
+ m_step->setVerboseOutput(checked);
+}
+
+void AndroidBuildApkWidget::updateSigningWarning()
+{
+ bool debug = m_step->buildConfiguration()->buildType() == ProjectExplorer::BuildConfiguration::Debug;
+ if (m_step->signPackage() && debug) {
+ m_ui->signingDebugWarningIcon->setVisible(true);
+ m_ui->signingDebugWarningLabel->setVisible(true);
+ } else {
+ m_ui->signingDebugWarningIcon->setVisible(false);
+ m_ui->signingDebugWarningLabel->setVisible(false);
+ }
+}
+
+void AndroidBuildApkWidget::updateDebugDeploySigningWarning()
+{
+ if (m_step->deployAction() == AndroidBuildApkStep::DebugDeployment) {
+ m_ui->signingDebugDeployError->setVisible(true);
+ m_ui->signingDebugDeployErrorIcon->setVisible(true);
+ m_ui->signPackageCheckBox->setChecked(false);
+ m_ui->signPackageCheckBox->setEnabled(false);
+ } else {
+ m_ui->signingDebugDeployError->setVisible(false);
+ m_ui->signingDebugDeployErrorIcon->setVisible(false);
+ m_ui->signPackageCheckBox->setEnabled(true);
+ }
+}
+
diff --git a/src/plugins/android/androidbuildapkwidget.h b/src/plugins/android/androidbuildapkwidget.h
new file mode 100644
index 0000000000..33215f171c
--- /dev/null
+++ b/src/plugins/android/androidbuildapkwidget.h
@@ -0,0 +1,83 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef ANDROIDBUILDAPKWIDGET_H
+#define ANDROIDBUILDAPKWIDGET_H
+
+#include "android_global.h"
+
+#include <projectexplorer/buildstep.h>
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class AndroidBuildApkWidget; }
+QT_END_NAMESPACE
+
+namespace QmakeProjectManager { class QmakeBuildConfiguration; }
+
+namespace Android {
+class AndroidBuildApkStep;
+
+class ANDROID_EXPORT AndroidBuildApkWidget : public ProjectExplorer::BuildStepConfigWidget
+{
+ Q_OBJECT
+
+public:
+ AndroidBuildApkWidget(AndroidBuildApkStep *step);
+ ~AndroidBuildApkWidget();
+
+private slots:
+ void setTargetSdk(const QString &sdk);
+ void setMinistro();
+ void setDeployLocalQtLibs();
+ void setBundleQtLibs();
+ void createKeyStore();
+ void certificatesAliasComboBoxCurrentIndexChanged(const QString &alias);
+ void certificatesAliasComboBoxActivated(const QString &alias);
+ void updateSigningWarning();
+ void updateDebugDeploySigningWarning();
+ void openPackageLocationCheckBoxToggled(bool checked);
+ void verboseOutputCheckBoxToggled(bool checked);
+ void updateKeyStorePath(const QString &path);
+ void signPackageCheckBoxToggled(bool checked);
+
+private:
+ virtual QString summaryText() const;
+ virtual QString displayName() const;
+ void setCertificates();
+
+ Ui::AndroidBuildApkWidget *m_ui;
+ AndroidBuildApkStep *m_step;
+};
+
+}
+
+#endif // ANDROIDBUILDAPKWIDGET_H
diff --git a/src/plugins/android/androidbuildapkwidget.ui b/src/plugins/android/androidbuildapkwidget.ui
new file mode 100644
index 0000000000..bdcaca57c3
--- /dev/null
+++ b/src/plugins/android/androidbuildapkwidget.ui
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AndroidBuildApkWidget</class>
+ <widget class="QWidget" name="AndroidBuildApkWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>819</width>
+ <height>390</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="0" colspan="2">
+ <widget class="QGroupBox" name="signPackage">
+ <property name="title">
+ <string>Sign package</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="KeystoreLocationLabel">
+ <property name="text">
+ <string>Keystore:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Utils::PathChooser" name="KeystoreLocationPathChooser" native="true"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="KeystoreCreatePushButton">
+ <property name="text">
+ <string>Create...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QCheckBox" name="signPackageCheckBox">
+ <property name="text">
+ <string>Sign package</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="signingDebugWarningIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="../coreplugin/core.qrc">:/core/images/warning.png</pixmap>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="signingDebugWarningLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Signing a debug package</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="KeystoreLocationLabel_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Certificate alias:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="certificatesAliasComboBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QLabel" name="signingDebugDeployErrorIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="../coreplugin/core.qrc">:/core/images/error.png</pixmap>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="signingDebugDeployError">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Signing an APK that uses &quot;Deploy local Qt libraries&quot; is not allowed</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="0" colspan="2">
+ <widget class="QGroupBox" name="application">
+ <property name="title">
+ <string>Application</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="targetSDKLabel">
+ <property name="text">
+ <string>Android build SDK:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="targetSDKComboBox"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QGroupBox" name="advancedActions">
+ <property name="title">
+ <string>Advanced Actions</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="verboseOutputCheckBox">
+ <property name="text">
+ <string>Verbose output</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="openPackageLocationCheckBox">
+ <property name="text">
+ <string>Open package location after build</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="qtDeployment">
+ <property name="title">
+ <string>Qt Deployment</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QRadioButton" name="ministroOption">
+ <property name="toolTip">
+ <string>Uses the external Ministro application to download and maintain Qt libraries.</string>
+ </property>
+ <property name="text">
+ <string>Use Ministro service to install Qt</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="bundleQtOption">
+ <property name="toolTip">
+ <string>Creates a standalone APK.</string>
+ </property>
+ <property name="text">
+ <string>Bundle Qt libraries in APK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="temporaryQtOption">
+ <property name="toolTip">
+ <string>Pushes local Qt libraries to device. You must have Qt libraries compiled for that platform.
+The APK will not be usable on any other device.</string>
+ </property>
+ <property name="text">
+ <string>Deploy local Qt libraries to temporary directory</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Utils::PathChooser</class>
+ <extends>QWidget</extends>
+ <header location="global">utils/pathchooser.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources>
+ <include location="../coreplugin/core.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp
index 3f89ad2c9a..025a133a5d 100644
--- a/src/plugins/android/androidconfigurations.cpp
+++ b/src/plugins/android/androidconfigurations.cpp
@@ -73,7 +73,7 @@ using namespace ProjectExplorer;
using namespace Utils;
namespace Android {
-namespace Internal {
+using namespace Internal;
namespace {
const QLatin1String SettingsGroup("AndroidConfigurations");
@@ -337,10 +337,12 @@ void AndroidConfig::updateAvailableSdkPlatforms() const
QStringList AndroidConfig::apiLevelNamesFor(const QList<SdkPlatform> &platforms)
{
- QStringList results;
- foreach (const SdkPlatform &platform, platforms)
- results << QLatin1String("android-") + QString::number(platform.apiLevel);
- return results;
+ return Utils::transform(platforms, AndroidConfig::apiLevelNameFor);
+}
+
+QString AndroidConfig::apiLevelNameFor(const SdkPlatform &platform)
+{
+ return QLatin1String("android-") + QString::number(platform.apiLevel);
}
QList<SdkPlatform> AndroidConfig::sdkTargets(int minApiLevel) const
@@ -836,15 +838,15 @@ SdkPlatform AndroidConfig::highestAndroidSdk() const
return m_availableSdkPlatforms.first();
}
-QString AndroidConfig::bestNdkPlatformMatch(const QString &targetAPI) const
+QString AndroidConfig::bestNdkPlatformMatch(int target) const
{
+ target = std::max(9, target);
updateNdkInformation();
- int target = targetAPI.mid(targetAPI.lastIndexOf(QLatin1Char('-')) + 1).toInt();
foreach (int apiLevel, m_availableNdkPlatforms) {
if (apiLevel <= target)
return QString::fromLatin1("android-%1").arg(apiLevel);
}
- return QLatin1String("android-8");
+ return QLatin1String("android-9");
}
FileName AndroidConfig::sdkLocation() const
@@ -1193,22 +1195,22 @@ AndroidConfigurations::AndroidConfigurations(QObject *parent)
m_instance = this;
}
-Utils::FileName javaHomeForJavac(const QString &location)
+static FileName javaHomeForJavac(const FileName &location)
{
- QFileInfo fileInfo(location);
+ QFileInfo fileInfo = location.toFileInfo();
int tries = 5;
while (tries > 0) {
QDir dir = fileInfo.dir();
dir.cdUp();
if (QFileInfo(dir.filePath(QLatin1String("lib/tools.jar"))).exists())
- return Utils::FileName::fromString(dir.path());
+ return FileName::fromString(dir.path());
if (fileInfo.isSymLink())
fileInfo.setFile(fileInfo.symLinkTarget());
else
break;
--tries;
}
- return Utils::FileName();
+ return FileName();
}
void AndroidConfigurations::load()
@@ -1220,10 +1222,10 @@ void AndroidConfigurations::load()
if (m_config.antLocation().isEmpty()) {
Environment env = Environment::systemEnvironment();
- QString location = env.searchInPath(QLatin1String("ant"));
- QFileInfo fi(location);
+ FileName location = env.searchInPath(QLatin1String("ant"));
+ QFileInfo fi = location.toFileInfo();
if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
- m_config.setAntLocation(FileName::fromString(location));
+ m_config.setAntLocation(location);
saveSettings = true;
}
}
@@ -1231,8 +1233,8 @@ void AndroidConfigurations::load()
if (m_config.openJDKLocation().isEmpty()) {
if (HostOsInfo::isLinuxHost()) {
Environment env = Environment::systemEnvironment();
- QString location = env.searchInPath(QLatin1String("javac"));
- QFileInfo fi(location);
+ FileName location = env.searchInPath(QLatin1String("javac"));
+ QFileInfo fi = location.toFileInfo();
if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
m_config.setOpenJDKLocation(javaHomeForJavac(location));
saveSettings = true;
@@ -1294,5 +1296,4 @@ void AndroidConfigurations::updateAndroidDevice()
AndroidConfigurations *AndroidConfigurations::m_instance = 0;
-} // namespace Internal
} // namespace Android
diff --git a/src/plugins/android/androidconfigurations.h b/src/plugins/android/androidconfigurations.h
index 1bd49a095c..3b28c80f79 100644
--- a/src/plugins/android/androidconfigurations.h
+++ b/src/plugins/android/androidconfigurations.h
@@ -30,6 +30,8 @@
#ifndef ANDROIDCONFIGURATIONS_H
#define ANDROIDCONFIGURATIONS_H
+#include "android_global.h"
+
#include <QObject>
#include <QString>
#include <QStringList>
@@ -37,7 +39,9 @@
#include <QHash>
#include <QMap>
#include <QFutureInterface>
+
#include <projectexplorer/abi.h>
+
#include <utils/fileutils.h>
#include <utils/environment.h>
@@ -49,7 +53,6 @@ namespace ProjectExplorer { class Project; }
namespace Android {
class AndroidPlugin;
-namespace Internal {
struct AndroidDeviceInfo
{
@@ -76,7 +79,7 @@ public:
QStringList abis;
};
-class AndroidConfig
+class ANDROID_EXPORT AndroidConfig
{
public:
AndroidConfig();
@@ -85,6 +88,7 @@ public:
void save(QSettings &settings) const;
static QStringList apiLevelNamesFor(const QList<SdkPlatform> &platforms);
+ static QString apiLevelNameFor(const SdkPlatform &platform);
QList<SdkPlatform> sdkTargets(int minApiLevel = 0) const;
Utils::FileName sdkLocation() const;
@@ -147,7 +151,7 @@ public:
bool startAVDAsync(const QString &avdName) const;
QString findAvd(int apiLevel, const QString &cpuAbi) const;
QString waitForAvd(int apiLevel, const QString &cpuAbi, const QFutureInterface<bool> &fi = QFutureInterface<bool>()) const;
- QString bestNdkPlatformMatch(const QString &targetAPI) const;
+ QString bestNdkPlatformMatch(int target) const;
static ProjectExplorer::Abi::Architecture architectureForToolChainPrefix(const QString &toolchainprefix);
static QLatin1String toolchainPrefix(ProjectExplorer::Abi::Architecture architecture);
@@ -192,7 +196,7 @@ private:
mutable QHash<QString, QString> m_serialNumberToDeviceName;
};
-class AndroidConfigurations : public QObject
+class ANDROID_EXPORT AndroidConfigurations : public QObject
{
friend class Android::AndroidPlugin;
Q_OBJECT
@@ -225,7 +229,6 @@ private:
QMap<ProjectExplorer::Project *, QMap<QString, QString> > m_defaultDeviceForAbi;
};
-} // namespace Internal
} // namespace Android
#endif // ANDROIDCONFIGURATIONS_H
diff --git a/src/plugins/android/androidconstants.h b/src/plugins/android/androidconstants.h
index f84e18f9b8..d05555661e 100644
--- a/src/plugins/android/androidconstants.h
+++ b/src/plugins/android/androidconstants.h
@@ -73,6 +73,11 @@ const char JAVA_MIMETYPE[] = "text/x-java";
const char WIZARD_JAVA[] = "Wizard.Java";
const char JAVA_WIZARD_CATEGORY[] = "U.Java";
const char JAVA_DISPLAY_CATEGORY[] = "Java";
+const char ANDROID_ARCHITECTURE[] = "Android.Architecture";
+const char ANDROID_DEPLOY_SETTINGS_FILE[] = "AndroidDeploySettingsFile";
+const char ANDROID_PACKAGE_SOURCE_DIR[] = "AndroidPackageSourceDir";
+const char ANDROID_EXTRA_LIBS[] = "AndroidExtraLibs";
+
} // namespace Constants;
} // namespace Android
diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp
index ae1d79b5e9..f9f70595f6 100644
--- a/src/plugins/android/androiddebugsupport.cpp
+++ b/src/plugins/android/androiddebugsupport.cpp
@@ -29,10 +29,10 @@
#include "androiddebugsupport.h"
-#include "androiddeploystep.h"
#include "androidglobal.h"
#include "androidrunner.h"
#include "androidmanager.h"
+#include "androidqtsupport.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerplugin.h>
@@ -41,19 +41,18 @@
#include <debugger/debuggerrunner.h>
#include <debugger/debuggerstartparameters.h>
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
-#include <qmakeprojectmanager/qmakebuildconfiguration.h>
-#include <qmakeprojectmanager/qmakenodes.h>
-#include <qmakeprojectmanager/qmakeproject.h>
+
#include <qtsupport/qtkitinformation.h>
-#include <QDir>
+#include <QDirIterator>
#include <QTcpServer>
using namespace Debugger;
using namespace ProjectExplorer;
-using namespace QmakeProjectManager;
namespace Android {
namespace Internal {
@@ -86,7 +85,6 @@ static QStringList qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *runConfig, QString *errorMessage)
{
Target *target = runConfig->target();
- QmakeProject *project = static_cast<QmakeProject *>(target->project());
DebuggerStartParameters params;
params.startMode = AttachToRemoteServer;
@@ -102,12 +100,9 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString();
if (ToolChain *tc = ToolChainKitInformation::toolChain(kit))
params.toolChainAbi = tc->targetAbi();
- params.executable = project->rootQmakeProjectNode()->buildDir() + QLatin1String("/app_process");
+ params.executable = target->activeBuildConfiguration()->buildDirectory().toString() + QLatin1String("/app_process");
params.remoteChannel = runConfig->remoteChannel();
- params.solibSearchPath.clear();
- QList<QmakeProFileNode *> nodes = project->allProFiles();
- foreach (QmakeProFileNode *node, nodes)
- params.solibSearchPath.append(node->targetInformation().buildDir);
+ params.solibSearchPath = AndroidManager::androidQtSupport(target)->soLibSearchPath(target);
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
params.solibSearchPath.append(qtSoPaths(version));
}
@@ -119,9 +114,9 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.qmlServerAddress = server.serverAddress().toString();
params.remoteSetupNeeded = true;
//TODO: Not sure if these are the right paths.
- params.projectSourceDirectory = project->projectDirectory().toString();
- params.projectSourceFiles = project->files(QmakeProject::ExcludeGeneratedFiles);
- params.projectBuildDirectory = project->rootQmakeProjectNode()->buildDir();
+ params.projectSourceDirectory = target->project()->projectDirectory().toString();
+ params.projectSourceFiles = target->project()->files(Project::ExcludeGeneratedFiles);
+ params.projectBuildDirectory = target->activeBuildConfiguration()->buildDirectory().toString();
}
DebuggerRunControl * const debuggerRunControl
diff --git a/src/plugins/android/androiddebugsupport.h b/src/plugins/android/androiddebugsupport.h
index c5f11384c8..ef705f644a 100644
--- a/src/plugins/android/androiddebugsupport.h
+++ b/src/plugins/android/androiddebugsupport.h
@@ -39,9 +39,9 @@ class DebuggerRunControl;
namespace ProjectExplorer { class RunControl; }
namespace Android {
-namespace Internal {
-
class AndroidRunConfiguration;
+
+namespace Internal {
class AndroidRunner;
class AndroidDebugSupport : public AndroidRunSupport
diff --git a/src/plugins/android/androiddeployconfiguration.cpp b/src/plugins/android/androiddeployconfiguration.cpp
index b58cd48c0b..177413f4ce 100644
--- a/src/plugins/android/androiddeployconfiguration.cpp
+++ b/src/plugins/android/androiddeployconfiguration.cpp
@@ -29,17 +29,15 @@
#include "androiddeployconfiguration.h"
#include "androidconstants.h"
-#include "androiddeploystep.h"
-#include "androidpackageinstallationstep.h"
-#include "androidpackagecreationstep.h"
#include "androiddeployqtstep.h"
#include "androidmanager.h"
+#include "androidqtsupport.h"
#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
-#include <qmakeprojectmanager/qmakeproject.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
@@ -75,15 +73,7 @@ bool AndroidDeployConfigurationFactory::canCreate(Target *parent, Core::Id id) c
DeployConfiguration *AndroidDeployConfigurationFactory::create(Target *parent, Core::Id id)
{
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent, id);
-
- if (id == ANDROID_DEPLOYCONFIGURATION_ID) {
- dc->stepList()->insertStep(0, new AndroidPackageInstallationStep(AndroidPackageInstallationStep::ProjectDirectory, dc->stepList()));
- dc->stepList()->insertStep(1, new AndroidPackageCreationStep(dc->stepList()));
- dc->stepList()->insertStep(2, new AndroidDeployStep(dc->stepList()));
- } else {
- dc->stepList()->insertStep(0, new AndroidPackageInstallationStep(AndroidPackageInstallationStep::BuildDirectory, dc->stepList()));
- dc->stepList()->insertStep(1, new AndroidDeployQtStep(dc->stepList()));
- }
+ dc->stepList()->insertStep(0, new AndroidDeployQtStep(dc->stepList()));
return dc;
}
@@ -122,9 +112,6 @@ DeployConfiguration *AndroidDeployConfigurationFactory::clone(Target *parent, De
QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> ids;
- if (!qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project()))
- return ids;
-
if (!parent->project()->supportsKit(parent->kit()))
return ids;
@@ -136,17 +123,13 @@ QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(Target *
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(parent->kit());
if (qt->type() != QLatin1String(Constants::ANDROIDQT))
return ids;
- if (qt->qtVersion() < QtSupport::QtVersionNumber(5, 2, 0))
- ids << Core::Id(ANDROID_DEPLOYCONFIGURATION_ID);
- else
- ids << Core::Id(ANDROID_DEPLOYCONFIGURATION2_ID);
+ ids << Core::Id(ANDROID_DEPLOYCONFIGURATION_ID);
return ids;
}
QString AndroidDeployConfigurationFactory::displayNameForId(Core::Id id) const
{
- if (id.name().startsWith(ANDROID_DC_PREFIX)
- || id.name().startsWith(ANDROID_DC2_PREFIX))
+ if (id.name().startsWith(ANDROID_DC_PREFIX))
return tr("Deploy on Android");
return QString();
}
diff --git a/src/plugins/android/androiddeployconfiguration.h b/src/plugins/android/androiddeployconfiguration.h
index 2d31fb2285..867444bce2 100644
--- a/src/plugins/android/androiddeployconfiguration.h
+++ b/src/plugins/android/androiddeployconfiguration.h
@@ -35,12 +35,9 @@
namespace Android {
namespace Internal {
-const char ANDROID_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.AndroidDeployConfiguration";
-const char ANDROID_DC_PREFIX[] = "Qt4ProjectManager.AndroidDeployConfiguration.";
-
// Qt 5.2 has a new form of deployment
-const char ANDROID_DEPLOYCONFIGURATION2_ID[] = "Qt4ProjectManager.AndroidDeployConfiguration2";
-const char ANDROID_DC2_PREFIX[] = "Qt4ProjectManager.AndroidDeployConfiguration2.";
+const char ANDROID_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.AndroidDeployConfiguration2";
+const char ANDROID_DC_PREFIX[] = "Qt4ProjectManager.AndroidDeployConfiguration2.";
class AndroidDeployConfiguration : public ProjectExplorer::DeployConfiguration
{
diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp
index c755cd515e..8f119ebb2e 100644
--- a/src/plugins/android/androiddeployqtstep.cpp
+++ b/src/plugins/android/androiddeployqtstep.cpp
@@ -30,38 +30,43 @@
#include "androiddeployqtstep.h"
#include "androiddeployqtwidget.h"
+#include "androidqtsupport.h"
#include "certificatesmodel.h"
#include "javaparser.h"
#include "androidmanager.h"
#include "androidconstants.h"
-#include <utils/qtcassert.h>
-#include <utils/qtcprocess.h>
#include <coreplugin/fileutils.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
+
+#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/target.h>
#include <projectexplorer/project.h>
+#include <projectexplorer/target.h>
+
#include <qtsupport/qtkitinformation.h>
-#include <qmakeprojectmanager/qmakebuildconfiguration.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakenodes.h>
+
+#include <utils/qtcassert.h>
+#include <utils/qtcprocess.h>
+
#include <QInputDialog>
#include <QMessageBox>
+
using namespace Android;
using namespace Android::Internal;
-const QLatin1String DeployActionKey("Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction");
+const QLatin1String UninstallPreviousPackageKey("UninstallPreviousPackage");
const QLatin1String KeystoreLocationKey("KeystoreLocation");
const QLatin1String SignPackageKey("SignPackage");
const QLatin1String BuildTargetSdkKey("BuildTargetSdk");
const QLatin1String VerboseOutputKey("VerboseOutput");
const QLatin1String InputFile("InputFile");
const QLatin1String ProFilePathForInputFile("ProFilePathForInputFile");
+const QLatin1String InstallFailedInconsistentCertificatesString("INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES");
const Core::Id AndroidDeployQtStep::Id("Qt4ProjectManager.AndroidDeployQtStep");
//////////////////
@@ -81,9 +86,6 @@ QList<Core::Id> AndroidDeployQtStepFactory::availableCreationIds(ProjectExplorer
return QList<Core::Id>();
if (parent->contains(AndroidDeployQtStep::Id))
return QList<Core::Id>();
- QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(parent->target()->kit());
- if (!qtVersion || qtVersion->qtVersion() < QtSupport::QtVersionNumber(5, 2, 0))
- return QList<Core::Id>();
return QList<Core::Id>() << AndroidDeployQtStep::Id;
}
@@ -152,25 +154,17 @@ AndroidDeployQtStep::AndroidDeployQtStep(ProjectExplorer::BuildStepList *parent,
void AndroidDeployQtStep::ctor()
{
+ m_uninstallPreviousPackage = false;
+ m_uninstallPreviousPackageTemp = false;
+ m_uninstallPreviousPackageRun = false;
+
//: AndroidDeployQtStep default display name
setDefaultDisplayName(tr("Deploy to Android device"));
- m_deployAction = BundleLibrariesDeployment;
- m_signPackage = false;
- m_openPackageLocation = false;
- m_verbose = false;
-
- // will be overwriten by settings if the user choose something different
- SdkPlatform sdk = AndroidConfigurations::currentConfig().highestAndroidSdk();
- if (sdk.apiLevel > 0)
- m_buildTargetSdk = QLatin1String("android-") + QString::number(sdk.apiLevel);
-
- connect(project(), SIGNAL(proFilesEvaluated()),
- this, SLOT(updateInputFile()));
}
bool AndroidDeployQtStep::init()
{
- if (AndroidManager::checkForQt51Files(project()->projectDirectory().toString()))
+ if (AndroidManager::checkForQt51Files(project()->projectDirectory()))
emit addOutput(tr("Found old folder \"android\" in source directory. Qt 5.2 does not use that folder by default."), ErrorOutput);
m_targetArch = AndroidManager::targetArch(target());
@@ -191,109 +185,34 @@ bool AndroidDeployQtStep::init()
m_avdName.clear();
m_serialNumber = info.serialNumber;
}
+ AndroidManager::setDeviceSerialNumber(target(), m_serialNumber);
- QmakeProjectManager::QmakeBuildConfiguration *bc
- = static_cast<QmakeProjectManager::QmakeBuildConfiguration *>(target()->activeBuildConfiguration());
-
- if (m_signPackage) {
- // check keystore and certificate passwords
- while (!AndroidManager::checkKeystorePassword(m_keystorePath.toString(), m_keystorePasswd)) {
- if (!keystorePassword())
- return false; // user canceled
- }
-
- while (!AndroidManager::checkCertificatePassword(m_keystorePath.toString(), m_keystorePasswd, m_certificateAlias, m_certificatePasswd)) {
- if (!certificatePassword())
- return false; // user canceled
- }
-
-
- if ((bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild))
- emit addOutput(tr("Warning: Signing a debug package."), BuildStep::ErrorMessageOutput);
- }
+ ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
if (!version)
return false;
- QmakeProjectManager::QmakeProject *pro = static_cast<QmakeProjectManager::QmakeProject *>(project());
- JavaParser *parser = new JavaParser;
- parser->setProjectFileList(pro->files(ProjectExplorer::Project::AllFiles));
- setOutputParser(parser);
-
- QString command = version->qmakeProperty("QT_HOST_BINS");
- if (!command.endsWith(QLatin1Char('/')))
- command += QLatin1Char('/');
- command += Utils::HostOsInfo::withExecutableSuffix(QLatin1String("androiddeployqt"));
-
- QString deploymentMethod;
- if (m_deployAction == MinistroDeployment)
- deploymentMethod = QLatin1String("ministro");
- else if (m_deployAction == DebugDeployment)
- deploymentMethod = QLatin1String("debug");
- else if (m_deployAction == BundleLibrariesDeployment)
- deploymentMethod = QLatin1String("bundled");
-
- QString outputDir = bc->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY)).toString();
- const QmakeProjectManager::QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile);
- if (!node) { // should never happen
- emit addOutput(tr("Internal Error: Could not find .pro file."), BuildStep::ErrorMessageOutput);
- return false;
- }
-
- QString inputFile = node->singleVariableValue(QmakeProjectManager::AndroidDeploySettingsFile);
- if (inputFile.isEmpty()) { // should never happen
- emit addOutput(tr("Internal Error: Unknown Android deployment JSON file location."), BuildStep::ErrorMessageOutput);
- return false;
- }
-
- QStringList arguments;
- arguments << QLatin1String("--input")
- << inputFile
- << QLatin1String("--output")
- << outputDir
- << QLatin1String("--deployment")
- << deploymentMethod
- << QLatin1String("--install")
- << QLatin1String("--ant")
- << AndroidConfigurations::currentConfig().antToolPath().toString()
- << QLatin1String("--android-platform")
- << m_buildTargetSdk
- << QLatin1String("--jdk")
- << AndroidConfigurations::currentConfig().openJDKLocation().toString();
-
- parser->setSourceDirectory(Utils::FileName::fromString(node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir)));
- parser->setBuildDirectory(Utils::FileName::fromString(outputDir));
-
- if (m_verbose)
- arguments << QLatin1String("--verbose");
- if (m_avdName.isEmpty())
- arguments << QLatin1String("--device")
- << info.serialNumber;
-
- if (m_signPackage) {
- arguments << QLatin1String("--sign")
- << m_keystorePath.toString()
- << m_certificateAlias
- << QLatin1String("--storepass")
- << m_keystorePasswd;
- if (!m_certificatePasswd.isEmpty())
- arguments << QLatin1String("--keypass")
- << m_certificatePasswd;
+ m_uninstallPreviousPackageRun = m_uninstallPreviousPackage || m_uninstallPreviousPackageTemp;
+ m_uninstallPreviousPackageTemp = false;
+ if (m_uninstallPreviousPackageRun) {
+ m_packageName = AndroidManager::packageName(target());
+ if (m_packageName.isEmpty()){
+ emit addOutput(tr("Cannot find the package name."), ErrorOutput);
+ return false;
+ }
}
ProjectExplorer::ProcessParameters *pp = processParameters();
+ pp->setCommand(AndroidConfigurations::currentConfig().adbToolPath().toString());
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
Utils::Environment env = bc->environment();
pp->setEnvironment(env);
- pp->setCommand(command);
- pp->setArguments(Utils::QtcProcess::joinArgs(arguments));
- pp->resolveAll();
+ m_apkPath = AndroidManager::androidQtSupport(target())->apkPath(target(), AndroidManager::signPackage(target())
+ ? AndroidQtSupport::ReleaseBuildSigned
+ : AndroidQtSupport::DebugBuild).toString();
- m_openPackageLocationForRun = m_openPackageLocation;
- m_apkPath = AndroidManager::apkPath(target(), m_signPackage ? AndroidManager::ReleaseBuildSigned
- : AndroidManager::DebugBuild).toString();
m_buildDirectory = bc->buildDirectory().toString();
bool result = AbstractProcessStep::init();
@@ -307,6 +226,7 @@ bool AndroidDeployQtStep::init()
void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
{
+ m_installOk = true;
if (!m_avdName.isEmpty()) {
QString serialNumber = AndroidConfigurations::currentConfig().waitForAvd(m_deviceAPILevel, m_targetArch, fi);
if (serialNumber.isEmpty()) {
@@ -315,12 +235,27 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
return;
}
m_serialNumber = serialNumber;
- QString args = processParameters()->arguments();
- Utils::QtcProcess::addArg(&args, QLatin1String("--device"));
- Utils::QtcProcess::addArg(&args, serialNumber);
- processParameters()->setArguments(args);
+ AndroidManager::setDeviceSerialNumber(target(), serialNumber);
+ }
+
+ if (m_uninstallPreviousPackageRun) {
+ emit addOutput(tr("Uninstall previous package %1.").arg(m_packageName), MessageOutput);
+ runCommand(AndroidConfigurations::currentConfig().adbToolPath().toString(),
+ AndroidDeviceInfo::adbSelector(m_serialNumber)
+ << QLatin1String("uninstall") << m_packageName);
}
+ ProjectExplorer::ProcessParameters *pp = processParameters();
+ QString args;
+ foreach (const QString &arg, AndroidDeviceInfo::adbSelector(m_serialNumber))
+ Utils::QtcProcess::addArg(&args, arg);
+
+ Utils::QtcProcess::addArg(&args, QLatin1String("install"));
+ Utils::QtcProcess::addArg(&args, QLatin1String("-r"));
+ Utils::QtcProcess::addArg(&args, m_apkPath);
+ pp->setArguments(args);
+ pp->resolveAll();
+
AbstractProcessStep::run(fi);
emit addOutput(tr("Pulling files necessary for debugging."), MessageOutput);
@@ -337,17 +272,17 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
void AndroidDeployQtStep::runCommand(const QString &program, const QStringList &arguments)
{
QProcess buildProc;
- emit addOutput(tr("Package deploy: Running command '%1 %2'.").arg(program).arg(arguments.join(QLatin1String(" "))), BuildStep::MessageOutput);
+ emit addOutput(tr("Package deploy: Running command \"%1 %2\".").arg(program).arg(arguments.join(QLatin1String(" "))), BuildStep::MessageOutput);
buildProc.start(program, arguments);
if (!buildProc.waitForStarted()) {
- emit addOutput(tr("Packaging error: Could not start command '%1 %2'. Reason: %3")
+ emit addOutput(tr("Packaging error: Could not start command \"%1 %2\". Reason: %3")
.arg(program).arg(arguments.join(QLatin1String(" "))).arg(buildProc.errorString()), BuildStep::ErrorMessageOutput);
return;
}
if (!buildProc.waitForFinished(2 * 60 * 1000)
|| buildProc.error() != QProcess::UnknownError
|| buildProc.exitCode() != 0) {
- QString mainMessage = tr("Packaging Error: Command '%1 %2' failed.")
+ QString mainMessage = tr("Packaging Error: Command \"%1 %2\" failed.")
.arg(program).arg(arguments.join(QLatin1String(" ")));
if (buildProc.error() != QProcess::UnknownError)
mainMessage += QLatin1Char(' ') + tr("Reason: %1").arg(buildProc.errorString());
@@ -357,148 +292,55 @@ void AndroidDeployQtStep::runCommand(const QString &program, const QStringList &
}
}
-void AndroidDeployQtStep::updateInputFile()
+ProjectExplorer::BuildStepConfigWidget *AndroidDeployQtStep::createConfigWidget()
{
- QmakeProjectManager::QmakeProject *pro = static_cast<QmakeProjectManager::QmakeProject *>(project());
- QList<QmakeProjectManager::QmakeProFileNode *> nodes = pro->applicationProFiles();
-
- const QmakeProjectManager::QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile);
- if (!nodes.contains(const_cast<QmakeProjectManager::QmakeProFileNode *>(node))) {
- if (!nodes.isEmpty())
- m_proFilePathForInputFile = nodes.first()->path();
- else
- m_proFilePathForInputFile.clear();
- }
-
- emit inputFileChanged();
+ return new AndroidDeployQtWidget(this);
}
-void AndroidDeployQtStep::showInGraphicalShell()
+void AndroidDeployQtStep::stdOutput(const QString &line)
{
- Core::FileUtils::showInGraphicalShell(Core::ICore::instance()->mainWindow(), m_apkPath);
+ if (line.contains(InstallFailedInconsistentCertificatesString))
+ m_installOk = false;
+ AbstractProcessStep::stdOutput(line);
}
-ProjectExplorer::BuildStepConfigWidget *AndroidDeployQtStep::createConfigWidget()
+void AndroidDeployQtStep::stdError(const QString &line)
{
- return new AndroidDeployQtWidget(this);
+ if (line.contains(InstallFailedInconsistentCertificatesString))
+ m_installOk = false;
+ AbstractProcessStep::stdError(line);
}
-void AndroidDeployQtStep::processFinished(int exitCode, QProcess::ExitStatus status)
+bool AndroidDeployQtStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
{
- AbstractProcessStep::processFinished(exitCode, status);
- if (m_openPackageLocationForRun)
- QMetaObject::invokeMethod(this, "showInGraphicalShell", Qt::QueuedConnection);
+ if (!m_installOk && !m_uninstallPreviousPackageRun &&
+ QMessageBox::critical(0, tr("Install failed"),
+ tr("Another application with the same package id but signed with "
+ "different ceritificate already exists.\n"
+ "Do you want to uninstall the existing package next time?"),
+ QMessageBox::Yes, QMessageBox::No)
+ == QMessageBox::Yes) {
+ m_uninstallPreviousPackageTemp = true;
+ }
+ return m_installOk && AbstractProcessStep::processSucceeded(exitCode, status);
}
bool AndroidDeployQtStep::fromMap(const QVariantMap &map)
{
- m_deployAction = AndroidDeployQtAction(map.value(QLatin1String(DeployActionKey),
- BundleLibrariesDeployment).toInt());
- m_keystorePath = Utils::FileName::fromString(map.value(KeystoreLocationKey).toString());
- m_signPackage = false; // don't restore this
- m_buildTargetSdk = map.value(BuildTargetSdkKey).toString();
- m_verbose = map.value(VerboseOutputKey).toBool();
- m_proFilePathForInputFile = map.value(ProFilePathForInputFile).toString();
+ m_uninstallPreviousPackage = map.value(UninstallPreviousPackageKey, false).toBool();
return ProjectExplorer::BuildStep::fromMap(map);
}
QVariantMap AndroidDeployQtStep::toMap() const
{
QVariantMap map = ProjectExplorer::BuildStep::toMap();
- map.insert(QLatin1String(DeployActionKey), m_deployAction);
- map.insert(KeystoreLocationKey, m_keystorePath.toString());
- map.insert(SignPackageKey, m_signPackage);
- map.insert(BuildTargetSdkKey, m_buildTargetSdk);
- map.insert(VerboseOutputKey, m_verbose);
- map.insert(ProFilePathForInputFile, m_proFilePathForInputFile);
+ map.insert(UninstallPreviousPackageKey, m_uninstallPreviousPackage);
return map;
}
-void AndroidDeployQtStep::setBuildTargetSdk(const QString &sdk)
+void AndroidDeployQtStep::setUninstallPreviousPackage(bool uninstall)
{
- m_buildTargetSdk = sdk;
-}
-
-QString AndroidDeployQtStep::buildTargetSdk() const
-{
- return m_buildTargetSdk;
-}
-
-Utils::FileName AndroidDeployQtStep::keystorePath()
-{
- return m_keystorePath;
-}
-
-AndroidDeployQtStep::AndroidDeployQtAction AndroidDeployQtStep::deployAction() const
-{
- return m_deployAction;
-}
-
-void AndroidDeployQtStep::setDeployAction(AndroidDeployQtStep::AndroidDeployQtAction deploy)
-{
- m_deployAction = deploy;
-}
-
-void AndroidDeployQtStep::setKeystorePath(const Utils::FileName &path)
-{
- m_keystorePath = path;
- m_certificatePasswd.clear();
- m_keystorePasswd.clear();
-}
-
-void AndroidDeployQtStep::setKeystorePassword(const QString &pwd)
-{
- m_keystorePasswd = pwd;
-}
-
-void AndroidDeployQtStep::setCertificateAlias(const QString &alias)
-{
- m_certificateAlias = alias;
-}
-
-void AndroidDeployQtStep::setCertificatePassword(const QString &pwd)
-{
- m_certificatePasswd = pwd;
-}
-
-bool AndroidDeployQtStep::signPackage() const
-{
- return m_signPackage;
-}
-
-void AndroidDeployQtStep::setSignPackage(bool b)
-{
- m_signPackage = b;
-}
-
-QString AndroidDeployQtStep::deviceSerialNumber()
-{
- return m_serialNumber;
-}
-
-bool AndroidDeployQtStep::openPackageLocation() const
-{
- return m_openPackageLocation;
-}
-
-void AndroidDeployQtStep::setOpenPackageLocation(bool open)
-{
- m_openPackageLocation = open;
-}
-
-void AndroidDeployQtStep::setVerboseOutput(bool verbose)
-{
- m_verbose = verbose;
-}
-
-QString AndroidDeployQtStep::proFilePathForInputFile() const
-{
- return m_proFilePathForInputFile;
-}
-
-void AndroidDeployQtStep::setProFilePathForInputFile(const QString &path)
-{
- m_proFilePathForInputFile = path;
+ m_uninstallPreviousPackage = uninstall;
}
bool AndroidDeployQtStep::runInGuiThread() const
@@ -506,69 +348,7 @@ bool AndroidDeployQtStep::runInGuiThread() const
return true;
}
-bool AndroidDeployQtStep::verboseOutput() const
-{
- return m_verbose;
-}
-
-// Note this functions is duplicated between AndroidDeployStep and AndroidDeployQtStep
-// since it does modify the stored password in AndroidDeployQtStep it's not easily
-// extractable. The situation will clean itself up once AndroidDeployStep is no longer
-// necessary
-QAbstractItemModel *AndroidDeployQtStep::keystoreCertificates()
+bool AndroidDeployQtStep::uninstallPreviousPackage()
{
- QString rawCerts;
- QProcess keytoolProc;
- while (!rawCerts.length() || !m_keystorePasswd.length()) {
- QStringList params;
- params << QLatin1String("-list") << QLatin1String("-v") << QLatin1String("-keystore") << m_keystorePath.toUserOutput() << QLatin1String("-storepass");
- if (!m_keystorePasswd.length())
- keystorePassword();
- if (!m_keystorePasswd.length())
- return 0;
- params << m_keystorePasswd;
- params << QLatin1String("-J-Duser.language=en");
- keytoolProc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), params);
- if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
- QMessageBox::critical(0, tr("Error"),
- tr("Failed to run keytool."));
- return 0;
- }
-
- if (keytoolProc.exitCode()) {
- QMessageBox::critical(0, tr("Error"),
- tr("Invalid password."));
- m_keystorePasswd.clear();
- }
- rawCerts = QString::fromLatin1(keytoolProc.readAllStandardOutput());
- }
- return new CertificatesModel(rawCerts, this);
-}
-
-bool AndroidDeployQtStep::keystorePassword()
-{
- m_keystorePasswd.clear();
- bool ok;
- QString text = QInputDialog::getText(0, tr("Keystore"),
- tr("Keystore password:"), QLineEdit::Password,
- QString(), &ok);
- if (ok && !text.isEmpty()) {
- m_keystorePasswd = text;
- return true;
- }
- return false;
-}
-
-bool AndroidDeployQtStep::certificatePassword()
-{
- m_certificatePasswd.clear();
- bool ok;
- QString text = QInputDialog::getText(0, tr("Certificate"),
- tr("Certificate password (%1):").arg(m_certificateAlias), QLineEdit::Password,
- QString(), &ok);
- if (ok && !text.isEmpty()) {
- m_certificatePasswd = text;
- return true;
- }
- return false;
+ return m_uninstallPreviousPackage;
}
diff --git a/src/plugins/android/androiddeployqtstep.h b/src/plugins/android/androiddeployqtstep.h
index 01745ccb5c..68f94bd552 100644
--- a/src/plugins/android/androiddeployqtstep.h
+++ b/src/plugins/android/androiddeployqtstep.h
@@ -71,91 +71,46 @@ class AndroidDeployQtStep : public ProjectExplorer::AbstractProcessStep
public:
AndroidDeployQtStep(ProjectExplorer::BuildStepList *bc);
- enum AndroidDeployQtAction
- {
- MinistroDeployment, // use ministro
- DebugDeployment,
- BundleLibrariesDeployment
- };
-
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
- AndroidDeployQtStep::AndroidDeployQtAction deployAction() const;
- QString deviceSerialNumber();
-
- void setBuildTargetSdk(const QString &sdk);
- QString buildTargetSdk() const;
-
- // signing
- Utils::FileName keystorePath();
- void setKeystorePath(const Utils::FileName &path);
- void setKeystorePassword(const QString &pwd);
- void setCertificateAlias(const QString &alias);
- void setCertificatePassword(const QString &pwd);
-
- QAbstractItemModel *keystoreCertificates();
- bool signPackage() const;
- void setSignPackage(bool b);
-
- bool openPackageLocation() const;
- void setOpenPackageLocation(bool open);
- bool verboseOutput() const;
- void setVerboseOutput(bool verbose);
-
- QString proFilePathForInputFile() const;
- void setProFilePathForInputFile(const QString &path);
-
bool runInGuiThread() const;
-signals:
- // also on purpose emitted if the possible values of this changed
- void inputFileChanged();
+ bool uninstallPreviousPackage();
public slots:
- void setDeployAction(AndroidDeployQtAction deploy); // slot?
-
-private slots:
- void showInGraphicalShell();
+ void setUninstallPreviousPackage(bool uninstall);
- void updateInputFile();
private:
AndroidDeployQtStep(ProjectExplorer::BuildStepList *bc,
AndroidDeployQtStep *other);
void ctor();
- bool keystorePassword();
- bool certificatePassword();
void runCommand(const QString &program, const QStringList &arguments);
bool init();
void run(QFutureInterface<bool> &fi);
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
bool immutable() const { return true; }
- void processFinished(int exitCode, QProcess::ExitStatus status);
+ void stdOutput(const QString &line);
+ void stdError(const QString &line);
+ virtual bool processSucceeded(int exitCode, QProcess::ExitStatus status);
- QString m_buildTargetSdk;
+ QString m_packageName;
QString m_serialNumber;
- AndroidDeployQtAction m_deployAction;
- bool m_signPackage;
- bool m_verbose;
- bool m_openPackageLocation;
- bool m_openPackageLocationForRun;
QString m_buildDirectory;
-
- Utils::FileName m_keystorePath;
- QString m_keystorePasswd;
- QString m_certificateAlias;
- QString m_certificatePasswd;
QString m_avdName;
QString m_apkPath;
+
QString m_targetArch;
- QString m_proFilePathForInputFile;
int m_deviceAPILevel;
-
+ bool m_uninstallPreviousPackage;
+ bool m_uninstallPreviousPackageTemp;
+ bool m_uninstallPreviousPackageRun;
static const Core::Id Id;
+ bool m_installOk;
};
}
-}
+} // namespace Android
#endif // ANDROIDDEPLOYQTSTEP_H
diff --git a/src/plugins/android/androiddeployqtwidget.cpp b/src/plugins/android/androiddeployqtwidget.cpp
index bcafad77b4..11f9bf9bdb 100644
--- a/src/plugins/android/androiddeployqtwidget.cpp
+++ b/src/plugins/android/androiddeployqtwidget.cpp
@@ -31,133 +31,28 @@
#include "androiddeployqtwidget.h"
#include "ui_androiddeployqtwidget.h"
-#include "androidcreatekeystorecertificate.h"
#include "androiddeployqtstep.h"
#include "androidmanager.h"
-#include "createandroidmanifestwizard.h"
-#include "androidextralibrarylistmodel.h"
-
-#include <projectexplorer/target.h>
-#include <qmakeprojectmanager/qmakebuildconfiguration.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakenodes.h>
-#include <utils/fancylineedit.h>
-#include <utils/pathchooser.h>
#include <QFileDialog>
-#include <algorithm>
-
-
using namespace Android;
using namespace Internal;
AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step)
: ProjectExplorer::BuildStepConfigWidget(),
m_ui(new Ui::AndroidDeployQtWidget),
- m_step(step),
- m_currentBuildConfiguration(0),
- m_ignoreChange(false)
+ m_step(step)
{
m_ui->setupUi(this);
- // Target sdk combobox
- int minApiLevel = 9;
- QStringList targets = AndroidConfig::apiLevelNamesFor(AndroidConfigurations::currentConfig().sdkTargets(minApiLevel));
- m_ui->targetSDKComboBox->addItems(targets);
- m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(step->buildTargetSdk()));
-
- // deployment option
- switch (m_step->deployAction()) {
- case AndroidDeployQtStep::MinistroDeployment:
- m_ui->ministroOption->setChecked(true);
- break;
- case AndroidDeployQtStep::DebugDeployment:
- m_ui->temporaryQtOption->setChecked(true);
- break;
- case AndroidDeployQtStep::BundleLibrariesDeployment:
- m_ui->bundleQtOption->setChecked(true);
- break;
- default:
- // can't happen
- break;
- }
-
- // signing
- m_ui->signPackageCheckBox->setChecked(m_step->signPackage());
- m_ui->KeystoreLocationPathChooser->setExpectedKind(Utils::PathChooser::File);
- m_ui->KeystoreLocationPathChooser->lineEdit()->setReadOnly(true);
- m_ui->KeystoreLocationPathChooser->setPath(m_step->keystorePath().toUserOutput());
- m_ui->KeystoreLocationPathChooser->setInitialBrowsePathBackup(QDir::homePath());
- m_ui->KeystoreLocationPathChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)"));
- m_ui->KeystoreLocationPathChooser->setPromptDialogTitle(tr("Select keystore file"));
- m_ui->signingDebugWarningIcon->hide();
- m_ui->signingDebugWarningLabel->hide();
- signPackageCheckBoxToggled(m_step->signPackage());
-
- m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput());
- m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation());
-
- bool oldFiles = AndroidManager::checkForQt51Files(m_step->project()->projectDirectory().toString());
- m_ui->oldFilesWarningIcon->setVisible(oldFiles);
- m_ui->oldFilesWarningLabel->setVisible(oldFiles);
-
- // target sdk
- connect(m_ui->targetSDKComboBox, SIGNAL(activated(QString)), SLOT(setTargetSdk(QString)));
-
- // deployment options
- connect(m_ui->ministroOption, SIGNAL(clicked()), SLOT(setMinistro()));
- connect(m_ui->temporaryQtOption, SIGNAL(clicked()), SLOT(setDeployLocalQtLibs()));
- connect(m_ui->bundleQtOption, SIGNAL(clicked()), SLOT(setBundleQtLibs()));
-
+ m_ui->uninstallPreviousPackage->setChecked(m_step->uninstallPreviousPackage());
connect(m_ui->installMinistroButton, SIGNAL(clicked()), SLOT(installMinistro()));
connect(m_ui->cleanLibsPushButton, SIGNAL(clicked()), SLOT(cleanLibsOnDevice()));
connect(m_ui->resetDefaultDevices, SIGNAL(clicked()), SLOT(resetDefaultDevices()));
- connect(m_ui->openPackageLocationCheckBox, SIGNAL(toggled(bool)),
- this, SLOT(openPackageLocationCheckBoxToggled(bool)));
- connect(m_ui->verboseOutputCheckBox, SIGNAL(toggled(bool)),
- this, SLOT(verboseOutputCheckBoxToggled(bool)));
-
- //signing
- connect(m_ui->signPackageCheckBox, SIGNAL(toggled(bool)),
- this, SLOT(signPackageCheckBoxToggled(bool)));
- connect(m_ui->KeystoreCreatePushButton, SIGNAL(clicked()),
- this, SLOT(createKeyStore()));
- connect(m_ui->KeystoreLocationPathChooser, SIGNAL(pathChanged(QString)),
- SLOT(updateKeyStorePath(QString)));
- connect(m_ui->certificatesAliasComboBox, SIGNAL(activated(QString)),
- this, SLOT(certificatesAliasComboBoxActivated(QString)));
- connect(m_ui->certificatesAliasComboBox, SIGNAL(currentIndexChanged(QString)),
- this, SLOT(certificatesAliasComboBoxCurrentIndexChanged(QString)));
+ connect(m_ui->uninstallPreviousPackage, SIGNAL(toggled(bool)),
+ m_step, SLOT(setUninstallPreviousPackage(bool)));
- activeBuildConfigurationChanged();
- connect(m_step->target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(activeBuildConfigurationChanged()));
-
- connect(m_ui->inputFileComboBox, SIGNAL(currentIndexChanged(int)),
- this, SLOT(inputFileComboBoxIndexChanged()));
-
- updateInputFileUi();
- connect(m_step, SIGNAL(inputFileChanged()),
- this, SLOT(updateInputFileUi()));
-
- connect(m_ui->createAndroidManifestButton, SIGNAL(clicked()),
- this, SLOT(createManifestButton()));
-
- m_extraLibraryListModel = new AndroidExtraLibraryListModel(static_cast<QmakeProjectManager::QmakeProject *>(m_step->project()),
- this);
- m_ui->androidExtraLibsListView->setModel(m_extraLibraryListModel);
-
- connect(m_ui->androidExtraLibsListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- this, SLOT(checkEnableRemoveButton()));
-
- connect(m_ui->addAndroidExtraLibButton, SIGNAL(clicked()), this, SLOT(addAndroidExtraLib()));
- connect(m_ui->removeAndroidExtraLibButton, SIGNAL(clicked()), this, SLOT(removeAndroidExtraLib()));
-
- connect(m_extraLibraryListModel, SIGNAL(enabledChanged(bool)),
- m_ui->additionalLibrariesGroupBox, SLOT(setEnabled(bool)));
-
- m_ui->additionalLibrariesGroupBox->setEnabled(m_extraLibraryListModel->isEnabled());
}
AndroidDeployQtWidget::~AndroidDeployQtWidget()
@@ -165,45 +60,6 @@ AndroidDeployQtWidget::~AndroidDeployQtWidget()
delete m_ui;
}
-void AndroidDeployQtWidget::createManifestButton()
-{
- CreateAndroidManifestWizard wizard(m_step->target());
- wizard.exec();
-}
-
-void AndroidDeployQtWidget::updateInputFileUi()
-{
- QmakeProjectManager::QmakeProject *project
- = static_cast<QmakeProjectManager::QmakeProject *>(m_step->project());
- QList<QmakeProjectManager::QmakeProFileNode *> nodes = project->applicationProFiles();
- int size = nodes.size();
- if (size == 0 || size == 1) {
- // there's nothing to select, e.g. before parsing
- m_ui->inputFileLabel->setVisible(false);
- m_ui->inputFileComboBox->setVisible(false);
- } else {
- m_ignoreChange = true;
- m_ui->inputFileLabel->setVisible(true);
- m_ui->inputFileComboBox->setVisible(true);
-
- m_ui->inputFileComboBox->clear();
- foreach (QmakeProjectManager::QmakeProFileNode *node, nodes)
- m_ui->inputFileComboBox->addItem(node->displayName(), node->path());
-
- int index = m_ui->inputFileComboBox->findData(m_step->proFilePathForInputFile());
- m_ui->inputFileComboBox->setCurrentIndex(index);
- m_ignoreChange = false;
- }
-}
-
-void AndroidDeployQtWidget::inputFileComboBoxIndexChanged()
-{
- if (m_ignoreChange)
- return;
- QString proFilePath = m_ui->inputFileComboBox->itemData(m_ui->inputFileComboBox->currentIndex()).toString();
- m_step->setProFilePathForInputFile(proFilePath);
-}
-
QString AndroidDeployQtWidget::displayName() const
{
return tr("<b>Deploy configurations</b>");
@@ -214,26 +70,6 @@ QString AndroidDeployQtWidget::summaryText() const
return displayName();
}
-void AndroidDeployQtWidget::setTargetSdk(const QString &sdk)
-{
- m_step->setBuildTargetSdk(sdk);
-}
-
-void AndroidDeployQtWidget::setMinistro()
-{
- m_step->setDeployAction(AndroidDeployQtStep::MinistroDeployment);
-}
-
-void AndroidDeployQtWidget::setDeployLocalQtLibs()
-{
- m_step->setDeployAction(AndroidDeployQtStep::DebugDeployment);
-}
-
-void AndroidDeployQtWidget::setBundleQtLibs()
-{
- m_step->setDeployAction(AndroidDeployQtStep::BundleLibrariesDeployment);
-}
-
void AndroidDeployQtWidget::installMinistro()
{
QString packagePath =
@@ -253,113 +89,3 @@ void AndroidDeployQtWidget::resetDefaultDevices()
AndroidConfigurations::clearDefaultDevices(m_step->project());
}
-void AndroidDeployQtWidget::signPackageCheckBoxToggled(bool checked)
-{
- m_ui->certificatesAliasComboBox->setEnabled(checked);
- m_step->setSignPackage(checked);
- updateSigningWarning();
- if (!checked)
- return;
- if (!m_step->keystorePath().isEmpty())
- setCertificates();
-}
-
-void AndroidDeployQtWidget::createKeyStore()
-{
- AndroidCreateKeystoreCertificate d;
- if (d.exec() != QDialog::Accepted)
- return;
- m_ui->KeystoreLocationPathChooser->setPath(d.keystoreFilePath().toUserOutput());
- m_step->setKeystorePath(d.keystoreFilePath());
- m_step->setKeystorePassword(d.keystorePassword());
- m_step->setCertificateAlias(d.certificateAlias());
- m_step->setCertificatePassword(d.certificatePassword());
- setCertificates();
-}
-
-void AndroidDeployQtWidget::setCertificates()
-{
- QAbstractItemModel *certificates = m_step->keystoreCertificates();
- m_ui->signPackageCheckBox->setChecked(certificates);
- m_ui->certificatesAliasComboBox->setModel(certificates);
-}
-
-void AndroidDeployQtWidget::updateKeyStorePath(const QString &path)
-{
- Utils::FileName file = Utils::FileName::fromString(path);
- m_step->setKeystorePath(file);
- m_ui->signPackageCheckBox->setChecked(!file.isEmpty());
- if (!file.isEmpty())
- setCertificates();
-}
-
-void AndroidDeployQtWidget::certificatesAliasComboBoxActivated(const QString &alias)
-{
- if (alias.length())
- m_step->setCertificateAlias(alias);
-}
-
-void AndroidDeployQtWidget::certificatesAliasComboBoxCurrentIndexChanged(const QString &alias)
-{
- if (alias.length())
- m_step->setCertificateAlias(alias);
-}
-
-void AndroidDeployQtWidget::openPackageLocationCheckBoxToggled(bool checked)
-{
- m_step->setOpenPackageLocation(checked);
-}
-
-void AndroidDeployQtWidget::verboseOutputCheckBoxToggled(bool checked)
-{
- m_step->setVerboseOutput(checked);
-}
-
-void AndroidDeployQtWidget::activeBuildConfigurationChanged()
-{
- if (m_currentBuildConfiguration)
- disconnect(m_currentBuildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
- this, SLOT(updateSigningWarning()));
- updateSigningWarning();
- QmakeProjectManager::QmakeBuildConfiguration *bc
- = qobject_cast<QmakeProjectManager::QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration());
- m_currentBuildConfiguration = bc;
- if (bc)
- connect(bc, SIGNAL(qmakeBuildConfigurationChanged()), this, SLOT(updateSigningWarning()));
- m_currentBuildConfiguration = bc;
-}
-
-void AndroidDeployQtWidget::updateSigningWarning()
-{
- QmakeProjectManager::QmakeBuildConfiguration *bc = qobject_cast<QmakeProjectManager::QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration());
- bool debug = bc && (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild);
- if (m_step->signPackage() && debug) {
- m_ui->signingDebugWarningIcon->setVisible(true);
- m_ui->signingDebugWarningLabel->setVisible(true);
- } else {
- m_ui->signingDebugWarningIcon->setVisible(false);
- m_ui->signingDebugWarningLabel->setVisible(false);
- }
-}
-
-void AndroidDeployQtWidget::addAndroidExtraLib()
-{
- QStringList fileNames = QFileDialog::getOpenFileNames(this,
- tr("Select additional libraries"),
- m_currentBuildConfiguration->target()->project()->projectDirectory().toString(),
- tr("Libraries (*.so)"));
-
- if (!fileNames.isEmpty())
- m_extraLibraryListModel->addEntries(fileNames);
-}
-
-void AndroidDeployQtWidget::removeAndroidExtraLib()
-{
- QModelIndexList removeList = m_ui->androidExtraLibsListView->selectionModel()->selectedIndexes();
- m_extraLibraryListModel->removeEntries(removeList);
-}
-
-void AndroidDeployQtWidget::checkEnableRemoveButton()
-{
- m_ui->removeAndroidExtraLibButton->setEnabled(m_ui->androidExtraLibsListView->selectionModel()->hasSelection());
-}
diff --git a/src/plugins/android/androiddeployqtwidget.h b/src/plugins/android/androiddeployqtwidget.h
index d44a79186a..158b530593 100644
--- a/src/plugins/android/androiddeployqtwidget.h
+++ b/src/plugins/android/androiddeployqtwidget.h
@@ -38,12 +38,10 @@ QT_BEGIN_NAMESPACE
namespace Ui { class AndroidDeployQtWidget; }
QT_END_NAMESPACE
-namespace QmakeProjectManager { class QmakeBuildConfiguration; }
-
namespace Android {
namespace Internal {
class AndroidDeployQtStep;
-class AndroidExtraLibraryListModel;
+
class AndroidDeployQtWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
@@ -53,39 +51,16 @@ public:
~AndroidDeployQtWidget();
private slots:
- void setTargetSdk(const QString &sdk);
- void setMinistro();
- void setDeployLocalQtLibs();
- void setBundleQtLibs();
void installMinistro();
void cleanLibsOnDevice();
void resetDefaultDevices();
- void createKeyStore();
- void certificatesAliasComboBoxCurrentIndexChanged(const QString &alias);
- void certificatesAliasComboBoxActivated(const QString &alias);
- void activeBuildConfigurationChanged();
- void updateSigningWarning();
- void openPackageLocationCheckBoxToggled(bool checked);
- void verboseOutputCheckBoxToggled(bool checked);
- void updateKeyStorePath(const QString &path);
- void signPackageCheckBoxToggled(bool checked);
- void updateInputFileUi();
- void inputFileComboBoxIndexChanged();
- void createManifestButton();
- void addAndroidExtraLib();
- void removeAndroidExtraLib();
- void checkEnableRemoveButton();
private:
virtual QString summaryText() const;
virtual QString displayName() const;
- void setCertificates();
Ui::AndroidDeployQtWidget *m_ui;
AndroidDeployQtStep *m_step;
- AndroidExtraLibraryListModel *m_extraLibraryListModel;
- QmakeProjectManager::QmakeBuildConfiguration *m_currentBuildConfiguration;
- bool m_ignoreChange;
};
}
diff --git a/src/plugins/android/androiddeployqtwidget.ui b/src/plugins/android/androiddeployqtwidget.ui
index fc744a6955..204d1d886f 100644
--- a/src/plugins/android/androiddeployqtwidget.ui
+++ b/src/plugins/android/androiddeployqtwidget.ui
@@ -6,376 +6,53 @@
<rect>
<x>0</x>
<y>0</y>
- <width>682</width>
- <height>615</height>
+ <width>403</width>
+ <height>178</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="2" column="0" colspan="2">
- <widget class="QGroupBox" name="signPackage">
- <property name="title">
- <string>Sign package</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="KeystoreLocationLabel">
- <property name="text">
- <string>Keystore:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Utils::PathChooser" name="KeystoreLocationPathChooser" native="true"/>
- </item>
- <item>
- <widget class="QPushButton" name="KeystoreCreatePushButton">
- <property name="text">
- <string>Create...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QCheckBox" name="signPackageCheckBox">
- <property name="text">
- <string>Sign package</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="signingDebugWarningIcon">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="pixmap">
- <pixmap resource="../coreplugin/core.qrc">:/core/images/warning.png</pixmap>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="signingDebugWarningLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Signing a debug package</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="KeystoreLocationLabel_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Certificate alias:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="certificatesAliasComboBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>300</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="3" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
<widget class="QGroupBox" name="advancedActions">
<property name="title">
- <string>Advanced Actions</string>
+ <string>Deploy options</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="4" column="0">
- <widget class="QPushButton" name="cleanLibsPushButton">
- <property name="text">
- <string>Clean Temporary Libraries Directory on Device</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QPushButton" name="installMinistroButton">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="uninstallPreviousPackage">
<property name="text">
- <string>Install Ministro from APK</string>
+ <string>Uninstall previous package</string>
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item>
<widget class="QPushButton" name="resetDefaultDevices">
<property name="text">
<string>Reset Default Devices</string>
</property>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QCheckBox" name="openPackageLocationCheckBox">
- <property name="text">
- <string>Open package location after build</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="verboseOutputCheckBox">
- <property name="text">
- <string>Verbose output</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QPushButton" name="createAndroidManifestButton">
- <property name="text">
- <string>Create AndroidManifest.xml</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QGroupBox" name="application">
- <property name="title">
- <string>Application</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="1" column="1">
- <widget class="QComboBox" name="targetSDKComboBox"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="targetSDKLabel">
- <property name="text">
- <string>Android build SDK:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="inputFileComboBox"/>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="inputFileLabel">
- <property name="text">
- <string>Input file for androiddeployqt:</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="oldFilesWarningIcon">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="pixmap">
- <pixmap resource="../coreplugin/core.qrc">:/core/images/warning.png</pixmap>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="oldFilesWarningLabel">
- <property name="text">
- <string>Qt no longer uses the folder &quot;android&quot; in the project's source directory.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="0">
- <widget class="QGroupBox" name="qtDeployment">
- <property name="title">
- <string>Qt Deployment</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QRadioButton" name="ministroOption">
- <property name="toolTip">
- <string>Uses the external Ministro application to download and maintain Qt libraries.&lt;br/&gt;&lt;br/&gt;Ministro is a third-party tool which provides the open source Qt libraries on demand. These libraries are compatible with the default open source binary package and will not always be up-to-date.</string>
- </property>
- <property name="text">
- <string>Use Ministro service to install Qt</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
<item>
- <widget class="QRadioButton" name="temporaryQtOption">
- <property name="toolTip">
- <string>Pushes local Qt libraries to device. You must have Qt libraries compiled for that platform.
-The APK will not be usable on any other device.</string>
- </property>
+ <widget class="QPushButton" name="cleanLibsPushButton">
<property name="text">
- <string>Deploy local Qt libraries to temporary directory</string>
+ <string>Clean Temporary Libraries Directory on Device</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="bundleQtOption">
- <property name="toolTip">
- <string>Creates a standalone APK.</string>
- </property>
+ <widget class="QPushButton" name="installMinistroButton">
<property name="text">
- <string>Bundle Qt libraries in APK</string>
+ <string>Install Ministro from APK</string>
</property>
</widget>
</item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item row="4" column="0" colspan="2">
- <widget class="QGroupBox" name="additionalLibrariesGroupBox">
- <property name="title">
- <string>Additional Libraries</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <layout class="QHBoxLayout" name="androidExtraLibsLayout">
- <item>
- <widget class="QListView" name="androidExtraLibsListView">
- <property name="toolTip">
- <string>List of extra libraries to include in Android package and load on startup.</string>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="androidExtraLibsButtonLayout">
- <item>
- <widget class="QToolButton" name="addAndroidExtraLibButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Select library to include in package.</string>
- </property>
- <property name="text">
- <string>Add...</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextOnly</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="removeAndroidExtraLibButton">
- <property name="toolTip">
- <string>Remove currently selected library from list.</string>
- </property>
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
</layout>
</widget>
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>Utils::PathChooser</class>
- <extends>QWidget</extends>
- <header location="global">utils/pathchooser.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources>
- <include location="../projectexplorer/projectexplorer.qrc"/>
- </resources>
+ <resources/>
<connections/>
</ui>
diff --git a/src/plugins/android/androiddeploystep.cpp b/src/plugins/android/androiddeploystep.cpp
deleted file mode 100644
index 565466a266..0000000000
--- a/src/plugins/android/androiddeploystep.cpp
+++ /dev/null
@@ -1,501 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "androiddeploystep.h"
-
-#include "androidconstants.h"
-#include "androiddeploystepwidget.h"
-#include "androidglobal.h"
-#include "androidpackagecreationstep.h"
-#include "androidrunconfiguration.h"
-#include "androidmanager.h"
-#include "androidtoolchain.h"
-#include "androiddevicedialog.h"
-
-#include <coreplugin/messagemanager.h>
-#include <projectexplorer/buildconfiguration.h>
-#include <projectexplorer/deployconfiguration.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/target.h>
-#include <qmakeprojectmanager/qmakebuildconfiguration.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakenodes.h>
-
-#include <qtsupport/qtkitinformation.h>
-
-#include <QDir>
-
-#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state)
-
-using namespace Core;
-using namespace ProjectExplorer;
-using namespace QmakeProjectManager;
-
-namespace Android {
-namespace Internal {
-
-static const char USE_LOCAL_QT_KEY[] = "Qt4ProjectManager.AndroidDeployStep.UseLocalQtLibs";
-static const char DEPLOY_ACTION_KEY[] = "Qt4ProjectManager.AndroidDeployStep.DeployAction";
-
-const Id AndroidDeployStep::Id("Qt4ProjectManager.AndroidDeployStep");
-
-AndroidDeployStep::AndroidDeployStep(ProjectExplorer::BuildStepList *parent)
- : BuildStep(parent, Id)
-{
- ctor();
-}
-
-AndroidDeployStep::AndroidDeployStep(ProjectExplorer::BuildStepList *parent,
- AndroidDeployStep *other)
- : BuildStep(parent, other)
-{
- ctor();
-}
-
-AndroidDeployStep::~AndroidDeployStep() { }
-
-void AndroidDeployStep::ctor()
-{
- //: AndroidDeployStep default display name
- setDefaultDisplayName(tr("Deploy to Android device"));
- m_deployAction = NoDeploy;
-
- QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit());
- m_bundleQtAvailable = qt && qt->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0);
- if (m_bundleQtAvailable)
- m_deployAction = BundleLibraries;
-
-
- connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
- this, SLOT(kitUpdated(ProjectExplorer::Kit*)));
-}
-
-bool AndroidDeployStep::init()
-{
- m_packageName = AndroidManager::packageName(target());
- m_deviceAPILevel = AndroidManager::minimumSDK(target());
- m_targetArch = AndroidManager::targetArch(target());
-
- AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(project(), m_deviceAPILevel, m_targetArch);
- if (info.serialNumber.isEmpty()) // aborted
- return false;
-
- m_deviceAPILevel = info.sdk;
- m_deviceSerialNumber = info.serialNumber;
-
- if (info.type == AndroidDeviceInfo::Emulator)
- m_avdName = m_deviceSerialNumber;
-
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
- if (!version)
- return false;
-
- const QmakeBuildConfiguration *bc = static_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration());
- if (!bc)
- return false;
-
- m_signPackage = false;
- // find AndroidPackageCreationStep
- foreach (BuildStep *step, target()->activeDeployConfiguration()->stepList()->steps()) {
- if (AndroidPackageCreationStep *apcs = qobject_cast<AndroidPackageCreationStep *>(step)) {
- m_signPackage = apcs->signPackage();
- break;
- }
- }
-
- m_qtVersionSourcePath = version->qmakeProperty("QT_INSTALL_PREFIX");
- m_androidDirPath = AndroidManager::dirPath(target());
- m_apkPathDebug = AndroidManager::apkPath(target(), AndroidManager::DebugBuild).toString();
- m_apkPathRelease = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildSigned).toString();
- m_buildDirectory = static_cast<QmakeProject *>(target()->project())->rootQmakeProjectNode()->buildDir();
- m_runDeployAction = m_deployAction;
- ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
- if (!tc || tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) {
- raiseError(tr("No Android toolchain selected."));
- return false;
- }
- m_ndkToolChainVersion = static_cast<AndroidToolChain *>(tc)->ndkToolChainVersion();
-
- QString arch = static_cast<QmakeProject *>(project())->rootQmakeProjectNode()->singleVariableValue(QmakeProjectManager::AndroidArchVar);
- if (!arch.isEmpty())
- m_libgnustl = AndroidManager::libGnuStl(arch, m_ndkToolChainVersion);
- return true;
-}
-
-void AndroidDeployStep::run(QFutureInterface<bool> &fi)
-{
- fi.reportResult(deployPackage());
-}
-
-BuildStepConfigWidget *AndroidDeployStep::createConfigWidget()
-{
- return new AndroidDeployStepWidget(this);
-}
-
-AndroidDeployStep::AndroidDeployAction AndroidDeployStep::deployAction()
-{
- return m_deployAction;
-}
-
-bool AndroidDeployStep::fromMap(const QVariantMap &map)
-{
- m_deployAction = AndroidDeployAction(map.value(QLatin1String(DEPLOY_ACTION_KEY), NoDeploy).toInt());
- QVariant useLocalQt = map.value(QLatin1String(USE_LOCAL_QT_KEY));
- if (useLocalQt.isValid()) { // old settings
- if (useLocalQt.toBool() && m_deployAction == NoDeploy)
- m_deployAction = BundleLibraries;
- }
-
- if (m_deployAction == InstallQASI)
- m_deployAction = NoDeploy;
- QtSupport::BaseQtVersion *qtVersion
- = QtSupport::QtKitInformation::qtVersion(target()->kit());
- if (m_deployAction == BundleLibraries)
- if (!qtVersion || qtVersion->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0))
- m_deployAction = NoDeploy; // the kit changed to a non qt5 kit
-
- m_bundleQtAvailable = qtVersion && qtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0);
-
- return ProjectExplorer::BuildStep::fromMap(map);
-}
-
-QVariantMap AndroidDeployStep::toMap() const
-{
- QVariantMap map = ProjectExplorer::BuildStep::toMap();
- map.insert(QLatin1String(DEPLOY_ACTION_KEY), m_deployAction);
- return map;
-}
-
-void AndroidDeployStep::kitUpdated(Kit *kit)
-{
- if (kit != target()->kit())
- return;
- QtSupport::BaseQtVersion *qtVersion
- = QtSupport::QtKitInformation::qtVersion(target()->kit());
-
- bool newBundleQtAvailable = qtVersion && qtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0);
- if (m_bundleQtAvailable != newBundleQtAvailable) {
- m_bundleQtAvailable = newBundleQtAvailable;
-
- if (!m_bundleQtAvailable && m_deployAction == BundleLibraries)
- m_deployAction = NoDeploy; // the kit changed to a non qt5 kit
-
- emit deployOptionsChanged();
- }
-}
-
-bool AndroidDeployStep::bundleQtOptionAvailable()
-{
- return m_bundleQtAvailable;
-}
-
-void AndroidDeployStep::setDeployAction(AndroidDeployStep::AndroidDeployAction deploy)
-{
- m_deployAction = deploy;
-
- AndroidManager::updateDeploymentSettings(target());
-}
-
-bool AndroidDeployStep::runCommand(QProcess *buildProc,
- const QString &program, const QStringList &arguments)
-{
- writeOutput(tr("Package deploy: Running command '%1 %2'.").arg(program).arg(arguments.join(QLatin1String(" "))), BuildStep::MessageOutput);
- buildProc->start(program, arguments);
- if (!buildProc->waitForStarted()) {
- writeOutput(tr("Packaging error: Could not start command '%1 %2'. Reason: %3")
- .arg(program).arg(arguments.join(QLatin1String(" "))).arg(buildProc->errorString()), BuildStep::ErrorMessageOutput);
- return false;
- }
- if (!buildProc->waitForFinished(2 * 60 * 1000)
- || buildProc->error() != QProcess::UnknownError
- || buildProc->exitCode() != 0) {
- QString mainMessage = tr("Packaging Error: Command '%1 %2' failed.")
- .arg(program).arg(arguments.join(QLatin1String(" ")));
- if (buildProc->error() != QProcess::UnknownError)
- mainMessage += QLatin1Char(' ') + tr("Reason: %1").arg(buildProc->errorString());
- else
- mainMessage += tr("Exit code: %1").arg(buildProc->exitCode());
- writeOutput(mainMessage, BuildStep::ErrorMessageOutput);
- return false;
- }
- return true;
-}
-
-void AndroidDeployStep::handleBuildOutput()
-{
- QProcess *const buildProc = qobject_cast<QProcess *>(sender());
- if (!buildProc)
- return;
- emit addOutput(QString::fromLocal8Bit(buildProc->readAllStandardOutput())
- , BuildStep::NormalOutput);
-}
-
-void AndroidDeployStep::handleBuildError()
-{
- QProcess *const buildProc = qobject_cast<QProcess *>(sender());
- if (!buildProc)
- return;
- emit addOutput(QString::fromLocal8Bit(buildProc->readAllStandardError())
- , BuildStep::ErrorOutput);
-}
-
-QString AndroidDeployStep::deviceSerialNumber()
-{
- return m_deviceSerialNumber;
-}
-
-unsigned int AndroidDeployStep::remoteModificationTime(const QString &fullDestination, QHash<QString, unsigned int> *cache)
-{
- QString destination = QFileInfo(fullDestination).absolutePath();
- QProcess process;
- QHash<QString, unsigned int>::const_iterator it = cache->find(fullDestination);
- if (it != cache->constEnd())
- return *it;
- QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
- arguments << QLatin1String("ls") << destination;
- process.start(AndroidConfigurations::currentConfig().adbToolPath().toString(), arguments);
- if (!process.waitForFinished(10000)
- || process.exitCode() != 0)
- return 0;
- QByteArray output = process.readAll();
- output.replace("\r\n", "\n");
- QList<QByteArray> lines = output.split('\n');
- foreach (const QByteArray &line, lines) {
- // do some checks if we got what we expected..
- if (line.count() < (3 * 8 + 3))
- continue;
- if (line.at(8) != ' '
- || line.at(17) != ' '
- || line.at(26) != ' ')
- continue;
- bool ok;
- int time = line.mid(18, 8).toUInt(&ok, 16);
- if (!ok)
- continue;
- QString fileName = QString::fromLocal8Bit(line.mid(27));
- cache->insert(destination + QLatin1Char('/') + fileName, time);
- }
- it = cache->find(fullDestination);
- if (it != cache->constEnd())
- return *it;
- return 0;
-}
-
-void AndroidDeployStep::collectFiles(QList<DeployItem> *deployList, const QString &localPath, const QString &remotePath,
- bool strip, const QStringList &filter)
-{
- QDirIterator libsIt(localPath, filter, QDir::NoFilter, QDirIterator::Subdirectories);
- int pos = localPath.size();
- while (libsIt.hasNext()) {
- libsIt.next();
- const QString destFile(remotePath + libsIt.filePath().mid(pos));
- if (!libsIt.fileInfo().isDir()) {
- deployList->append(DeployItem(libsIt.filePath(),
- libsIt.fileInfo().lastModified().toTime_t(),
- destFile, strip));
- }
- }
-}
-
-void AndroidDeployStep::fetchRemoteModificationTimes(QList<DeployItem> *deployList)
-{
- QHash<QString, unsigned int> cache;
- for (int i = 0; i < deployList->count(); ++i) {
- DeployItem &item = (*deployList)[i];
- item.remoteTimeStamp
- = remoteModificationTime(item.remoteFileName, &cache);
- }
-}
-
-void AndroidDeployStep::filterModificationTimes(QList<DeployItem> *deployList)
-{
- QList<DeployItem>::iterator it = deployList->begin();
- while (it != deployList->end()) {
- int index = it - deployList->begin();
- Q_UNUSED(index);
- if ((*it).localTimeStamp <= (*it).remoteTimeStamp)
- it = deployList->erase(it);
- else
- ++it;
- }
-}
-
-void AndroidDeployStep::copyFilesToTemp(QList<DeployItem> *deployList, const QString &tempDirectory, const QString &sourcePrefix)
-{
- QDir dir;
-
- int pos = sourcePrefix.size();
- for (int i = 0; i < deployList->count(); ++i) {
- DeployItem &item = (*deployList)[i];
- if (!item.needsStrip)
- continue;
- const QString destFile(tempDirectory + item.localFileName.mid(pos));
- dir.mkpath(QFileInfo(destFile).absolutePath());
- QFile::copy(item.localFileName, destFile);
- item.localFileName = destFile;
- }
-}
-
-void AndroidDeployStep::stripFiles(const QList<DeployItem> &deployList, Abi::Architecture architecture, const QString &ndkToolchainVersion)
-{
- QProcess stripProcess;
- foreach (const DeployItem &item, deployList) {
- stripProcess.start(AndroidConfigurations::currentConfig().stripPath(architecture, ndkToolchainVersion).toString(),
- QStringList()<<QLatin1String("--strip-unneeded") << item.localFileName);
- stripProcess.waitForStarted();
- if (!stripProcess.waitForFinished())
- stripProcess.kill();
- }
-}
-
-void AndroidDeployStep::deployFiles(QProcess *process, const QList<DeployItem> &deployList)
-{
- foreach (const DeployItem &item, deployList) {
- runCommand(process, AndroidConfigurations::currentConfig().adbToolPath().toString(),
- AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
- << QLatin1String("push") << item.localFileName
- << item.remoteFileName);
- }
-}
-
-bool AndroidDeployStep::deployPackage()
-{
- if (!m_avdName.isEmpty()) {
- if (AndroidConfigurations::currentConfig().findAvd(m_deviceAPILevel, m_targetArch).isEmpty()
- && !AndroidConfigurations::currentConfig().startAVDAsync(m_avdName))
- return false;
- m_deviceSerialNumber = AndroidConfigurations::currentConfig().waitForAvd(m_deviceAPILevel, m_targetArch);
- }
-
- QProcess *const deployProc = new QProcess;
- connect(deployProc, SIGNAL(readyReadStandardOutput()), this,
- SLOT(handleBuildOutput()));
- connect(deployProc, SIGNAL(readyReadStandardError()), this,
- SLOT(handleBuildError()));
-
- if (m_runDeployAction == DeployLocal) {
- writeOutput(tr("Deploy Qt libraries. This may take some time, please wait."));
- const QString tempPath = QDir::tempPath() + QLatin1String("/android_qt_libs_") + m_packageName;
- AndroidPackageCreationStep::removeDirectory(tempPath);
-
- const QString remoteRoot = QLatin1String("/data/local/tmp/qt");
- QList<DeployItem> deployList;
- collectFiles(&deployList,
- m_qtVersionSourcePath + QLatin1String("/lib"),
- remoteRoot + QLatin1String("/lib"),
- true,
- QStringList() << QLatin1String("*.so"));
-
- // don't use the libgnustl_shared.so from the qt directory
- for (int i = 0; i < deployList.count(); ++i) {
- if (deployList.at(i).remoteFileName == QLatin1String("/data/local/tmp/qt/lib/libgnustl_shared.so")) {
- deployList.removeAt(i);
- break;
- }
- }
-
- // We want to deploy that *always*
- // since even if the timestamps did not change, the toolchain might have changed
- // leading to a different file
- deployList.append(DeployItem(m_libgnustl,
- QDateTime::currentDateTimeUtc().toTime_t(),
- QLatin1String("/data/local/tmp/qt/lib/libgnustl_shared.so"), false));
-
- collectFiles(&deployList,
- m_qtVersionSourcePath + QLatin1String("/plugins"),
- remoteRoot + QLatin1String("/plugins"),
- true);
- collectFiles(&deployList,
- m_qtVersionSourcePath + QLatin1String("/imports"),
- remoteRoot + QLatin1String("/imports"),
- true);
- collectFiles(&deployList,
- m_qtVersionSourcePath + QLatin1String("/qml"),
- remoteRoot + QLatin1String("/qml"),
- true);
- collectFiles(&deployList,
- m_qtVersionSourcePath + QLatin1String("/jar"),
- remoteRoot + QLatin1String("/jar"),
- true);
-
- fetchRemoteModificationTimes(&deployList);
- filterModificationTimes(&deployList);
- copyFilesToTemp(&deployList, tempPath, m_qtVersionSourcePath);
- stripFiles(deployList, target()->activeRunConfiguration()->abi().architecture(), m_ndkToolChainVersion);
- deployFiles(deployProc, deployList);
-
- AndroidPackageCreationStep::removeDirectory(tempPath);
- }
-
- deployProc->setWorkingDirectory(m_androidDirPath.toString());
-
- writeOutput(tr("Installing package onto %1.").arg(m_deviceSerialNumber));
- runCommand(deployProc, AndroidConfigurations::currentConfig().adbToolPath().toString(),
- AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("uninstall") << m_packageName);
- QString package = m_apkPathDebug;
-
- if (m_signPackage && QFile::exists(m_apkPathRelease))
- package = m_apkPathRelease;
-
- if (!runCommand(deployProc, AndroidConfigurations::currentConfig().adbToolPath().toString(),
- AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("install") << package)) {
- raiseError(tr("Package installation failed."));
- disconnect(deployProc, 0, this, 0);
- deployProc->deleteLater();
- return false;
- }
-
- writeOutput(tr("Pulling files necessary for debugging."));
- runCommand(deployProc, AndroidConfigurations::currentConfig().adbToolPath().toString(),
- AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
- << QLatin1String("pull") << QLatin1String("/system/bin/app_process")
- << QString::fromLatin1("%1/app_process").arg(m_buildDirectory));
- runCommand(deployProc, AndroidConfigurations::currentConfig().adbToolPath().toString(),
- AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("pull")
- << QLatin1String("/system/lib/libc.so")
- << QString::fromLatin1("%1/libc.so").arg(m_buildDirectory));
- disconnect(deployProc, 0, this, 0);
- deployProc->deleteLater();
- return true;
-}
-
-void AndroidDeployStep::raiseError(const QString &errorString)
-{
- emit addTask(Task(Task::Error, errorString, Utils::FileName::fromString(QString()), -1,
- ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT));
-}
-
-void AndroidDeployStep::writeOutput(const QString &text, OutputFormat format)
-{
- emit addOutput(text, format);
-}
-
-} // namespace Internal
-} // namespace Android
diff --git a/src/plugins/android/androiddeploystep.h b/src/plugins/android/androiddeploystep.h
deleted file mode 100644
index f8f1536dda..0000000000
--- a/src/plugins/android/androiddeploystep.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef ANDROIDDEPLOYSTEP_H
-#define ANDROIDDEPLOYSTEP_H
-
-#include "androidconfigurations.h"
-
-#include <projectexplorer/buildstep.h>
-#include <qtsupport/baseqtversion.h>
-
-#include <QProcess>
-
-QT_BEGIN_NAMESPACE
-class QEventLoop;
-class QTimer;
-QT_END_NAMESPACE
-
-namespace Android {
-namespace Internal {
-class AndroidDeviceConfigListModel;
-class AndroidPackageCreationStep;
-
-class DeployItem
-{
-public:
- DeployItem(const QString &_localFileName,
- unsigned int _localTimeStamp,
- const QString &_remoteFileName,
- bool _needsStrip)
- : localFileName(_localFileName),
- remoteFileName(_remoteFileName),
- localTimeStamp(_localTimeStamp),
- remoteTimeStamp(0),
- needsStrip(_needsStrip)
- {}
- QString localFileName;
- QString remoteFileName;
- unsigned int localTimeStamp;
- unsigned int remoteTimeStamp;
- bool needsStrip;
-};
-
-class AndroidDeployStep : public ProjectExplorer::BuildStep
-{
- Q_OBJECT
- friend class AndroidDeployStepFactory;
-
-public:
- enum AndroidDeployAction
- {
- NoDeploy, // use ministro
- DeployLocal,
- InstallQASI, // unused old value
- BundleLibraries
- };
-
-public:
- AndroidDeployStep(ProjectExplorer::BuildStepList *bc);
-
- virtual ~AndroidDeployStep();
-
- QString deviceSerialNumber();
-
- AndroidDeployAction deployAction();
-
- bool fromMap(const QVariantMap &map);
- QVariantMap toMap() const;
-
- bool bundleQtOptionAvailable();
-
-public slots:
- void setDeployAction(AndroidDeployAction deploy);
-
-signals:
- void done();
- void error();
- void deployOptionsChanged();
-
-private slots:
- bool deployPackage();
- void handleBuildOutput();
- void handleBuildError();
- void kitUpdated(ProjectExplorer::Kit *kit);
-
-private:
- AndroidDeployStep(ProjectExplorer::BuildStepList *bc,
- AndroidDeployStep *other);
- virtual bool init();
- virtual void run(QFutureInterface<bool> &fi);
- virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
- virtual bool immutable() const { return true; }
-
- void ctor();
- void raiseError(const QString &error);
- void writeOutput(const QString &text, OutputFormat = MessageOutput);
- bool runCommand(QProcess *buildProc, const QString &program, const QStringList &arguments);
- unsigned int remoteModificationTime(const QString &fullDestination,
- QHash<QString, unsigned int> *cache);
- void collectFiles(QList<DeployItem> *deployList, const QString &localPath,
- const QString &remotePath, bool strip, const QStringList &filter = QStringList());
- void filterModificationTimes(QList<DeployItem> *deployList);
- void copyFilesToTemp(QList<DeployItem> *deployList, const QString &tempDirectory, const QString &sourcePrefix);
- void fetchRemoteModificationTimes(QList<DeployItem> *deployList);
- void stripFiles(const QList<DeployItem> &deployList, ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolchainVersion);
- void deployFiles(QProcess *process, const QList<DeployItem> &deployList);
- bool checkForQt51Files();
-
-private:
- QString m_deviceSerialNumber;
- int m_deviceAPILevel;
- QString m_targetArch;
-
- AndroidDeployAction m_deployAction;
-
- // members to transfer data from init() to run
- QString m_avdName;
- QString m_packageName;
- QString m_qtVersionSourcePath;
- bool m_signPackage;
- Utils::FileName m_androidDirPath;
- QString m_apkPathDebug;
- QString m_apkPathRelease;
- QString m_buildDirectory;
- AndroidDeployAction m_runDeployAction;
- QString m_ndkToolChainVersion;
- QString m_libgnustl;
- bool m_bundleQtAvailable;
- static const Core::Id Id;
-};
-
-} // namespace Internal
-} // namespace Android
-
-#endif // ANDROIDDEPLOYSTEP_H
diff --git a/src/plugins/android/androiddeploystepfactory.cpp b/src/plugins/android/androiddeploystepfactory.cpp
deleted file mode 100644
index b91c886e31..0000000000
--- a/src/plugins/android/androiddeploystepfactory.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "androiddeploystepfactory.h"
-
-#include "androiddeploystep.h"
-#include "androidmanager.h"
-
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/target.h>
-#include <qtsupport/qtsupportconstants.h>
-#include <qtsupport/qtkitinformation.h>
-
-#include <QCoreApplication>
-
-using namespace ProjectExplorer;
-
-namespace Android {
-namespace Internal {
-
-AndroidDeployStepFactory::AndroidDeployStepFactory(QObject *parent)
- : IBuildStepFactory(parent)
-{
-}
-
-QList<Core::Id> AndroidDeployStepFactory::availableCreationIds(BuildStepList *parent) const
-{
- if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
- return QList<Core::Id>();
- if (!AndroidManager::supportsAndroid(parent->target()))
- return QList<Core::Id>();
- if (parent->contains(AndroidDeployStep::Id))
- return QList<Core::Id>();
- QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(parent->target()->kit());
- if (qtVersion && qtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0))
- return QList<Core::Id>();
- return QList<Core::Id>() << AndroidDeployStep::Id;
-}
-
-QString AndroidDeployStepFactory::displayNameForId(Core::Id id) const
-{
- if (id == AndroidDeployStep::Id)
- return tr("Deploy to Android device or emulator");
- return QString();
-}
-
-bool AndroidDeployStepFactory::canCreate(BuildStepList *parent, Core::Id id) const
-{
- return availableCreationIds(parent).contains(id);
-}
-
-BuildStep *AndroidDeployStepFactory::create(BuildStepList *parent, Core::Id id)
-{
- Q_ASSERT(canCreate(parent, id));
- Q_UNUSED(id);
- return new AndroidDeployStep(parent);
-}
-
-bool AndroidDeployStepFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
-{
- return canCreate(parent, idFromMap(map));
-}
-
-BuildStep *AndroidDeployStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
-{
- Q_ASSERT(canRestore(parent, map));
- AndroidDeployStep * const step = new AndroidDeployStep(parent);
- if (!step->fromMap(map)) {
- delete step;
- return 0;
- }
- return step;
-}
-
-bool AndroidDeployStepFactory::canClone(BuildStepList *parent, BuildStep *product) const
-{
- return canCreate(parent, product->id());
-}
-
-BuildStep *AndroidDeployStepFactory::clone(BuildStepList *parent, BuildStep *product)
-{
- Q_ASSERT(canClone(parent, product));
- return new AndroidDeployStep(parent, static_cast<AndroidDeployStep *>(product));
-}
-
-} // namespace Internal
-} // namespace Android
diff --git a/src/plugins/android/androiddeploystepwidget.cpp b/src/plugins/android/androiddeploystepwidget.cpp
deleted file mode 100644
index 5804c65ca6..0000000000
--- a/src/plugins/android/androiddeploystepwidget.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "androiddeploystepwidget.h"
-#include "ui_androiddeploystepwidget.h"
-
-#include "androiddeploystep.h"
-#include "androidmanager.h"
-#include "androidrunconfiguration.h"
-
-#include <coreplugin/icore.h>
-
-#include <QFileDialog>
-
-namespace Android {
-namespace Internal {
-
-AndroidDeployStepWidget::AndroidDeployStepWidget(AndroidDeployStep *step) :
- ProjectExplorer::BuildStepConfigWidget(),
- ui(new Ui::AndroidDeployStepWidget),
- m_step(step)
-{
- ui->setupUi(this);
-
- deployOptionsChanged();
-
- connect(ui->ministroOption, SIGNAL(clicked()), SLOT(setMinistro()));
- connect(ui->temporaryQtOption, SIGNAL(clicked()), SLOT(setDeployLocalQtLibs()));
- connect(ui->bundleQtOption, SIGNAL(clicked()), SLOT(setBundleQtLibs()));
-
- connect(ui->chooseButton, SIGNAL(clicked()), SLOT(setQASIPackagePath()));
- connect(ui->cleanLibsPushButton, SIGNAL(clicked()), SLOT(cleanLibsOnDevice()));
- connect(ui->resetDefaultDevices, SIGNAL(clicked()), SLOT(resetDefaultDevices()));
-
- connect(m_step, SIGNAL(deployOptionsChanged()),
- this, SLOT(deployOptionsChanged()));
-}
-
-void AndroidDeployStepWidget::deployOptionsChanged()
-{
- switch (m_step->deployAction()) {
- case AndroidDeployStep::NoDeploy:
- ui->ministroOption->setChecked(true);
- break;
- case AndroidDeployStep::DeployLocal:
- ui->temporaryQtOption->setChecked(true);
- break;
- case AndroidDeployStep::BundleLibraries:
- ui->bundleQtOption->setChecked(true);
- break;
- default:
- ui->ministroOption->setChecked(true);
- break;
- }
-
- ui->bundleQtOption->setVisible(m_step->bundleQtOptionAvailable());
-}
-
-AndroidDeployStepWidget::~AndroidDeployStepWidget()
-{
- delete ui;
-}
-
-QString AndroidDeployStepWidget::displayName() const
-{
- return tr("<b>Deploy configurations</b>");
-}
-
-QString AndroidDeployStepWidget::summaryText() const
-{
- return displayName();
-}
-
-void AndroidDeployStepWidget::setMinistro()
-{
- m_step->setDeployAction(AndroidDeployStep::NoDeploy);
-}
-
-void AndroidDeployStepWidget::setDeployLocalQtLibs()
-{
- m_step->setDeployAction(AndroidDeployStep::DeployLocal);
-}
-
-void AndroidDeployStepWidget::setBundleQtLibs()
-{
- m_step->setDeployAction(AndroidDeployStep::BundleLibraries);
-}
-
-void AndroidDeployStepWidget::setQASIPackagePath()
-{
- QString packagePath =
- QFileDialog::getOpenFileName(this, tr("Qt Android Smart Installer"),
- QDir::homePath(), tr("Android package (*.apk)"));
- if (!packagePath.isEmpty())
- AndroidManager::installQASIPackage(m_step->target(), packagePath);
-}
-
-
-void AndroidDeployStepWidget::cleanLibsOnDevice()
-{
- AndroidManager::cleanLibsOnDevice(m_step->target());
-}
-
-void AndroidDeployStepWidget::resetDefaultDevices()
-{
- AndroidConfigurations::clearDefaultDevices(m_step->project());
-}
-
-} // namespace Internal
-} // namespace Android
diff --git a/src/plugins/android/androiddeploystepwidget.ui b/src/plugins/android/androiddeploystepwidget.ui
deleted file mode 100644
index 5973527807..0000000000
--- a/src/plugins/android/androiddeploystepwidget.ui
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AndroidDeployStepWidget</class>
- <widget class="QWidget" name="AndroidDeployStepWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>682</width>
- <height>183</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Qt Deployment</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QRadioButton" name="ministroOption">
- <property name="toolTip">
- <string>Uses the external Ministro application to download and maintain Qt libraries.</string>
- </property>
- <property name="text">
- <string>Use Ministro service to install Qt</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="temporaryQtOption">
- <property name="toolTip">
- <string>Pushes local Qt libraries to device. You must have Qt libraries compiled for that platform.
-The APK will not be usable on any other device.</string>
- </property>
- <property name="text">
- <string>Deploy local Qt libraries to temporary directory</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="bundleQtOption">
- <property name="toolTip">
- <string>Creates a standalone APK.</string>
- </property>
- <property name="text">
- <string>Bundle Qt libraries in APK</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Advanced Actions</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0">
- <widget class="QPushButton" name="cleanLibsPushButton">
- <property name="text">
- <string>Clean Temporary Libraries Directory on Device</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QPushButton" name="chooseButton">
- <property name="text">
- <string>Install Ministro from APK</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="0">
- <widget class="QPushButton" name="resetDefaultDevices">
- <property name="text">
- <string>Reset Default Devices</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/plugins/android/androiddevice.h b/src/plugins/android/androiddevice.h
index ae119a96c3..3456bc0b90 100644
--- a/src/plugins/android/androiddevice.h
+++ b/src/plugins/android/androiddevice.h
@@ -33,9 +33,10 @@
#include <projectexplorer/devicesupport/idevice.h>
namespace Android {
-namespace Internal {
class AndroidConfigurations; // needed for friend declaration
+namespace Internal {
+
class AndroidDevice : public ProjectExplorer::IDevice
{
public:
@@ -54,7 +55,7 @@ public:
protected:
friend class AndroidDeviceFactory;
- friend class AndroidConfigurations;
+ friend class Android::AndroidConfigurations;
AndroidDevice();
AndroidDevice(const AndroidDevice &other);
};
diff --git a/src/plugins/android/androidglobal.h b/src/plugins/android/androidglobal.h
index f8f29e1b1a..61c94085fc 100644
--- a/src/plugins/android/androidglobal.h
+++ b/src/plugins/android/androidglobal.h
@@ -32,7 +32,7 @@
#include <utils/environment.h>
-#include <projectexplorer/deployconfiguration.h>
+#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
#define ASSERT_STATE_GENERIC(State, expected, actual) \
@@ -45,17 +45,19 @@ class AndroidGlobal
{
public:
- template<class T> static T *buildStep(const ProjectExplorer::DeployConfiguration *dc)
+ template<class T> static T *buildStep(const ProjectExplorer::BuildConfiguration *dc)
{
if (!dc)
return 0;
- ProjectExplorer::BuildStepList *bsl = dc->stepList();
- if (!bsl)
- return 0;
- const QList<ProjectExplorer::BuildStep *> &buildSteps = bsl->steps();
- for (int i = buildSteps.count() - 1; i >= 0; --i) {
- if (T * const step = qobject_cast<T *>(buildSteps.at(i)))
- return step;
+ foreach (const Core::Id &id, dc->knownStepLists()) {
+ ProjectExplorer::BuildStepList *bsl = dc->stepList(id);
+ if (!bsl)
+ return 0;
+ const QList<ProjectExplorer::BuildStep *> &buildSteps = bsl->steps();
+ for (int i = buildSteps.count() - 1; i >= 0; --i) {
+ if (T * const step = qobject_cast<T *>(buildSteps.at(i)))
+ return step;
+ }
}
return 0;
}
diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp
index e6be2237d1..8ea68d46bb 100644
--- a/src/plugins/android/androidmanager.cpp
+++ b/src/plugins/android/androidmanager.cpp
@@ -31,22 +31,25 @@
#include "androiddeployconfiguration.h"
#include "androidconfigurations.h"
#include "androidrunconfiguration.h"
-#include "androiddeploystep.h"
#include "androidglobal.h"
-#include "androidpackagecreationstep.h"
#include "androidtoolchain.h"
#include "androiddeployqtstep.h"
+#include "androidqtsupport.h"
+#include "androidqtversion.h"
+#include "androidbuildapkstep.h"
#include <coreplugin/documentmanager.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/icore.h>
+
+#include <extensionsystem/pluginmanager.h>
+
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
-#include <qmakeprojectmanager/qmakenodes.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
-#include <qmakeprojectmanager/qmakebuildconfiguration.h>
+
#include <qtsupport/customexecutablerunconfiguration.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
@@ -64,126 +67,59 @@ namespace {
const QLatin1String AndroidDirName("android");
const QLatin1String AndroidManifestName("AndroidManifest.xml");
const QLatin1String AndroidLibsFileName("/res/values/libs.xml");
- const QLatin1String AndroidStringsFileName("/res/values/strings.xml");
const QLatin1String AndroidDefaultPropertiesName("project.properties");
- const QLatin1String AndroidLibraryPrefix("--Managed_by_Qt_Creator--");
-
- QString cleanPackageName(QString packageName)
- {
- QRegExp legalChars(QLatin1String("[a-zA-Z0-9_\\.]"));
-
- for (int i = 0; i < packageName.length(); ++i)
- if (!legalChars.exactMatch(packageName.mid(i, 1)))
- packageName[i] = QLatin1Char('_');
-
- static QStringList keywords;
- if (keywords.isEmpty())
- keywords << QLatin1String("abstract") << QLatin1String("continue") << QLatin1String("for")
- << QLatin1String("new") << QLatin1String("switch") << QLatin1String("assert")
- << QLatin1String("default") << QLatin1String("if") << QLatin1String("package")
- << QLatin1String("synchronized") << QLatin1String("boolean") << QLatin1String("do")
- << QLatin1String("goto") << QLatin1String("private") << QLatin1String("this")
- << QLatin1String("break") << QLatin1String("double") << QLatin1String("implements")
- << QLatin1String("protected") << QLatin1String("throw") << QLatin1String("byte")
- << QLatin1String("else") << QLatin1String("import") << QLatin1String("public")
- << QLatin1String("throws") << QLatin1String("case") << QLatin1String("enum")
- << QLatin1String("instanceof") << QLatin1String("return") << QLatin1String("transient")
- << QLatin1String("catch") << QLatin1String("extends") << QLatin1String("int")
- << QLatin1String("short") << QLatin1String("try") << QLatin1String("char")
- << QLatin1String("final") << QLatin1String("interface") << QLatin1String("static")
- << QLatin1String("void") << QLatin1String("class") << QLatin1String("finally")
- << QLatin1String("long") << QLatin1String("strictfp") << QLatin1String("volatile")
- << QLatin1String("const") << QLatin1String("float") << QLatin1String("native")
- << QLatin1String("super") << QLatin1String("while");
-
- // No keywords
- int index = -1;
- while (index != packageName.length()) {
- int next = packageName.indexOf(QLatin1Char('.'), index + 1);
- if (next == -1)
- next = packageName.length();
- QString word = packageName.mid(index + 1, next - index - 1);
- if (!word.isEmpty()) {
- QChar c = word[0];
- if (c >= QChar(QLatin1Char('0')) && c<= QChar(QLatin1Char('9'))) {
- packageName.insert(index + 1, QLatin1Char('_'));
- index = next + 1;
- continue;
- }
- }
- if (keywords.contains(word)) {
- packageName.insert(next, QLatin1String("_"));
- index = next + 1;
- } else {
- index = next;
- }
- }
+ const QLatin1String AndroidDeviceSn("AndroidDeviceSerialNumber");
-
- return packageName;
- }
} // anonymous namespace
namespace Android {
-namespace Internal {
-bool AndroidManager::supportsAndroid(ProjectExplorer::Target *target)
+using namespace Internal;
+
+class Library
{
- if (!qobject_cast<QmakeProjectManager::QmakeProject *>(target->project()))
- return false;
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
- return version && version->platformName() == QLatin1String(QtSupport::Constants::ANDROID_PLATFORM);
-}
+public:
+ Library()
+ { level = -1; }
+ int level;
+ QStringList dependencies;
+ QString name;
+};
-QString AndroidManager::packageName(ProjectExplorer::Target *target)
+typedef QMap<QString, Library> LibrariesMap;
+
+static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName);
+static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
+static QStringList libsXml(ProjectExplorer::Target *target, const QString &tag);
+
+enum ItemType
{
- QDomDocument doc;
- if (!openManifest(target, doc))
- return QString();
- QDomElement manifestElem = doc.documentElement();
- return manifestElem.attribute(QLatin1String("package"));
-}
+ Lib,
+ Jar,
+ BundledFile,
+ BundledJar
+};
+static QString loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType item, const QString &attribute=QLatin1String("file"));
-bool AndroidManager::setPackageName(ProjectExplorer::Target *target, const QString &name)
+
+bool AndroidManager::supportsAndroid(const ProjectExplorer::Kit *kit)
{
- QDomDocument doc;
- if (!openManifest(target, doc))
- return false;
- QDomElement manifestElem = doc.documentElement();
- manifestElem.setAttribute(QLatin1String("package"), cleanPackageName(name));
- return saveManifest(target, doc);
+ QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
+ return version && version->platformName() == QLatin1String(QtSupport::Constants::ANDROID_PLATFORM);
}
-QString AndroidManager::applicationName(ProjectExplorer::Target *target)
+bool AndroidManager::supportsAndroid(const ProjectExplorer::Target *target)
{
- QDomDocument doc;
- if (!openXmlFile(doc, stringsPath(target)))
- return QString();
- QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("string"));
- while (!metadataElem.isNull()) {
- if (metadataElem.attribute(QLatin1String("name")) == QLatin1String("app_name"))
- return metadataElem.text();
- metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
- }
- return QString();
+ return supportsAndroid(target->kit());
}
-bool AndroidManager::setApplicationName(ProjectExplorer::Target *target, const QString &name)
+QString AndroidManager::packageName(ProjectExplorer::Target *target)
{
QDomDocument doc;
- Utils::FileName path = stringsPath(target);
- if (!openXmlFile(doc, path))
- return false;
- QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("string"));
- while (!metadataElem.isNull()) {
- if (metadataElem.attribute(QLatin1String("name")) == QLatin1String("app_name")) {
- metadataElem.removeChild(metadataElem.firstChild());
- metadataElem.appendChild(doc.createTextNode(name));
- break;
- }
- metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
- }
- return saveXmlFile(target, doc, path);
+ if (!openManifest(target, doc))
+ return QString();
+ QDomElement manifestElem = doc.documentElement();
+ return manifestElem.attribute(QLatin1String("package"));
}
QString AndroidManager::intentName(ProjectExplorer::Target *target)
@@ -220,63 +156,33 @@ int AndroidManager::minimumSDK(ProjectExplorer::Target *target)
QString AndroidManager::buildTargetSDK(ProjectExplorer::Target *target)
{
- QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target->kit());
- if (qt && qt->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0)) {
- if (!target->activeDeployConfiguration())
- return QLatin1String("android-9");
- AndroidDeployQtStep *step = AndroidGlobal::buildStep<AndroidDeployQtStep>(target->activeDeployConfiguration());
- if (step)
- return step->buildTargetSdk();
- return QLatin1String("android-9");
- }
+ AndroidBuildApkStep *androidBuildApkStep
+ = AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
+ if (androidBuildApkStep)
+ return androidBuildApkStep->buildTargetSdk();
- QVariant v = target->namedSettings(QLatin1String("AndroidManager.TargetSdk"));
- if (v.isValid())
- return v.toString();
-
- QString fallback = QLatin1String("android-8");
- if (qt && qt->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0))
- fallback = QLatin1String("android-9");
-
- if (!createAndroidTemplatesIfNecessary(target))
- return fallback;
-
- QFile file(defaultPropertiesPath(target).toString());
- if (!file.open(QIODevice::ReadOnly))
- return fallback;
- while (!file.atEnd()) {
- QByteArray line = file.readLine();
- if (line.startsWith("target="))
- return QString::fromLatin1(line.trimmed().mid(7));
- }
+ QString fallback = AndroidConfig::apiLevelNameFor(AndroidConfigurations::currentConfig().highestAndroidSdk());
return fallback;
}
-bool AndroidManager::setBuildTargetSDK(ProjectExplorer::Target *target, const QString &sdk)
+bool AndroidManager::signPackage(ProjectExplorer::Target *target)
{
- updateTarget(target, sdk, applicationName(target));
- target->setNamedSettings(QLatin1String("AndroidManager.TargetSdk"), sdk);
- return true;
+ AndroidBuildApkStep *androidBuildApkStep
+ = AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
+ if (androidBuildApkStep)
+ return androidBuildApkStep->signPackage();
+ return false;
}
QString AndroidManager::targetArch(ProjectExplorer::Target *target)
{
- QmakeProjectManager::QmakeProject *pro = qobject_cast<QmakeProjectManager::QmakeProject *>(target->project());
- if (!pro)
- return QString();
- QmakeProjectManager::QmakeProFileNode *node = pro->rootQmakeProjectNode();
- if (!node)
- return QString();
- return node->singleVariableValue(QmakeProjectManager::AndroidArchVar);
+ AndroidQtVersion *qt = static_cast<AndroidQtVersion *>(QtSupport::QtKitInformation::qtVersion(target->kit()));
+ return qt->targetArch();
}
Utils::FileName AndroidManager::dirPath(ProjectExplorer::Target *target)
{
- QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target->kit());
- if (qtVersion && qtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0))
- return target->activeBuildConfiguration()->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY));
- Utils::FileName dir = target->project()->projectDirectory();
- return dir.appendPath(AndroidDirName);
+ return target->activeBuildConfiguration()->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY));
}
Utils::FileName AndroidManager::manifestPath(ProjectExplorer::Target *target)
@@ -289,112 +195,28 @@ Utils::FileName AndroidManager::libsPath(ProjectExplorer::Target *target)
return dirPath(target).appendPath(AndroidLibsFileName);
}
-Utils::FileName AndroidManager::stringsPath(ProjectExplorer::Target *target)
-{
- return dirPath(target).appendString(AndroidStringsFileName);
-}
-
Utils::FileName AndroidManager::defaultPropertiesPath(ProjectExplorer::Target *target)
{
return dirPath(target).appendPath(AndroidDefaultPropertiesName);
}
-Utils::FileName AndroidManager::srcPath(ProjectExplorer::Target *target)
-{
- return dirPath(target).appendPath(QLatin1String("/src"));
-}
-
-Utils::FileName AndroidManager::apkPath(ProjectExplorer::Target *target, BuildType buildType)
-{
- QString packageName = QLatin1String("QtApp");
- QString buildTypeName;
- if (buildType == DebugBuild)
- buildTypeName = QLatin1String("debug");
- else if (buildType == ReleaseBuildUnsigned)
- buildTypeName =QLatin1String("release-unsigned");
- else
- buildTypeName = QLatin1String("release");
-
- QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target->kit());
- if (!qt || qt->qtVersion() < QtSupport::QtVersionNumber(5, 2, 0)) {
- // Qt 5.1 and earlier:
- packageName = applicationName(target);
- if (buildType == ReleaseBuildSigned)
- buildTypeName = QLatin1String("signed");
- }
-
- return dirPath(target)
- .appendPath(QLatin1String("bin"))
- .appendPath(QString::fromLatin1("%1-%2.apk")
- .arg(packageName)
- .arg(buildTypeName));
-}
-
-QStringList AndroidManager::availableTargetApplications(ProjectExplorer::Target *target)
-{
- QStringList apps;
- QmakeProjectManager::QmakeProject *qmakeProject = qobject_cast<QmakeProjectManager::QmakeProject *>(target->project());
- if (!qmakeProject)
- return apps;
- foreach (QmakeProjectManager::QmakeProFileNode *proFile, qmakeProject->applicationProFiles()) {
- if (proFile->projectType() == QmakeProjectManager::ApplicationTemplate) {
- if (proFile->targetInformation().target.startsWith(QLatin1String("lib"))
- && proFile->targetInformation().target.endsWith(QLatin1String(".so")))
- apps << proFile->targetInformation().target.mid(3, proFile->targetInformation().target.lastIndexOf(QLatin1Char('.')) - 3);
- else
- apps << proFile->targetInformation().target;
- }
- }
- apps.sort();
- return apps;
-}
-
-QString AndroidManager::targetApplication(ProjectExplorer::Target *target)
-{
- QDomDocument doc;
- if (!openManifest(target, doc))
- return QString();
- QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).firstChildElement(QLatin1String("meta-data"));
- while (!metadataElem.isNull()) {
- if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.lib_name"))
- return metadataElem.attribute(QLatin1String("android:value"));
- metadataElem = metadataElem.nextSiblingElement(QLatin1String("meta-data"));
- }
- return QString();
-}
-
-// Note, this could be implemented via a base class and a couple of virtuals
-// but I intend to remove the indirection once we drop support for qt 4.8
-// and qt 5.1.
bool AndroidManager::bundleQt(ProjectExplorer::Target *target)
{
- AndroidDeployStep *androidDeployStep
- = AndroidGlobal::buildStep<AndroidDeployStep>(target->activeDeployConfiguration());
- if (androidDeployStep)
- return androidDeployStep->deployAction() == AndroidDeployStep::BundleLibraries;
-
- AndroidDeployQtStep *androidDeployQtStep
- = AndroidGlobal::buildStep<AndroidDeployQtStep>(target->activeDeployConfiguration());
- if (androidDeployQtStep)
- return androidDeployQtStep->deployAction() == AndroidDeployQtStep::BundleLibrariesDeployment;
+ AndroidBuildApkStep *androidBuildApkStep
+ = AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
+ if (androidBuildApkStep)
+ return androidBuildApkStep->deployAction() == AndroidBuildApkStep::BundleLibrariesDeployment;
return false;
}
bool AndroidManager::useLocalLibs(ProjectExplorer::Target *target)
{
- AndroidDeployStep *androidDeployStep
- = AndroidGlobal::buildStep<AndroidDeployStep>(target->activeDeployConfiguration());
- if (androidDeployStep) {
- return androidDeployStep->deployAction() == AndroidDeployStep::DeployLocal
- || androidDeployStep->deployAction() == AndroidDeployStep::BundleLibraries;
- }
-
- AndroidDeployQtStep *androidDeployQtStep
- = AndroidGlobal::buildStep<AndroidDeployQtStep>(target->activeDeployConfiguration());
- if (androidDeployQtStep) {
- return androidDeployQtStep->deployAction() == AndroidDeployQtStep::DebugDeployment
- || androidDeployQtStep->deployAction() == AndroidDeployQtStep::BundleLibrariesDeployment;
+ AndroidBuildApkStep *androidBuildApkStep
+ = AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
+ if (androidBuildApkStep) {
+ return androidBuildApkStep->deployAction() == AndroidBuildApkStep::DebugDeployment
+ || androidBuildApkStep->deployAction() == AndroidBuildApkStep::BundleLibrariesDeployment;
}
return false;
@@ -402,317 +224,12 @@ bool AndroidManager::useLocalLibs(ProjectExplorer::Target *target)
QString AndroidManager::deviceSerialNumber(ProjectExplorer::Target *target)
{
- AndroidDeployStep *androidDeployStep
- = AndroidGlobal::buildStep<AndroidDeployStep>(target->activeDeployConfiguration());
- if (androidDeployStep)
- return androidDeployStep->deviceSerialNumber();
-
- AndroidDeployQtStep *androidDeployQtStep
- = AndroidGlobal::buildStep<AndroidDeployQtStep>(target->activeDeployConfiguration());
- if (androidDeployQtStep)
- return androidDeployQtStep->deviceSerialNumber();
- return QString();
-}
-
-bool AndroidManager::updateDeploymentSettings(ProjectExplorer::Target *target)
-{
- // For Qt 4, the "use local libs" options is handled by passing command line arguments to the
- // app, so no need to alter the AndroidManifest.xml
- QtSupport::BaseQtVersion *baseQtVersion = QtSupport::QtKitInformation::qtVersion(target->kit());
- if (baseQtVersion == 0 || baseQtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
- return true;
-
- if (baseQtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0))
- return true;
-
- ProjectExplorer::RunConfiguration *runConfiguration = target->activeRunConfiguration();
- AndroidRunConfiguration *androidRunConfiguration = qobject_cast<AndroidRunConfiguration *>(runConfiguration);
- if (androidRunConfiguration == 0)
- return false;
-
- bool useLocalLibs = AndroidManager::useLocalLibs(target);
- bool bundleQtLibs = AndroidManager::bundleQt(target);
-
- QDomDocument doc;
- if (!openManifest(target, doc))
- return false;
-
- QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).firstChildElement(QLatin1String("meta-data"));
-
- // ### Passes -1 for API level, which means it won't work with setups that require
- // library selection based on API level. Use the old approach (command line argument)
- // in these cases. Hence the Qt version > 4 condition at the beginning of this function.
- QString localLibs;
- QString localJars;
- QString staticInitClasses;
- if (useLocalLibs) {
- localLibs = loadLocalLibs(target, -1);
- localJars = loadLocalJars(target, -1);
- staticInitClasses = loadLocalJarsInitClasses(target, -1);
- }
-
- bool changedManifest = false;
- while (!metadataElem.isNull()) {
- if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.use_local_qt_libs")) {
- if (metadataElem.attribute(QLatin1String("android:value")).toInt() != int(useLocalLibs)) {
- metadataElem.setAttribute(QLatin1String("android:value"), int(useLocalLibs));
- changedManifest = true;
- }
- } else if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.load_local_libs")) {
- if (metadataElem.attribute(QLatin1String("android:value")) != localLibs) {
- metadataElem.setAttribute(QLatin1String("android:value"), localLibs);
- changedManifest = true;
- }
- } else if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.load_local_jars")) {
- if (metadataElem.attribute(QLatin1String("android:value")) != localJars) {
- metadataElem.setAttribute(QLatin1String("android:value"), localJars);
- changedManifest = true;
- }
- } else if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.static_init_classes")) {
- if (metadataElem.attribute(QLatin1String("android:value")) != staticInitClasses) {
- metadataElem.setAttribute(QLatin1String("android:value"), staticInitClasses);
- changedManifest = true;
- }
- } else if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.bundle_local_qt_libs")) {
- if (metadataElem.attribute(QLatin1String("android:value")).toInt() != int(bundleQtLibs)) {
- metadataElem.setAttribute(QLatin1String("android:value"), int(bundleQtLibs));
- changedManifest = true;
- }
- }
-
- metadataElem = metadataElem.nextSiblingElement(QLatin1String("meta-data"));
- }
-
- if (changedManifest)
- return saveManifest(target, doc);
- else
- return true;
-}
-
-bool AndroidManager::setTargetApplication(ProjectExplorer::Target *target, const QString &name)
-{
- QDomDocument doc;
- if (!openManifest(target, doc))
- return false;
- QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).firstChildElement(QLatin1String("meta-data"));
- while (!metadataElem.isNull()) {
- if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.lib_name")) {
- metadataElem.setAttribute(QLatin1String("android:value"), name);
- return saveManifest(target, doc);
- }
- metadataElem = metadataElem.nextSiblingElement(QLatin1String("meta-data"));
- }
- return false;
+ return target->namedSettings(AndroidDeviceSn).toString();
}
-QString AndroidManager::targetApplicationPath(ProjectExplorer::Target *target)
+void AndroidManager::setDeviceSerialNumber(ProjectExplorer::Target *target, const QString &deviceSerialNumber)
{
- QString selectedApp = targetApplication(target);
- if (selectedApp.isEmpty())
- return QString();
- QmakeProjectManager::QmakeProject *qmakeProject = qobject_cast<QmakeProjectManager::QmakeProject *>(target->project());
- foreach (QmakeProjectManager::QmakeProFileNode *proFile, qmakeProject->applicationProFiles()) {
- if (proFile->projectType() == QmakeProjectManager::ApplicationTemplate) {
- if (proFile->targetInformation().target.startsWith(QLatin1String("lib"))
- && proFile->targetInformation().target.endsWith(QLatin1String(".so"))) {
- if (proFile->targetInformation().target.mid(3, proFile->targetInformation().target.lastIndexOf(QLatin1Char('.')) - 3)
- == selectedApp)
- return proFile->targetInformation().buildDir + QLatin1Char('/') + proFile->targetInformation().target;
- } else {
- if (proFile->targetInformation().target == selectedApp)
- return proFile->targetInformation().buildDir + QLatin1String("/lib") + proFile->targetInformation().target + QLatin1String(".so");
- }
- }
- }
- return QString();
-}
-
-bool AndroidManager::createAndroidTemplatesIfNecessary(ProjectExplorer::Target *target)
-{
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
- QmakeProjectManager::QmakeProject *qmakeProject = qobject_cast<QmakeProjectManager::QmakeProject*>(target->project());
- if (!qmakeProject || !qmakeProject->rootProjectNode() || !version)
- return false;
-
- // TODO we should create the AndroidManifest.xml file for that version
- if (version->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0))
- return true;
-
- Utils::FileName javaSrcPath
- = Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_PREFIX"))
- .appendPath(QLatin1String("src/android/java"));
- QDir projectDir(qmakeProject->projectDirectory().toString());
- Utils::FileName androidPath = dirPath(target);
-
- QStringList m_ignoreFiles;
- bool forceUpdate = false;
- QDomDocument srcVersionDoc;
- Utils::FileName srcVersionPath = javaSrcPath;
- srcVersionPath.appendPath(QLatin1String("version.xml"));
- if (openXmlFile(srcVersionDoc, srcVersionPath)) {
- QDomDocument dstVersionDoc;
- Utils::FileName dstVersionPath=androidPath;
- dstVersionPath.appendPath(QLatin1String("version.xml"));
- if (openXmlFile(dstVersionDoc, dstVersionPath))
- forceUpdate = (srcVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble()
- > dstVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble());
- else
- forceUpdate = true;
-
- if (forceUpdate && androidPath.toFileInfo().exists()) {
- QDomElement ignoreFile = srcVersionDoc.documentElement().firstChildElement(QLatin1String("ignore")).firstChildElement(QLatin1String("file"));
- while (!ignoreFile.isNull()) {
- m_ignoreFiles << ignoreFile.text();
- ignoreFile = ignoreFile.nextSiblingElement();
- }
- }
- }
-
- Utils::FileName src = androidPath;
- src.appendPath(QLatin1String("src"));
- Utils::FileName res = androidPath;
- res.appendPath(QLatin1String("res"));
-
- if (!forceUpdate && androidPath.toFileInfo().exists()
- && manifestPath(target).toFileInfo().exists()
- && src.toFileInfo().exists()
- && res.toFileInfo().exists())
- return true;
-
- forceUpdate &= androidPath.toFileInfo().exists();
-
- if (!dirPath(target).toFileInfo().exists() && !projectDir.mkdir(AndroidDirName)) {
- raiseError(tr("Error creating Android directory \"%1\".").arg(AndroidDirName));
- return false;
- }
-
- QStringList androidFiles;
- QDirIterator it(javaSrcPath.toString(), QDirIterator::Subdirectories);
- int pos = it.path().size();
- while (it.hasNext()) {
- it.next();
- if (it.fileInfo().isDir()) {
- projectDir.mkpath(AndroidDirName + it.filePath().mid(pos));
- } else {
- Utils::FileName dstFile = androidPath;
- dstFile.appendPath(it.filePath().mid(pos));
- if (m_ignoreFiles.contains(it.fileName())) {
- continue;
- } else {
- if (dstFile.toFileInfo().exists())
- QFile::remove(dstFile.toString());
- else
- androidFiles << dstFile.toString();
- }
- QFile::copy(it.filePath(), dstFile.toString());
- }
- }
- if (!androidFiles.isEmpty())
- qmakeProject->rootProjectNode()->addFiles(androidFiles);
-
- int minApiLevel = 4;
- if (QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target->kit()))
- if (qt->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0))
- minApiLevel = 9;
-
- QStringList sdks = AndroidConfig::apiLevelNamesFor(AndroidConfigurations::currentConfig().sdkTargets(minApiLevel));
- if (sdks.isEmpty()) {
- raiseError(tr("No Qt for Android SDKs were found.\nPlease install at least one SDK."));
- return false;
- }
-
- updateTarget(target, sdks.first());
- QStringList apps = availableTargetApplications(target);
- if (!apps.isEmpty())
- setTargetApplication(target, apps.at(0));
-
- QString applicationName = target->project()->displayName();
- if (!applicationName.isEmpty()) {
- setPackageName(target, packageName(target) + QLatin1Char('.') + applicationName);
- applicationName[0] = applicationName[0].toUpper();
- setApplicationName(target, applicationName);
- }
-
- if (forceUpdate)
- QMessageBox::warning(Core::ICore::dialogParent(), tr("Warning"), tr("Android files have been updated automatically."));
-
- return true;
-}
-
-void AndroidManager::updateTarget(ProjectExplorer::Target *target, const QString &targetSDK, const QString &name)
-{
- QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target->kit());
- if (qtVersion && qtVersion->qtVersion() >= QtSupport::QtVersionNumber(5,2,0))
- return;
-
- QString androidDir = dirPath(target).toString();
-
- Utils::Environment env = Utils::Environment::systemEnvironment();
- QString javaHome = AndroidConfigurations::currentConfig().openJDKLocation().toString();
- if (!javaHome.isEmpty())
- env.set(QLatin1String("JAVA_HOME"), javaHome);
- // clean previous build
- QProcess androidProc;
- androidProc.setWorkingDirectory(androidDir);
- androidProc.setProcessEnvironment(env.toProcessEnvironment());
- androidProc.start(AndroidConfigurations::currentConfig().antToolPath().toString(),
- QStringList() << QLatin1String("clean"));
- if (!androidProc.waitForFinished(-1))
- androidProc.terminate();
- // clean previous build
-
- int targetSDKNumber = targetSDK.mid(targetSDK.lastIndexOf(QLatin1Char('-')) + 1).toInt();
- bool commentLines = false;
- QDirIterator it(androidDir, QStringList() << QLatin1String("*.java"), QDir::Files, QDirIterator::Subdirectories);
- while (it.hasNext()) {
- it.next();
- QFile file(it.filePath());
- if (!file.open(QIODevice::ReadWrite))
- continue;
- QList<QByteArray> lines = file.readAll().trimmed().split('\n');
-
- bool modified = false;
- bool comment = false;
- for (int i = 0; i < lines.size(); i++) {
- QByteArray trimmed = lines[i].trimmed();
- if (trimmed.contains("@ANDROID-")) {
- commentLines = targetSDKNumber < trimmed.mid(trimmed.lastIndexOf('-') + 1).toInt();
- comment = !comment;
- continue;
- }
- if (!comment)
- continue;
- if (commentLines) {
- if (!trimmed.startsWith("//QtCreator")) {
- lines[i] = "//QtCreator " + lines[i];
- modified = true;
- }
- } else { if (trimmed.startsWith("//QtCreator")) {
- lines[i] = lines[i].mid(12);
- modified = true;
- }
- }
- }
- if (modified) {
- file.resize(0);
- foreach (const QByteArray &line, lines) {
- file.write(line);
- file.write("\n");
- }
- }
- file.close();
- }
-
- QStringList params;
- params << QLatin1String("update") << QLatin1String("project") << QLatin1String("-p") << androidDir;
- if (!targetSDK.isEmpty())
- params << QLatin1String("-t") << targetSDK;
- if (!name.isEmpty())
- params << QLatin1String("-n") << name;
- androidProc.setProcessEnvironment(AndroidConfigurations::currentConfig().androidToolEnvironment().toProcessEnvironment());
- androidProc.start(AndroidConfigurations::currentConfig().androidToolPath().toString(), params);
- if (!androidProc.waitForFinished(-1))
- androidProc.terminate();
+ target->setNamedSettings(AndroidDeviceSn, deviceSerialNumber);
}
Utils::FileName AndroidManager::localLibsRulesFilePath(ProjectExplorer::Target *target)
@@ -728,11 +245,6 @@ QString AndroidManager::loadLocalLibs(ProjectExplorer::Target *target, int apiLe
return loadLocal(target, apiLevel, Lib);
}
-QString AndroidManager::loadLocalBundledFiles(ProjectExplorer::Target *target, int apiLevel)
-{
- return loadLocal(target, apiLevel, BundledFile);
-}
-
QString AndroidManager::loadLocalJars(ProjectExplorer::Target *target, int apiLevel)
{
ItemType type = bundleQt(target) ? BundledJar : Jar;
@@ -745,17 +257,9 @@ QString AndroidManager::loadLocalJarsInitClasses(ProjectExplorer::Target *target
return loadLocal(target, apiLevel, type, QLatin1String("initClass"));
}
-QPair<int, int> AndroidManager::apiLevelRange(ProjectExplorer::Target *target)
+QPair<int, int> AndroidManager::apiLevelRange()
{
- // 4 is the minimum version on which qt is supported
- // 19 and 20 are not yet released, but allow the user
- // to set them
- int minApiLevel = 4;
- QtSupport::BaseQtVersion *qt;
- if (target && (qt = QtSupport::QtKitInformation::qtVersion(target->kit())))
- if (qt->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0))
- minApiLevel = 9;
- return qMakePair(minApiLevel, 20);
+ return qMakePair(9, 20);
}
QString AndroidManager::androidNameForApiLevel(int x)
@@ -800,155 +304,27 @@ QString AndroidManager::androidNameForApiLevel(int x)
}
}
-QVector<AndroidManager::Library> AndroidManager::availableQtLibsWithDependencies(ProjectExplorer::Target *target)
-{
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
- if (!target->activeRunConfiguration())
- return QVector<AndroidManager::Library>();
-
- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target->kit());
- if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
- return QVector<AndroidManager::Library>();
-
- QmakeProjectManager::QmakeProject *project = static_cast<QmakeProjectManager::QmakeProject *>(target->project());
- QString arch = project->rootQmakeProjectNode()->singleVariableValue(QmakeProjectManager::AndroidArchVar);
-
- AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
- QString libgnustl = libGnuStl(arch, atc->ndkToolChainVersion());
-
- Utils::FileName readelfPath = AndroidConfigurations::currentConfig().readelfPath(target->activeRunConfiguration()->abi().architecture(),
- atc->ndkToolChainVersion());
- const QmakeProjectManager::QmakeProject *const qmakeProject
- = qobject_cast<const QmakeProjectManager::QmakeProject *>(target->project());
- if (!qmakeProject || !version)
- return QVector<AndroidManager::Library>();
- QString qtLibsPath = version->qmakeProperty("QT_INSTALL_LIBS");
- if (!readelfPath.toFileInfo().exists())
- return QVector<AndroidManager::Library>();
- LibrariesMap mapLibs;
- QDir libPath;
- QDirIterator it(qtLibsPath, QStringList() << QLatin1String("*.so"), QDir::Files, QDirIterator::Subdirectories);
- while (it.hasNext()) {
- libPath = it.next();
- const QString library = libPath.absolutePath().mid(libPath.absolutePath().lastIndexOf(QLatin1Char('/')) + 1);
- mapLibs[library].dependencies = dependencies(readelfPath, libPath.absolutePath());
- }
-
- const QString library = libgnustl.mid(libgnustl.lastIndexOf(QLatin1Char('/')) + 1);
- mapLibs[library] = Library();
-
- // clean dependencies
- const LibrariesMap::Iterator lend = mapLibs.end();
- for (LibrariesMap::Iterator lit = mapLibs.begin(); lit != lend; ++lit) {
- Library &library = lit.value();
- int it = 0;
- while (it < library.dependencies.size()) {
- const QString &dependName = library.dependencies[it];
- if (!mapLibs.contains(dependName) && dependName.startsWith(QLatin1String("lib")) && dependName.endsWith(QLatin1String(".so")))
- library.dependencies.removeAt(it);
- else
- ++it;
- }
- if (library.dependencies.isEmpty())
- library.level = 0;
- }
-
- QVector<Library> qtLibraries;
- // calculate the level for every library
- for (LibrariesMap::Iterator lit = mapLibs.begin(); lit != lend; ++lit) {
- Library &library = lit.value();
- const QString &key = lit.key();
- if (library.level < 0)
- setLibraryLevel(key, mapLibs);
-
- if (library.name.isEmpty() && key.startsWith(QLatin1String("lib")) && key.endsWith(QLatin1String(".so")))
- library.name = key.mid(3, key.length() - 6);
-
- for (int it = 0; it < library.dependencies.size(); it++) {
- const QString &libName = library.dependencies[it];
- if (libName.startsWith(QLatin1String("lib")) && libName.endsWith(QLatin1String(".so")))
- library.dependencies[it] = libName.mid(3, libName.length() - 6);
- }
- qtLibraries.push_back(library);
- }
- Utils::sort(qtLibraries, [](const Library &a, const Library &b) -> bool {
- if (a.level == b.level)
- return a.name < b.name;
- return a.level < b.level;
- });
-
- return qtLibraries;
-
-}
-
-QStringList AndroidManager::availableQtLibs(ProjectExplorer::Target *target)
-{
- QStringList libs;
- QVector<Library> qtLibraries = availableQtLibsWithDependencies(target);
- foreach (Library lib, qtLibraries)
- libs.push_back(lib.name);
- return libs;
-}
-
QStringList AndroidManager::qtLibs(ProjectExplorer::Target *target)
{
return libsXml(target, QLatin1String("qt_libs"));
}
-bool AndroidManager::setQtLibs(ProjectExplorer::Target *target, const QStringList &libs)
-{
- return setLibsXml(target, libs, QLatin1String("qt_libs"));
-}
-
-bool AndroidManager::setBundledInAssets(ProjectExplorer::Target *target, const QStringList &fileList)
-{
- return setLibsXml(target, fileList, QLatin1String("bundled_in_assets"));
-}
-
-bool AndroidManager::setBundledInLib(ProjectExplorer::Target *target, const QStringList &fileList)
-{
- return setLibsXml(target, fileList, QLatin1String("bundled_in_lib"));
-}
-
-QStringList AndroidManager::availablePrebundledLibs(ProjectExplorer::Target *target)
-{
- QStringList libs;
- QmakeProjectManager::QmakeProject *qmakeProject = qobject_cast<QmakeProjectManager::QmakeProject *>(target->project());
- if (!qmakeProject)
- return libs;
-
- foreach (QmakeProjectManager::QmakeProFileNode *node, qmakeProject->allProFiles())
- if (node->projectType() == QmakeProjectManager::LibraryTemplate)
- libs << node->targetInformation().target;
- return libs;
-}
-
QStringList AndroidManager::prebundledLibs(ProjectExplorer::Target *target)
{
return libsXml(target, QLatin1String("bundled_libs"));
}
-bool AndroidManager::setPrebundledLibs(ProjectExplorer::Target *target, const QStringList &libs)
-{
- return setLibsXml(target, libs, QLatin1String("bundled_libs"));
-}
-
-bool AndroidManager::openLibsXml(ProjectExplorer::Target *target, QDomDocument &doc)
+static bool openLibsXml(ProjectExplorer::Target *target, QDomDocument &doc)
{
- return openXmlFile(doc, libsPath(target));
+ return openXmlFile(doc, AndroidManager::libsPath(target));
}
-bool AndroidManager::saveLibsXml(ProjectExplorer::Target *target, QDomDocument &doc)
+static void raiseError(const QString &reason)
{
- return saveXmlFile(target, doc, libsPath(target));
+ QMessageBox::critical(0, AndroidManager::tr("Error creating Android templates."), reason);
}
-void AndroidManager::raiseError(const QString &reason)
-{
- QMessageBox::critical(0, tr("Error creating Android templates."), reason);
-}
-
-QString AndroidManager::loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType item, const QString &attribute)
+static QString loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType item, const QString &attribute)
{
QString itemType;
if (item == Lib)
@@ -960,12 +336,12 @@ QString AndroidManager::loadLocal(ProjectExplorer::Target *target, int apiLevel,
QString localLibs;
- QDir rulesFilesDir(localLibsRulesFilePath(target).toString());
+ QDir rulesFilesDir(AndroidManager::localLibsRulesFilePath(target).toString());
if (!rulesFilesDir.exists())
return localLibs;
QStringList libs;
- libs << qtLibs(target) << prebundledLibs(target);
+ libs << AndroidManager::qtLibs(target) << AndroidManager::prebundledLibs(target);
QFileInfoList rulesFiles = rulesFilesDir.entryInfoList(QStringList() << QLatin1String("*.xml"),
QDir::Files | QDir::Readable);
@@ -1047,44 +423,25 @@ QString AndroidManager::loadLocal(ProjectExplorer::Target *target, int apiLevel,
return localLibs;
}
-bool AndroidManager::openXmlFile(QDomDocument &doc, const Utils::FileName &fileName)
+static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName)
{
QFile f(fileName.toString());
if (!f.open(QIODevice::ReadOnly))
return false;
if (!doc.setContent(f.readAll())) {
- raiseError(tr("Cannot parse \"%1\".").arg(fileName.toUserOutput()));
+ raiseError(AndroidManager::tr("Cannot parse \"%1\".").arg(fileName.toUserOutput()));
return false;
}
return true;
}
-bool AndroidManager::saveXmlFile(ProjectExplorer::Target *target, QDomDocument &doc, const Utils::FileName &fileName)
-{
- if (!createAndroidTemplatesIfNecessary(target))
- return false;
-
- QFile f(fileName.toString());
- if (!f.open(QIODevice::WriteOnly)) {
- raiseError(tr("Cannot open \"%1\".").arg(fileName.toUserOutput()));
- return false;
- }
- return f.write(doc.toByteArray(4)) >= 0;
-}
-
-bool AndroidManager::openManifest(ProjectExplorer::Target *target, QDomDocument &doc)
-{
- return openXmlFile(doc, manifestPath(target));
-}
-
-bool AndroidManager::saveManifest(ProjectExplorer::Target *target, QDomDocument &doc)
+static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc)
{
- Core::FileChangeBlocker blocker(manifestPath(target).toString());
- return saveXmlFile(target, doc, manifestPath(target));
+ return openXmlFile(doc, AndroidManager::manifestPath(target));
}
-QStringList AndroidManager::libsXml(ProjectExplorer::Target *target, const QString &tag)
+static QStringList libsXml(ProjectExplorer::Target *target, const QString &tag)
{
QStringList libs;
QDomDocument doc;
@@ -1105,94 +462,6 @@ QStringList AndroidManager::libsXml(ProjectExplorer::Target *target, const QStri
return libs;
}
-bool AndroidManager::setLibsXml(ProjectExplorer::Target *target, const QStringList &libs, const QString &tag)
-{
- QDomDocument doc;
- if (!openLibsXml(target, doc))
- return false;
- QDomElement arrayElem = doc.documentElement().firstChildElement(QLatin1String("array"));
- while (!arrayElem.isNull()) {
- if (arrayElem.attribute(QLatin1String("name")) == tag) {
- doc.documentElement().removeChild(arrayElem);
- arrayElem = doc.createElement(QLatin1String("array"));
- arrayElem.setAttribute(QLatin1String("name"), tag);
- foreach (const QString &lib, libs) {
- QDomElement item = doc.createElement(QLatin1String("item"));
- item.appendChild(doc.createTextNode(lib));
- arrayElem.appendChild(item);
- }
- doc.documentElement().appendChild(arrayElem);
- return saveLibsXml(target, doc);
- }
- arrayElem = arrayElem.nextSiblingElement(QLatin1String("array"));
- }
- return false;
-}
-
-
-QStringList AndroidManager::dependencies(const Utils::FileName &readelfPath, const QString &lib)
-{
- QStringList libs;
-
- QProcess readelfProc;
- readelfProc.start(readelfPath.toString(), QStringList() << QLatin1String("-d") << QLatin1String("-W") << lib);
-
- if (!readelfProc.waitForFinished(-1)) {
- readelfProc.kill();
- return libs;
- }
-
- QList<QByteArray> lines = readelfProc.readAll().trimmed().split('\n');
- foreach (const QByteArray &line, lines) {
- if (line.contains("(NEEDED)") && line.contains("Shared library:") ) {
- const int pos = line.lastIndexOf('[') + 1;
- libs << QString::fromLatin1(line.mid(pos, line.lastIndexOf(']') - pos));
- }
- }
- return libs;
-}
-
-int AndroidManager::setLibraryLevel(const QString &library, LibrariesMap &mapLibs)
-{
- int maxlevel = mapLibs[library].level;
- if (maxlevel > 0)
- return maxlevel;
- foreach (QString lib, mapLibs[library].dependencies) {
- foreach (const QString &key, mapLibs.keys()) {
- if (library == key)
- continue;
- if (key == lib) {
- int libLevel = mapLibs[key].level;
-
- if (libLevel < 0)
- libLevel = setLibraryLevel(key, mapLibs);
-
- if (libLevel > maxlevel)
- maxlevel = libLevel;
- break;
- }
- }
- }
- if (mapLibs[library].level < 0)
- mapLibs[library].level = maxlevel + 1;
- return maxlevel + 1;
-}
-
-QString AndroidManager::libGnuStl(const QString &arch, const QString &ndkToolChainVersion)
-{
- return AndroidConfigurations::currentConfig().ndkLocation().toString()
- + QLatin1String("/sources/cxx-stl/gnu-libstdc++/")
- + ndkToolChainVersion + QLatin1String("/libs/")
- + arch
- + QLatin1String("/libgnustl_shared.so");
-}
-
-QString AndroidManager::libraryPrefix()
-{
- return AndroidLibraryPrefix;
-}
-
-
void AndroidManager::cleanLibsOnDevice(ProjectExplorer::Target *target)
{
const QString targetArch = AndroidManager::targetArch(target);
@@ -1305,17 +574,25 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const
return proc.exitCode() == 0;
}
-bool AndroidManager::checkForQt51Files(const QString &projectDirectory)
+bool AndroidManager::checkForQt51Files(Utils::FileName fileName)
{
- Utils::FileName fileName = Utils::FileName::fromString(projectDirectory);
fileName.appendPath(QLatin1String("android")).appendPath(QLatin1String("version.xml"));
if (!fileName.toFileInfo().exists())
return false;
QDomDocument dstVersionDoc;
- if (!AndroidManager::openXmlFile(dstVersionDoc, fileName))
+ if (!openXmlFile(dstVersionDoc, fileName))
return false;
return dstVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble() < 5.2;
}
-} // namespace Internal
+AndroidQtSupport *AndroidManager::androidQtSupport(ProjectExplorer::Target *target)
+{
+ QList<AndroidQtSupport *> providerList = ExtensionSystem::PluginManager::getObjects<AndroidQtSupport>();
+ foreach (AndroidQtSupport *provider, providerList) {
+ if (provider->canHandle(target))
+ return provider;
+ }
+ return 0;
+}
+
} // namespace Android
diff --git a/src/plugins/android/androidmanager.h b/src/plugins/android/androidmanager.h
index ca5e35d63b..a738555d2b 100644
--- a/src/plugins/android/androidmanager.h
+++ b/src/plugins/android/androidmanager.h
@@ -30,53 +30,45 @@
#ifndef ANDROIDMANAGER_H
#define ANDROIDMANAGER_H
+#include "android_global.h"
#include <utils/fileutils.h>
-#include <QDomDocument>
#include <QPair>
#include <QObject>
#include <QStringList>
-namespace ProjectExplorer { class Target; }
+namespace ProjectExplorer {
+class Kit;
+class Target;
+}
namespace Android {
-namespace Internal {
-class AndroidManager : public QObject
+class AndroidQtSupport;
+
+class ANDROID_EXPORT AndroidManager : public QObject
{
Q_OBJECT
public:
- enum BuildType
- {
- DebugBuild,
- ReleaseBuildUnsigned,
- ReleaseBuildSigned
- };
- static bool supportsAndroid(ProjectExplorer::Target *target);
+ static bool supportsAndroid(const ProjectExplorer::Kit *kit);
+ static bool supportsAndroid(const ProjectExplorer::Target *target);
static QString packageName(ProjectExplorer::Target *target);
- static bool setPackageName(ProjectExplorer::Target *target, const QString &name);
-
- static QString applicationName(ProjectExplorer::Target *target);
- static bool setApplicationName(ProjectExplorer::Target *target, const QString &name);
static QString intentName(ProjectExplorer::Target *target);
static QString activityName(ProjectExplorer::Target *target);
- static QStringList availableTargetApplications(ProjectExplorer::Target *target);
- static QString targetApplication(ProjectExplorer::Target *target);
- static bool setTargetApplication(ProjectExplorer::Target *target, const QString &name);
- static QString targetApplicationPath(ProjectExplorer::Target *target);
-
- static bool updateDeploymentSettings(ProjectExplorer::Target *target);
static bool bundleQt(ProjectExplorer::Target *target);
static bool useLocalLibs(ProjectExplorer::Target *target);
static QString deviceSerialNumber(ProjectExplorer::Target *target);
+ static void setDeviceSerialNumber(ProjectExplorer::Target *target, const QString &deviceSerialNumber);
static QString buildTargetSDK(ProjectExplorer::Target *target);
- static bool setBuildTargetSDK(ProjectExplorer::Target *target, const QString &sdk);
+
+ static bool signPackage(ProjectExplorer::Target *target);
+
static int minimumSDK(ProjectExplorer::Target *target);
static QString targetArch(ProjectExplorer::Target *target);
@@ -84,84 +76,28 @@ public:
static Utils::FileName dirPath(ProjectExplorer::Target *target);
static Utils::FileName manifestPath(ProjectExplorer::Target *target);
static Utils::FileName libsPath(ProjectExplorer::Target *target);
- static Utils::FileName stringsPath(ProjectExplorer::Target *target);
static Utils::FileName defaultPropertiesPath(ProjectExplorer::Target *target);
- static Utils::FileName srcPath(ProjectExplorer::Target *target);
- static Utils::FileName apkPath(ProjectExplorer::Target *target, BuildType buildType);
-
- static bool createAndroidTemplatesIfNecessary(ProjectExplorer::Target *target);
- static void updateTarget(ProjectExplorer::Target *target, const QString &buildTargetSDK,
- const QString &name = QString());
static Utils::FileName localLibsRulesFilePath(ProjectExplorer::Target *target);
static QString loadLocalLibs(ProjectExplorer::Target *target, int apiLevel = -1);
static QString loadLocalJars(ProjectExplorer::Target *target, int apiLevel = -1);
- static QString loadLocalBundledFiles(ProjectExplorer::Target *target, int apiLevel = -1);
static QString loadLocalJarsInitClasses(ProjectExplorer::Target *target, int apiLevel = -1);
- static QPair<int, int> apiLevelRange(ProjectExplorer::Target *target);
+ static QPair<int, int> apiLevelRange();
static QString androidNameForApiLevel(int x);
- class Library
- {
- public:
- Library()
- { level = -1; }
- int level;
- QStringList dependencies;
- QString name;
- };
- typedef QMap<QString, Library> LibrariesMap;
-
- static QVector<AndroidManager::Library> availableQtLibsWithDependencies(ProjectExplorer::Target *target);
- static QStringList availableQtLibs(ProjectExplorer::Target *target);
static QStringList qtLibs(ProjectExplorer::Target *target);
- static bool setQtLibs(ProjectExplorer::Target *target, const QStringList &libs);
-
- static bool setBundledInLib(ProjectExplorer::Target *target,
- const QStringList &fileList);
- static bool setBundledInAssets(ProjectExplorer::Target *target,
- const QStringList &fileList);
-
- static QStringList availablePrebundledLibs(ProjectExplorer::Target *target);
static QStringList prebundledLibs(ProjectExplorer::Target *target);
- static bool setPrebundledLibs(ProjectExplorer::Target *target, const QStringList &libs);
-
- static QString libGnuStl(const QString &arch, const QString &ndkToolChainVersion);
- static QString libraryPrefix();
static void cleanLibsOnDevice(ProjectExplorer::Target *target);
static void installQASIPackage(ProjectExplorer::Target *target, const QString &packagePath);
static bool checkKeystorePassword(const QString &keystorePath, const QString &keystorePasswd);
static bool checkCertificatePassword(const QString &keystorePath, const QString &keystorePasswd, const QString &alias, const QString &certificatePasswd);
- static bool checkForQt51Files(const QString &projectDirectory);
-private:
- static void raiseError(const QString &reason);
- static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName);
- static bool saveXmlFile(ProjectExplorer::Target *target, QDomDocument &doc, const Utils::FileName &fileName);
- static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
- static bool saveManifest(ProjectExplorer::Target *target, QDomDocument &doc);
- static bool openLibsXml(ProjectExplorer::Target *target, QDomDocument &doc);
- static bool saveLibsXml(ProjectExplorer::Target *target, QDomDocument &doc);
- static QStringList libsXml(ProjectExplorer::Target *target, const QString &tag);
- static bool setLibsXml(ProjectExplorer::Target *target, const QStringList &libs, const QString &tag);
-
- enum ItemType
- {
- Lib,
- Jar,
- BundledFile,
- BundledJar
- };
- static QString loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType item, const QString &attribute=QLatin1String("file"));
-
- static QStringList dependencies(const Utils::FileName &readelfPath, const QString &lib);
- static int setLibraryLevel(const QString &library, LibrariesMap &mapLibs);
-
+ static bool checkForQt51Files(Utils::FileName fileName);
+ static AndroidQtSupport *androidQtSupport(ProjectExplorer::Target *target);
};
-} // namespace Internal
} // namespace Android
#endif // ANDROIDMANAGER_H
diff --git a/src/plugins/android/androidmanifestdocument.cpp b/src/plugins/android/androidmanifestdocument.cpp
index 10f5894801..0abb250292 100644
--- a/src/plugins/android/androidmanifestdocument.cpp
+++ b/src/plugins/android/androidmanifestdocument.cpp
@@ -33,16 +33,13 @@
#include <coreplugin/editormanager/ieditor.h>
-#include <QDir>
-#include <QDomDocument>
+#include <QFileInfo>
using namespace Android;
using namespace Android::Internal;
-
AndroidManifestDocument::AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget)
- : TextEditor::PlainTextDocument(),
- m_editorWidget(editorWidget)
+ : m_editorWidget(editorWidget)
{
setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
diff --git a/src/plugins/android/androidmanifestdocument.h b/src/plugins/android/androidmanifestdocument.h
index 3fa3369941..e741f5208a 100644
--- a/src/plugins/android/androidmanifestdocument.h
+++ b/src/plugins/android/androidmanifestdocument.h
@@ -30,14 +30,14 @@
#ifndef ANDROIDMANIFESTDOCUMENT_H
#define ANDROIDMANIFESTDOCUMENT_H
-#include <coreplugin/textdocument.h>
-#include <texteditor/plaintexteditor.h>
+#include <texteditor/basetexteditor.h>
namespace Android {
namespace Internal {
+
class AndroidManifestEditorWidget;
-class AndroidManifestDocument : public TextEditor::PlainTextDocument
+class AndroidManifestDocument : public TextEditor::BaseTextDocument
{
public:
explicit AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget);
diff --git a/src/plugins/android/androidmanifesteditor.cpp b/src/plugins/android/androidmanifesteditor.cpp
index 6422701ef3..a3f6f7ad54 100644
--- a/src/plugins/android/androidmanifesteditor.cpp
+++ b/src/plugins/android/androidmanifesteditor.cpp
@@ -81,7 +81,7 @@ AndroidManifestEditorWidget *AndroidManifestEditor::widget() const
Core::IDocument *AndroidManifestEditor::document()
{
- return textEditor()->baseTextDocument();
+ return textEditor()->textDocument();
}
TextEditor::BaseTextEditorWidget *AndroidManifestEditor::textEditor() const
diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp
index 061f2a94a9..9eaa74b637 100644
--- a/src/plugins/android/androidmanifesteditorwidget.cpp
+++ b/src/plugins/android/androidmanifesteditorwidget.cpp
@@ -32,22 +32,23 @@
#include "androidconstants.h"
#include "androidmanifestdocument.h"
#include "androidmanager.h"
+#include "androidqtsupport.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/infobar.h>
#include <coreplugin/editormanager/ieditor.h>
-#include <texteditor/plaintexteditor.h>
+
#include <projectexplorer/project.h>
#include <projectexplorer/projectwindow.h>
-#include <projectexplorer/iprojectproperties.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/kitinformation.h>
+
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h>
-#include <qmakeprojectmanager/qmakeproject.h>
+#include <texteditor/basetexteditor.h>
#include <utils/algorithm.h>
#include <QLineEdit>
@@ -110,6 +111,7 @@ AndroidManifestEditorWidget::AndroidManifestEditorWidget()
m_appNameInStringsXml(false)
{
m_textEditorWidget = new AndroidManifestTextEditorWidget(this);
+ m_textEditorWidget->setupAsPlainEditor();
TextEditor::TextEditorSettings::initializeEditor(m_textEditorWidget);
initializePage();
@@ -470,13 +472,13 @@ bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
void AndroidManifestEditorWidget::updateTargetComboBox()
{
- const QString docPath(m_textEditorWidget->baseTextDocument()->filePath());
+ const QString docPath(m_textEditorWidget->textDocument()->filePath());
ProjectExplorer::Project *project = androidProject(docPath);
QStringList items;
if (project) {
ProjectExplorer::Kit *kit = project->activeTarget()->kit();
if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(kit) == Constants::ANDROID_DEVICE_TYPE)
- items = AndroidManager::availableTargetApplications(project->activeTarget());
+ items = AndroidManager::androidQtSupport(project->activeTarget())->projectTargetApplications(project->activeTarget());
}
// QComboBox randomly resets what the user has entered
@@ -571,7 +573,7 @@ void AndroidManifestEditorWidget::preSave()
syncToEditor();
if (m_setAppName && m_appNameInStringsXml) {
- QString baseDir = QFileInfo(m_textEditorWidget->baseTextDocument()->filePath()).absolutePath();
+ QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QFile f(fileName);
if (f.open(QIODevice::ReadOnly)) {
@@ -595,7 +597,7 @@ void AndroidManifestEditorWidget::preSave()
m_setAppName = false;
}
- QString baseDir = QFileInfo(m_textEditorWidget->baseTextDocument()->filePath()).absolutePath();
+ QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
if (!m_lIconPath.isEmpty()) {
copyIcon(LowDPI, baseDir, m_lIconPath);
m_lIconPath.clear();
@@ -618,7 +620,7 @@ Core::IEditor *AndroidManifestEditorWidget::editor() const
return m_editor;
}
-TextEditor::PlainTextEditorWidget *AndroidManifestEditorWidget::textEditorWidget() const
+TextEditor::BaseTextEditorWidget *AndroidManifestEditorWidget::textEditorWidget() const
{
return m_textEditorWidget;
}
@@ -689,9 +691,8 @@ void AndroidManifestEditorWidget::updateInfoBar()
void AndroidManifestEditorWidget::updateSdkVersions()
{
- const QString docPath(m_textEditorWidget->baseTextDocument()->filePath());
- Project *project = androidProject(docPath);
- QPair<int, int> apiLevels = AndroidManager::apiLevelRange(project ? project->activeTarget() : 0);
+ const QString docPath(m_textEditorWidget->textDocument()->filePath());
+ QPair<int, int> apiLevels = AndroidManager::apiLevelRange();
for (int i = apiLevels.first; i < apiLevels.second + 1; ++i)
m_androidMinSdkVersion->addItem(tr("API %1: %2")
.arg(i)
@@ -707,7 +708,7 @@ void AndroidManifestEditorWidget::updateSdkVersions()
void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int line, int column)
{
- Core::InfoBar *infoBar = m_textEditorWidget->baseTextDocument()->infoBar();
+ Core::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
QString text;
if (line < 0)
text = tr("Could not parse file: \"%1\".").arg(errorMessage);
@@ -725,7 +726,7 @@ void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int
void AndroidManifestEditorWidget::hideInfoBar()
{
- Core::InfoBar *infoBar = m_textEditorWidget->baseTextDocument()->infoBar();
+ Core::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
infoBar->removeInfo(infoBarId);
m_timerParseCheck.stop();
}
@@ -764,7 +765,7 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
setApiLevel(m_androidMinSdkVersion, usesSdkElement, QLatin1String("android:minSdkVersion"));
setApiLevel(m_androidTargetSdkVersion, usesSdkElement, QLatin1String("android:targetSdkVersion"));
- QString baseDir = QFileInfo(m_textEditorWidget->baseTextDocument()->filePath()).absolutePath();
+ QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QDomElement applicationElement = manifest.firstChildElement(QLatin1String("application"));
@@ -1422,9 +1423,10 @@ int PermissionsModel::rowCount(const QModelIndex &parent) const
AndroidManifestTextEditorWidget::AndroidManifestTextEditorWidget(AndroidManifestEditorWidget *parent)
- : TextEditor::PlainTextEditorWidget(new AndroidManifestDocument(parent), parent),
+ : TextEditor::BaseTextEditorWidget(new AndroidManifestDocument(parent), parent),
m_parent(parent)
{
- baseTextDocument()->setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
+ setupAsPlainEditor();
+ textDocument()->setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
}
diff --git a/src/plugins/android/androidmanifesteditorwidget.h b/src/plugins/android/androidmanifesteditorwidget.h
index bfc016cac2..4775ba97be 100644
--- a/src/plugins/android/androidmanifesteditorwidget.h
+++ b/src/plugins/android/androidmanifesteditorwidget.h
@@ -31,7 +31,6 @@
#define ANDROIDMANIFESTEDITORWIDGET_H
#include <texteditor/basetexteditor.h>
-#include <texteditor/plaintexteditor.h>
#include <QAbstractListModel>
#include <QStackedWidget>
@@ -80,7 +79,7 @@ private:
QStringList m_permissions;
};
-class AndroidManifestTextEditorWidget : public TextEditor::PlainTextEditorWidget
+class AndroidManifestTextEditorWidget : public TextEditor::BaseTextEditorWidget
{
public:
AndroidManifestTextEditorWidget(AndroidManifestEditorWidget *parent = 0);
@@ -109,7 +108,7 @@ public:
void preSave();
Core::IEditor *editor() const;
- TextEditor::PlainTextEditorWidget *textEditorWidget() const;
+ TextEditor::BaseTextEditorWidget *textEditorWidget() const;
public slots:
void setDirty(bool dirty = true);
@@ -193,7 +192,7 @@ private:
QComboBox *m_permissionsComboBox;
QTimer m_timerParseCheck;
- TextEditor::PlainTextEditorWidget *m_textEditorWidget;
+ TextEditor::BaseTextEditorWidget *m_textEditorWidget;
QStackedWidget *m_stackedWidget;
AndroidManifestEditor *m_editor;
};
diff --git a/src/plugins/android/androidpackagecreationfactory.cpp b/src/plugins/android/androidpackagecreationfactory.cpp
deleted file mode 100644
index 0eab6b29b6..0000000000
--- a/src/plugins/android/androidpackagecreationfactory.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "androidpackagecreationfactory.h"
-
-#include "androidpackagecreationstep.h"
-#include "androidmanager.h"
-
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/target.h>
-
-#include <qtsupport/qtkitinformation.h>
-
-using namespace ProjectExplorer;
-
-namespace Android {
-namespace Internal {
-
-AndroidPackageCreationFactory::AndroidPackageCreationFactory(QObject *parent)
- : IBuildStepFactory(parent)
-{
-}
-
-QList<Core::Id> AndroidPackageCreationFactory::availableCreationIds(BuildStepList *parent) const
-{
- if (parent->id() != Constants::BUILDSTEPS_DEPLOY)
- return QList<Core::Id>();
- if (!AndroidManager::supportsAndroid(parent->target()))
- return QList<Core::Id>();
- if (parent->contains(AndroidPackageCreationStep::CreatePackageId))
- return QList<Core::Id>();
- QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(parent->target()->kit());
- if (qtVersion && qtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0))
- return QList<Core::Id>();
- return QList<Core::Id>() << AndroidPackageCreationStep::CreatePackageId;
-}
-
-QString AndroidPackageCreationFactory::displayNameForId(Core::Id id) const
-{
- if (id == AndroidPackageCreationStep::CreatePackageId)
- return tr("Create Android (.apk) Package");
- return QString();
-}
-
-bool AndroidPackageCreationFactory::canCreate(BuildStepList *parent, Core::Id id) const
-{
- return availableCreationIds(parent).contains(id);
-}
-
-BuildStep *AndroidPackageCreationFactory::create(BuildStepList *parent, Core::Id id)
-{
- Q_ASSERT(canCreate(parent, id));
- Q_UNUSED(id);
- return new AndroidPackageCreationStep(parent);
-}
-
-bool AndroidPackageCreationFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
-{
- return canCreate(parent, idFromMap(map));
-}
-
-BuildStep *AndroidPackageCreationFactory::restore(BuildStepList *parent, const QVariantMap &map)
-{
- Q_ASSERT(canRestore(parent, map));
- AndroidPackageCreationStep *const step = new AndroidPackageCreationStep(parent);
- if (!step->fromMap(map)) {
- delete step;
- return 0;
- }
- return step;
-}
-
-bool AndroidPackageCreationFactory::canClone(BuildStepList *parent, BuildStep *product) const
-{
- return canCreate(parent, product->id());
-}
-
-BuildStep *AndroidPackageCreationFactory::clone(BuildStepList *parent, BuildStep *product)
-{
- Q_ASSERT(canClone(parent, product));
- return new AndroidPackageCreationStep(parent, static_cast<AndroidPackageCreationStep *>(product));
-}
-
-} // namespace Internal
-} // namespace Android
diff --git a/src/plugins/android/androidpackagecreationstep.cpp b/src/plugins/android/androidpackagecreationstep.cpp
deleted file mode 100644
index b67426574c..0000000000
--- a/src/plugins/android/androidpackagecreationstep.cpp
+++ /dev/null
@@ -1,883 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "androidpackagecreationstep.h"
-
-#include "androidconstants.h"
-#include "androiddeploystep.h"
-#include "androidglobal.h"
-#include "androidpackagecreationwidget.h"
-#include "androidmanager.h"
-#include "androidgdbserverkitinformation.h"
-#include "androidtoolchain.h"
-#include "certificatesmodel.h"
-
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/runconfiguration.h>
-#include <projectexplorer/target.h>
-#include <qmakeprojectmanager/qmakebuildconfiguration.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakenodes.h>
-#include <qtsupport/qtkitinformation.h>
-
-#include <coreplugin/icore.h>
-#include <coreplugin/fileutils.h>
-
-#include <QAbstractListModel>
-#include <QProcess>
-#include <QVector>
-#include <QPair>
-#include <QWidget>
-#include <QMessageBox>
-#include <QInputDialog>
-#include <QMainWindow>
-
-using namespace ProjectExplorer;
-using namespace ProjectExplorer::Constants;
-
-namespace Android {
-namespace Internal {
-
-namespace {
- const QLatin1String KeystoreLocationKey("KeystoreLocation");
- const QLatin1String SignPackageKey("SignPackage");
- const QLatin1String AliasString("Alias name:");
- const QLatin1String CertificateSeparator("*******************************************");
-}
-
-using namespace QmakeProjectManager;
-
-AndroidPackageCreationStep::AndroidPackageCreationStep(BuildStepList *bsl)
- : BuildStep(bsl, CreatePackageId)
-{
- ctor();
-}
-
-AndroidPackageCreationStep::AndroidPackageCreationStep(BuildStepList *bsl,
- AndroidPackageCreationStep *other)
- : BuildStep(bsl, other)
-{
- ctor();
-}
-
-void AndroidPackageCreationStep::ctor()
-{
- setDefaultDisplayName(tr("Packaging for Android"));
- m_openPackageLocation = true;
- m_bundleQt = false;
- m_signPackage = false;
- connect(&m_outputParser, SIGNAL(addTask(ProjectExplorer::Task)), this, SIGNAL(addTask(ProjectExplorer::Task)));
-}
-
-bool AndroidPackageCreationStep::init()
-{
- const QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration());
- if (!bc) {
- raiseError(tr("Cannot create Android package: current build configuration is not Qt 4."));
- return false;
- }
- QmakeProject *project = static_cast<QmakeProject *>(target()->project());
- m_outputParser.setProjectFileList(project->files(Project::AllFiles));
-
- // Copying
- m_androidDir = AndroidManager::dirPath(target());
- Utils::FileName path = m_androidDir;
- QString androidTargetArch = project->rootQmakeProjectNode()->singleVariableValue(QmakeProjectManager::AndroidArchVar);
- if (androidTargetArch.isEmpty()) {
- raiseError(tr("Cannot create Android package: No ANDROID_TARGET_ARCH set in make spec."));
- return false;
- }
-
- Utils::FileName androidLibPath = path.appendPath(QLatin1String("libs/") + androidTargetArch);
- m_gdbServerDestination = androidLibPath.appendPath(QLatin1String("gdbserver"));
- m_gdbServerSource = AndroidGdbServerKitInformation::gdbServer(target()->kit());
-
- if (!AndroidManager::createAndroidTemplatesIfNecessary(target()))
- return false;
-
- AndroidManager::updateTarget(target(), AndroidManager::buildTargetSDK(target()), AndroidManager::applicationName(target()));
- m_antToolPath = AndroidConfigurations::currentConfig().antToolPath();
- m_apkPathUnsigned = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildUnsigned);
- m_apkPathSigned = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildSigned);
- m_signPackageForRun = m_signPackage;
- m_keystorePathForRun = m_keystorePath;
- m_certificatePasswdForRun = m_certificatePasswd;
- m_jarSigner = AndroidConfigurations::currentConfig().jarsignerPath();
- m_zipAligner = AndroidConfigurations::currentConfig().zipalignPath();
- m_environment = bc->environment();
-
- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
- if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
- return false;
-
- initCheckRequiredLibrariesForRun();
-
- if (m_signPackage && (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild))
- emit addOutput(tr("Warning: Signing a debug package."), BuildStep::ErrorMessageOutput);
-
- return true;
-}
-
-void AndroidPackageCreationStep::run(QFutureInterface<bool> &fi)
-{
- fi.reportResult(createPackage());
-}
-
-BuildStepConfigWidget *AndroidPackageCreationStep::createConfigWidget()
-{
- return new AndroidPackageCreationWidget(this);
-}
-
-static inline QString msgCannotFindElfInformation()
-{
- return AndroidPackageCreationStep::tr("Cannot find ELF information");
-}
-
-static inline QString msgCannotFindExecutable(const QString &appPath)
-{
- return AndroidPackageCreationStep::tr("Cannot find \"%1\".\n"
- "Please make sure your application is "
- "built successfully and is selected in Application tab ('Run option').").arg(appPath);
-}
-
-static void parseSharedLibs(const QByteArray &buffer, QStringList *libs)
-{
-#if defined(_WIN32)
- QList<QByteArray> lines = buffer.trimmed().split('\r');
-#else
- QList<QByteArray> lines = buffer.trimmed().split('\n');
-#endif
- foreach (const QByteArray &line, lines) {
- if (line.contains("(NEEDED)") && line.contains("Shared library:") ) {
- const int pos = line.lastIndexOf('[') + 1;
- (*libs) << QString::fromLatin1(line.mid(pos, line.length() - pos - 1));
- }
- }
-}
-
-void markNeeded(const QString &library,
- const QVector<AndroidManager::Library> &dependencies,
- QMap<QString, bool> *neededMap)
-{
- if (!neededMap->contains(library))
- return;
- if (neededMap->value(library))
- return;
- neededMap->insert(library, true);
- for (int i = 0; i < dependencies.size(); ++i) {
- if (dependencies.at(i).name == library) {
- foreach (const QString &dependency, dependencies.at(i).dependencies)
- markNeeded(dependency, dependencies, neededMap);
- break;
- }
- }
-}
-
-QStringList requiredLibraries(QVector<AndroidManager::Library> availableLibraries,
- const QStringList &checkedLibs, const QStringList &dependencies)
-{
- QMap<QString, bool> neededLibraries;
- QVector<AndroidManager::Library>::const_iterator it, end;
- it = availableLibraries.constBegin();
- end = availableLibraries.constEnd();
-
- for (; it != end; ++it)
- neededLibraries[(*it).name] = false;
-
- // Checked items are always needed
- foreach (const QString &lib, checkedLibs)
- markNeeded(lib, availableLibraries, &neededLibraries);
-
- foreach (const QString &lib, dependencies) {
- if (lib.startsWith(QLatin1String("lib"))
- && lib.endsWith(QLatin1String(".so")))
- markNeeded(lib.mid(3, lib.size() - 6), availableLibraries, &neededLibraries);
- }
-
- for (int i = availableLibraries.size() - 1; i>= 0; --i)
- if (!neededLibraries.value(availableLibraries.at(i).name))
- availableLibraries.remove(i);
-
- QStringList requiredLibraries;
- foreach (const AndroidManager::Library &lib, availableLibraries) {
- if (neededLibraries.value(lib.name))
- requiredLibraries << lib.name;
- }
- return requiredLibraries;
-}
-
-void AndroidPackageCreationStep::checkRequiredLibraries()
-{
- QProcess readelfProc;
- QString appPath = AndroidManager::targetApplicationPath(target());
- if (!QFile::exists(appPath)) {
- raiseError(msgCannotFindElfInformation(), msgCannotFindExecutable(appPath));
- return;
- }
-
- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
- if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
- return;
- AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
-
- readelfProc.start(AndroidConfigurations::currentConfig().readelfPath(target()->activeRunConfiguration()->abi().architecture(), atc->ndkToolChainVersion()).toString(),
- QStringList() << QLatin1String("-d") << QLatin1String("-W") << appPath);
- if (!readelfProc.waitForFinished(-1)) {
- readelfProc.kill();
- return;
- }
- QStringList libs;
- parseSharedLibs(readelfProc.readAll(), &libs);
- AndroidManager::setQtLibs(target(), requiredLibraries(AndroidManager::availableQtLibsWithDependencies(target()),
- AndroidManager::qtLibs(target()), libs));
- emit updateRequiredLibrariesModels();
-}
-
-void AndroidPackageCreationStep::initCheckRequiredLibrariesForRun()
-{
- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
- if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
- return;
- AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
-
- m_appPath = Utils::FileName::fromString(AndroidManager::targetApplicationPath(target()));
- m_readElf = AndroidConfigurations::currentConfig().readelfPath(target()->activeRunConfiguration()->abi().architecture(),
- atc->ndkToolChainVersion());
- m_qtLibs = AndroidManager::qtLibs(target());
- m_availableQtLibs = AndroidManager::availableQtLibsWithDependencies(target());
- m_prebundledLibs = AndroidManager::prebundledLibs(target());
-}
-
-void AndroidPackageCreationStep::getBundleInformation()
-{
- m_bundleQt = AndroidManager::bundleQt(target());
- if (m_bundleQt) {
- m_bundledJars = AndroidManager::loadLocalJars(target()).split(QLatin1Char(':'),
- QString::SkipEmptyParts);
- m_otherBundledFiles = AndroidManager::loadLocalBundledFiles(target()).split(QLatin1Char(':'),
- QString::SkipEmptyParts);
- }
-}
-
-void AndroidPackageCreationStep::checkRequiredLibrariesForRun()
-{
- QProcess readelfProc;
- if (!m_appPath.toFileInfo().exists()) {
- raiseError(msgCannotFindElfInformation(), msgCannotFindExecutable(m_appPath.toUserOutput()));
- return;
- }
- readelfProc.start(m_readElf.toString(), QStringList() << QLatin1String("-d") << QLatin1String("-W") << m_appPath.toUserOutput());
- if (!readelfProc.waitForFinished(-1)) {
- readelfProc.kill();
- return;
- }
- QStringList libs;
- parseSharedLibs(readelfProc.readAll(), &libs);
-
- m_qtLibsWithDependencies = requiredLibraries(m_availableQtLibs, m_qtLibs, libs);
- QMetaObject::invokeMethod(this, "setQtLibs",Qt::BlockingQueuedConnection,
- Q_ARG(QStringList, m_qtLibsWithDependencies));
-
- QMetaObject::invokeMethod(this, "getBundleInformation", Qt::BlockingQueuedConnection);
-
- emit updateRequiredLibrariesModels();
-}
-
-void AndroidPackageCreationStep::setQtLibs(const QStringList &qtLibs)
-{
- AndroidManager::setQtLibs(target(), qtLibs);
-}
-
-void AndroidPackageCreationStep::setPrebundledLibs(const QStringList &prebundledLibs)
-{
- AndroidManager::setPrebundledLibs(target(), prebundledLibs);
-}
-
-Utils::FileName AndroidPackageCreationStep::keystorePath()
-{
- return m_keystorePath;
-}
-
-void AndroidPackageCreationStep::setKeystorePath(const Utils::FileName &path)
-{
- m_keystorePath = path;
- m_certificatePasswd.clear();
- m_keystorePasswd.clear();
-}
-
-void AndroidPackageCreationStep::setKeystorePassword(const QString &pwd)
-{
- m_keystorePasswd = pwd;
-}
-
-void AndroidPackageCreationStep::setCertificateAlias(const QString &alias)
-{
- m_certificateAlias = alias;
-}
-
-void AndroidPackageCreationStep::setCertificatePassword(const QString &pwd)
-{
- m_certificatePasswd = pwd;
-}
-
-void AndroidPackageCreationStep::setOpenPackageLocation(bool open)
-{
- m_openPackageLocation = open;
-}
-
-QAbstractItemModel *AndroidPackageCreationStep::keystoreCertificates()
-{
- QString rawCerts;
- QProcess keytoolProc;
- while (!rawCerts.length() || !m_keystorePasswd.length()) {
- QStringList params;
- params << QLatin1String("-list") << QLatin1String("-v") << QLatin1String("-keystore") << m_keystorePath.toUserOutput() << QLatin1String("-storepass");
- if (!m_keystorePasswd.length())
- keystorePassword();
- if (!m_keystorePasswd.length())
- return 0;
- params << m_keystorePasswd;
- params << QLatin1String("-J-Duser.language=en");
- keytoolProc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), params);
- if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
- QMessageBox::critical(0, tr("Error"),
- tr("Failed to run keytool"));
- return 0;
- }
-
- if (keytoolProc.exitCode()) {
- QMessageBox::critical(0, tr("Error"),
- tr("Invalid password"));
- m_keystorePasswd.clear();
- }
- rawCerts = QString::fromLatin1(keytoolProc.readAllStandardOutput());
- }
- return new CertificatesModel(rawCerts, this);
-}
-
-bool AndroidPackageCreationStep::signPackage() const
-{
- return m_signPackage;
-}
-
-void AndroidPackageCreationStep::setSignPackage(bool b)
-{
- m_signPackage = b;
-}
-
-bool AndroidPackageCreationStep::fromMap(const QVariantMap &map)
-{
- if (!BuildStep::fromMap(map))
- return false;
- m_keystorePath = Utils::FileName::fromString(map.value(KeystoreLocationKey).toString());
- m_signPackage = map.value(SignPackageKey).toBool();
- return true;
-}
-
-QVariantMap AndroidPackageCreationStep::toMap() const
-{
- QVariantMap map(BuildStep::toMap());
- map.insert(KeystoreLocationKey, m_keystorePath.toString());
- map.insert(SignPackageKey, m_signPackage);
- return map;
-}
-
-QStringList AndroidPackageCreationStep::collectRelativeFilePaths(const QString &parentPath)
-{
- QStringList relativeFilePaths;
-
- QDirIterator libsIt(parentPath, QDir::NoFilter, QDirIterator::Subdirectories);
- int pos = parentPath.size();
- while (libsIt.hasNext()) {
- libsIt.next();
- if (!libsIt.fileInfo().isDir())
- relativeFilePaths.append(libsIt.filePath().mid(pos));
- }
-
- return relativeFilePaths;
-}
-
-void AndroidPackageCreationStep::collectFiles(QList<DeployItem> *deployList,
- QList<DeployItem> *pluginsAndImportsList)
-{
- Q_ASSERT(deployList != 0);
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
- if (!version)
- return;
-
- QmakeProject *project = static_cast<QmakeProject *>(target()->project());
- QString androidTargetArch = project->rootQmakeProjectNode()->singleVariableValue(QmakeProjectManager::AndroidArchVar);
-
- QString androidAssetsPath = m_androidDir.toString() + QLatin1String("/assets/");
- QString androidJarPath = m_androidDir.toString() + QLatin1String("/libs/");
- QString androidLibPath = m_androidDir.toString() + QLatin1String("/libs/") + androidTargetArch;
-
- QString qtVersionSourcePath = version->sourcePath().toString();
-
- foreach (QString qtLib, m_qtLibsWithDependencies) {
- QString fullPath = qtVersionSourcePath
- + QLatin1String("/lib/lib")
- + qtLib
- + QLatin1String(".so");
- QString destinationPath = androidLibPath
- + QLatin1String("/lib")
- + qtLib
- + QLatin1String(".so");
-
- // If the Qt lib/ folder contains libgnustl_shared.so, don't deploy it from there, since
- // it will be deployed directly from the NDK instead.
- if (qtLib != QLatin1String("gnustl_shared")) {
- DeployItem deployItem(fullPath, 0, destinationPath, true);
- deployList->append(deployItem);
- }
- }
-
- if (!androidTargetArch.isEmpty()) {
- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
- if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
- return;
-
- AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
-
- QString libgnustl = AndroidManager::libGnuStl(androidTargetArch, atc->ndkToolChainVersion());
- DeployItem deployItem(libgnustl, 0, androidLibPath + QLatin1String("/libgnustl_shared.so"), false);
- deployList->append(deployItem);
- }
-
- foreach (QString jar, m_bundledJars) {
- QString fullPath = qtVersionSourcePath + QLatin1Char('/') + jar;
- QFileInfo fileInfo(fullPath);
- if (fileInfo.exists()) {
- QString destinationPath = androidJarPath
- + AndroidManager::libraryPrefix()
- + fileInfo.fileName();
- deployList->append(DeployItem(fullPath, 0, destinationPath, true));
- }
- }
-
- QSet<QString> alreadyListed;
- foreach (QString bundledFile, m_otherBundledFiles) {
- QStringList allFiles;
- if (QFileInfo(qtVersionSourcePath + QLatin1Char('/') + bundledFile).isDir()) {
- if (!bundledFile.endsWith(QLatin1Char('/')))
- bundledFile.append(QLatin1Char('/'));
-
- allFiles = collectRelativeFilePaths(qtVersionSourcePath + QLatin1Char('/') + bundledFile);
- } else {
- // If we need to bundle a specific file, we just add an empty string and the file
- // names and data will be prepared correctly in the loop below.
- allFiles = QStringList(QString());
- }
-
- foreach (QString file, allFiles) {
- QString fullPath = qtVersionSourcePath + QLatin1Char('/') + bundledFile + file;
- if (alreadyListed.contains(fullPath))
- continue;
-
- alreadyListed.insert(fullPath);
-
- QString garbledFileName;
- QString destinationPath;
- bool shouldStrip = false;
-
- QString fullFileName = bundledFile + file;
- if (fullFileName.endsWith(QLatin1String(".so"))) {
- if (fullFileName.startsWith(QLatin1String("lib/"))) {
- // Special case when the destination folder is lib/
- // Since this is also the source folder, there is no need to garble the file
- // name and copy it. We also won't have write access to this folder, so we
- // couldn't if we wanted to.
- garbledFileName = fullFileName.mid(sizeof("lib/") - 1);
- } else {
- garbledFileName = QLatin1String("lib")
- + AndroidManager::libraryPrefix()
- + QString(fullFileName).replace(QLatin1Char('/'), QLatin1Char('_'));
- }
- destinationPath = androidLibPath + QLatin1Char('/') + garbledFileName;
- shouldStrip = true;
- } else {
- garbledFileName = AndroidManager::libraryPrefix() + QLatin1Char('/') + fullFileName;
- destinationPath = androidAssetsPath + garbledFileName;
- }
-
- deployList->append(DeployItem(fullPath, 0, destinationPath, shouldStrip));
- pluginsAndImportsList->append(DeployItem(garbledFileName,
- 0,
- fullFileName,
- shouldStrip));
- }
- }
-}
-
-void AndroidPackageCreationStep::removeManagedFilesFromPackage(const Utils::FileName &qtLibraryDir)
-{
- // Clean up all files managed by Qt Creator
- {
- QString androidLibPath = m_androidDir.toString() + QLatin1String("/libs/");
- QDirIterator dirIt(m_androidDir.toString(), QDirIterator::Subdirectories);
- while (dirIt.hasNext()) {
- dirIt.next();
-
- if (!dirIt.fileInfo().isDir()) {
- bool isQtLibrary = dirIt.fileInfo().path().startsWith(androidLibPath)
- && dirIt.fileName().startsWith(QLatin1String("libQt5"))
- && dirIt.fileName().endsWith(QLatin1String(".so"));
-
- if (isQtLibrary) {
- Utils::FileName qtLibraryFile = qtLibraryDir;
- qtLibraryFile.appendPath(dirIt.fileName());
- isQtLibrary = qtLibraryFile.toFileInfo().exists();
- }
-
- if (dirIt.filePath().contains(AndroidManager::libraryPrefix()) || isQtLibrary)
- QFile::remove(dirIt.filePath());
- }
- }
- }
-
- removeDirectory(m_androidDir.toString() + QLatin1String("/assets/") + AndroidManager::libraryPrefix());
-}
-
-void AndroidPackageCreationStep::copyFilesIntoPackage(const QList<DeployItem> &deployList)
-{
- foreach (DeployItem item, deployList) {
- QFileInfo info(item.remoteFileName);
- if (info.exists())
- QFile::remove(item.remoteFileName);
- else
- QDir().mkpath(info.absolutePath());
-
- QFile::copy(item.localFileName, item.remoteFileName);
- }
-}
-
-void AndroidPackageCreationStep::stripFiles(const QList<DeployItem> &deployList)
-{
-
- QStringList fileList;
- foreach (DeployItem item, deployList)
- if (item.needsStrip)
- fileList.append(item.remoteFileName);
-
- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
- if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
- return;
-
- AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
- stripAndroidLibs(fileList,
- target()->activeRunConfiguration()->abi().architecture(),
- atc->ndkToolChainVersion());
-}
-
-void AndroidPackageCreationStep::updateXmlForFiles(const QStringList &inLibList,
- const QStringList &inAssetsList)
-{
- AndroidManager::setBundledInLib(target(), inLibList);
- AndroidManager::setBundledInAssets(target(), inAssetsList);
-}
-
-
-bool AndroidPackageCreationStep::createPackage()
-{
- checkRequiredLibrariesForRun();
-
- emit addOutput(tr("Copy Qt app & libs to Android package ..."), MessageOutput);
-
- QStringList build;
- // build << QLatin1String("-silent"); //TODO depends on ant 1.9.0, enabled, not *now*
- build << QLatin1String("clean");
- QFile::remove(m_gdbServerDestination.toString());
- if (m_signPackageForRun) {
- build << QLatin1String("release");
- } else {
- build << QLatin1String("debug");
- QDir dir;
- dir.mkpath(m_gdbServerDestination.toFileInfo().absolutePath());
- if (!QFile::copy(m_gdbServerSource.toString(), m_gdbServerDestination.toString())) {
- raiseError(tr("Can't copy gdbserver from \"%1\" to \"%2\"").arg(m_gdbServerSource.toUserOutput())
- .arg(m_gdbServerDestination.toUserOutput()));
- return false;
- }
- }
-
- QList<DeployItem> deployFiles;
- QList<DeployItem> importsAndPlugins;
-
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
-
- // Qt 5 supports bundling libraries inside the apk. We guard the code for Qt 5 to be sure we
- // do not disrupt existing projects.
- if (version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0)) {
- bool bundleQt = AndroidManager::bundleQt(target());
-
- // Collect the files to bundle in the package
- if (bundleQt)
- collectFiles(&deployFiles, &importsAndPlugins);
-
- // Remove files from package if they are not needed
- removeManagedFilesFromPackage(version->libraryPath());
-
- // Deploy files to package
- if (bundleQt) {
- copyFilesIntoPackage(deployFiles);
- stripFiles(deployFiles);
-
- QStringList inLibList;
- QStringList inAssetsList;
- foreach (DeployItem deployItem, importsAndPlugins) {
- QString conversionInfo = deployItem.localFileName
- + QLatin1Char(':')
- + deployItem.remoteFileName;
-
- if (deployItem.localFileName.endsWith(QLatin1String(".so")))
- inLibList.append(conversionInfo);
- else
- inAssetsList.append(conversionInfo);
- }
-
- QMetaObject::invokeMethod(this,
- "updateXmlForFiles",
- Qt::BlockingQueuedConnection,
- Q_ARG(QStringList, inLibList),
- Q_ARG(QStringList, inAssetsList));
- }
- }
-
- emit addOutput(tr("Creating package file ..."), MessageOutput);
-
- QProcess *const buildProc = new QProcess;
- buildProc->setProcessEnvironment(m_environment.toProcessEnvironment());
-
- connect(buildProc, SIGNAL(readyReadStandardOutput()), this,
- SLOT(handleBuildStdOutOutput()), Qt::DirectConnection);
- connect(buildProc, SIGNAL(readyReadStandardError()), this,
- SLOT(handleBuildStdErrOutput()), Qt::DirectConnection);
-
- buildProc->setWorkingDirectory(m_androidDir.toString());
-
- if (!runCommand(buildProc, m_antToolPath.toString(), build)) {
- disconnect(buildProc, 0, this, 0);
- buildProc->deleteLater();
- return false;
- }
-
- if (m_signPackageForRun) {
- emit addOutput(tr("Signing package ..."), MessageOutput);
- while (true) {
- if (m_certificatePasswdForRun.isEmpty())
- QMetaObject::invokeMethod(this, "certificatePassword", Qt::BlockingQueuedConnection);
-
- if (m_certificatePasswdForRun.isEmpty()) {
- disconnect(buildProc, 0, this, 0);
- buildProc->deleteLater();
- return false;
- }
-
- QByteArray keyPass = m_certificatePasswdForRun.toUtf8();
- build.clear();
- build << QLatin1String("-verbose") << QLatin1String("-digestalg") << QLatin1String("SHA1")
- << QLatin1String("-sigalg") << QLatin1String("MD5withRSA")
- << QLatin1String("-keystore") << m_keystorePathForRun.toUserOutput()
- << QLatin1String("-storepass") << m_keystorePasswd
- << m_apkPathUnsigned.toUserOutput()
- << m_certificateAlias;
- buildProc->start(m_jarSigner.toString(), build);
- if (!buildProc->waitForStarted()) {
- disconnect(buildProc, 0, this, 0);
- buildProc->deleteLater();
- return false;
- }
-
- keyPass += '\n';
- buildProc->write(keyPass);
- buildProc->waitForBytesWritten();
- buildProc->waitForFinished();
-
- if (!buildProc->exitCode())
- break;
- emit addOutput(tr("Failed, try again"), ErrorMessageOutput);
- m_certificatePasswdForRun.clear();
- }
- build.clear();
- build << QLatin1String("-f") << QLatin1String("-v") << QLatin1String("4") << m_apkPathUnsigned.toString() << m_apkPathSigned.toString();
- buildProc->start(m_zipAligner.toString(), build);
- buildProc->waitForFinished();
- if (!buildProc->exitCode()) {
- QFile::remove(m_apkPathUnsigned.toString());
- emit addOutput(tr("Release signed package created to %1")
- .arg(m_apkPathSigned.toUserOutput())
- , MessageOutput);
-
- if (m_openPackageLocation)
- QMetaObject::invokeMethod(this, "showInGraphicalShell", Qt::QueuedConnection);
- }
- }
- emit addOutput(tr("Package created."), BuildStep::MessageOutput);
- disconnect(buildProc, 0, this, 0);
- buildProc->deleteLater();
- return true;
-}
-
-void AndroidPackageCreationStep::stripAndroidLibs(const QStringList & files, Abi::Architecture architecture, const QString &ndkToolchainVersion)
-{
- QProcess stripProcess;
- foreach (const QString &file, files) {
- stripProcess.start(AndroidConfigurations::currentConfig().stripPath(architecture, ndkToolchainVersion).toString(),
- QStringList()<<QLatin1String("--strip-unneeded") << file);
- stripProcess.waitForStarted();
- if (!stripProcess.waitForFinished())
- stripProcess.kill();
- }
-}
-
-bool AndroidPackageCreationStep::removeDirectory(const QString &dirPath)
-{
- QDir dir(dirPath);
- if (!dir.exists())
- return true;
-
- const QStringList &files
- = dir.entryList(QDir::Files | QDir::Hidden | QDir::System);
- foreach (const QString &fileName, files) {
- if (!dir.remove(fileName))
- return false;
- }
-
- const QStringList &subDirs
- = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
- foreach (const QString &subDirName, subDirs) {
- if (!removeDirectory(dirPath + QLatin1Char('/') + subDirName))
- return false;
- }
-
- return dir.rmdir(dirPath);
-}
-
-bool AndroidPackageCreationStep::runCommand(QProcess *buildProc
- , const QString &program, const QStringList &arguments)
-{
- emit addOutput(tr("Package deploy: Running command '%1 %2'.").arg(program).arg(arguments.join(QLatin1String(" "))), BuildStep::MessageOutput);
- buildProc->start(program, arguments);
- if (!buildProc->waitForStarted()) {
- raiseError(tr("Packaging failed."),
- tr("Packaging error: Could not start command '%1 %2'. Reason: %3")
- .arg(program).arg(arguments.join(QLatin1String(" "))).arg(buildProc->errorString()));
- return false;
- }
- buildProc->waitForFinished(-1);
-
- handleProcessOutput(buildProc, false);
- handleProcessOutput(buildProc, true);
-
- if (buildProc->error() != QProcess::UnknownError
- || buildProc->exitCode() != 0) {
- QString mainMessage = tr("Packaging Error: Command '%1 %2' failed.")
- .arg(program).arg(arguments.join(QLatin1String(" ")));
- if (buildProc->error() != QProcess::UnknownError)
- mainMessage += QLatin1Char(' ') + tr("Reason: %1").arg(buildProc->errorString());
- else
- mainMessage += tr("Exit code: %1").arg(buildProc->exitCode());
- raiseError(mainMessage);
- return false;
- }
- return true;
-}
-
-void AndroidPackageCreationStep::handleBuildStdOutOutput()
-{
- QProcess *const process = qobject_cast<QProcess *>(sender());
- if (!process)
- return;
- handleProcessOutput(process, false);
-}
-
-void AndroidPackageCreationStep::handleBuildStdErrOutput()
-{
- QProcess *const process = qobject_cast<QProcess *>(sender());
- if (!process)
- return;
-
- handleProcessOutput(process, true);
-}
-
-void AndroidPackageCreationStep::handleProcessOutput(QProcess *process, bool stdErr)
-{
- process->setReadChannel(stdErr ? QProcess::StandardError : QProcess::StandardOutput);
- while (process->canReadLine()) {
- QString line = QString::fromLocal8Bit(process->readLine());
- if (stdErr)
- m_outputParser.stdError(line);
- else
- m_outputParser.stdOutput(line);
- emit addOutput(line, stdErr ? BuildStep::ErrorOutput
- : BuildStep::NormalOutput,
- BuildStep::DontAppendNewline);
- }
-}
-
-void AndroidPackageCreationStep::keystorePassword()
-{
- m_keystorePasswd.clear();
- bool ok;
- QString text = QInputDialog::getText(0, tr("Keystore"),
- tr("Keystore password:"), QLineEdit::Password,
- QString(), &ok);
- if (ok && !text.isEmpty())
- m_keystorePasswd = text;
-}
-
-void AndroidPackageCreationStep::certificatePassword()
-{
- m_certificatePasswdForRun.clear();
- bool ok;
- QString text = QInputDialog::getText(0, tr("Certificate"),
- tr("Certificate password (%1):").arg(m_certificateAlias), QLineEdit::Password,
- QString(), &ok);
- if (ok && !text.isEmpty())
- m_certificatePasswdForRun = text;
-}
-
-void AndroidPackageCreationStep::showInGraphicalShell()
-{
- Core::FileUtils::showInGraphicalShell(Core::ICore::mainWindow(), m_apkPathSigned.toString());
-}
-
-void AndroidPackageCreationStep::raiseError(const QString &shortMsg,
- const QString &detailedMsg)
-{
- emit addOutput(detailedMsg.isNull() ? shortMsg : detailedMsg, BuildStep::ErrorOutput);
- emit addTask(Task(Task::Error, shortMsg, Utils::FileName::fromString(QString()), -1,
- TASK_CATEGORY_DEPLOYMENT));
-}
-
-const Core::Id AndroidPackageCreationStep::CreatePackageId("Qt4ProjectManager.AndroidPackageCreationStep");
-
-} // namespace Internal
-} // namespace Android
diff --git a/src/plugins/android/androidpackagecreationstep.h b/src/plugins/android/androidpackagecreationstep.h
deleted file mode 100644
index baa703627e..0000000000
--- a/src/plugins/android/androidpackagecreationstep.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef ANDROIDPACKAGECREATIONSTEP_H
-#define ANDROIDPACKAGECREATIONSTEP_H
-
-#include "javaparser.h"
-#include "androidmanager.h"
-
-#include <projectexplorer/abi.h>
-#include <projectexplorer/buildstep.h>
-#include <utils/environment.h>
-
-#include <QAbstractItemModel>
-
-QT_BEGIN_NAMESPACE
-class QProcess;
-QT_END_NAMESPACE
-
-namespace Android {
-namespace Internal {
-
-class DeployItem;
-
-class AndroidPackageCreationStep : public ProjectExplorer::BuildStep
-{
- Q_OBJECT
- friend class AndroidPackageCreationFactory;
-
-public:
- AndroidPackageCreationStep(ProjectExplorer::BuildStepList *bsl);
-
- static bool removeDirectory(const QString &dirPath);
- static void stripAndroidLibs(const QStringList &files, ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolchainVersion);
-
- static const QLatin1String DefaultVersionNumber;
-
- void checkRequiredLibraries();
- void initCheckRequiredLibrariesForRun();
- void checkRequiredLibrariesForRun();
-
- Utils::FileName keystorePath();
- void setKeystorePath(const Utils::FileName &path);
- void setKeystorePassword(const QString &pwd);
- void setCertificateAlias(const QString &alias);
- void setCertificatePassword(const QString &pwd);
- void setOpenPackageLocation(bool open);
- QAbstractItemModel *keystoreCertificates();
- bool signPackage() const;
- void setSignPackage(bool b);
-
-protected:
- bool fromMap(const QVariantMap &map);
- QVariantMap toMap() const;
-
-private slots:
- void handleBuildStdOutOutput();
- void handleBuildStdErrOutput();
- void keystorePassword();
- void certificatePassword();
- void showInGraphicalShell();
- void setQtLibs(const QStringList &qtLibs);
- void setPrebundledLibs(const QStringList &prebundledLibs);
- void updateXmlForFiles(const QStringList &inLibList, const QStringList &inAssetsList);
- void getBundleInformation();
-
-signals:
- void updateRequiredLibrariesModels();
-
-private:
- AndroidPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig,
- AndroidPackageCreationStep *other);
-
- void ctor();
- virtual bool init();
- virtual void run(QFutureInterface<bool> &fi);
- virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
- virtual bool immutable() const { return true; }
- bool createPackage();
- bool runCommand(QProcess *buildProc, const QString &program, const QStringList &arguments);
- void raiseError(const QString &shortMsg,
- const QString &detailedMsg = QString());
-
- QStringList collectRelativeFilePaths(const QString &parentPath);
- void collectFiles(QList<DeployItem> *deployList, QList<DeployItem> *pluginsAndImports);
- void removeManagedFilesFromPackage(const Utils::FileName &qtLibraryDir);
- void copyFilesIntoPackage(const QList<DeployItem> &deployList);
- void stripFiles(const QList<DeployItem> &deployList);
-
- static const Core::Id CreatePackageId;
-
-private:
- void handleProcessOutput(QProcess *process, bool stdErr);
- bool m_signPackage;
- Utils::FileName m_keystorePath;
- QString m_keystorePasswd;
- QString m_certificateAlias;
- QString m_certificatePasswd;
- bool m_openPackageLocation;
- JavaParser m_outputParser;
-
- // members to pass data from init() to run()
- Utils::FileName m_androidDir;
- Utils::FileName m_gdbServerSource;
- Utils::FileName m_gdbServerDestination;
- Utils::FileName m_antToolPath;
- Utils::FileName m_apkPathUnsigned;
- Utils::FileName m_apkPathSigned;
- bool m_signPackageForRun;
- Utils::FileName m_keystorePathForRun;
- QString m_certificatePasswdForRun;
- Utils::FileName m_jarSigner;
- Utils::FileName m_zipAligner;
- // more for checkLibraries
- Utils::FileName m_appPath;
- Utils::FileName m_readElf;
- QStringList m_qtLibs;
- QStringList m_qtLibsWithDependencies;
- QVector<AndroidManager::Library> m_availableQtLibs;
- QStringList m_prebundledLibs;
- QStringList m_bundledJars;
- QStringList m_otherBundledFiles;
- bool m_bundleQt;
- Utils::Environment m_environment;
-};
-
-} // namespace Internal
-} // namespace Android
-
-#endif // ANDROIDPACKAGECREATIONSTEP_H
diff --git a/src/plugins/android/androidpackagecreationwidget.cpp b/src/plugins/android/androidpackagecreationwidget.cpp
deleted file mode 100644
index 7dfebc7e3a..0000000000
--- a/src/plugins/android/androidpackagecreationwidget.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "androidpackagecreationwidget.h"
-#include "androidpackagecreationstep.h"
-#include "androidconfigurations.h"
-#include "androidcreatekeystorecertificate.h"
-#include "androidmanager.h"
-#include "androiddeploystep.h"
-#include "androidglobal.h"
-#include "ui_androidpackagecreationwidget.h"
-
-#include <projectexplorer/project.h>
-#include <projectexplorer/target.h>
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/buildmanager.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qmakeprojectmanager/qmakebuildconfiguration.h>
-#include <qmakeprojectmanager/qmakestep.h>
-#include <utils/pathchooser.h>
-
-#include <QTimer>
-
-#include <QFileDialog>
-#include <QFileSystemWatcher>
-#include <QMessageBox>
-#include <qtsupport/baseqtversion.h>
-#include <qtsupport/qtkitinformation.h>
-
-namespace Android {
-namespace Internal {
-
-using namespace ProjectExplorer;
-using namespace QmakeProjectManager;
-
-///////////////////////////// CheckModel /////////////////////////////
-
-CheckModel::CheckModel(QObject *parent)
- : QAbstractListModel(parent)
-{
-}
-
-void CheckModel::setAvailableItems(const QStringList &items)
-{
- beginResetModel();
- m_availableItems = items;
- endResetModel();
-}
-
-void CheckModel::setCheckedItems(const QStringList &items)
-{
- m_checkedItems = items;
- if (rowCount())
- emit dataChanged(index(0), index(rowCount()-1));
-}
-
-const QStringList &CheckModel::checkedItems()
-{
- return m_checkedItems;
-}
-
-QVariant CheckModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
- switch (role) {
- case Qt::CheckStateRole:
- return m_checkedItems.contains(m_availableItems.at(index.row())) ? Qt::Checked : Qt::Unchecked;
- case Qt::DisplayRole:
- return m_availableItems.at(index.row());
- }
- return QVariant();
-}
-
-void CheckModel::moveUp(int index)
-{
- beginMoveRows(QModelIndex(), index, index, QModelIndex(), index - 1);
- const QString &item1 = m_availableItems[index];
- const QString &item2 = m_availableItems[index - 1];
- m_availableItems.swap(index, index - 1);
- index = m_checkedItems.indexOf(item1);
- int index2 = m_checkedItems.indexOf(item2);
- if (index > -1 && index2 > -1)
- m_checkedItems.swap(index, index2);
- endMoveRows();
-}
-
-bool CheckModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- if (role != Qt::CheckStateRole || !index.isValid())
- return false;
- if (value.toInt() == Qt::Checked)
- m_checkedItems.append(m_availableItems.at(index.row()));
- else
- m_checkedItems.removeAll(m_availableItems.at(index.row()));
- emit dataChanged(index, index);
- return true;
-}
-
-int CheckModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.isValid())
- return 0;
- return m_availableItems.count();
-}
-
-Qt::ItemFlags CheckModel::flags(const QModelIndex &/*index*/) const
-{
- return Qt::ItemIsSelectable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled;
-}
-
-///////////////////////////// AndroidPackageCreationWidget /////////////////////////////
-
-AndroidPackageCreationWidget::AndroidPackageCreationWidget(AndroidPackageCreationStep *step)
- : ProjectExplorer::BuildStepConfigWidget(),
- m_step(step),
- m_ui(new Ui::AndroidPackageCreationWidget),
- m_fileSystemWatcher(new QFileSystemWatcher(this)),
- m_currentBuildConfiguration(0)
-{
- m_qtLibsModel = new CheckModel(this);
- m_prebundledLibs = new CheckModel(this);
-
- m_ui->setupUi(this);
- m_ui->KeystoreLocationPushButton->setText(Utils::PathChooser::browseButtonLabel());
- m_ui->signingDebugWarningIcon->hide();
- m_ui->signingDebugWarningLabel->hide();
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- QTimer::singleShot(50, this, SLOT(initGui()));
- connect(m_step, SIGNAL(updateRequiredLibrariesModels()), SLOT(updateRequiredLibrariesModels()));
-}
-
-void AndroidPackageCreationWidget::initGui()
-{
- updateAndroidProjectInfo();
- ProjectExplorer::Target *target = m_step->target();
-
- m_fileSystemWatcher->addPath(AndroidManager::dirPath(target).toString());
- m_fileSystemWatcher->addPath(AndroidManager::manifestPath(target).toString());
- m_fileSystemWatcher->addPath(AndroidManager::srcPath(target).toString());
- connect(m_fileSystemWatcher, SIGNAL(directoryChanged(QString)),
- this, SLOT(updateAndroidProjectInfo()));
- connect(m_fileSystemWatcher, SIGNAL(fileChanged(QString)), this,
- SLOT(updateAndroidProjectInfo()));
-
- connect(m_ui->targetSDKComboBox, SIGNAL(activated(QString)), SLOT(setTargetSDK(QString)));
- connect(m_qtLibsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(setQtLibs(QModelIndex,QModelIndex)));
- connect(m_prebundledLibs, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(setPrebundledLibs(QModelIndex,QModelIndex)));
- connect(m_ui->prebundledLibsListView, SIGNAL(activated(QModelIndex)), SLOT(prebundledLibSelected(QModelIndex)));
- connect(m_ui->prebundledLibsListView, SIGNAL(clicked(QModelIndex)), SLOT(prebundledLibSelected(QModelIndex)));
- connect(m_ui->upPushButton, SIGNAL(clicked()), SLOT(prebundledLibMoveUp()));
- connect(m_ui->downPushButton, SIGNAL(clicked()), SLOT(prebundledLibMoveDown()));
- connect(m_ui->readInfoPushButton, SIGNAL(clicked()), SLOT(readElfInfo()));
-
- m_ui->qtLibsListView->setModel(m_qtLibsModel);
- m_ui->prebundledLibsListView->setModel(m_prebundledLibs);
- m_ui->KeystoreLocationLineEdit->setText(m_step->keystorePath().toUserOutput());
-
- // Make the buildconfiguration emit a evironmentChanged() signal
- // TODO find a better way
- QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration());
- if (!bc)
- return;
- bool use = bc->useSystemEnvironment();
- bc->setUseSystemEnvironment(!use);
- bc->setUseSystemEnvironment(use);
-
- activeBuildConfigurationChanged();
- connect(m_step->target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(activeBuildConfigurationChanged()));
-}
-
-void AndroidPackageCreationWidget::updateSigningWarning()
-{
- QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration());
- bool debug = bc && (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild);
- if (m_step->signPackage() && debug) {
- m_ui->signingDebugWarningIcon->setVisible(true);
- m_ui->signingDebugWarningLabel->setVisible(true);
- } else {
- m_ui->signingDebugWarningIcon->setVisible(false);
- m_ui->signingDebugWarningLabel->setVisible(false);
- }
-}
-
-void AndroidPackageCreationWidget::activeBuildConfigurationChanged()
-{
- if (m_currentBuildConfiguration)
- disconnect(m_currentBuildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
- this, SLOT(updateSigningWarning()));
- updateSigningWarning();
- QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration());
- m_currentBuildConfiguration = bc;
- if (bc)
- connect(bc, SIGNAL(qmakeBuildConfigurationChanged()), this, SLOT(updateSigningWarning()));
- m_currentBuildConfiguration = bc;
-}
-
-void AndroidPackageCreationWidget::updateAndroidProjectInfo()
-{
- ProjectExplorer::Target *target = m_step->target();
- m_ui->targetSDKComboBox->clear();
-
- int minApiLevel = 4;
- if (QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target->kit()))
- if (qt->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0))
- minApiLevel = 9;
-
- QStringList targets = AndroidConfig::apiLevelNamesFor(AndroidConfigurations::currentConfig().sdkTargets(minApiLevel));
- m_ui->targetSDKComboBox->addItems(targets);
- m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(AndroidManager::buildTargetSDK(target)));
-
- m_qtLibsModel->setAvailableItems(AndroidManager::availableQtLibs(target));
- m_qtLibsModel->setCheckedItems(AndroidManager::qtLibs(target));
- m_prebundledLibs->setAvailableItems(AndroidManager::availablePrebundledLibs(target));
- m_prebundledLibs->setCheckedItems(AndroidManager::prebundledLibs(target));
-}
-
-void AndroidPackageCreationWidget::setTargetSDK(const QString &sdk)
-{
- AndroidManager::setBuildTargetSDK(m_step->target(), sdk);
- QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration());
- if (!bc)
- return;
- QMakeStep *qs = bc->qmakeStep();
- if (!qs)
- return;
-
- qs->setForced(true);
-
- BuildManager::buildList(bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN),
- ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
- BuildManager::appendStep(qs, ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
- bc->setSubNodeBuild(0);
- // Make the buildconfiguration emit a evironmentChanged() signal
- // TODO find a better way
- bool use = bc->useSystemEnvironment();
- bc->setUseSystemEnvironment(!use);
- bc->setUseSystemEnvironment(use);
-}
-
-void AndroidPackageCreationWidget::setQtLibs(QModelIndex, QModelIndex)
-{
- AndroidManager::setQtLibs(m_step->target(), m_qtLibsModel->checkedItems());
- AndroidDeployStep * const deployStep = AndroidGlobal::buildStep<AndroidDeployStep>(m_step->target()->activeDeployConfiguration());
- if (deployStep->deployAction() == AndroidDeployStep::DeployLocal
- || deployStep->deployAction() == AndroidDeployStep::BundleLibraries)
- AndroidManager::updateDeploymentSettings(m_step->target());
-}
-
-void AndroidPackageCreationWidget::setPrebundledLibs(QModelIndex, QModelIndex)
-{
- AndroidManager::setPrebundledLibs(m_step->target(), m_prebundledLibs->checkedItems());
- AndroidDeployStep * const deployStep = AndroidGlobal::buildStep<AndroidDeployStep>(m_step->target()->activeDeployConfiguration());
- if (deployStep->deployAction() == AndroidDeployStep::DeployLocal
- || deployStep->deployAction() == AndroidDeployStep::BundleLibraries)
- AndroidManager::updateDeploymentSettings(m_step->target());
-}
-
-void AndroidPackageCreationWidget::prebundledLibSelected(const QModelIndex &index)
-{
- m_ui->upPushButton->setEnabled(false);
- m_ui->downPushButton->setEnabled(false);
- if (!index.isValid())
- return;
- if (index.row() > 0)
- m_ui->upPushButton->setEnabled(true);
- if (index.row() < m_prebundledLibs->rowCount(QModelIndex()) - 1)
- m_ui->downPushButton->setEnabled(true);
-}
-
-void AndroidPackageCreationWidget::prebundledLibMoveUp()
-{
- const QModelIndex &index = m_ui->prebundledLibsListView->currentIndex();
- if (index.isValid())
- m_prebundledLibs->moveUp(index.row());
-}
-
-void AndroidPackageCreationWidget::prebundledLibMoveDown()
-{
- const QModelIndex &index = m_ui->prebundledLibsListView->currentIndex();
- if (index.isValid())
- m_prebundledLibs->moveUp(index.row() + 1);
-}
-
-void AndroidPackageCreationWidget::updateRequiredLibrariesModels()
-{
- m_qtLibsModel->setCheckedItems(AndroidManager::qtLibs(m_step->target()));
- m_prebundledLibs->setCheckedItems(AndroidManager::prebundledLibs(m_step->target()));
-}
-
-void AndroidPackageCreationWidget::readElfInfo()
-{
- m_step->checkRequiredLibraries();
-}
-
-QString AndroidPackageCreationWidget::summaryText() const
-{
- return tr("<b>Package configurations</b>");
-}
-
-QString AndroidPackageCreationWidget::displayName() const
-{
- return m_step->displayName();
-}
-
-void AndroidPackageCreationWidget::setCertificates()
-{
- QAbstractItemModel *certificates = m_step->keystoreCertificates();
- m_ui->signPackageCheckBox->setChecked(certificates);
- m_ui->certificatesAliasComboBox->setModel(certificates);
-}
-
-void AndroidPackageCreationWidget::on_signPackageCheckBox_toggled(bool checked)
-{
- m_step->setSignPackage(checked);
- updateSigningWarning();
- if (!checked)
- return;
- if (!m_step->keystorePath().isEmpty())
- setCertificates();
-}
-
-void AndroidPackageCreationWidget::on_KeystoreCreatePushButton_clicked()
-{
- AndroidCreateKeystoreCertificate d;
- if (d.exec() != QDialog::Accepted)
- return;
- m_ui->KeystoreLocationLineEdit->setText(d.keystoreFilePath().toUserOutput());
- m_step->setKeystorePath(d.keystoreFilePath());
- m_step->setKeystorePassword(d.keystorePassword());
- m_step->setCertificateAlias(d.certificateAlias());
- m_step->setCertificatePassword(d.certificatePassword());
- setCertificates();
-}
-
-void AndroidPackageCreationWidget::on_KeystoreLocationPushButton_clicked()
-{
- Utils::FileName keystorePath = m_step->keystorePath();
- if (keystorePath.isEmpty())
- keystorePath = Utils::FileName::fromString(QDir::homePath());
- Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select keystore file"), keystorePath.toString(), tr("Keystore files (*.keystore *.jks)")));
- if (file.isEmpty())
- return;
- m_ui->KeystoreLocationLineEdit->setText(file.toUserOutput());
- m_step->setKeystorePath(file);
- m_ui->signPackageCheckBox->setChecked(false);
-}
-
-void AndroidPackageCreationWidget::on_certificatesAliasComboBox_activated(const QString &alias)
-{
- if (alias.length())
- m_step->setCertificateAlias(alias);
-}
-
-void AndroidPackageCreationWidget::on_certificatesAliasComboBox_currentIndexChanged(const QString &alias)
-{
- if (alias.length())
- m_step->setCertificateAlias(alias);
-}
-
-void AndroidPackageCreationWidget::on_openPackageLocationCheckBox_toggled(bool checked)
-{
- m_step->setOpenPackageLocation(checked);
-}
-
-} // namespace Internal
-} // namespace Android
diff --git a/src/plugins/android/androidpackagecreationwidget.h b/src/plugins/android/androidpackagecreationwidget.h
deleted file mode 100644
index 4eb0916b46..0000000000
--- a/src/plugins/android/androidpackagecreationwidget.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/**************************************************************************
-**
-** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef ANDROIDPACKAGECREATIONWIDGET_H
-#define ANDROIDPACKAGECREATIONWIDGET_H
-
-#include <projectexplorer/buildstep.h>
-
-#include <QAbstractListModel>
-#include <QStringList>
-
-QT_BEGIN_NAMESPACE
-class QFileSystemWatcher;
-
-namespace Ui { class AndroidPackageCreationWidget; }
-QT_END_NAMESPACE
-
-namespace QmakeProjectManager { class QmakeBuildConfiguration; }
-
-namespace Android {
-namespace Internal {
-class AndroidPackageCreationStep;
-
-class CheckModel: public QAbstractListModel
-{
- Q_OBJECT
-public:
- CheckModel(QObject *parent = 0);
- void setAvailableItems(const QStringList &items);
- void setCheckedItems(const QStringList &items);
- const QStringList &checkedItems();
- QVariant data(const QModelIndex &index, int role) const;
- void moveUp(int index);
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
-protected:
- bool setData(const QModelIndex &index, const QVariant &value, int role);
- Qt::ItemFlags flags(const QModelIndex &index) const;
-private:
- QStringList m_availableItems;
- QStringList m_checkedItems;
-};
-
-class AndroidPackageCreationWidget : public ProjectExplorer::BuildStepConfigWidget
-{
- Q_OBJECT
-public:
- AndroidPackageCreationWidget(AndroidPackageCreationStep *step);
-
- virtual QString summaryText() const;
- virtual QString displayName() const;
-
-public slots:
- void readElfInfo();
-
-private:
- void setEnabledSaveDiscardButtons(bool enabled);
- void setCertificates();
-
-private slots:
- void initGui();
- void updateAndroidProjectInfo();
-
- void setTargetSDK(const QString &sdk);
-
- void setQtLibs(QModelIndex, QModelIndex);
- void setPrebundledLibs(QModelIndex, QModelIndex);
- void prebundledLibSelected(const QModelIndex &index);
- void prebundledLibMoveUp();
- void prebundledLibMoveDown();
-
- void updateRequiredLibrariesModels();
- void on_signPackageCheckBox_toggled(bool checked);
- void on_KeystoreCreatePushButton_clicked();
- void on_KeystoreLocationPushButton_clicked();
- void on_certificatesAliasComboBox_activated(const QString &alias);
- void on_certificatesAliasComboBox_currentIndexChanged(const QString &alias);
-
- void on_openPackageLocationCheckBox_toggled(bool checked);
-
- void updateSigningWarning();
- void activeBuildConfigurationChanged();
-private:
- AndroidPackageCreationStep *const m_step;
- Ui::AndroidPackageCreationWidget *const m_ui;
- CheckModel *m_qtLibsModel;
- CheckModel *m_prebundledLibs;
- QFileSystemWatcher *m_fileSystemWatcher;
- QmakeProjectManager::QmakeBuildConfiguration *m_currentBuildConfiguration;
-};
-
-} // namespace Internal
-} // namespace Android
-
-#endif // ANDROIDPACKAGECREATIONWIDGET_H
diff --git a/src/plugins/android/androidpackagecreationwidget.ui b/src/plugins/android/androidpackagecreationwidget.ui
deleted file mode 100644
index 102e74cfb4..0000000000
--- a/src/plugins/android/androidpackagecreationwidget.ui
+++ /dev/null
@@ -1,323 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AndroidPackageCreationWidget</class>
- <widget class="QWidget" name="AndroidPackageCreationWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>688</width>
- <height>553</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>1</horstretch>
- <verstretch>1</verstretch>
- </sizepolicy>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Application</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="editDebianFileLabel_4">
- <property name="text">
- <string>&lt;b&gt;Android target SDK:&lt;/b&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="targetSDKComboBox"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="librariesGroupBox">
- <property name="title">
- <string>Libraries</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0" colspan="2">
- <widget class="QPushButton" name="readInfoPushButton">
- <property name="toolTip">
- <string>Automatically check required Qt libraries from compiled application.</string>
- </property>
- <property name="text">
- <string>Read information from application (must be compiled)</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QFrame" name="frame">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Required Qt libraries</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QListView" name="qtLibsListView"/>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QFrame" name="frame_2">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>&lt;center&gt;Prebundled libraries&lt;/center&gt;
-&lt;p align=&quot;justify&quot;&gt;Please be aware that the order is very important: If library &lt;i&gt;A&lt;/i&gt; depends on library &lt;i&gt;B&lt;/i&gt;, &lt;i&gt;B&lt;/i&gt; &lt;b&gt;must&lt;/b&gt; go before &lt;i&gt;A&lt;/i&gt;.&lt;/p&gt;</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QListView" name="prebundledLibsListView"/>
- </item>
- <item row="1" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="upPushButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Up</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="downPushButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Down</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Sign package</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="KeystoreLocationLabel">
- <property name="text">
- <string>Keystore:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="KeystoreLocationLineEdit">
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="KeystoreCreatePushButton">
- <property name="text">
- <string>Create</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="KeystoreLocationPushButton">
- <property name="text">
- <string>Browse</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QCheckBox" name="signPackageCheckBox">
- <property name="text">
- <string>Sign package</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="openPackageLocationCheckBox">
- <property name="text">
- <string>Open package location after is complete</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="signingDebugWarningIcon">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="pixmap">
- <pixmap resource="../coreplugin/core.qrc">:/core/images/warning.png</pixmap>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="signingDebugWarningLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Signing a debug package</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="KeystoreLocationLabel_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Certificate alias:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="certificatesAliasComboBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>300</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources>
- <include location="../projectexplorer/projectexplorer.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>signPackageCheckBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>certificatesAliasComboBox</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>138</x>
- <y>93</y>
- </hint>
- <hint type="destinationlabel">
- <x>184</x>
- <y>139</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>addFile()</slot>
- <slot>removeFile()</slot>
- <slot>handleSkipButtonToggled(bool)</slot>
- <slot>versionInfoChanged()</slot>
- <slot>editDebianFile()</slot>
- <slot>setPackageManagerIcon()</slot>
- </slots>
-</ui>
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp
index d4a7861125..ff0592fd31 100644
--- a/src/plugins/android/androidplugin.cpp
+++ b/src/plugins/android/androidplugin.cpp
@@ -31,13 +31,10 @@
#include "androidconstants.h"
#include "androidconfigurations.h"
-#include "androiddeploystepfactory.h"
#include "androiddeployqtstep.h"
#include "androiddevice.h"
#include "androiddevicefactory.h"
#include "androidmanager.h"
-#include "androidpackagecreationfactory.h"
-#include "androidpackageinstallationfactory.h"
#include "androidrunfactories.h"
#include "androidsettingspage.h"
#include "androidtoolchain.h"
@@ -72,13 +69,9 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
- new Internal::AndroidConfigurations(this);
+ new AndroidConfigurations(this);
addAutoReleasedObject(new Internal::AndroidRunControlFactory);
- addAutoReleasedObject(new Internal::AndroidRunConfigurationFactory);
- addAutoReleasedObject(new Internal::AndroidPackageInstallationFactory);
- addAutoReleasedObject(new Internal::AndroidPackageCreationFactory);
- addAutoReleasedObject(new Internal::AndroidDeployStepFactory);
addAutoReleasedObject(new Internal::AndroidDeployQtStepFactory);
addAutoReleasedObject(new Internal::AndroidSettingsPage);
addAutoReleasedObject(new Internal::AndroidQtVersionFactory);
@@ -118,16 +111,16 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
void AndroidPlugin::kitsRestored()
{
- Internal::AndroidConfigurations::updateAutomaticKitList();
+ AndroidConfigurations::updateAutomaticKitList();
connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- Internal::AndroidConfigurations::instance(), SLOT(updateAutomaticKitList()));
+ AndroidConfigurations::instance(), SLOT(updateAutomaticKitList()));
disconnect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsChanged()),
this, SLOT(kitsRestored()));
}
void AndroidPlugin::updateDevice()
{
- Internal::AndroidConfigurations::updateAndroidDevice();
+ AndroidConfigurations::updateAndroidDevice();
}
} // namespace Android
diff --git a/src/plugins/android/androidqtsupport.h b/src/plugins/android/androidqtsupport.h
new file mode 100644
index 0000000000..96cbf342f8
--- /dev/null
+++ b/src/plugins/android/androidqtsupport.h
@@ -0,0 +1,73 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef ANDROIDSUPPORT_H
+#define ANDROIDSUPPORT_H
+
+#include <QObject>
+#include <QList>
+
+#include <projectexplorer/project.h>
+
+#include <utils/fileutils.h>
+
+#include "android_global.h"
+
+namespace ProjectExplorer {
+ class Target;
+ class DeployConfiguration;
+ class ProcessParameters;
+}
+
+namespace Android {
+
+class ANDROID_EXPORT AndroidQtSupport : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum BuildType {
+ DebugBuild,
+ ReleaseBuildUnsigned,
+ ReleaseBuildSigned
+ };
+
+public:
+ virtual bool canHandle(const ProjectExplorer::Target *target) const = 0;
+ virtual QStringList soLibSearchPath(const ProjectExplorer::Target *target) const = 0;
+ virtual QStringList projectTargetApplications(const ProjectExplorer::Target *target) const = 0;
+ virtual Utils::FileName apkPath(ProjectExplorer::Target *target, BuildType buildType) const = 0;
+
+ virtual void resetBuild(const ProjectExplorer::Target *target) = 0;
+};
+
+} // namespace QtSupport
+
+
+#endif // ANDROIDSUPPORT_H
diff --git a/src/plugins/android/androidqtversion.cpp b/src/plugins/android/androidqtversion.cpp
index 2929d93a3c..c808ecfb29 100644
--- a/src/plugins/android/androidqtversion.cpp
+++ b/src/plugins/android/androidqtversion.cpp
@@ -35,22 +35,19 @@
#include <utils/environment.h>
#include <utils/hostosinfo.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
-
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <projectexplorer/target.h>
#include <projectexplorer/kit.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <proparser/profileevaluator.h>
using namespace Android::Internal;
using namespace ProjectExplorer;
-using namespace QmakeProjectManager;
AndroidQtVersion::AndroidQtVersion()
: QtSupport::BaseQtVersion()
@@ -109,12 +106,12 @@ void AndroidQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::En
env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::currentConfig().toolchainHost());
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::currentConfig().ndkLocation().toUserOutput());
- QmakeProject *qmakeProject = qobject_cast<QmakeProjectManager::QmakeProject *>(ProjectExplorerPlugin::instance()->currentProject());
- if (!qmakeProject || !qmakeProject->activeTarget()
+ Project *project = ProjectExplorerPlugin::instance()->currentProject();
+ if (!project || !project->activeTarget()
|| QtSupport::QtKitInformation::qtVersion(k)->type() != QLatin1String(Constants::ANDROIDQT))
return;
- Target *target = qmakeProject->activeTarget();
+ Target *target = project->activeTarget();
if (DeviceTypeKitInformation::deviceTypeId(target->kit()) != Constants::ANDROID_DEVICE_TYPE)
return;
if (AndroidConfigurations::currentConfig().ndkLocation().isEmpty()
@@ -122,7 +119,7 @@ void AndroidQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::En
return;
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
- AndroidConfigurations::currentConfig().bestNdkPlatformMatch(AndroidManager::buildTargetSDK(target)));
+ AndroidConfigurations::currentConfig().bestNdkPlatformMatch(AndroidManager::minimumSDK(target)));
}
Utils::Environment AndroidQtVersion::qmakeRunEnvironment() const
diff --git a/src/plugins/android/androidrunconfiguration.cpp b/src/plugins/android/androidrunconfiguration.cpp
index 668f1332d5..de6beed225 100644
--- a/src/plugins/android/androidrunconfiguration.cpp
+++ b/src/plugins/android/androidrunconfiguration.cpp
@@ -28,7 +28,6 @@
****************************************************************************/
#include "androidrunconfiguration.h"
-#include "androiddeploystep.h"
#include "androidglobal.h"
#include "androidtoolchain.h"
#include "androidmanager.h"
@@ -37,36 +36,21 @@
#include <projectexplorer/target.h>
#include <qtsupport/qtoutputformatter.h>
#include <qtsupport/qtkitinformation.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakenodes.h>
#include <utils/qtcassert.h>
-namespace {
-const char PRO_FILE_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.ProFile";
-}
-
using namespace ProjectExplorer;
-using QmakeProjectManager::QmakeProject;
namespace Android {
-namespace Internal {
-AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id, const QString &path)
+AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id)
: RunConfiguration(parent, id)
- , m_proFilePath(path)
{
- QmakeProject *project = static_cast<QmakeProject *>(parent->project());
- m_parseSuccess = project->validParse(m_proFilePath);
- m_parseInProgress = project->parseInProgress(m_proFilePath);
init();
}
AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, AndroidRunConfiguration *source)
: RunConfiguration(parent, source)
- , m_proFilePath(source->m_proFilePath)
- , m_parseSuccess(source->m_parseSuccess)
- , m_parseInProgress(source->m_parseInProgress)
{
init();
}
@@ -74,55 +58,6 @@ AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, AndroidRunConfi
void AndroidRunConfiguration::init()
{
setDefaultDisplayName(defaultDisplayName());
- connect(target()->project(), SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)),
- this, SLOT(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)));
-}
-
-bool AndroidRunConfiguration::fromMap(const QVariantMap &map)
-{
- const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
- m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString()));
- m_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
- m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(m_proFilePath);
-
- return RunConfiguration::fromMap(map);
-}
-
-QVariantMap AndroidRunConfiguration::toMap() const
-{
- const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
- QVariantMap map(RunConfiguration::toMap());
- map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath));
- return map;
-}
-
-bool AndroidRunConfiguration::isEnabled() const
-{
- return m_parseSuccess && !m_parseInProgress;
-}
-
-QString AndroidRunConfiguration::disabledReason() const
-{
- if (m_parseInProgress)
- return tr("The .pro file \"%1\" is currently being parsed.")
- .arg(QFileInfo(m_proFilePath).fileName());
-
- if (!m_parseSuccess)
- return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
- return QString();
-}
-
-void AndroidRunConfiguration::proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress)
-{
- if (m_proFilePath != pro->path())
- return;
-
- bool enabled = isEnabled();
- QString reason = disabledReason();
- m_parseSuccess = success;
- m_parseInProgress = parseInProgress;
- if (enabled != isEnabled() || reason != disabledReason())
- emit enabledChanged();
}
QWidget *AndroidRunConfiguration::createConfigurationWidget()
@@ -145,10 +80,4 @@ const QString AndroidRunConfiguration::remoteChannel() const
return QLatin1String(":5039");
}
-QString AndroidRunConfiguration::proFilePath() const
-{
- return m_proFilePath;
-}
-
-} // namespace Internal
} // namespace Android
diff --git a/src/plugins/android/androidrunconfiguration.h b/src/plugins/android/androidrunconfiguration.h
index 2a4be87f20..2374f04e30 100644
--- a/src/plugins/android/androidrunconfiguration.h
+++ b/src/plugins/android/androidrunconfiguration.h
@@ -30,54 +30,32 @@
#ifndef ANDROIDRUNCONFIGURATION_H
#define ANDROIDRUNCONFIGURATION_H
+#include "android_global.h"
#include "androidconstants.h"
#include "androidconfigurations.h"
#include <projectexplorer/runconfiguration.h>
-namespace QmakeProjectManager { class QmakeProFileNode; }
-
namespace Android {
-namespace Internal {
-
-class AndroidDeployStep;
-class AndroidRunConfigurationFactory;
-class AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
+class ANDROID_EXPORT AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
- friend class AndroidRunConfigurationFactory;
-
public:
- AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path);
+ AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
QWidget *createConfigurationWidget();
Utils::OutputFormatter *createOutputFormatter() const;
-
- void setArguments(const QString &args);
- QString proFilePath() const;
-
const QString remoteChannel() const;
- bool isEnabled() const;
- QString disabledReason() const;
protected:
AndroidRunConfiguration(ProjectExplorer::Target *parent, AndroidRunConfiguration *source);
QString defaultDisplayName();
- bool fromMap(const QVariantMap &map);
- QVariantMap toMap() const;
-private slots:
- void proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress);
private:
void init();
-
- QString m_proFilePath;
- bool m_parseSuccess;
- bool m_parseInProgress;
};
-} // namespace Internal
} // namespace Android
#endif // ANDROIDRUNCONFIGURATION_H
diff --git a/src/plugins/android/androidruncontrol.cpp b/src/plugins/android/androidruncontrol.cpp
index 49c9d70c6c..5d283f1b8d 100644
--- a/src/plugins/android/androidruncontrol.cpp
+++ b/src/plugins/android/androidruncontrol.cpp
@@ -29,7 +29,6 @@
#include "androidruncontrol.h"
-#include "androiddeploystep.h"
#include "androidglobal.h"
#include "androidrunconfiguration.h"
#include "androidrunner.h"
diff --git a/src/plugins/android/androidruncontrol.h b/src/plugins/android/androidruncontrol.h
index 48f9ca6a32..ab624b507d 100644
--- a/src/plugins/android/androidruncontrol.h
+++ b/src/plugins/android/androidruncontrol.h
@@ -33,9 +33,9 @@
#include <projectexplorer/runconfiguration.h>
namespace Android {
-namespace Internal {
-
class AndroidRunConfiguration;
+
+namespace Internal {
class AndroidRunner;
class AndroidRunControl : public ProjectExplorer::RunControl
diff --git a/src/plugins/android/androidrunfactories.cpp b/src/plugins/android/androidrunfactories.cpp
index 13e46e0a7e..7c5640edc0 100644
--- a/src/plugins/android/androidrunfactories.cpp
+++ b/src/plugins/android/androidrunfactories.cpp
@@ -40,114 +40,16 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <debugger/debuggerconstants.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakenodes.h>
#include <qtsupport/customexecutablerunconfiguration.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
using namespace ProjectExplorer;
-using namespace QmakeProjectManager;
namespace Android {
namespace Internal {
-static const char ANDROID_RC_ID_PREFIX[] = "Qt4ProjectManager.AndroidRunConfiguration:";
-
-static QString pathFromId(Core::Id id)
-{
- return id.suffixAfter(ANDROID_RC_ID_PREFIX);
-}
-
-AndroidRunConfigurationFactory::AndroidRunConfigurationFactory(QObject *parent)
- : QmakeRunConfigurationFactory(parent)
-{
- setObjectName(QLatin1String("AndroidRunConfigurationFactory"));
-}
-
-bool AndroidRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
-{
- if (!canHandle(parent))
- return false;
- return availableCreationIds(parent).contains(id);
-}
-
-bool AndroidRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
-{
- if (!canHandle(parent))
- return false;
- return ProjectExplorer::idFromMap(map).name().startsWith(ANDROID_RC_ID_PREFIX);
-}
-
-bool AndroidRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
-{
- return canCreate(parent, source->id());
-}
-
-QList<Core::Id> AndroidRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
-{
- if (!AndroidManager::supportsAndroid(parent))
- return QList<Core::Id>();
-
- QmakeProject *project = static_cast<QmakeProject *>(parent->project());
-
- QList<QmakeProFileNode *> nodes = project->allProFiles(QList<QmakeProjectType>()
- << ApplicationTemplate
- << LibraryTemplate);
-
- if (mode == AutoCreate)
- nodes = QmakeProject::nodesWithQtcRunnable(nodes);
-
- const Core::Id base = Core::Id(ANDROID_RC_ID_PREFIX);
- return QmakeProject::idsForNodes(base, nodes);
-}
-
-QString AndroidRunConfigurationFactory::displayNameForId(Core::Id id) const
-{
- return QFileInfo(pathFromId(id)).completeBaseName();
-}
-
-RunConfiguration *AndroidRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
-{
- return new AndroidRunConfiguration(parent, id, pathFromId(id));
-}
-
-RunConfiguration *AndroidRunConfigurationFactory::doRestore(Target *parent,
- const QVariantMap &map)
-{
- Core::Id id = ProjectExplorer::idFromMap(map);
- return new AndroidRunConfiguration(parent, id, pathFromId(id));
-}
-
-RunConfiguration *AndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
-{
- if (!canClone(parent, source))
- return 0;
-
- AndroidRunConfiguration *old = static_cast<AndroidRunConfiguration *>(source);
- return new AndroidRunConfiguration(parent, old);
-}
-
-bool AndroidRunConfigurationFactory::canHandle(Target *t) const
-{
- if (!t->project()->supportsKit(t->kit()))
- return false;
- return AndroidManager::supportsAndroid(t);
-}
-
-QList<RunConfiguration *> AndroidRunConfigurationFactory::runConfigurationsForNode(Target *t, const Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
- if (AndroidRunConfiguration *qt4c = qobject_cast<AndroidRunConfiguration *>(rc))
- if (qt4c->proFilePath() == n->path())
- result << rc;
- return result;
-}
-
-// #pragma mark -- AndroidRunControlFactory
-
AndroidRunControlFactory::AndroidRunControlFactory(QObject *parent)
: IRunControlFactory(parent)
{
diff --git a/src/plugins/android/androidrunfactories.h b/src/plugins/android/androidrunfactories.h
index 06e87d37b5..9b220fed6e 100644
--- a/src/plugins/android/androidrunfactories.h
+++ b/src/plugins/android/androidrunfactories.h
@@ -30,8 +30,9 @@
#ifndef ANDROIDRUNFACTORIES_H
#define ANDROIDRUNFACTORIES_H
+#include "android_global.h"
#include <projectexplorer/runconfiguration.h>
-#include <qmakeprojectmanager/qmakerunconfigurationfactory.h>
+
namespace ProjectExplorer {
class RunControl;
@@ -43,34 +44,6 @@ class Node;
namespace Android {
namespace Internal {
-class AndroidRunConfigurationFactory : public QmakeProjectManager::QmakeRunConfigurationFactory
-{
- Q_OBJECT
-
-public:
- explicit AndroidRunConfigurationFactory(QObject *parent = 0);
-
- QString displayNameForId(Core::Id id) const;
- QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const;
-
- bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const;
-
- bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
-
- bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
- ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
-
- QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
- const ProjectExplorer::Node *n);
-
-private:
- bool canHandle(ProjectExplorer::Target *t) const;
-
- ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id);
- ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
- const QVariantMap &map);
-};
-
class AndroidRunControlFactory : public ProjectExplorer::IRunControlFactory
{
Q_OBJECT
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index 4958b1be8d..51c9af54a3 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -29,7 +29,6 @@
#include "androidrunner.h"
-#include "androiddeploystep.h"
#include "androiddeployqtstep.h"
#include "androidconfigurations.h"
#include "androidglobal.h"
diff --git a/src/plugins/android/androidrunner.h b/src/plugins/android/androidrunner.h
index a42034b557..9e9fee4b52 100644
--- a/src/plugins/android/androidrunner.h
+++ b/src/plugins/android/androidrunner.h
@@ -41,10 +41,10 @@
#include <QMutex>
namespace Android {
-namespace Internal {
-
class AndroidRunConfiguration;
+namespace Internal {
+
class AndroidRunner : public QThread
{
Q_OBJECT
diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp
index 1f03231231..1868ec5b1c 100644
--- a/src/plugins/android/androidtoolchain.cpp
+++ b/src/plugins/android/androidtoolchain.cpp
@@ -217,16 +217,16 @@ QString AndroidToolChain::makeCommand(const Utils::Environment &env) const
{
QStringList extraDirectories = AndroidConfigurations::currentConfig().makeExtraSearchDirectories();
if (HostOsInfo::isWindowsHost()) {
- QString tmp = env.searchInPath(QLatin1String("ma-make.exe"), extraDirectories);
+ FileName tmp = env.searchInPath(QLatin1String("ma-make.exe"), extraDirectories);
if (!tmp.isEmpty())
- return tmp;
+ return QString();
tmp = env.searchInPath(QLatin1String("mingw32-make"), extraDirectories);
- return tmp.isEmpty() ? QLatin1String("mingw32-make") : tmp;
+ return tmp.isEmpty() ? QLatin1String("mingw32-make") : tmp.toString();
}
QString make = QLatin1String("make");
- QString tmp = env.searchInPath(make, extraDirectories);
- return tmp.isEmpty() ? make : tmp;
+ FileName tmp = env.searchInPath(make, extraDirectories);
+ return tmp.isEmpty() ? make : tmp.toString();
}
QString AndroidToolChain::ndkToolChainVersion() const
@@ -386,7 +386,7 @@ QList<ToolChain *> AndroidToolChainFactory::createToolChainsForNdk(const Utils::
continue;
AndroidToolChain *tc = new AndroidToolChain(arch, version, ToolChain::AutoDetection);
FileName compilerPath = AndroidConfigurations::currentConfig().gccPath(arch, version);
- tc->setCompilerCommand(compilerPath);
+ tc->resetToolChain(compilerPath);
result.append(tc);
QMap<Abi::Architecture, AndroidToolChain *>::const_iterator it
diff --git a/src/plugins/android/avddialog.h b/src/plugins/android/avddialog.h
index d0aefc2221..706da287a9 100644
--- a/src/plugins/android/avddialog.h
+++ b/src/plugins/android/avddialog.h
@@ -34,9 +34,10 @@
#include <QDialog>
namespace Android {
-namespace Internal {
class AndroidConfig;
+namespace Internal {
+
class AvdDialog : public QDialog
{
Q_OBJECT
diff --git a/src/plugins/android/javaeditor.cpp b/src/plugins/android/javaeditor.cpp
index 763228fd15..f9d22aec97 100644
--- a/src/plugins/android/javaeditor.cpp
+++ b/src/plugins/android/javaeditor.cpp
@@ -55,6 +55,9 @@ JavaEditor::JavaEditor(JavaEditorWidget *editor)
setContext(Core::Context(Constants::C_JAVA_EDITOR,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
+ setCommentStyle(Utils::CommentDefinition::CppStyle);
+ setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<JavaCompletionAssistProvider>());
+ setAutoCompleter(new JavaAutoCompleter);
}
Core::IEditor *JavaEditor::duplicate()
@@ -65,11 +68,6 @@ Core::IEditor *JavaEditor::duplicate()
return ret->editor();
}
-TextEditor::CompletionAssistProvider *JavaEditor::completionAssistProvider()
-{
- return ExtensionSystem::PluginManager::getObject<JavaCompletionAssistProvider>();
-}
-
//
// JavaEditorWidget
//
@@ -77,27 +75,11 @@ TextEditor::CompletionAssistProvider *JavaEditor::completionAssistProvider()
JavaEditorWidget::JavaEditorWidget(QWidget *parent)
: BaseTextEditorWidget(new JavaDocument(), parent)
{
- ctor();
}
JavaEditorWidget::JavaEditorWidget(JavaEditorWidget *other)
: BaseTextEditorWidget(other)
{
- ctor();
-}
-
-void JavaEditorWidget::ctor()
-{
- m_commentDefinition.clearCommentStyles();
- m_commentDefinition.singleLine = QLatin1String("//");
- m_commentDefinition.multiLineStart = QLatin1String("/*");
- m_commentDefinition.multiLineEnd = QLatin1String("*/");
- setAutoCompleter(new JavaAutoCompleter);
-}
-
-void JavaEditorWidget::unCommentSelection()
-{
- Utils::unCommentSelection(this, m_commentDefinition);
}
TextEditor::BaseTextEditor *JavaEditorWidget::createEditor()
diff --git a/src/plugins/android/javaeditor.h b/src/plugins/android/javaeditor.h
index f660429638..8e8fc6a5d1 100644
--- a/src/plugins/android/javaeditor.h
+++ b/src/plugins/android/javaeditor.h
@@ -59,15 +59,11 @@ public:
JavaEditorWidget(QWidget *parent = 0);
JavaEditorWidget(JavaEditorWidget *other);
- void unCommentSelection();
-
protected:
TextEditor::BaseTextEditor *createEditor();
private:
JavaEditorWidget(BaseTextEditorWidget *); // avoid stupidity
- void ctor();
- Utils::CommentDefinition m_commentDefinition;
};
class JavaDocument : public TextEditor::BaseTextDocument
@@ -81,6 +77,6 @@ public:
};
} // namespace Internal
-} // namespace QmakeProjectManager
+} // namespace Android
#endif // JAVAEDITOR_H
diff --git a/src/plugins/bazaar/bazaarcontrol.cpp b/src/plugins/bazaar/bazaarcontrol.cpp
index 56d10a9c33..7ec4520c3f 100644
--- a/src/plugins/bazaar/bazaarcontrol.cpp
+++ b/src/plugins/bazaar/bazaarcontrol.cpp
@@ -68,10 +68,10 @@ bool BazaarControl::managesFile(const QString &workingDirectory, const QString &
bool BazaarControl::isConfigured() const
{
- const QString binary = m_bazaarClient->settings()->binaryPath();
+ const Utils::FileName binary = m_bazaarClient->settings()->binaryPath();
if (binary.isEmpty())
return false;
- QFileInfo fi(binary);
+ QFileInfo fi = binary.toFileInfo();
return fi.exists() && fi.isFile() && fi.isExecutable();
}
diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp
index c9a258aefc..0cad2b85e9 100644
--- a/src/plugins/bazaar/bazaarplugin.cpp
+++ b/src/plugins/bazaar/bazaarplugin.cpp
@@ -26,6 +26,7 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
+
#include "bazaarplugin.h"
#include "constants.h"
#include "bazaarclient.h"
@@ -66,35 +67,75 @@
#include <QDir>
#include <QDialog>
-using namespace Bazaar::Internal;
-using namespace Bazaar;
+#ifdef WITH_TESTS
+#include <QTest>
+#endif
-static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
- { VcsBase::LogOutput, // type
+using namespace Core;
+using namespace Utils;
+using namespace VcsBase;
+
+namespace Bazaar {
+namespace Internal {
+
+// Submit editor parameters
+const char COMMIT_ID[] = "Bazaar Commit Log Editor";
+const char COMMIT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Commit Log Editor");
+const char COMMITMIMETYPE[] = "text/vnd.qtcreator.bazaar.commit";
+
+// Menu items
+// File menu actions
+const char ADD[] = "Bazaar.AddSingleFile";
+const char DELETE[] = "Bazaar.DeleteSingleFile";
+const char ANNOTATE[] = "Bazaar.Annotate";
+const char DIFF[] = "Bazaar.DiffSingleFile";
+const char LOG[] = "Bazaar.LogSingleFile";
+const char REVERT[] = "Bazaar.RevertSingleFile";
+const char STATUS[] = "Bazaar.Status";
+
+// Directory menu Actions
+const char DIFFMULTI[] = "Bazaar.Action.DiffMulti";
+const char REVERTMULTI[] = "Bazaar.Action.RevertALL";
+const char STATUSMULTI[] = "Bazaar.Action.StatusMulti";
+const char LOGMULTI[] = "Bazaar.Action.Logmulti";
+
+// Repository menu actions
+const char PULL[] = "Bazaar.Action.Pull";
+const char PUSH[] = "Bazaar.Action.Push";
+const char UPDATE[] = "Bazaar.Action.Update";
+const char COMMIT[] = "Bazaar.Action.Commit";
+const char UNCOMMIT[] = "Bazaar.Action.UnCommit";
+const char CREATE_REPOSITORY[] = "Bazaar.Action.CreateRepository";
+
+// Submit editor actions
+const char DIFFEDITOR[] = "Bazaar.Action.Editor.Diff";
+
+const VcsBaseEditorParameters editorParameters[] = {
+ { LogOutput, // type
Constants::FILELOG_ID, // id
Constants::FILELOG_DISPLAY_NAME, // display name
Constants::FILELOG, // context
Constants::LOGAPP}, // mime type
- { VcsBase::AnnotateOutput,
+ { AnnotateOutput,
Constants::ANNOTATELOG_ID,
Constants::ANNOTATELOG_DISPLAY_NAME,
Constants::ANNOTATELOG,
Constants::ANNOTATEAPP},
- { VcsBase::DiffOutput,
+ { DiffOutput,
Constants::DIFFLOG_ID,
Constants::DIFFLOG_DISPLAY_NAME,
Constants::DIFFLOG,
Constants::DIFFAPP}
};
-static const VcsBase::VcsBaseSubmitEditorParameters submitEditorParameters = {
- Constants::COMMITMIMETYPE,
- Constants::COMMIT_ID,
- Constants::COMMIT_DISPLAY_NAME,
- Constants::COMMIT_ID,
- VcsBase::VcsBaseSubmitEditorParameters::DiffFiles
+const VcsBaseSubmitEditorParameters submitEditorParameters = {
+ COMMITMIMETYPE,
+ COMMIT_ID,
+ COMMIT_DISPLAY_NAME,
+ COMMIT_ID,
+ VcsBaseSubmitEditorParameters::DiffFiles
};
@@ -114,11 +155,8 @@ BazaarPlugin::BazaarPlugin()
BazaarPlugin::~BazaarPlugin()
{
- if (m_client) {
- delete m_client;
- m_client = 0;
- }
-
+ delete m_client;
+ m_client = 0;
m_instance = 0;
}
@@ -127,28 +165,28 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
- typedef VcsBase::VcsEditorFactory<BazaarEditor> BazaarEditorFactory;
+ typedef VcsEditorFactory<BazaarEditor> BazaarEditorFactory;
m_client = new BazaarClient(&m_bazaarSettings);
initializeVcs(new BazaarControl(m_client));
m_optionsPage = new OptionsPage();
addAutoReleasedObject(m_optionsPage);
- m_bazaarSettings.readSettings(Core::ICore::settings());
+ m_bazaarSettings.readSettings(ICore::settings());
connect(m_client, SIGNAL(changed(QVariant)), versionControl(), SLOT(changed(QVariant)));
static const char *describeSlot = SLOT(view(QString,QString));
- const int editorCount = sizeof(editorParameters) / sizeof(VcsBase::VcsBaseEditorParameters);
+ const int editorCount = sizeof(editorParameters) / sizeof(VcsBaseEditorParameters);
for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new BazaarEditorFactory(editorParameters + i, m_client, describeSlot));
- addAutoReleasedObject(new VcsBase::VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters));
+ addAutoReleasedObject(new VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters));
addAutoReleasedObject(new CloneWizardFactory);
const QString prefix = QLatin1String("bzr");
- m_commandLocator = new Core::CommandLocator("Bazaar", prefix, prefix);
+ m_commandLocator = new CommandLocator("Bazaar", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
createMenu();
@@ -186,10 +224,10 @@ void BazaarPlugin::setSettings(const BazaarSettings &settings)
void BazaarPlugin::createMenu()
{
- Core::Context context(Core::Constants::C_GLOBAL);
+ Context context(Core::Constants::C_GLOBAL);
// Create menu item for Bazaar
- m_bazaarContainer = Core::ActionManager::createMenu(Core::Id("Bazaar.BazaarMenu"));
+ m_bazaarContainer = ActionManager::createMenu("Bazaar.BazaarMenu");
QMenu *menu = m_bazaarContainer->menu();
menu->setTitle(tr("Bazaar"));
@@ -201,64 +239,64 @@ void BazaarPlugin::createMenu()
m_bazaarContainer->addSeparator(context);
// Request the Tools menu and add the Bazaar menu to it
- Core::ActionContainer *toolsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_TOOLS));
+ ActionContainer *toolsMenu = ActionManager::actionContainer(Core::Constants::M_TOOLS);
toolsMenu->addMenu(m_bazaarContainer);
m_menuAction = m_bazaarContainer->menu()->menuAction();
}
-void BazaarPlugin::createFileActions(const Core::Context &context)
+void BazaarPlugin::createFileActions(const Context &context)
{
Core::Command *command;
- m_annotateFile = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_annotateFile, Core::Id(Constants::ANNOTATE), context);
+ m_annotateFile = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_annotateFile, ANNOTATE, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_diffFile, Core::Id(Constants::DIFF), context);
+ m_diffFile = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_diffFile, DIFF, context);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+D") : tr("ALT+Z,Alt+D")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Z,Meta+D") : tr("ALT+Z,Alt+D")));
connect(m_diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_logFile = new Utils::ParameterAction(tr("Log Current File"), tr("Log \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_logFile, Core::Id(Constants::LOG), context);
+ m_logFile = new ParameterAction(tr("Log Current File"), tr("Log \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_logFile, LOG, context);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+L") : tr("ALT+Z,Alt+L")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Z,Meta+L") : tr("ALT+Z,Alt+L")));
connect(m_logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_statusFile, Core::Id(Constants::STATUS), context);
+ m_statusFile = new ParameterAction(tr("Status Current File"), tr("Status \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_statusFile, STATUS, context);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+S") : tr("ALT+Z,Alt+S")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Z,Meta+S") : tr("ALT+Z,Alt+S")));
connect(m_statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_bazaarContainer->addSeparator(context);
- m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_addAction, Core::Id(Constants::ADD), context);
+ m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_addAction, ADD, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_deleteAction, Core::Id(Constants::DELETE), context);
+ m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_deleteAction, DELETE, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_revertFile, Core::Id(Constants::REVERT), context);
+ m_revertFile = new ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_revertFile, REVERT, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
m_bazaarContainer->addAction(command);
@@ -267,28 +305,28 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
void BazaarPlugin::addCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void BazaarPlugin::annotateCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void BazaarPlugin::diffCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void BazaarPlugin::logCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_client->log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
QStringList(), true);
@@ -296,10 +334,10 @@ void BazaarPlugin::logCurrentFile()
void BazaarPlugin::revertCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
- QDialog dialog(Core::ICore::dialogParent());
+ QDialog dialog(ICore::dialogParent());
Ui::RevertDialog revertUi;
revertUi.setupUi(&dialog);
if (dialog.exec() != QDialog::Accepted)
@@ -311,40 +349,40 @@ void BazaarPlugin::revertCurrentFile()
void BazaarPlugin::statusCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile());
}
-void BazaarPlugin::createDirectoryActions(const Core::Context &context)
+void BazaarPlugin::createDirectoryActions(const Context &context)
{
QAction *action;
Core::Command *command;
action = new QAction(tr("Diff"), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::DIFFMULTI), context);
+ command = ActionManager::registerAction(action, DIFFMULTI, context);
connect(action, SIGNAL(triggered()), this, SLOT(diffRepository()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Log"), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::LOGMULTI), context);
+ command = ActionManager::registerAction(action, LOGMULTI, context);
connect(action, SIGNAL(triggered()), this, SLOT(logRepository()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Revert..."), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::REVERTMULTI), context);
+ command = ActionManager::registerAction(action, REVERTMULTI, context);
connect(action, SIGNAL(triggered()), this, SLOT(revertAll()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Status"), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::STATUSMULTI), context);
+ command = ActionManager::registerAction(action, STATUSMULTI, context);
connect(action, SIGNAL(triggered()), this, SLOT(statusMulti()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
@@ -353,14 +391,14 @@ void BazaarPlugin::createDirectoryActions(const Core::Context &context)
void BazaarPlugin::diffRepository()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_client->diff(state.topLevel());
}
void BazaarPlugin::logRepository()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QStringList extraOptions;
extraOptions += QLatin1String("--limit=") + QString::number(settings().intValue(BazaarSettings::logCountKey));
@@ -369,10 +407,10 @@ void BazaarPlugin::logRepository()
void BazaarPlugin::revertAll()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- QDialog dialog(Core::ICore::dialogParent());
+ QDialog dialog(ICore::dialogParent());
Ui::RevertDialog revertUi;
revertUi.setupUi(&dialog);
if (dialog.exec() != QDialog::Accepted)
@@ -382,64 +420,64 @@ void BazaarPlugin::revertAll()
void BazaarPlugin::statusMulti()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_client->status(state.topLevel());
}
-void BazaarPlugin::createRepositoryActions(const Core::Context &context)
+void BazaarPlugin::createRepositoryActions(const Context &context)
{
QAction *action = 0;
Core::Command *command = 0;
action = new QAction(tr("Pull..."), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::PULL), context);
+ command = ActionManager::registerAction(action, PULL, context);
connect(action, SIGNAL(triggered()), this, SLOT(pull()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Push..."), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::PUSH), context);
+ command = ActionManager::registerAction(action, PUSH, context);
connect(action, SIGNAL(triggered()), this, SLOT(push()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Update..."), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::UPDATE), context);
+ command = ActionManager::registerAction(action, UPDATE, context);
connect(action, SIGNAL(triggered()), this, SLOT(update()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Commit..."), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::COMMIT), context);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+C") : tr("ALT+Z,Alt+C")));
+ command = ActionManager::registerAction(action, COMMIT, context);
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Z,Meta+C") : tr("ALT+Z,Alt+C")));
connect(action, SIGNAL(triggered()), this, SLOT(commit()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Uncommit..."), this);
m_repositoryActionList.append(action);
- command = Core::ActionManager::registerAction(action, Core::Id(Constants::UNCOMMIT), context);
+ command = ActionManager::registerAction(action, UNCOMMIT, context);
connect(action, SIGNAL(triggered()), this, SLOT(uncommit()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
QAction *createRepositoryAction = new QAction(tr("Create Repository..."), this);
- command = Core::ActionManager::registerAction(createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context);
+ command = ActionManager::registerAction(createRepositoryAction, CREATE_REPOSITORY, context);
connect(createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
m_bazaarContainer->addAction(command);
}
void BazaarPlugin::pull()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- PullOrPushDialog dialog(PullOrPushDialog::PullMode, Core::ICore::dialogParent());
+ PullOrPushDialog dialog(PullOrPushDialog::PullMode, ICore::dialogParent());
if (dialog.exec() != QDialog::Accepted)
return;
QStringList extraOptions;
@@ -456,10 +494,10 @@ void BazaarPlugin::pull()
void BazaarPlugin::push()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- PullOrPushDialog dialog(PullOrPushDialog::PushMode, Core::ICore::dialogParent());
+ PullOrPushDialog dialog(PullOrPushDialog::PushMode, ICore::dialogParent());
if (dialog.exec() != QDialog::Accepted)
return;
QStringList extraOptions;
@@ -478,10 +516,10 @@ void BazaarPlugin::push()
void BazaarPlugin::update()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- QDialog dialog(Core::ICore::dialogParent());
+ QDialog dialog(ICore::dialogParent());
Ui::RevertDialog revertUi;
revertUi.setupUi(&dialog);
dialog.setWindowTitle(tr("Update"));
@@ -492,22 +530,22 @@ void BazaarPlugin::update()
void BazaarPlugin::createSubmitEditorActions()
{
- Core::Context context(Constants::COMMIT_ID);
+ Context context(COMMIT_ID);
Core::Command *command;
- m_editorCommit = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- command = Core::ActionManager::registerAction(m_editorCommit, Core::Id(Constants::COMMIT), context);
+ m_editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
+ command = ActionManager::registerAction(m_editorCommit, COMMIT, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor()));
- m_editorDiff = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- command = Core::ActionManager::registerAction(m_editorDiff, Core::Id(Constants::DIFFEDITOR), context);
+ m_editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
+ command = ActionManager::registerAction(m_editorDiff, DIFFEDITOR, context);
m_editorUndo = new QAction(tr("&Undo"), this);
- command = Core::ActionManager::registerAction(m_editorUndo, Core::Id(Core::Constants::UNDO), context);
+ command = ActionManager::registerAction(m_editorUndo, Core::Constants::UNDO, context);
m_editorRedo = new QAction(tr("&Redo"), this);
- command = Core::ActionManager::registerAction(m_editorRedo, Core::Id(Core::Constants::REDO), context);
+ command = ActionManager::registerAction(m_editorRedo, Core::Constants::REDO, context);
}
void BazaarPlugin::commit()
@@ -515,23 +553,23 @@ void BazaarPlugin::commit()
if (raiseSubmitEditor())
return;
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_submitRepository = state.topLevel();
- connect(m_client, SIGNAL(parsedStatus(QList<VcsBase::VcsBaseClient::StatusItem>)),
- this, SLOT(showCommitWidget(QList<VcsBase::VcsBaseClient::StatusItem>)));
+ connect(m_client, SIGNAL(parsedStatus(QList<VcsBaseClient::StatusItem>)),
+ this, SLOT(showCommitWidget(QList<VcsBaseClient::StatusItem>)));
// The "--short" option allows to easily parse status output
m_client->emitParsedStatus(m_submitRepository, QStringList(QLatin1String("--short")));
}
-void BazaarPlugin::showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status)
+void BazaarPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &status)
{
- VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
+ VcsBaseOutputWindow *outputWindow = VcsBaseOutputWindow::instance();
//Once we receive our data release the connection so it can be reused elsewhere
- disconnect(m_client, SIGNAL(parsedStatus(QList<VcsBase::VcsBaseClient::StatusItem>)),
- this, SLOT(showCommitWidget(QList<VcsBase::VcsBaseClient::StatusItem>)));
+ disconnect(m_client, SIGNAL(parsedStatus(QList<VcsBaseClient::StatusItem>)),
+ this, SLOT(showCommitWidget(QList<VcsBaseClient::StatusItem>)));
if (status.isEmpty()) {
outputWindow->appendError(tr("There are no changes to commit."));
@@ -539,15 +577,15 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusIt
}
// Start new temp file
- Utils::TempFileSaver saver;
+ TempFileSaver saver;
// Keep the file alive, else it removes self and forgets its name
saver.setAutoRemove(false);
if (!saver.finalize()) {
- VcsBase::VcsBaseOutputWindow::instance()->appendError(saver.errorString());
+ VcsBaseOutputWindow::instance()->appendError(saver.errorString());
return;
}
- Core::IEditor *editor = Core::EditorManager::openEditor(saver.fileName(), Constants::COMMIT_ID);
+ IEditor *editor = EditorManager::openEditor(saver.fileName(), COMMIT_ID);
if (!editor) {
outputWindow->appendError(tr("Unable to create an editor for the commit."));
return;
@@ -582,7 +620,6 @@ void BazaarPlugin::diffFromEditorSelected(const QStringList &files)
}
#ifdef WITH_TESTS
-#include <QTest>
void BazaarPlugin::testDiffFileResolving_data()
{
@@ -644,15 +681,15 @@ void BazaarPlugin::commitFromEditor()
{
// Close the submit editor
m_submitActionTriggered = true;
- Core::EditorManager::closeEditor();
+ EditorManager::closeEditor();
}
void BazaarPlugin::uncommit()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- UnCommitDialog dialog(Core::ICore::dialogParent());
+ UnCommitDialog dialog(ICore::dialogParent());
if (dialog.exec() == QDialog::Accepted)
m_client->synchronousUncommit(state.topLevel(), dialog.revision(), dialog.extraOptions());
}
@@ -661,20 +698,20 @@ bool BazaarPlugin::submitEditorAboutToClose()
{
CommitEditor *commitEditor = qobject_cast<CommitEditor *>(submitEditor());
QTC_ASSERT(commitEditor, return true);
- Core::IDocument *editorDocument = commitEditor->document();
+ IDocument *editorDocument = commitEditor->document();
QTC_ASSERT(editorDocument, return true);
bool dummyPrompt = false;
- const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult response =
+ const VcsBaseSubmitEditor::PromptSubmitResult response =
commitEditor->promptSubmit(tr("Close Commit Editor"), tr("Do you want to commit the changes?"),
tr("Message check failed. Do you want to proceed?"),
&dummyPrompt, !m_submitActionTriggered);
m_submitActionTriggered = false;
switch (response) {
- case VcsBase::VcsBaseSubmitEditor::SubmitCanceled:
+ case VcsBaseSubmitEditor::SubmitCanceled:
return false;
- case VcsBase::VcsBaseSubmitEditor::SubmitDiscarded:
+ case VcsBaseSubmitEditor::SubmitDiscarded:
return true;
default:
break;
@@ -683,7 +720,7 @@ bool BazaarPlugin::submitEditorAboutToClose()
QStringList files = commitEditor->checkedFiles();
if (!files.empty()) {
//save the commit message
- if (!Core::DocumentManager::saveDocument(editorDocument))
+ if (!DocumentManager::saveDocument(editorDocument))
return false;
//rewrite entries of the form 'file => newfile' to 'newfile' because
@@ -734,4 +771,7 @@ void BazaarPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
repoAction->setEnabled(repoEnabled);
}
-Q_EXPORT_PLUGIN(BazaarPlugin)
+} // namespace Internal
+} // namespace Bazaar
+
+Q_EXPORT_PLUGIN(Bazaar::Internal::BazaarPlugin)
diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h
index f5f5b1d53d..8c5afbc11e 100644
--- a/src/plugins/bazaar/bazaarplugin.h
+++ b/src/plugins/bazaar/bazaarplugin.h
@@ -26,6 +26,7 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
+
#ifndef BAZAARPLUGIN_H
#define BAZAARPLUGIN_H
@@ -40,19 +41,13 @@ class QAction;
QT_END_NAMESPACE
namespace Core {
-class ActionManager;
class ActionContainer;
class CommandLocator;
class Id;
-class IVersionControl;
-class IEditorFactory;
-class IEditor;
} // namespace Core
namespace Utils { class ParameterAction; }
-namespace VcsBase { class VcsBaseSubmitEditor; }
-
namespace Bazaar {
namespace Internal {
diff --git a/src/plugins/bazaar/constants.h b/src/plugins/bazaar/constants.h
index 54e9505004..054c9909b7 100644
--- a/src/plugins/bazaar/constants.h
+++ b/src/plugins/bazaar/constants.h
@@ -61,38 +61,6 @@ const char DIFFLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Diff Editor
const char DIFFLOG[] = "Bazaar Diff Editor";
const char DIFFAPP[] = "text/x-patch";
-// Submit editor parameters
-const char COMMIT_ID[] = "Bazaar Commit Log Editor";
-const char COMMIT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Commit Log Editor");
-const char COMMITMIMETYPE[] = "text/vnd.qtcreator.bazaar.commit";
-
-// Menu items
-// File menu actions
-const char ADD[] = "Bazaar.AddSingleFile";
-const char DELETE[] = "Bazaar.DeleteSingleFile";
-const char ANNOTATE[] = "Bazaar.Annotate";
-const char DIFF[] = "Bazaar.DiffSingleFile";
-const char LOG[] = "Bazaar.LogSingleFile";
-const char REVERT[] = "Bazaar.RevertSingleFile";
-const char STATUS[] = "Bazaar.Status";
-
-// Directory menu Actions
-const char DIFFMULTI[] = "Bazaar.Action.DiffMulti";
-const char REVERTMULTI[] = "Bazaar.Action.RevertALL";
-const char STATUSMULTI[] = "Bazaar.Action.StatusMulti";
-const char LOGMULTI[] = "Bazaar.Action.Logmulti";
-
-// Repository menu actions
-const char PULL[] = "Bazaar.Action.Pull";
-const char PUSH[] = "Bazaar.Action.Push";
-const char UPDATE[] = "Bazaar.Action.Update";
-const char COMMIT[] = "Bazaar.Action.Commit";
-const char UNCOMMIT[] = "Bazaar.Action.UnCommit";
-const char CREATE_REPOSITORY[] = "Bazaar.Action.CreateRepository";
-
-// Submit editor actions
-const char DIFFEDITOR[] = "Bazaar.Action.Editor.Diff";
-
} // namespace Constants
} // namespace Bazaar
diff --git a/src/plugins/beautifier/abstractsettings.cpp b/src/plugins/beautifier/abstractsettings.cpp
index 774478edaf..bf164cef28 100644
--- a/src/plugins/beautifier/abstractsettings.cpp
+++ b/src/plugins/beautifier/abstractsettings.cpp
@@ -196,7 +196,7 @@ void AbstractSettings::save()
}
// remove old files
- foreach (const QString file, m_stylesToRemove)
+ foreach (const QString &file, m_stylesToRemove)
m_styleDir.remove(file);
m_stylesToRemove.clear();
@@ -239,7 +239,7 @@ void AbstractSettings::read()
s->beginGroup(QLatin1String(Constants::SETTINGS_GROUP));
s->beginGroup(m_name);
const QStringList keys = s->allKeys();
- foreach (const QString key, keys) {
+ foreach (const QString &key, keys) {
if (key == QLatin1String("command"))
setCommand(s->value(key).toString());
else if (m_settings.contains(key))
@@ -259,7 +259,7 @@ void AbstractSettings::read()
const QStringList files
= m_styleDir.entryList(QStringList() << QLatin1Char('*') + m_ending,
QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);
- foreach (const QString filename, files) {
+ foreach (const QString &filename, files) {
// do not allow empty file names
if (filename == m_ending)
continue;
diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp
index b5867192c3..3d88b68339 100644
--- a/src/plugins/bineditor/bineditorplugin.cpp
+++ b/src/plugins/bineditor/bineditorplugin.cpp
@@ -440,7 +440,7 @@ QWidget *BinEditorWidgetFactory::createWidget(QWidget *parent)
///////////////////////////////// BinEditorPlugin //////////////////////////////////
-BinEditorPlugin::BinEditorPlugin()
+BinEditorPlugin::BinEditorPlugin() : m_factory(0)
{
m_undoAction = m_redoAction = m_copyAction = m_selectAllAction = 0;
}
diff --git a/src/plugins/bookmarks/bookmark.cpp b/src/plugins/bookmarks/bookmark.cpp
index 16e6d21780..e64a91be7e 100644
--- a/src/plugins/bookmarks/bookmark.cpp
+++ b/src/plugins/bookmarks/bookmark.cpp
@@ -37,10 +37,10 @@
using namespace Bookmarks::Internal;
Bookmark::Bookmark(const QString& fileName, int lineNumber, BookmarkManager *manager) :
- BaseTextMark(fileName, lineNumber),
+ TextMark(fileName, lineNumber),
m_manager(manager)
{
- setPriority(TextEditor::ITextMark::NormalPriority);
+ setPriority(TextEditor::TextMark::NormalPriority);
setIcon(m_manager->bookmarkIcon());
}
@@ -52,7 +52,7 @@ void Bookmark::removedFromEditor()
void Bookmark::updateLineNumber(int line)
{
if (line != lineNumber()) {
- BaseTextMark::updateLineNumber(line);
+ TextMark::updateLineNumber(line);
m_manager->updateBookmark(this);
}
}
@@ -60,7 +60,7 @@ void Bookmark::updateLineNumber(int line)
void Bookmark::move(int line)
{
if (line != lineNumber()) {
- BaseTextMark::move(line);
+ TextMark::move(line);
m_manager->updateBookmark(this);
}
}
@@ -75,7 +75,7 @@ void Bookmark::updateBlock(const QTextBlock &block)
void Bookmark::updateFileName(const QString &fileName)
{
- BaseTextMark::updateFileName(fileName);
+ TextMark::updateFileName(fileName);
m_manager->updateBookmark(this);
}
diff --git a/src/plugins/bookmarks/bookmark.h b/src/plugins/bookmarks/bookmark.h
index 5ac9db50d5..2388f6b9d0 100644
--- a/src/plugins/bookmarks/bookmark.h
+++ b/src/plugins/bookmarks/bookmark.h
@@ -30,15 +30,14 @@
#ifndef BOOKMARK_H
#define BOOKMARK_H
-#include <texteditor/itexteditor.h>
-#include <texteditor/basetextmark.h>
+#include <texteditor/textmark.h>
namespace Bookmarks {
namespace Internal {
class BookmarkManager;
-class Bookmark : public TextEditor::BaseTextMark
+class Bookmark : public TextEditor::TextMark
{
public:
Bookmark(const QString &fileName, int lineNumber, BookmarkManager *manager);
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index b601bd00ce..ff8c49d276 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -39,7 +39,7 @@
#include <coreplugin/actionmanager/command.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <utils/tooltip/tooltip.h>
#include <utils/tooltip/tipcontents.h>
#include <utils/qtcassert.h>
@@ -410,7 +410,7 @@ QVariant BookmarkManager::data(const QModelIndex &index, int role) const
void BookmarkManager::toggleBookmark()
{
- ITextEditor *editor = ITextEditor::currentTextEditor();
+ BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
if (!editor)
return;
@@ -429,9 +429,7 @@ void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber)
}
// Add a new bookmark if no bookmark existed on this line
- Bookmark *bookmark = new Bookmark(fileName, editorLine, this);
- bookmark->init();
- addBookmark(bookmark);
+ addBookmark(new Bookmark(fileName, editorLine, this));
}
void BookmarkManager::updateBookmark(Bookmark *bookmark)
@@ -526,7 +524,7 @@ void BookmarkManager::prevInDocument()
void BookmarkManager::documentPrevNext(bool next)
{
- ITextEditor *editor = ITextEditor::currentTextEditor();
+ BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
int editorLine = editor->currentLine();
QFileInfo fi(editor->document()->filePath());
if (!m_bookmarksMap.contains(fi.path()))
@@ -615,7 +613,7 @@ BookmarkManager::State BookmarkManager::state() const
if (m_bookmarksMap.empty())
return NoBookMarks;
- ITextEditor *editor = ITextEditor::currentTextEditor();
+ BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
if (!editor)
return HasBookMarks;
@@ -769,7 +767,6 @@ void BookmarkManager::addBookmark(const QString &s)
if (!filePath.isEmpty() && !findBookmark(filePath, lineNumber)) {
Bookmark *b = new Bookmark(filePath, lineNumber, this);
b->setNote(note);
- b->init();
addBookmark(b, false);
}
} else {
@@ -798,7 +795,7 @@ void BookmarkManager::saveBookmarks()
SessionManager::setValue(QLatin1String("Bookmarks"), list);
}
-void BookmarkManager::operateTooltip(ITextEditor *textEditor, const QPoint &pos, Bookmark *mark)
+void BookmarkManager::operateTooltip(BaseTextEditor *textEditor, const QPoint &pos, Bookmark *mark)
{
if (!mark)
return;
@@ -820,15 +817,15 @@ void BookmarkManager::loadBookmarks()
updateActionStatus();
}
-void BookmarkManager::handleBookmarkRequest(ITextEditor *textEditor,
+void BookmarkManager::handleBookmarkRequest(BaseTextEditor *textEditor,
int line,
- ITextEditor::MarkRequestKind kind)
+ BaseTextEditor::MarkRequestKind kind)
{
- if (kind == ITextEditor::BookmarkRequest && textEditor->document())
+ if (kind == BaseTextEditor::BookmarkRequest && textEditor->document())
toggleBookmark(textEditor->document()->filePath(), line);
}
-void BookmarkManager::handleBookmarkTooltipRequest(ITextEditor *textEditor, const QPoint &pos,
+void BookmarkManager::handleBookmarkTooltipRequest(BaseTextEditor *textEditor, const QPoint &pos,
int line)
{
if (textEditor->document()) {
@@ -842,34 +839,15 @@ void BookmarkManager::handleBookmarkTooltipRequest(ITextEditor *textEditor, cons
BookmarkViewFactory::BookmarkViewFactory(BookmarkManager *bm)
: m_manager(bm)
{
+ setDisplayName(BookmarkView::tr("Bookmarks"));
+ setPriority(300);
+ setId("Bookmarks");
+ setActivationSequence(QKeySequence(Core::UseMacShortcuts ? tr("Alt+Meta+M") : tr("Alt+M")));
}
-QString BookmarkViewFactory::displayName() const
+NavigationView BookmarkViewFactory::createWidget()
{
- return BookmarkView::tr("Bookmarks");
-}
-
-int BookmarkViewFactory::priority() const
-{
- return 300;
-}
-
-Id BookmarkViewFactory::id() const
-{
- return "Bookmarks";
-}
-
-QKeySequence BookmarkViewFactory::activationSequence() const
-{
- return QKeySequence(Core::UseMacShortcuts ? tr("Alt+Meta+M") : tr("Alt+M"));
-}
-
-Core::NavigationView BookmarkViewFactory::createWidget()
-{
- BookmarkView *bookmarkView = new BookmarkView(m_manager);
- Core::NavigationView view;
- view.widget = bookmarkView;
- return view;
+ return NavigationView(new BookmarkView(m_manager));
}
} // namespace Internal
diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h
index ce195897de..0fbd7876da 100644
--- a/src/plugins/bookmarks/bookmarkmanager.h
+++ b/src/plugins/bookmarks/bookmarkmanager.h
@@ -34,7 +34,7 @@
#include <coreplugin/icontext.h>
#include <coreplugin/inavigationwidgetfactory.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <QAbstractItemModel>
#include <QMultiMap>
@@ -108,10 +108,10 @@ signals:
private slots:
void updateActionStatus();
void loadBookmarks();
- void handleBookmarkRequest(TextEditor::ITextEditor * textEditor,
+ void handleBookmarkRequest(TextEditor::BaseTextEditor * textEditor,
int line,
- TextEditor::ITextEditor::MarkRequestKind kind);
- void handleBookmarkTooltipRequest(TextEditor::ITextEditor *textEditor,
+ TextEditor::BaseTextEditor::MarkRequestKind kind);
+ void handleBookmarkTooltipRequest(TextEditor::BaseTextEditor *textEditor,
const QPoint &pos,
int line);
@@ -123,7 +123,7 @@ private:
void addBookmark(const QString &s);
static QString bookmarkToString(const Bookmark *b);
void saveBookmarks();
- void operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark);
+ void operateTooltip(TextEditor::BaseTextEditor *textEditor, const QPoint &pos, Bookmark *mark);
typedef QMultiMap<QString, Bookmark *> FileNameBookmarksMap;
typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap;
@@ -170,10 +170,6 @@ public:
BookmarkViewFactory(BookmarkManager *bm);
private:
- QString displayName() const;
- int priority() const;
- Core::Id id() const;
- QKeySequence activationSequence() const;
Core::NavigationView createWidget();
BookmarkManager *m_manager;
diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp
index c4fc525bdb..d1423a0335 100644
--- a/src/plugins/bookmarks/bookmarksplugin.cpp
+++ b/src/plugins/bookmarks/bookmarksplugin.cpp
@@ -40,7 +40,7 @@
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/id.h>
#include <extensionsystem/pluginmanager.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <texteditor/texteditorconstants.h>
#include <QtPlugin>
@@ -152,32 +152,32 @@ void BookmarksPlugin::updateActions(int state)
void BookmarksPlugin::editorOpened(Core::IEditor *editor)
{
- if (qobject_cast<ITextEditor *>(editor)) {
- connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
- this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+ if (qobject_cast<BaseTextEditor *>(editor)) {
+ connect(editor, SIGNAL(markContextMenuRequested(TextEditor::BaseTextEditor*,int,QMenu*)),
+ this, SLOT(requestContextMenu(TextEditor::BaseTextEditor*,int,QMenu*)));
connect(editor,
- SIGNAL(markRequested(TextEditor::ITextEditor*,int,
- TextEditor::ITextEditor::MarkRequestKind)),
+ SIGNAL(markRequested(TextEditor::BaseTextEditor*,int,
+ TextEditor::BaseTextEditor::MarkRequestKind)),
m_bookmarkManager,
- SLOT(handleBookmarkRequest(TextEditor::ITextEditor*,int,
- TextEditor::ITextEditor::MarkRequestKind)));
+ SLOT(handleBookmarkRequest(TextEditor::BaseTextEditor*,int,
+ TextEditor::BaseTextEditor::MarkRequestKind)));
connect(editor,
- SIGNAL(markTooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
+ SIGNAL(markTooltipRequested(TextEditor::BaseTextEditor*,QPoint,int)),
m_bookmarkManager,
- SLOT(handleBookmarkTooltipRequest(TextEditor::ITextEditor*,QPoint,int)));
+ SLOT(handleBookmarkTooltipRequest(TextEditor::BaseTextEditor*,QPoint,int)));
}
}
void BookmarksPlugin::editorAboutToClose(Core::IEditor *editor)
{
- if (qobject_cast<ITextEditor *>(editor)) {
- disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
- this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+ if (qobject_cast<BaseTextEditor *>(editor)) {
+ disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::BaseTextEditor*,int,QMenu*)),
+ this, SLOT(requestContextMenu(TextEditor::BaseTextEditor*,int,QMenu*)));
}
}
-void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
+void BookmarksPlugin::requestContextMenu(TextEditor::BaseTextEditor *editor,
int lineNumber, QMenu *menu)
{
// Don't set bookmarks in disassembler views.
diff --git a/src/plugins/bookmarks/bookmarksplugin.h b/src/plugins/bookmarks/bookmarksplugin.h
index 63045c42cc..417b4dc1d6 100644
--- a/src/plugins/bookmarks/bookmarksplugin.h
+++ b/src/plugins/bookmarks/bookmarksplugin.h
@@ -42,7 +42,7 @@ QT_END_NAMESPACE
namespace Core { class IEditor; }
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace Bookmarks {
namespace Internal {
@@ -67,7 +67,7 @@ public slots:
private slots:
void editorOpened(Core::IEditor *editor);
void editorAboutToClose(Core::IEditor *editor);
- void requestContextMenu(TextEditor::ITextEditor *editor,
+ void requestContextMenu(TextEditor::BaseTextEditor *editor,
int lineNumber, QMenu *menu);
void bookmarkMarginActionTriggered();
void editBookmarkActionTriggered();
diff --git a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp
index 637921a84e..f6297b84a5 100644
--- a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp
+++ b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp
@@ -41,6 +41,7 @@
#include <cpptools/cppmodelmanager.h>
+#include <projectexplorer/projectpanelfactory.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
@@ -54,7 +55,12 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
- addAutoReleasedObject(new ClangProjectSettingsPanelFactory);
+ auto panelFactory = new ProjectExplorer::ProjectPanelFactory();
+ panelFactory->setPriority(60);
+ panelFactory->setDisplayName(ClangProjectSettingsWidget::tr("Clang Settings"));
+ panelFactory->setSimpleCreateWidgetFunction<ClangProjectSettingsWidget>(QIcon());
+
+ ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
ClangCodeModel::Internal::initializeClang();
diff --git a/src/plugins/clangcodemodel/clangcompletion.cpp b/src/plugins/clangcodemodel/clangcompletion.cpp
index 90ed1d7794..a15b905e6c 100644
--- a/src/plugins/clangcodemodel/clangcompletion.cpp
+++ b/src/plugins/clangcodemodel/clangcompletion.cpp
@@ -509,7 +509,7 @@ void ClangAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor
}
// Avoid inserting characters that are already there
- const int endsPosition = editor->position(TextEditor::ITextEditor::EndOfLine);
+ const int endsPosition = editor->position(TextEditor::BaseTextEditor::EndOfLine);
const QString existingText = editor->textDocument()->textAt(editor->position(),
endsPosition - editor->position());
int existLength = 0;
diff --git a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp
index 37760aa4ee..f9032d5367 100644
--- a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp
+++ b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp
@@ -38,39 +38,6 @@
using namespace ProjectExplorer;
using namespace ClangCodeModel::Internal;
-static const char CLANGPROJECTSETTINGS_PANEL_ID[] = "ClangCodeModel.ProjectPanel";
-
-
-QString ClangProjectSettingsPanelFactory::id() const
-{
- return QLatin1String(CLANGPROJECTSETTINGS_PANEL_ID);
-}
-
-QString ClangProjectSettingsPanelFactory::displayName() const
-{
- return ClangProjectSettingsWidget::tr("Clang Settings");
-}
-
-int ClangProjectSettingsPanelFactory::priority() const
-{
- return 60;
-}
-
-bool ClangProjectSettingsPanelFactory::supports(Project *project)
-{
- Q_UNUSED(project);
-
- return true;
-}
-
-PropertiesPanel *ClangProjectSettingsPanelFactory::createPanel(Project *project)
-{
- PropertiesPanel *panel = new PropertiesPanel;
- panel->setDisplayName(ClangProjectSettingsWidget::tr("Clang Settings"));
- panel->setWidget(new ClangProjectSettingsWidget(project));
- return panel;
-}
-
ClangProjectSettingsWidget::ClangProjectSettingsWidget(Project *project)
: m_project(project)
{
diff --git a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h
index 7f826a4830..82acce6cc2 100644
--- a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h
+++ b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h
@@ -32,23 +32,15 @@
#include "ui_clangprojectsettingspropertiespage.h"
-#include <projectexplorer/iprojectproperties.h>
-
#include <QString>
+namespace ProjectExplorer {
+ class Project;
+}
+
namespace ClangCodeModel {
namespace Internal {
-class ClangProjectSettingsPanelFactory: public ProjectExplorer::IProjectPanelFactory
-{
-public:
- QString id() const;
- QString displayName() const;
- int priority() const;
- bool supports(ProjectExplorer::Project *project);
- ProjectExplorer::PropertiesPanel *createPanel(ProjectExplorer::Project *project);
-};
-
class ClangProjectSettingsWidget: public QWidget
{
Q_OBJECT
diff --git a/src/plugins/clangcodemodel/semanticmarker.h b/src/plugins/clangcodemodel/semanticmarker.h
index 43959b4e27..744aece1c6 100644
--- a/src/plugins/clangcodemodel/semanticmarker.h
+++ b/src/plugins/clangcodemodel/semanticmarker.h
@@ -36,7 +36,7 @@
#include "sourcemarker.h"
#include "utils.h"
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <QMutex>
#include <QScopedPointer>
diff --git a/src/plugins/clangcodemodel/test/completiontesthelper.cpp b/src/plugins/clangcodemodel/test/completiontesthelper.cpp
index cac9bcd04e..e11bbb1222 100644
--- a/src/plugins/clangcodemodel/test/completiontesthelper.cpp
+++ b/src/plugins/clangcodemodel/test/completiontesthelper.cpp
@@ -37,7 +37,7 @@
#include <cpptools/cppcompletionassist.h>
#include <texteditor/basetextdocument.h>
-#include <texteditor/plaintexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <texteditor/codeassist/iassistproposal.h>
#include <texteditor/codeassist/iassistproposalmodel.h>
#include <texteditor/codeassist/basicproposalitemlistmodel.h>
diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp
index e0d756a3a8..09d7796648 100644
--- a/src/plugins/classview/classviewmanager.cpp
+++ b/src/plugins/classview/classviewmanager.cpp
@@ -41,7 +41,7 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <QThread>
#include <QMutex>
@@ -224,10 +224,6 @@ void Manager::initialize()
{
// use Qt::QueuedConnection everywhere
- // widget factory signals
- connect(NavigationWidgetFactory::instance(), SIGNAL(widgetIsCreated()),
- SLOT(onWidgetIsCreated()), Qt::QueuedConnection);
-
// internal manager state is changed
connect(this, SIGNAL(stateChanged(bool)), SLOT(onStateChanged(bool)), Qt::QueuedConnection);
@@ -319,17 +315,6 @@ void Manager::setState(bool state)
}
/*!
- Reacts to the widget factory creating a widget.
-
- \sa setState, state
-*/
-
-void Manager::onWidgetIsCreated()
-{
- // do nothing - continue to sleep
-}
-
-/*!
Reacts to the \a visibility of one navigation pane widget being changed
(there might be a lot of them).
@@ -473,7 +458,7 @@ void Manager::gotoLocations(const QList<QVariant> &list)
fileName = document->filePath();
// if text file - what is current position?
- TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
+ TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
if (textEditor) {
// there is open currently text editor
int position = textEditor->position();
diff --git a/src/plugins/classview/classviewmanager.h b/src/plugins/classview/classviewmanager.h
index f05d8a7733..19c973de26 100644
--- a/src/plugins/classview/classviewmanager.h
+++ b/src/plugins/classview/classviewmanager.h
@@ -87,7 +87,6 @@ public slots:
void setFlatMode(bool flat);
protected slots:
- void onWidgetIsCreated();
void onWidgetVisibilityIsChanged(bool visibility);
void onStateChanged(bool state);
void onProjectListChanged();
diff --git a/src/plugins/classview/classviewnavigationwidgetfactory.cpp b/src/plugins/classview/classviewnavigationwidgetfactory.cpp
index 2255faf1c8..1ba4bc96d8 100644
--- a/src/plugins/classview/classviewnavigationwidgetfactory.cpp
+++ b/src/plugins/classview/classviewnavigationwidgetfactory.cpp
@@ -41,8 +41,6 @@
namespace ClassView {
namespace Internal {
-static NavigationWidgetFactory *factoryInstance;
-
///////////////////////////////// NavigationWidgetFactory //////////////////////////////////
/*!
@@ -52,49 +50,13 @@ static NavigationWidgetFactory *factoryInstance;
Supports the \c setState public slot for adding the widget factory to or
removing it from \c ExtensionSystem::PluginManager.
-
- Also supports the \c widgetIsCreated and \c stateChanged signals.
-*/
-
-/*!
- \fn void NavigationWidgetFactory::widgetIsCreated()
-
- Informs that the widget factory created a widget.
*/
NavigationWidgetFactory::NavigationWidgetFactory()
{
- factoryInstance = this;
-}
-
-NavigationWidgetFactory::~NavigationWidgetFactory()
-{
- factoryInstance = 0;
-}
-
-NavigationWidgetFactory *NavigationWidgetFactory::instance()
-{
- return factoryInstance;
-}
-
-QString NavigationWidgetFactory::displayName() const
-{
- return tr("Class View");
-}
-
-int NavigationWidgetFactory::priority() const
-{
- return 500;
-}
-
-Core::Id NavigationWidgetFactory::id() const
-{
- return "Class View";
-}
-
-QKeySequence NavigationWidgetFactory::activationSequence() const
-{
- return QKeySequence();
+ setDisplayName(tr("Class View"));
+ setPriority(500);
+ setId("Class View");
}
Core::NavigationView NavigationWidgetFactory::createWidget()
@@ -103,7 +65,6 @@ Core::NavigationView NavigationWidgetFactory::createWidget()
NavigationWidget *widget = new NavigationWidget();
navigationView.widget = widget;
navigationView.dockToolBarWidgets = widget->createToolButtons();
- emit widgetIsCreated();
return navigationView;
}
diff --git a/src/plugins/classview/classviewnavigationwidgetfactory.h b/src/plugins/classview/classviewnavigationwidgetfactory.h
index 3cb0ec3b0c..450ae71930 100644
--- a/src/plugins/classview/classviewnavigationwidgetfactory.h
+++ b/src/plugins/classview/classviewnavigationwidgetfactory.h
@@ -40,28 +40,8 @@ class NavigationWidgetFactory : public Core::INavigationWidgetFactory
Q_OBJECT
public:
- //! Constructor
NavigationWidgetFactory();
- //! Destructor
- ~NavigationWidgetFactory();
-
- //! Access to static instance
- static NavigationWidgetFactory *instance();
-
- // Core::INavigationWidgetFactory
- //! \implements Core::INavigationWidgetFactory::displayName
- QString displayName() const;
-
- //! \implements Core::INavigationWidgetFactory::priority
- int priority() const;
-
- //! \implements Core::INavigationWidgetFactory::id
- Core::Id id() const;
-
- //! \implements Core::INavigationWidgetFactory::activationSequence
- QKeySequence activationSequence() const;
-
//! \implements Core::INavigationWidgetFactory::createWidget
Core::NavigationView createWidget();
@@ -70,9 +50,6 @@ public:
//! \implements Core::INavigationWidgetFactory::restoreSettings
void restoreSettings(int position, QWidget *widget);
-
-signals:
- void widgetIsCreated();
};
} // namespace Internal
diff --git a/src/plugins/classview/classviewplugin.cpp b/src/plugins/classview/classviewplugin.cpp
index 95117dc8d5..517ae0cc1b 100644
--- a/src/plugins/classview/classviewplugin.cpp
+++ b/src/plugins/classview/classviewplugin.cpp
@@ -51,11 +51,8 @@ bool Plugin::initialize(const QStringList &arguments, QString *errorMessage)
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
- // create a navigation widget factory
- (void) new NavigationWidgetFactory;
-
// add to ExtensionSystem
- addAutoReleasedObject(NavigationWidgetFactory::instance());
+ addAutoReleasedObject(new NavigationWidgetFactory);
// create manager
(void) new Manager(this);
diff --git a/src/plugins/clearcase/activityselector.cpp b/src/plugins/clearcase/activityselector.cpp
index 3b78094e61..c7dbf9d03e 100644
--- a/src/plugins/clearcase/activityselector.cpp
+++ b/src/plugins/clearcase/activityselector.cpp
@@ -87,7 +87,7 @@ bool ActivitySelector::refresh()
int current;
QList<QStringPair> activities = m_plugin->activities(&current);
m_cmbActivity->clear();
- foreach (QStringPair activity, activities)
+ foreach (const QStringPair &activity, activities)
m_cmbActivity->addItem(activity.second, activity.first);
m_cmbActivity->setCurrentIndex(current);
m_cmbActivity->updateGeometry();
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index 1ea29ff15a..3fab90897d 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -1500,7 +1500,7 @@ ClearCaseResponse
}
const Utils::SynchronousProcessResponse sp_resp =
- VcsBase::VcsBasePlugin::runVcs(workingDir, executable,
+ VcsBase::VcsBasePlugin::runVcs(workingDir, Utils::FileName::fromUserInput(executable),
arguments, timeOut,
flags, outputCodec);
@@ -1531,7 +1531,7 @@ IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const QString
return 0;
e->setForceReadOnly(true);
s.replace(QLatin1Char(' '), QLatin1Char('_'));
- e->baseTextDocument()->setSuggestedFileName(s);
+ e->textDocument()->setSuggestedFileName(s);
if (!source.isEmpty())
e->setSource(source);
if (codec)
diff --git a/src/plugins/clearcase/clearcasesettings.cpp b/src/plugins/clearcase/clearcasesettings.cpp
index f3e6320e90..edd144f3fd 100644
--- a/src/plugins/clearcase/clearcasesettings.cpp
+++ b/src/plugins/clearcase/clearcasesettings.cpp
@@ -77,7 +77,7 @@ void ClearCaseSettings::fromSettings(QSettings *settings)
{
settings->beginGroup(QLatin1String(groupC));
ccCommand = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
- ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand);
+ ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand).toString();
timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool();
QString sDiffType = settings->value(QLatin1String(diffTypeKeyC), QLatin1String("Graphical")).toString();
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
index d442c52f13..509d385a8c 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
@@ -101,6 +101,11 @@ void CMakeBuildConfiguration::setUseNinja(bool useNninja)
}
}
+void CMakeBuildConfiguration::emitBuildTypeChanged()
+{
+ emit buildTypeChanged();
+}
+
CMakeBuildConfiguration::~CMakeBuildConfiguration()
{ }
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
index 54cffa4310..3413c374b1 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
@@ -61,6 +61,8 @@ public:
bool useNinja() const;
void setUseNinja(bool);
+ void emitBuildTypeChanged();
+
signals:
void useNinjaChanged(bool);
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
index 46c26cdf35..5c0b1fdd06 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
@@ -62,6 +62,8 @@ CMakeEditor::CMakeEditor(CMakeEditorWidget *editor)
setContext(Core::Context(CMakeProjectManager::Constants::C_CMAKEEDITOR,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
+ setCommentStyle(Utils::CommentDefinition::HashStyle);
+ setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<CMakeFileCompletionAssistProvider>());
connect(document(), SIGNAL(changed()), this, SLOT(markAsChanged()));
}
@@ -73,11 +75,6 @@ Core::IEditor *CMakeEditor::duplicate()
return ret->editor();
}
-TextEditor::CompletionAssistProvider *CMakeEditor::completionAssistProvider()
-{
- return ExtensionSystem::PluginManager::getObject<CMakeFileCompletionAssistProvider>();
-}
-
void CMakeEditor::markAsChanged()
{
if (!document()->isModified())
@@ -109,7 +106,7 @@ void CMakeEditor::build()
QString CMakeEditor::contextHelpId() const
{
int pos = position();
- TextEditor::ITextEditorDocument* doc = const_cast<CMakeEditor*>(this)->textDocument();
+ TextEditor::BaseTextDocument *doc = const_cast<CMakeEditor*>(this)->textDocument();
QChar chr;
do {
@@ -154,32 +151,17 @@ QString CMakeEditor::contextHelpId() const
CMakeEditorWidget::CMakeEditorWidget(QWidget *parent)
: BaseTextEditorWidget(new CMakeDocument(), parent)
-{
- ctor();
-}
+{}
CMakeEditorWidget::CMakeEditorWidget(CMakeEditorWidget *other)
: BaseTextEditorWidget(other)
-{
- ctor();
-}
-
-void CMakeEditorWidget::ctor()
-{
- m_commentDefinition.clearCommentStyles();
- m_commentDefinition.singleLine = QLatin1Char('#');
-}
+{}
TextEditor::BaseTextEditor *CMakeEditorWidget::createEditor()
{
return new CMakeEditor(this);
}
-void CMakeEditorWidget::unCommentSelection()
-{
- Utils::unCommentSelection(this, m_commentDefinition);
-}
-
void CMakeEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{
showDefaultContextMenu(e, Constants::M_CONTEXT);
@@ -242,7 +224,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// TODO: Resolve variables
- QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
+ QDir dir(QFileInfo(textDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.h b/src/plugins/cmakeprojectmanager/cmakeeditor.h
index 618f2103dd..5c59481d47 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.h
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.h
@@ -53,7 +53,6 @@ public:
CMakeEditor(CMakeEditorWidget *);
Core::IEditor *duplicate();
- TextEditor::CompletionAssistProvider *completionAssistProvider();
QString contextHelpId() const;
@@ -78,13 +77,8 @@ protected:
TextEditor::BaseTextEditor *createEditor();
void contextMenuEvent(QContextMenuEvent *e);
-public slots:
- void unCommentSelection();
-
private:
CMakeEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
- void ctor();
- Utils::CommentDefinition m_commentDefinition;
};
class CMakeDocument : public TextEditor::BaseTextDocument
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 6ae4e4e5f1..8e859e73f0 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -190,6 +190,55 @@ QString CMakeProject::shadowBuildDirectory(const QString &projectFilePath, const
return QDir::cleanPath(projectDir.absoluteFilePath(buildPath));
}
+QStringList CMakeProject::getCXXFlagsFor(const CMakeBuildTarget &buildTarget)
+{
+ QString makeCommand = QDir::fromNativeSeparators(buildTarget.makeCommand);
+ int startIndex = makeCommand.indexOf(QLatin1Char('\"'));
+ int endIndex = makeCommand.indexOf(QLatin1Char('\"'), startIndex + 1);
+ if (startIndex != -1 && endIndex != -1) {
+ startIndex += 1;
+ QString makefile = makeCommand.mid(startIndex, endIndex - startIndex);
+ int slashIndex = makefile.lastIndexOf(QLatin1Char('/'));
+ makefile.truncate(slashIndex);
+ makefile.append(QLatin1String("/CMakeFiles/") + buildTarget.title + QLatin1String(".dir/flags.make"));
+ QFile file(makefile);
+ if (file.exists()) {
+ file.open(QIODevice::ReadOnly | QIODevice::Text);
+ QTextStream stream(&file);
+ while (!stream.atEnd()) {
+ QString line = stream.readLine().trimmed();
+ if (line.startsWith(QLatin1String("CXX_FLAGS ="))) {
+ // Skip past =
+ return line.mid(11).trimmed().split(QLatin1Char(' '), QString::SkipEmptyParts);
+ }
+ }
+ }
+ }
+
+ // Attempt to find build.ninja file and obtain FLAGS (CXX_FLAGS) from there if no suitable flags.make were
+ // found
+ // Get "all" target's working directory
+ QString buildNinjaFile = QDir::fromNativeSeparators(buildTarget.workingDirectory);
+ buildNinjaFile += QLatin1String("/build.ninja");
+ QFile buildNinja(buildNinjaFile);
+ if (buildNinja.exists()) {
+ buildNinja.open(QIODevice::ReadOnly | QIODevice::Text);
+ QTextStream stream(&buildNinja);
+ bool cxxFound = false;
+ while (!stream.atEnd()) {
+ QString line = stream.readLine().trimmed();
+ // Look for a build rule which invokes CXX_COMPILER
+ if (line.startsWith(QLatin1String("build"))) {
+ cxxFound = line.indexOf(QLatin1String("CXX_COMPILER")) != -1;
+ } else if (cxxFound && line.startsWith(QLatin1String("FLAGS ="))) {
+ // Skip past =
+ return line.mid(7).trimmed().split(QLatin1Char(' '), QString::SkipEmptyParts);
+ }
+ }
+ }
+ return QStringList();
+}
+
bool CMakeProject::parseCMakeLists()
{
if (!activeTarget() ||
@@ -215,7 +264,7 @@ bool CMakeProject::parseCMakeLists()
CMakeCbpParser cbpparser;
// Parsing
//qDebug()<<"Parsing file "<<cbpFile;
- if (!cbpparser.parseCbpFile(cbpFile)) {
+ if (!cbpparser.parseCbpFile(cbpFile, projectDirectory().toString())) {
// TODO report error
emit buildTargetsChanged();
return false;
@@ -277,116 +326,69 @@ bool CMakeProject::parseCMakeLists()
return true;
}
- QStringList cxxflags;
- bool found = false;
- foreach (const CMakeBuildTarget &buildTarget, m_buildTargets) {
- QString makeCommand = QDir::fromNativeSeparators(buildTarget.makeCommand);
- int startIndex = makeCommand.indexOf(QLatin1Char('\"'));
- int endIndex = makeCommand.indexOf(QLatin1Char('\"'), startIndex + 1);
- if (startIndex == -1 || endIndex == -1)
- continue;
- startIndex += 1;
- QString makefile = makeCommand.mid(startIndex, endIndex - startIndex);
- int slashIndex = makefile.lastIndexOf(QLatin1Char('/'));
- makefile.truncate(slashIndex);
- makefile.append(QLatin1String("/CMakeFiles/") + buildTarget.title + QLatin1String(".dir/flags.make"));
- QFile file(makefile);
- if (file.exists()) {
- file.open(QIODevice::ReadOnly | QIODevice::Text);
- QTextStream stream(&file);
- while (!stream.atEnd()) {
- QString line = stream.readLine().trimmed();
- if (line.startsWith(QLatin1String("CXX_FLAGS ="))) {
- // Skip past =
- cxxflags = line.mid(11).trimmed().split(QLatin1Char(' '), QString::SkipEmptyParts);
- found = true;
- break;
- }
- }
- }
- if (found)
- break;
- }
- // Attempt to find build.ninja file and obtain FLAGS (CXX_FLAGS) from there if no suitable flags.make were
- // found
- if (!found && !cbpparser.buildTargets().isEmpty()) {
- // Get "all" target's working directory
- QString buildNinjaFile = QDir::fromNativeSeparators(cbpparser.buildTargets().at(0).workingDirectory);
- buildNinjaFile += QLatin1String("/build.ninja");
- QFile buildNinja(buildNinjaFile);
- if (buildNinja.exists()) {
- buildNinja.open(QIODevice::ReadOnly | QIODevice::Text);
- QTextStream stream(&buildNinja);
- bool cxxFound = false;
- while (!stream.atEnd()) {
- QString line = stream.readLine().trimmed();
- // Look for a build rule which invokes CXX_COMPILER
- if (line.startsWith(QLatin1String("build"))) {
- cxxFound = line.indexOf(QLatin1String("CXX_COMPILER")) != -1;
- } else if (cxxFound && line.startsWith(QLatin1String("FLAGS ="))) {
- // Skip past =
- cxxflags = line.mid(7).trimmed().split(QLatin1Char(' '), QString::SkipEmptyParts);
- break;
- }
- }
- }
- }
-
CppTools::CppModelManagerInterface *modelmanager =
CppTools::CppModelManagerInterface::instance();
if (modelmanager) {
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
pinfo.clearProjectParts();
- typedef CppTools::ProjectPart ProjectPart;
- ProjectPart::Ptr part(new ProjectPart);
- part->project = this;
- part->displayName = displayName();
- part->projectFile = projectFilePath().toString();
-
- // This explicitly adds -I. to the include paths
- part->headerPaths += ProjectPart::HeaderPath(projectDirectory().toString(),
- ProjectPart::HeaderPath::IncludePath);
-
- foreach (const QString &includeFile, cbpparser.includeFiles()) {
- ProjectPart::HeaderPath hp(includeFile, ProjectPart::HeaderPath::IncludePath);
-
- // CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework
- // paths. The work-around is to check if the include path ends in ".framework", and
- // if so, add the parent directory as framework path.
- if (includeFile.endsWith(QLatin1String(".framework"))) {
- const int slashIdx = includeFile.lastIndexOf(QLatin1Char('/'));
- if (slashIdx != -1) {
- hp = ProjectPart::HeaderPath(includeFile.left(slashIdx),
- ProjectPart::HeaderPath::FrameworkPath);
- continue;
+ foreach (const CMakeBuildTarget &cbt, m_buildTargets) {
+ typedef CppTools::ProjectPart ProjectPart;
+ ProjectPart::Ptr part(new ProjectPart);
+ part->project = this;
+ part->displayName = cbt.title;
+ part->projectFile = projectFilePath().toString();
+
+ // This explicitly adds -I. to the include paths
+ part->headerPaths += ProjectPart::HeaderPath(projectDirectory().toString(),
+ ProjectPart::HeaderPath::IncludePath);
+
+ foreach (const QString &includeFile, cbt.includeFiles) {
+ ProjectPart::HeaderPath hp(includeFile, ProjectPart::HeaderPath::IncludePath);
+
+ // CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework
+ // paths. The work-around is to check if the include path ends in ".framework", and
+ // if so, add the parent directory as framework path.
+ if (includeFile.endsWith(QLatin1String(".framework"))) {
+ const int slashIdx = includeFile.lastIndexOf(QLatin1Char('/'));
+ if (slashIdx != -1) {
+ hp = ProjectPart::HeaderPath(includeFile.left(slashIdx),
+ ProjectPart::HeaderPath::FrameworkPath);
+ continue;
+ }
}
+
+ part->headerPaths += hp;
}
- part->headerPaths += hp;
- }
+ part->projectDefines += cbt.defines;
- part->projectDefines += cbpparser.defines();
+ // TODO rewrite
+ CppTools::ProjectFileAdder adder(part->files);
+ foreach (const QString &file, cbt.files)
+ adder.maybeAdd(file);
- CppTools::ProjectFileAdder adder(part->files);
- foreach (const QString &file, m_files)
- adder.maybeAdd(file);
+ QStringList cxxflags = getCXXFlagsFor(cbt);
- part->evaluateToolchain(tc,
- cxxflags,
- cxxflags,
- SysRootKitInformation::sysRoot(k));
+ part->evaluateToolchain(tc,
+ cxxflags,
+ cxxflags,
+ SysRootKitInformation::sysRoot(k));
- pinfo.appendProjectPart(part);
+ setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty());
+ pinfo.appendProjectPart(part);
+ }
m_codeModelFuture.cancel();
m_codeModelFuture = modelmanager->updateProjectInfo(pinfo);
- setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty());
}
+ emit displayNameChanged();
emit buildTargetsChanged();
emit fileListChanged();
+ emit activeBC->emitBuildTypeChanged();
+
return true;
}
@@ -892,8 +894,56 @@ void CMakeBuildSettingsWidget::runCMake()
// CMakeCbpParser
////
-bool CMakeCbpParser::parseCbpFile(const QString &fileName)
+// called after everything is parsed
+// this function tries to figure out to which CMakeBuildTarget
+// each file belongs, so that it gets the appropriate defines and
+// compiler flags
+void CMakeCbpParser::sortFiles()
{
+ QList<Utils::FileName> fileNames = Utils::transform(m_fileList, [] (FileNode *node) {
+ return Utils::FileName::fromString(node->path());
+ });
+
+ Utils::sort(fileNames);
+
+
+ CMakeBuildTarget *last = 0;
+ Utils::FileName parentDirectory;
+
+ foreach (const Utils::FileName &fileName, fileNames) {
+ if (fileName.parentDir() == parentDirectory && last) {
+ // easy case, same parent directory as last file
+ last->files.append(fileName.toString());
+ } else {
+ int bestLength = -1;
+ int bestIndex = -1;
+
+ for (int i = 0; i < m_buildTargets.size(); ++i) {
+ const CMakeBuildTarget &target = m_buildTargets.at(i);
+ if (fileName.isChildOf(Utils::FileName::fromString(target.sourceDirectory))
+ && target.sourceDirectory.size() > bestLength) {
+ bestLength = target.sourceDirectory.size();
+ bestIndex = i;
+ }
+ }
+
+ if (bestIndex == -1 && !m_buildTargets.isEmpty())
+ bestIndex = 0;
+
+ if (bestIndex != -1) {
+ m_buildTargets[bestIndex].files.append(fileName.toString());
+ last = &m_buildTargets[bestIndex];
+ parentDirectory = fileName.parentDir();
+ }
+ }
+ }
+}
+
+bool CMakeCbpParser::parseCbpFile(const QString &fileName, const QString &sourceDirectory)
+{
+ m_buildDirectory = QFileInfo(fileName).absolutePath();
+ m_sourceDirectory = sourceDirectory;
+
QFile fi(fileName);
if (fi.exists() && fi.open(QFile::ReadOnly)) {
setDevice(&fi);
@@ -905,9 +955,10 @@ bool CMakeCbpParser::parseCbpFile(const QString &fileName)
else if (isStartElement())
parseUnknownElement();
}
+
+ sortFiles();
+
fi.close();
- m_includeFiles.sort();
- m_includeFiles.removeDuplicates();
return true;
}
return false;
@@ -990,6 +1041,10 @@ void CMakeCbpParser::parseBuildTargetOption()
m_buildTarget.library = true;
} else if (attributes().hasAttribute(QLatin1String("working_dir"))) {
m_buildTarget.workingDirectory = attributes().value(QLatin1String("working_dir")).toString();
+ QDir dir(m_buildDirectory);
+ QString relative = dir.relativeFilePath(m_buildTarget.workingDirectory);
+ m_buildTarget.sourceDirectory
+ = Utils::FileName::fromString(m_sourceDirectory).appendPath(relative).toString();
}
while (!atEnd()) {
readNext();
@@ -1084,20 +1139,20 @@ void CMakeCbpParser::parseAdd()
const QString includeDirectory = addAttributes.value(QLatin1String("directory")).toString();
// allow adding multiple times because order happens
if (!includeDirectory.isEmpty())
- m_includeFiles.append(includeDirectory);
+ m_buildTarget.includeFiles.append(includeDirectory);
QString compilerOption = addAttributes.value(QLatin1String("option")).toString();
// defining multiple times a macro to the same value makes no sense
- if (!compilerOption.isEmpty() && !m_compilerOptions.contains(compilerOption)) {
- m_compilerOptions.append(compilerOption);
+ if (!compilerOption.isEmpty() && !m_buildTarget.compilerOptions.contains(compilerOption)) {
+ m_buildTarget.compilerOptions.append(compilerOption);
int macroNameIndex = compilerOption.indexOf(QLatin1String("-D")) + 2;
if (macroNameIndex != 1) {
int assignIndex = compilerOption.indexOf(QLatin1Char('='), macroNameIndex);
if (assignIndex != -1)
compilerOption[assignIndex] = ' ';
- m_defines.append("#define ");
- m_defines.append(compilerOption.mid(macroNameIndex).toUtf8());
- m_defines.append('\n');
+ m_buildTarget.defines.append("#define ");
+ m_buildTarget.defines.append(compilerOption.mid(macroNameIndex).toUtf8());
+ m_buildTarget.defines.append('\n');
}
}
@@ -1192,16 +1247,6 @@ bool CMakeCbpParser::hasCMakeFiles()
return !m_cmakeFileList.isEmpty();
}
-QStringList CMakeCbpParser::includeFiles()
-{
- return m_includeFiles;
-}
-
-QByteArray CMakeCbpParser::defines() const
-{
- return m_defines;
-}
-
QList<CMakeBuildTarget> CMakeCbpParser::buildTargets()
{
return m_buildTargets;
@@ -1218,6 +1263,10 @@ void CMakeBuildTarget::clear()
makeCommand.clear();
makeCleanCommand.clear();
workingDirectory.clear();
+ sourceDirectory.clear();
title.clear();
library = false;
+ includeFiles.clear();
+ compilerOptions.clear();
+ defines.clear();
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h
index cd0edf866f..aa97f99e08 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.h
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.h
@@ -65,8 +65,16 @@ struct CMakeBuildTarget
QString executable; // TODO: rename to output?
bool library;
QString workingDirectory;
+ QString sourceDirectory;
QString makeCommand;
QString makeCleanCommand;
+
+ // code model
+ QStringList includeFiles;
+ QStringList compilerOptions;
+ QByteArray defines;
+ QStringList files;
+
void clear();
};
@@ -125,6 +133,7 @@ private:
QString uiHeaderFile(const QString &uiFile);
void updateRunConfigurations(ProjectExplorer::Target *t);
void updateApplicationAndDeploymentTargets();
+ QStringList getCXXFlagsFor(const CMakeBuildTarget &buildTarget);
CMakeManager *m_manager;
ProjectExplorer::Target *m_activeTarget;
@@ -144,12 +153,10 @@ private:
class CMakeCbpParser : public QXmlStreamReader
{
public:
- bool parseCbpFile(const QString &fileName);
+ bool parseCbpFile(const QString &fileName, const QString &sourceDirectory);
QList<ProjectExplorer::FileNode *> fileList();
QList<ProjectExplorer::FileNode *> cmakeFileList();
- QStringList includeFiles();
QList<CMakeBuildTarget> buildTargets();
- QByteArray defines() const;
QString projectName() const;
QString compilerName() const;
bool hasCMakeFiles();
@@ -169,19 +176,19 @@ private:
void parseUnit();
void parseUnitOption();
void parseUnknownElement();
+ void sortFiles();
QList<ProjectExplorer::FileNode *> m_fileList;
QList<ProjectExplorer::FileNode *> m_cmakeFileList;
QSet<QString> m_processedUnits;
bool m_parsingCmakeUnit;
- QStringList m_includeFiles;
- QStringList m_compilerOptions;
- QByteArray m_defines;
CMakeBuildTarget m_buildTarget;
QList<CMakeBuildTarget> m_buildTargets;
QString m_projectName;
QString m_compiler;
+ QString m_sourceDirectory;
+ QString m_buildDirectory;
};
class CMakeFile : public Core::IDocument
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
index bb91725ee9..9c9e34ad7b 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
@@ -41,7 +41,6 @@ const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor";
const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor";
const char RUNCMAKE[] = "CMakeProject.RunCMake";
const char RUNCMAKECONTEXTMENU[] = "CMakeProject.RunCMakeContextMenu";
-const char CMAKE_SUPPORT_FEATURE[] = "CMake.CMakeSupport";
// Project
const char CMAKEPROJECT_ID[] = "CMakeProjectManager.CMakeProject";
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
index a3bb189064..ef3a4619b6 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
@@ -49,16 +49,6 @@
using namespace CMakeProjectManager::Internal;
-class CMakeFeatureProvider : public Core::IFeatureProvider
-{
- Core::FeatureSet availableFeatures(const QString & /* platform */) const {
- return Core::FeatureSet(Core::Id(CMakeProjectManager::Constants::CMAKE_SUPPORT_FEATURE));
- }
-
- QStringList availablePlatforms() const { return QStringList(); }
- QString displayNameForPlatform(const QString & /* platform */) const { return QString(); }
-};
-
CMakeProjectPlugin::CMakeProjectPlugin()
{
}
@@ -82,7 +72,6 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
addAutoReleasedObject(new CMakeEditorFactory(manager));
addAutoReleasedObject(new CMakeLocatorFilter);
addAutoReleasedObject(new CMakeFileCompletionAssistProvider(cmp));
- addAutoReleasedObject(new CMakeFeatureProvider);
auto hf = new TextEditor::HighlighterFactory;
hf->setProductType<CMakeHighlighter>();
diff --git a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp
index bc1360cdb5..c03dd394f6 100644
--- a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp
@@ -81,7 +81,7 @@ CMakeSettingsPage::~CMakeSettingsPage()
QString CMakeSettingsPage::findCmakeExecutable() const
{
- return Utils::Environment::systemEnvironment().searchInPath(QLatin1String("cmake"));
+ return Utils::Environment::systemEnvironment().searchInPath(QLatin1String("cmake")).toString();
}
QWidget *CMakeSettingsPage::widget()
diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp
index b81d8889a8..28dab79f52 100644
--- a/src/plugins/cmakeprojectmanager/makestep.cpp
+++ b/src/plugins/cmakeprojectmanager/makestep.cpp
@@ -140,7 +140,7 @@ void MakeStep::activeBuildConfigurationChanged()
void MakeStep::buildTargetsChanged()
{
QStringList filteredTargets;
- foreach (const QString t, static_cast<CMakeProject *>(project())->buildTargetTitles()) {
+ foreach (const QString &t, static_cast<CMakeProject *>(project())->buildTargetTitles()) {
if (m_buildTargets.contains(t))
filteredTargets.append(t);
}
@@ -340,7 +340,6 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
m_buildTargetsList->setMinimumHeight(200);
fl->addRow(tr("Targets:"), m_buildTargetsList);
- // TODO update this list also on rescans of the CMakeLists.txt
CMakeProject *pro = static_cast<CMakeProject *>(m_makeStep->project());
QStringList targetList = pro->buildTargetTitles();
targetList.sort();
diff --git a/src/plugins/coreplugin/actionmanager/commandmappings.cpp b/src/plugins/coreplugin/actionmanager/commandmappings.cpp
index dd46fd54eb..75a528eaef 100644
--- a/src/plugins/coreplugin/actionmanager/commandmappings.cpp
+++ b/src/plugins/coreplugin/actionmanager/commandmappings.cpp
@@ -249,7 +249,7 @@ void CommandMappings::finish()
void CommandMappings::commandChanged(QTreeWidgetItem *current)
{
if (!current || !current->data(0, Qt::UserRole).isValid()) {
- d->targetEdit->setText(QString());
+ d->targetEdit->clear();
d->targetEditGroup->setEnabled(false);
return;
}
diff --git a/src/plugins/coreplugin/core.qrc b/src/plugins/coreplugin/core.qrc
index 4523a86f83..37a9805eba 100644
--- a/src/plugins/coreplugin/core.qrc
+++ b/src/plugins/coreplugin/core.qrc
@@ -14,12 +14,12 @@
<file>images/filenew.png</file>
<file>images/fileopen.png</file>
<file>images/filesave.png</file>
- <file>images/find.png</file>
- <file>images/findnext.png</file>
<file>images/logo/128/QtProject-qtcreator.png</file>
<file>images/logo/32/QtProject-qtcreator.png</file>
<file>images/inputfield.png</file>
+ <file>images/inputfield@2x.png</file>
<file>images/inputfield_disabled.png</file>
+ <file>images/inputfield_disabled@2x.png</file>
<file>images/linkicon.png</file>
<file>images/linkicon@2x.png</file>
<file>images/locked.png</file>
@@ -58,6 +58,7 @@
<file>images/category_design.png</file>
<file>editormanager/BinFiles.mimetypes.xml</file>
<file>images/progressbar.png</file>
+ <file>images/progressbar@2x.png</file>
<file>images/help.png</file>
<file>images/editclear.png</file>
<file>images/editclear@2x.png</file>
diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h
index aa07c979e4..ae4152c1de 100644
--- a/src/plugins/coreplugin/coreconstants.h
+++ b/src/plugins/coreplugin/coreconstants.h
@@ -199,9 +199,10 @@ const char ICON_RESET[] = ":/core/images/reset.png";
const char ICON_RELOAD_GRAY[] = ":/core/images/reload_gray.png";
const char ICON_MAGNIFIER[] = ":/core/images/magnifier.png";
const char ICON_TOGGLE_SIDEBAR[] = ":/core/images/sidebaricon.png";
-const char ICON_CLOSE_DOCUMENT[] = ":/core/images/button_close.png";
-const char ICON_CLOSE[] = ":/core/images/closebutton.png";
-const char ICON_CLOSE_DARK[] = ":/core/images/darkclosebutton.png";
+const char ICON_BUTTON_CLOSE[] = ":/core/images/button_close.png";
+const char ICON_CLOSE_BUTTON[] = ":/core/images/closebutton.png";
+const char ICON_DARK_CLOSE_BUTTON[] = ":/core/images/darkclosebutton.png";
+const char ICON_DARK_CLOSE[] = ":/core/images/darkclose.png";
const char ICON_SPLIT_HORIZONTAL[] = ":/core/images/splitbutton_horizontal.png";
const char ICON_SPLIT_VERTICAL[] = ":/core/images/splitbutton_vertical.png";
const char ICON_CLOSE_SPLIT_TOP[] = ":/core/images/splitbutton_closetop.png";
diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp
index 1457d52b96..8a99a4b2fd 100644
--- a/src/plugins/coreplugin/coreplugin.cpp
+++ b/src/plugins/coreplugin/coreplugin.cpp
@@ -35,6 +35,7 @@
#include "mimedatabase.h"
#include "modemanager.h"
#include "infobar.h"
+#include "iwizardfactory.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h>
@@ -60,6 +61,8 @@ CorePlugin::CorePlugin() : m_editMode(0), m_designMode(0)
CorePlugin::~CorePlugin()
{
+ IWizardFactory::destroyFeatureProvider();
+
delete m_findPlugin;
delete m_locator;
diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro
index 7cda9e211f..e0183194d4 100644
--- a/src/plugins/coreplugin/coreplugin.pro
+++ b/src/plugins/coreplugin/coreplugin.pro
@@ -28,6 +28,7 @@ SOURCES += mainwindow.cpp \
vcsmanager.cpp \
statusbarmanager.cpp \
versiondialog.cpp \
+ editormanager/editorarea.cpp \
editormanager/editormanager.cpp \
editormanager/editorview.cpp \
editormanager/documentmodel.cpp \
@@ -117,7 +118,9 @@ HEADERS += mainwindow.h \
outputwindow.h \
vcsmanager.h \
statusbarmanager.h \
+ editormanager/editorarea.h \
editormanager/editormanager.h \
+ editormanager/editormanager_p.h \
editormanager/editorview.h \
editormanager/documentmodel.h \
editormanager/openeditorsview.h \
diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs
index a03dcf2331..a034cd0722 100644
--- a/src/plugins/coreplugin/coreplugin.qbs
+++ b/src/plugins/coreplugin/coreplugin.qbs
@@ -140,7 +140,8 @@ QtcPlugin {
files: [
"BinFiles.mimetypes.xml",
"documentmodel.cpp", "documentmodel.h",
- "editormanager.cpp", "editormanager.h",
+ "editorarea.cpp", "editorarea.h",
+ "editormanager.cpp", "editormanager.h", "editormanager_p.h",
"editorview.cpp", "editorview.h",
"ieditor.cpp", "ieditor.h",
"ieditorfactory.cpp", "ieditorfactory.h",
diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp
index a9c1a2977d..fa3353159d 100644
--- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp
+++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp
@@ -521,11 +521,11 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
updateButtons(index);
ExternalTool *tool = m_model->toolForIndex(index);
if (!tool) {
- ui->description->setText(QString());
+ ui->description->clear();
ui->executable->setPath(QString());
- ui->arguments->setText(QString());
+ ui->arguments->clear();
ui->workingDirectory->setPath(QString());
- ui->inputText->setPlainText(QString());
+ ui->inputText->clear();
ui->infoWidget->setEnabled(false);
return;
}
diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp
index 95d0a134f5..079d074b9f 100644
--- a/src/plugins/coreplugin/dialogs/newdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/newdialog.cpp
@@ -429,7 +429,7 @@ void NewDialog::currentItemChanged(const QModelIndex &index)
}
} else {
- m_ui->templateDescription->setText(QString());
+ m_ui->templateDescription->clear();
}
updateOkButton();
}
diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
index ac41705326..13b491e424 100644
--- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
@@ -30,7 +30,7 @@
#include "readonlyfilesdialog.h"
#include "ui_readonlyfilesdialog.h"
-#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/editormanager/editormanager_p.h>
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
@@ -275,7 +275,7 @@ int ReadOnlyFilesDialog::exec()
}
break;
case RO_SaveAs:
- if (!EditorManager::saveDocumentAs(d->document)) {
+ if (!EditorManagerPrivate::saveDocumentAs(d->document)) {
failedToMakeWritable << buttongroup.fileName;
continue;
}
diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
index c4fd7e78f5..5368db8ec8 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
@@ -512,7 +512,7 @@ void SettingsDialog::currentChanged(const QModelIndex &current)
showCategory(m_proxyModel->mapToSource(current).row());
} else {
m_stackedLayout->setCurrentIndex(0);
- m_headerLabel->setText(QString());
+ m_headerLabel->clear();
}
}
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index 8fd1605f76..6913d01f78 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -37,6 +37,7 @@
#include <coreplugin/dialogs/readonlyfilesdialog.h>
#include <coreplugin/dialogs/saveitemsdialog.h>
#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/editormanager/editormanager_p.h>
#include <coreplugin/editormanager/editorview.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/ieditorfactory.h>
@@ -617,7 +618,7 @@ static bool saveModifiedFilesHelper(const QList<IDocument *> &documents,
}
}
foreach (IDocument *document, documentsToSave) {
- if (!EditorManager::saveDocument(document)) {
+ if (!EditorManagerPrivate::saveDocument(document)) {
if (cancelled)
*cancelled = true;
notSaved.append(document);
@@ -913,7 +914,7 @@ void DocumentManager::checkForReload()
d->m_blockActivated = true;
- IDocument::ReloadSetting defaultBehavior = EditorManager::reloadSetting();
+ IDocument::ReloadSetting defaultBehavior = EditorManagerPrivate::reloadSetting();
Utils::ReloadPromptAnswer previousReloadAnswer = Utils::ReloadCurrent;
Utils::FileDeletedPromptAnswer previousDeletedAnswer = Utils::FileDeletedSave;
@@ -1421,7 +1422,7 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
QList<IEditor *> editorsOpenForFile
= DocumentModel::editorsForFilePath(entry.fileName);
foreach (IEditor *openEditor, editorsOpenForFile) {
- Internal::EditorView *view = EditorManager::viewForEditor(openEditor);
+ Internal::EditorView *view = EditorManagerPrivate::viewForEditor(openEditor);
if (view && view->currentEditor() == openEditor) // visible
views.append(view);
}
@@ -1431,15 +1432,15 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
if (views.isEmpty()) {
EditorManager::openEditor(entry.fileName, entry.editorFactory->id());
} else {
- if (Internal::EditorView *currentView = EditorManager::currentEditorView()) {
+ if (Internal::EditorView *currentView = EditorManagerPrivate::currentEditorView()) {
if (views.removeOne(currentView))
views.prepend(currentView); // open editor in current view first
}
EditorManager::OpenEditorFlags flags;
foreach (Internal::EditorView *view, views) {
IEditor *editor =
- EditorManager::openEditor(view, entry.fileName, entry.editorFactory->id(),
- flags);
+ EditorManagerPrivate::openEditor(view, entry.fileName,
+ entry.editorFactory->id(), flags);
// Do not change the current editor after opening the first one. That
// * prevents multiple updates of focus etc which are not necessary
// * lets us control which editor is made current by putting the current editor view
diff --git a/src/plugins/coreplugin/editmode.cpp b/src/plugins/coreplugin/editmode.cpp
index 412d142535..506eab6204 100644
--- a/src/plugins/coreplugin/editmode.cpp
+++ b/src/plugins/coreplugin/editmode.cpp
@@ -60,7 +60,8 @@ EditMode::EditMode() :
m_rightSplitWidgetLayout->setMargin(0);
QWidget *rightSplitWidget = new QWidget;
rightSplitWidget->setLayout(m_rightSplitWidgetLayout);
- m_rightSplitWidgetLayout->insertWidget(0, new Core::EditorManagerPlaceHolder(this));
+ auto editorPlaceHolder = new EditorManagerPlaceHolder(this);
+ m_rightSplitWidgetLayout->insertWidget(0, editorPlaceHolder);
MiniSplitter *rightPaneSplitter = new MiniSplitter;
rightPaneSplitter->insertWidget(0, rightSplitWidget);
@@ -84,7 +85,7 @@ EditMode::EditMode() :
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(grabEditorManager(Core::IMode*)));
- m_splitter->setFocusProxy(EditorManager::instance());
+ m_splitter->setFocusProxy(editorPlaceHolder);
IContext *modeContextObject = new IContext(this);
modeContextObject->setContext(Context(Constants::C_EDITORMANAGER));
diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp
index 8f2fc35a65..025ba197ae 100644
--- a/src/plugins/coreplugin/editormanager/documentmodel.cpp
+++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp
@@ -177,10 +177,7 @@ void DocumentModel::addRestoredDocument(const QString &fileName, const QString &
DocumentModel::Entry *DocumentModel::firstRestoredEntry()
{
- for (int i = 0; i < d->m_entries.count(); ++i)
- if (!d->m_entries.at(i)->document)
- return d->m_entries.at(i);
- return 0;
+ return Utils::findOrDefault(d->m_entries, [](Entry *entry) { return !entry->document; });
}
void DocumentModelPrivate::addEntry(DocumentModel::Entry *entry)
@@ -220,11 +217,10 @@ int DocumentModelPrivate::indexOfFilePath(const QString &filePath) const
if (filePath.isEmpty())
return -1;
const QString fixedPath = DocumentManager::fixFileName(filePath, DocumentManager::KeepLinks);
- for (int i = 0; i < d->m_entries.count(); ++i) {
- if (DocumentManager::fixFileName(d->m_entries.at(i)->fileName(), DocumentManager::KeepLinks) == fixedPath)
- return i;
- }
- return -1;
+ return Utils::indexOf(m_entries, [&fixedPath](DocumentModel::Entry *entry) {
+ return DocumentManager::fixFileName(entry->fileName(),
+ DocumentManager::KeepLinks) == fixedPath;
+ });
}
void DocumentModel::removeEntry(DocumentModel::Entry *entry)
@@ -308,18 +304,15 @@ int DocumentModel::indexOfDocument(IDocument *document)
int DocumentModelPrivate::indexOfDocument(IDocument *document) const
{
- for (int i = 0; i < m_entries.count(); ++i)
- if (m_entries.at(i)->document == document)
- return i;
- return -1;
+ return Utils::indexOf(m_entries, [&document](DocumentModel::Entry *entry) {
+ return entry->document == document;
+ });
}
DocumentModel::Entry *DocumentModel::entryForDocument(IDocument *document)
{
- int index = indexOfDocument(document);
- if (index < 0)
- return 0;
- return d->m_entries.at(index);
+ return Utils::findOrDefault(d->m_entries,
+ [&document](Entry *entry) { return entry->document == document; });
}
QList<IDocument *> DocumentModel::openedDocuments()
@@ -329,10 +322,8 @@ QList<IDocument *> DocumentModel::openedDocuments()
IDocument *DocumentModel::documentForFilePath(const QString &filePath)
{
- int index = d->indexOfFilePath(filePath);
- if (index < 0)
- return 0;
- return d->m_entries.at(index)->document;
+ Entry *e = Utils::findOrDefault(d->m_entries, Utils::equal(&Entry::fileName, filePath));
+ return e ? e->document : 0;
}
QList<IEditor *> DocumentModel::editorsForFilePath(const QString &filePath)
diff --git a/src/plugins/coreplugin/editormanager/editorarea.cpp b/src/plugins/coreplugin/editormanager/editorarea.cpp
new file mode 100644
index 0000000000..54c9f8b21f
--- /dev/null
+++ b/src/plugins/coreplugin/editormanager/editorarea.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "editorarea.h"
+
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/icontext.h>
+#include <coreplugin/icore.h>
+
+namespace Core {
+namespace Internal {
+
+EditorArea::EditorArea()
+{
+ m_context = new IContext;
+ m_context->setContext(Context(Constants::C_EDITORMANAGER));
+ m_context->setWidget(this);
+ ICore::addContextObject(m_context);
+}
+
+EditorArea::~EditorArea()
+{
+ ICore::removeContextObject(m_context);
+ delete m_context;
+}
+
+} // Internal
+} // Core
diff --git a/src/plugins/texteditor/basetextmark.h b/src/plugins/coreplugin/editormanager/editorarea.h
index 849092ce78..0bdffbfb69 100644
--- a/src/plugins/texteditor/basetextmark.h
+++ b/src/plugins/coreplugin/editormanager/editorarea.h
@@ -27,36 +27,30 @@
**
****************************************************************************/
-#ifndef BASETEXTMARK_H
-#define BASETEXTMARK_H
+#ifndef EDITORAREA_H
+#define EDITORAREA_H
-#include "texteditor_global.h"
-#include "itextmark.h"
+#include "editorview.h"
-namespace TextEditor {
-namespace Internal { class BaseTextMarkRegistry; }
+namespace Core {
-class ITextMarkable;
+class IContext;
-class TEXTEDITOR_EXPORT BaseTextMark : public TextEditor::ITextMark
+namespace Internal {
+
+class EditorArea : public SplitterOrView
{
- friend class Internal::BaseTextMarkRegistry;
+ Q_OBJECT
public:
- BaseTextMark(const QString &fileName, int lineNumber);
- void init();
- virtual ~BaseTextMark();
-
- /// called if the filename of the document changed
- virtual void updateFileName(const QString &fileName);
-
- // access to internal data
- QString fileName() const { return m_fileName; }
+ EditorArea();
+ ~EditorArea();
private:
- QString m_fileName;
+ IContext *m_context;
};
-} // namespace TextEditor
+} // Internal
+} // Core
-#endif // BASETEXTMARK_H
+#endif // EDITORAREA_H
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index a427350124..040490ec48 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -28,6 +28,8 @@
****************************************************************************/
#include "editormanager.h"
+#include "editormanager_p.h"
+
#include "editorview.h"
#include "openeditorswindow.h"
#include "openeditorsview.h"
@@ -60,6 +62,7 @@
#include <extensionsystem/pluginmanager.h>
+#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
@@ -87,6 +90,11 @@ static const char kCurrentDocumentXPos[] = "CurrentDocument:XPos";
static const char kCurrentDocumentYPos[] = "CurrentDocument:YPos";
static const char kMakeWritableWarning[] = "Core.EditorManager.MakeWritable";
+static const char documentStatesKey[] = "EditorManager/DocumentStates";
+static const char reloadBehaviorKey[] = "EditorManager/ReloadBehavior";
+static const char autoSaveEnabledKey[] = "EditorManager/AutoSaveEnabled";
+static const char autoSaveIntervalKey[] = "EditorManager/AutoSaveInterval";
+
//===================EditorClosingCoreListener======================
namespace Core {
@@ -118,6 +126,7 @@ EditorManagerPlaceHolder::EditorManagerPlaceHolder(Core::IMode *mode, QWidget *p
{
setLayout(new QVBoxLayout);
layout()->setMargin(0);
+ setFocusProxy(EditorManagerPrivate::mainEditorArea());
connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(currentModeChanged(Core::IMode*)));
@@ -127,7 +136,7 @@ EditorManagerPlaceHolder::EditorManagerPlaceHolder(Core::IMode *mode, QWidget *p
EditorManagerPlaceHolder::~EditorManagerPlaceHolder()
{
// EditorManager will be deleted in ~MainWindow()
- EditorManager *em = EditorManager::instance();
+ QWidget *em = EditorManagerPrivate::mainEditorArea();
if (em && em->parent() == this) {
em->hide();
em->setParent(0);
@@ -138,10 +147,11 @@ void EditorManagerPlaceHolder::currentModeChanged(Core::IMode *mode)
{
if (m_mode == mode) {
QWidget *previousFocus = 0;
- if (EditorManager::instance()->focusWidget() && EditorManager::instance()->focusWidget()->hasFocus())
- previousFocus = EditorManager::instance()->focusWidget();
- layout()->addWidget(EditorManager::instance());
- EditorManager::instance()->show();
+ QWidget *em = EditorManagerPrivate::mainEditorArea();
+ if (em->focusWidget() && em->focusWidget()->hasFocus())
+ previousFocus = em->focusWidget();
+ layout()->addWidget(em);
+ em->show();
if (previousFocus)
previousFocus->setFocus();
}
@@ -149,119 +159,125 @@ void EditorManagerPlaceHolder::currentModeChanged(Core::IMode *mode)
// ---------------- EditorManager
-namespace Core {
+static EditorManager *m_instance = 0;
+static EditorManagerPrivate *d;
+static int extractLineNumber(QString *fileName)
+{
+ int i = fileName->length() - 1;
+ for (; i >= 0; --i) {
+ if (!fileName->at(i).isNumber())
+ break;
+ }
+ if (i == -1)
+ return -1;
+ const QChar c = fileName->at(i);
+ if (c == QLatin1Char(':') || c == QLatin1Char('+')) {
+ bool ok;
+ const QString suffix = fileName->mid(i + 1);
+ const int result = suffix.toInt(&ok);
+ if (suffix.isEmpty() || ok) {
+ fileName->truncate(i);
+ return result;
+ }
+ }
+ return -1;
+}
-class EditorManagerPrivate
+static QString autoSaveName(const QString &fileName)
{
-public:
- explicit EditorManagerPrivate(QWidget *parent);
- ~EditorManagerPrivate();
- QList<EditLocation> m_globalHistory;
- QList<Internal::SplitterOrView *> m_root;
- QList<IContext *> m_rootContext;
- QPointer<IEditor> m_currentEditor;
- QPointer<IEditor> m_scheduledCurrentEditor;
- QPointer<EditorView> m_currentView;
- QTimer *m_autoSaveTimer;
-
- // actions
- QAction *m_revertToSavedAction;
- QAction *m_saveAction;
- QAction *m_saveAsAction;
- QAction *m_closeCurrentEditorAction;
- QAction *m_closeAllEditorsAction;
- QAction *m_closeOtherEditorsAction;
- QAction *m_closeAllEditorsExceptVisibleAction;
- QAction *m_gotoNextDocHistoryAction;
- QAction *m_gotoPreviousDocHistoryAction;
- QAction *m_goBackAction;
- QAction *m_goForwardAction;
- QAction *m_splitAction;
- QAction *m_splitSideBySideAction;
- QAction *m_splitNewWindowAction;
- QAction *m_removeCurrentSplitAction;
- QAction *m_removeAllSplitsAction;
- QAction *m_gotoNextSplitAction;
-
- QAction *m_saveCurrentEditorContextAction;
- QAction *m_saveAsCurrentEditorContextAction;
- QAction *m_revertToSavedCurrentEditorContextAction;
-
- QAction *m_closeCurrentEditorContextAction;
- QAction *m_closeAllEditorsContextAction;
- QAction *m_closeOtherEditorsContextAction;
- QAction *m_closeAllEditorsExceptVisibleContextAction;
- QAction *m_openGraphicalShellAction;
- QAction *m_openTerminalAction;
- QAction *m_findInDirectoryAction;
- DocumentModel::Entry *m_contextMenuEntry;
-
- Internal::OpenEditorsWindow *m_windowPopup;
- Internal::EditorClosingCoreListener *m_coreListener;
-
- QMap<QString, QVariant> m_editorStates;
- Internal::OpenEditorsViewFactory *m_openEditorsFactory;
-
- IDocument::ReloadSetting m_reloadSetting;
-
- QString m_titleAddition;
- QString m_titleVcsTopic;
-
- bool m_autoSaveEnabled;
- int m_autoSaveInterval;
-};
+ return fileName + QLatin1String(".autosave");
}
-EditorManagerPrivate::EditorManagerPrivate(QWidget *parent) :
+static void setFocusToEditorViewAndUnmaximizePanes(EditorView *view)
+{
+ IEditor *editor = view->currentEditor();
+ QWidget *target = editor ? editor->widget() : view;
+ QWidget *focus = target->focusWidget();
+ QWidget *w = focus ? focus : target;
+
+ w->setFocus();
+ ICore::raiseWindow(w);
+
+ OutputPanePlaceHolder *holder = OutputPanePlaceHolder::getCurrent();
+ if (holder && holder->window() == view->window()) {
+ // unmaximize output pane if necessary
+ if (holder->isVisible() && holder->isMaximized())
+ holder->unmaximize();
+ }
+}
+
+/* For something that has a 'QString id' (IEditorFactory
+ * or IExternalEditor), find the one matching a id. */
+template <class EditorFactoryLike>
+EditorFactoryLike *findById(Core::Id id)
+{
+ return ExtensionSystem::PluginManager::getObject<EditorFactoryLike>(
+ [&id](EditorFactoryLike *efl) {
+ return id == efl->id();
+ });
+}
+
+EditorManagerPrivate::EditorManagerPrivate(QObject *parent) :
+ QObject(parent),
m_autoSaveTimer(0),
- m_revertToSavedAction(new QAction(EditorManager::tr("Revert to Saved"), parent)),
- m_saveAction(new QAction(parent)),
- m_saveAsAction(new QAction(parent)),
- m_closeCurrentEditorAction(new QAction(EditorManager::tr("Close"), parent)),
- m_closeAllEditorsAction(new QAction(EditorManager::tr("Close All"), parent)),
- m_closeOtherEditorsAction(new QAction(EditorManager::tr("Close Others"), parent)),
- m_closeAllEditorsExceptVisibleAction(new QAction(EditorManager::tr("Close All Except Visible"), parent)),
- m_gotoNextDocHistoryAction(new QAction(EditorManager::tr("Next Open Document in History"), parent)),
- m_gotoPreviousDocHistoryAction(new QAction(EditorManager::tr("Previous Open Document in History"), parent)),
- m_goBackAction(new QAction(QIcon(QLatin1String(Constants::ICON_PREV)), EditorManager::tr("Go Back"), parent)),
- m_goForwardAction(new QAction(QIcon(QLatin1String(Constants::ICON_NEXT)), EditorManager::tr("Go Forward"), parent)),
- m_saveCurrentEditorContextAction(new QAction(EditorManager::tr("&Save"), parent)),
- m_saveAsCurrentEditorContextAction(new QAction(EditorManager::tr("Save &As..."), parent)),
- m_revertToSavedCurrentEditorContextAction(new QAction(EditorManager::tr("Revert to Saved"), parent)),
- m_closeCurrentEditorContextAction(new QAction(EditorManager::tr("Close"), parent)),
- m_closeAllEditorsContextAction(new QAction(EditorManager::tr("Close All"), parent)),
- m_closeOtherEditorsContextAction(new QAction(EditorManager::tr("Close Others"), parent)),
- m_closeAllEditorsExceptVisibleContextAction(new QAction(EditorManager::tr("Close All Except Visible"), parent)),
- m_openGraphicalShellAction(new QAction(FileUtils::msgGraphicalShellAction(), parent)),
- m_openTerminalAction(new QAction(FileUtils::msgTerminalAction(), parent)),
- m_findInDirectoryAction(new QAction(FileUtils::msgFindInDirectory(), parent)),
+ m_revertToSavedAction(new QAction(EditorManager::tr("Revert to Saved"), this)),
+ m_saveAction(new QAction(this)),
+ m_saveAsAction(new QAction(this)),
+ m_closeCurrentEditorAction(new QAction(EditorManager::tr("Close"), this)),
+ m_closeAllEditorsAction(new QAction(EditorManager::tr("Close All"), this)),
+ m_closeOtherEditorsAction(new QAction(EditorManager::tr("Close Others"), this)),
+ m_closeAllEditorsExceptVisibleAction(new QAction(EditorManager::tr("Close All Except Visible"), this)),
+ m_gotoNextDocHistoryAction(new QAction(EditorManager::tr("Next Open Document in History"), this)),
+ m_gotoPreviousDocHistoryAction(new QAction(EditorManager::tr("Previous Open Document in History"), this)),
+ m_goBackAction(new QAction(QIcon(QLatin1String(Constants::ICON_PREV)), EditorManager::tr("Go Back"), this)),
+ m_goForwardAction(new QAction(QIcon(QLatin1String(Constants::ICON_NEXT)), EditorManager::tr("Go Forward"), this)),
+ m_saveCurrentEditorContextAction(new QAction(EditorManager::tr("&Save"), this)),
+ m_saveAsCurrentEditorContextAction(new QAction(EditorManager::tr("Save &As..."), this)),
+ m_revertToSavedCurrentEditorContextAction(new QAction(EditorManager::tr("Revert to Saved"), this)),
+ m_closeCurrentEditorContextAction(new QAction(EditorManager::tr("Close"), this)),
+ m_closeAllEditorsContextAction(new QAction(EditorManager::tr("Close All"), this)),
+ m_closeOtherEditorsContextAction(new QAction(EditorManager::tr("Close Others"), this)),
+ m_closeAllEditorsExceptVisibleContextAction(new QAction(EditorManager::tr("Close All Except Visible"), this)),
+ m_openGraphicalShellAction(new QAction(FileUtils::msgGraphicalShellAction(), this)),
+ m_openTerminalAction(new QAction(FileUtils::msgTerminalAction(), this)),
+ m_findInDirectoryAction(new QAction(FileUtils::msgFindInDirectory(), this)),
m_windowPopup(0),
m_coreListener(0),
m_reloadSetting(IDocument::AlwaysAsk),
m_autoSaveEnabled(true),
m_autoSaveInterval(5)
{
- DocumentModel::init();
+ d = this;
}
EditorManagerPrivate::~EditorManagerPrivate()
{
-// clearNavigationHistory();
- DocumentModel::destroy();
-}
+ if (ICore::instance()) {
+ if (m_coreListener) {
+ ExtensionSystem::PluginManager::removeObject(m_coreListener);
+ delete m_coreListener;
+ }
+ ExtensionSystem::PluginManager::removeObject(m_openEditorsFactory);
+ delete m_openEditorsFactory;
+ }
-static EditorManager *m_instance = 0;
-static EditorManagerPrivate *d;
+ // close all extra windows
+ for (int i = 0; i < m_editorAreas.size(); ++i) {
+ EditorArea *area = m_editorAreas.at(i);
+ disconnect(area, SIGNAL(destroyed(QObject*)), this, SLOT(editorAreaDestroyed(QObject*)));
+ delete area;
+ }
+ m_editorAreas.clear();
+ delete m_windowPopup;
-EditorManager *EditorManager::instance() { return m_instance; }
+ DocumentModel::destroy();
+ d = 0;
+}
-EditorManager::EditorManager(QWidget *parent) :
- QWidget(parent)
+void EditorManagerPrivate::init()
{
- d = new EditorManagerPrivate(parent);
- m_instance = this;
-
+ DocumentModel::init();
connect(ICore::instance(), SIGNAL(contextAboutToChange(QList<Core::IContext*>)),
this, SLOT(handleContextChange(QList<Core::IContext*>)));
@@ -272,21 +288,21 @@ EditorManager::EditorManager(QWidget *parent) :
ActionContainer *mfile = ActionManager::actionContainer(Constants::M_FILE);
// Revert to saved
- d->m_revertToSavedAction->setIcon(QIcon::fromTheme(QLatin1String("document-revert")));
- Command *cmd = ActionManager::registerAction(d->m_revertToSavedAction,
+ m_revertToSavedAction->setIcon(QIcon::fromTheme(QLatin1String("document-revert")));
+ Command *cmd = ActionManager::registerAction(m_revertToSavedAction,
Constants::REVERTTOSAVED, editManagerContext);
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(tr("Revert File to Saved"));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
- connect(d->m_revertToSavedAction, SIGNAL(triggered()), this, SLOT(revertToSaved()));
+ connect(m_revertToSavedAction, SIGNAL(triggered()), m_instance, SLOT(revertToSaved()));
// Save Action
- ActionManager::registerAction(d->m_saveAction, Constants::SAVE, editManagerContext);
- connect(d->m_saveAction, SIGNAL(triggered()), this, SLOT(saveDocument()));
+ ActionManager::registerAction(m_saveAction, Constants::SAVE, editManagerContext);
+ connect(m_saveAction, SIGNAL(triggered()), m_instance, SLOT(saveDocument()));
// Save As Action
- ActionManager::registerAction(d->m_saveAsAction, Constants::SAVEAS, editManagerContext);
- connect(d->m_saveAsAction, SIGNAL(triggered()), this, SLOT(saveDocumentAs()));
+ ActionManager::registerAction(m_saveAsAction, Constants::SAVEAS, editManagerContext);
+ connect(m_saveAsAction, SIGNAL(triggered()), m_instance, SLOT(saveDocumentAs()));
// Window Menu
ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
@@ -296,12 +312,12 @@ EditorManager::EditorManager(QWidget *parent) :
mwindow->addSeparator(editManagerContext, Constants::G_WINDOW_NAVIGATE);
// Close Action
- cmd = ActionManager::registerAction(d->m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext, true);
+ cmd = ActionManager::registerAction(m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext, true);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+W")));
cmd->setAttribute(Core::Command::CA_UpdateText);
- cmd->setDescription(d->m_closeCurrentEditorAction->text());
+ cmd->setDescription(m_closeCurrentEditorAction->text());
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
- connect(d->m_closeCurrentEditorAction, SIGNAL(triggered()), this, SLOT(closeEditor()));
+ connect(m_closeCurrentEditorAction, SIGNAL(triggered()), m_instance, SLOT(closeEditor()));
if (Utils::HostOsInfo::isWindowsHost()) {
// workaround for QTCREATORBUG-72
@@ -309,100 +325,109 @@ EditorManager::EditorManager(QWidget *parent) :
cmd = ActionManager::registerAction(action, Constants::CLOSE_ALTERNATIVE, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F4")));
cmd->setDescription(EditorManager::tr("Close"));
- connect(action, SIGNAL(triggered()), this, SLOT(closeEditor()));
+ connect(action, SIGNAL(triggered()), m_instance, SLOT(closeEditor()));
}
// Close All Action
- cmd = ActionManager::registerAction(d->m_closeAllEditorsAction, Constants::CLOSEALL, editManagerContext, true);
+ cmd = ActionManager::registerAction(m_closeAllEditorsAction, Constants::CLOSEALL, editManagerContext, true);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+W")));
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
- connect(d->m_closeAllEditorsAction, SIGNAL(triggered()), this, SLOT(closeAllEditors()));
+ connect(m_closeAllEditorsAction, SIGNAL(triggered()), m_instance, SLOT(closeAllEditors()));
// Close All Others Action
- cmd = ActionManager::registerAction(d->m_closeOtherEditorsAction, Constants::CLOSEOTHERS, editManagerContext, true);
+ cmd = ActionManager::registerAction(m_closeOtherEditorsAction, Constants::CLOSEOTHERS, editManagerContext, true);
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
cmd->setAttribute(Core::Command::CA_UpdateText);
- connect(d->m_closeOtherEditorsAction, SIGNAL(triggered()), this, SLOT(closeOtherEditors()));
+ connect(m_closeOtherEditorsAction, SIGNAL(triggered()), m_instance, SLOT(closeOtherEditors()));
// Close All Others Except Visible Action
- cmd = ActionManager::registerAction(d->m_closeAllEditorsExceptVisibleAction, Constants::CLOSEALLEXCEPTVISIBLE, editManagerContext, true);
+ cmd = ActionManager::registerAction(m_closeAllEditorsExceptVisibleAction, Constants::CLOSEALLEXCEPTVISIBLE, editManagerContext, true);
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
- connect(d->m_closeAllEditorsExceptVisibleAction, SIGNAL(triggered()), this, SLOT(closeAllEditorsExceptVisible()));
+ connect(m_closeAllEditorsExceptVisibleAction, SIGNAL(triggered()),
+ this, SLOT(closeAllEditorsExceptVisible()));
//Save XXX Context Actions
- connect(d->m_saveCurrentEditorContextAction, SIGNAL(triggered()), this, SLOT(saveDocumentFromContextMenu()));
- connect(d->m_saveAsCurrentEditorContextAction, SIGNAL(triggered()), this, SLOT(saveDocumentAsFromContextMenu()));
- connect(d->m_revertToSavedCurrentEditorContextAction, SIGNAL(triggered()), this, SLOT(revertToSavedFromContextMenu()));
+ connect(m_saveCurrentEditorContextAction, SIGNAL(triggered()),
+ this, SLOT(saveDocumentFromContextMenu()));
+ connect(m_saveAsCurrentEditorContextAction, SIGNAL(triggered()),
+ this, SLOT(saveDocumentAsFromContextMenu()));
+ connect(m_revertToSavedCurrentEditorContextAction, SIGNAL(triggered()),
+ this, SLOT(revertToSavedFromContextMenu()));
// Close XXX Context Actions
- connect(d->m_closeAllEditorsContextAction, SIGNAL(triggered()), this, SLOT(closeAllEditors()));
- connect(d->m_closeCurrentEditorContextAction, SIGNAL(triggered()), this, SLOT(closeEditorFromContextMenu()));
- connect(d->m_closeOtherEditorsContextAction, SIGNAL(triggered()), this, SLOT(closeOtherEditorsFromContextMenu()));
- connect(d->m_closeAllEditorsExceptVisibleContextAction, SIGNAL(triggered()), this, SLOT(closeAllEditorsExceptVisible()));
-
- connect(d->m_openGraphicalShellAction, SIGNAL(triggered()), this, SLOT(showInGraphicalShell()));
- connect(d->m_openTerminalAction, SIGNAL(triggered()), this, SLOT(openTerminal()));
- connect(d->m_findInDirectoryAction, SIGNAL(triggered()), this, SLOT(findInDirectory()));
+ connect(m_closeAllEditorsContextAction, SIGNAL(triggered()),
+ m_instance, SLOT(closeAllEditors()));
+ connect(m_closeCurrentEditorContextAction, SIGNAL(triggered()),
+ this, SLOT(closeEditorFromContextMenu()));
+ connect(m_closeOtherEditorsContextAction, SIGNAL(triggered()),
+ this, SLOT(closeOtherEditorsFromContextMenu()));
+ connect(m_closeAllEditorsExceptVisibleContextAction, SIGNAL(triggered()),
+ this, SLOT(closeAllEditorsExceptVisible()));
+
+ connect(m_openGraphicalShellAction, SIGNAL(triggered()), this, SLOT(showInGraphicalShell()));
+ connect(m_openTerminalAction, SIGNAL(triggered()), this, SLOT(openTerminal()));
+ connect(m_findInDirectoryAction, SIGNAL(triggered()), this, SLOT(findInDirectory()));
// Goto Previous In History Action
- cmd = ActionManager::registerAction(d->m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext);
+ cmd = ActionManager::registerAction(m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Tab") : tr("Ctrl+Tab")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
- connect(d->m_gotoPreviousDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoPreviousDocHistory()));
+ connect(m_gotoPreviousDocHistoryAction, SIGNAL(triggered()),
+ this, SLOT(gotoPreviousDocHistory()));
// Goto Next In History Action
- cmd = ActionManager::registerAction(d->m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext);
+ cmd = ActionManager::registerAction(m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Shift+Tab") : tr("Ctrl+Shift+Tab")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
- connect(d->m_gotoNextDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoNextDocHistory()));
+ connect(m_gotoNextDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoNextDocHistory()));
// Go back in navigation history
- cmd = ActionManager::registerAction(d->m_goBackAction, Constants::GO_BACK, editDesignContext);
+ cmd = ActionManager::registerAction(m_goBackAction, Constants::GO_BACK, editDesignContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Left") : tr("Alt+Left")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
- connect(d->m_goBackAction, SIGNAL(triggered()), this, SLOT(goBackInNavigationHistory()));
+ connect(m_goBackAction, SIGNAL(triggered()), m_instance, SLOT(goBackInNavigationHistory()));
// Go forward in navigation history
- cmd = ActionManager::registerAction(d->m_goForwardAction, Constants::GO_FORWARD, editDesignContext);
+ cmd = ActionManager::registerAction(m_goForwardAction, Constants::GO_FORWARD, editDesignContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Right") : tr("Alt+Right")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
- connect(d->m_goForwardAction, SIGNAL(triggered()), this, SLOT(goForwardInNavigationHistory()));
+ connect(m_goForwardAction, SIGNAL(triggered()), m_instance, SLOT(goForwardInNavigationHistory()));
- d->m_splitAction = new QAction(tr("Split"), this);
- cmd = ActionManager::registerAction(d->m_splitAction, Constants::SPLIT, editManagerContext);
+ m_splitAction = new QAction(tr("Split"), this);
+ cmd = ActionManager::registerAction(m_splitAction, Constants::SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
- connect(d->m_splitAction, SIGNAL(triggered()), this, SLOT(split()));
+ connect(m_splitAction, SIGNAL(triggered()), this, SLOT(split()));
- d->m_splitSideBySideAction = new QAction(tr("Split Side by Side"), this);
- cmd = ActionManager::registerAction(d->m_splitSideBySideAction, Constants::SPLIT_SIDE_BY_SIDE, editManagerContext);
+ m_splitSideBySideAction = new QAction(tr("Split Side by Side"), this);
+ cmd = ActionManager::registerAction(m_splitSideBySideAction, Constants::SPLIT_SIDE_BY_SIDE, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,3") : tr("Ctrl+E,3")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
- connect(d->m_splitSideBySideAction, SIGNAL(triggered()), this, SLOT(splitSideBySide()));
+ connect(m_splitSideBySideAction, SIGNAL(triggered()), m_instance, SLOT(splitSideBySide()));
- d->m_splitNewWindowAction = new QAction(tr("Open in New Window"), this);
- cmd = ActionManager::registerAction(d->m_splitNewWindowAction, Constants::SPLIT_NEW_WINDOW, editManagerContext);
+ m_splitNewWindowAction = new QAction(tr("Open in New Window"), this);
+ cmd = ActionManager::registerAction(m_splitNewWindowAction, Constants::SPLIT_NEW_WINDOW, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,4") : tr("Ctrl+E,4")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
- connect(d->m_splitNewWindowAction, SIGNAL(triggered()), this, SLOT(splitNewWindow()));
+ connect(m_splitNewWindowAction, SIGNAL(triggered()), this, SLOT(splitNewWindow()));
- d->m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this);
- cmd = ActionManager::registerAction(d->m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext);
+ m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this);
+ cmd = ActionManager::registerAction(m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,0") : tr("Ctrl+E,0")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
- connect(d->m_removeCurrentSplitAction, SIGNAL(triggered()), this, SLOT(removeCurrentSplit()));
+ connect(m_removeCurrentSplitAction, SIGNAL(triggered()), this, SLOT(removeCurrentSplit()));
- d->m_removeAllSplitsAction = new QAction(tr("Remove All Splits"), this);
- cmd = ActionManager::registerAction(d->m_removeAllSplitsAction, Constants::REMOVE_ALL_SPLITS, editManagerContext);
+ m_removeAllSplitsAction = new QAction(tr("Remove All Splits"), this);
+ cmd = ActionManager::registerAction(m_removeAllSplitsAction, Constants::REMOVE_ALL_SPLITS, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,1") : tr("Ctrl+E,1")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
- connect(d->m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits()));
+ connect(m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits()));
- d->m_gotoNextSplitAction = new QAction(tr("Go to Next Split or Window"), this);
- cmd = ActionManager::registerAction(d->m_gotoNextSplitAction, Constants::GOTO_NEXT_SPLIT, editManagerContext);
+ m_gotoNextSplitAction = new QAction(tr("Go to Next Split or Window"), this);
+ cmd = ActionManager::registerAction(m_gotoNextSplitAction, Constants::GOTO_NEXT_SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,o") : tr("Ctrl+E,o")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
- connect(d->m_gotoNextSplitAction, SIGNAL(triggered()), this, SLOT(gotoNextSplit()));
+ connect(m_gotoNextSplitAction, SIGNAL(triggered()), this, SLOT(gotoNextSplit()));
ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT);
ActionContainer *advancedMenu = ActionManager::createMenu(Constants::M_EDIT_ADVANCED);
@@ -423,54 +448,21 @@ EditorManager::EditorManager(QWidget *parent) :
advancedMenu->addSeparator(editManagerContext, Constants::G_EDIT_EDITOR);
// other setup
- SplitterOrView *firstRoot = new SplitterOrView();
- d->m_root.append(firstRoot);
- d->m_rootContext.append(0);
- d->m_currentView = firstRoot->view();
-
- QHBoxLayout *layout = new QHBoxLayout(this);
- layout->setMargin(0);
- layout->setSpacing(0);
- layout->addWidget(firstRoot);
+ auto mainEditorArea = new EditorArea();
+ mainEditorArea->hide();
+ connect(mainEditorArea, SIGNAL(destroyed(QObject*)), this, SLOT(editorAreaDestroyed(QObject*)));
+ d->m_editorAreas.append(mainEditorArea);
+ d->m_currentView = mainEditorArea->view();
updateActions();
- d->m_windowPopup = new OpenEditorsWindow(this);
+ m_windowPopup = new OpenEditorsWindow;
+ m_windowPopup->hide();
- d->m_autoSaveTimer = new QTimer(this);
- connect(d->m_autoSaveTimer, SIGNAL(timeout()), SLOT(autoSave()));
+ m_autoSaveTimer = new QTimer(this);
+ connect(m_autoSaveTimer, SIGNAL(timeout()), SLOT(autoSave()));
updateAutoSave();
-}
-
-EditorManager::~EditorManager()
-{
- m_instance = 0;
- if (ICore::instance()) {
- if (d->m_coreListener) {
- ExtensionSystem::PluginManager::removeObject(d->m_coreListener);
- delete d->m_coreListener;
- }
- ExtensionSystem::PluginManager::removeObject(d->m_openEditorsFactory);
- delete d->m_openEditorsFactory;
- }
-
- // close all extra windows
- for (int i = 1; i < d->m_root.size(); ++i) {
- SplitterOrView *root = d->m_root.at(i);
- disconnect(root, SIGNAL(destroyed(QObject*)), this, SLOT(rootDestroyed(QObject*)));
- IContext *rootContext = d->m_rootContext.at(i);
- ICore::removeContextObject(rootContext);
- delete root;
- delete rootContext;
- }
- d->m_root.clear();
- d->m_rootContext.clear();
- delete d;
-}
-
-void EditorManager::init()
-{
d->m_coreListener = new EditorClosingCoreListener();
ExtensionSystem::PluginManager::addObject(d->m_coreListener);
@@ -479,39 +471,436 @@ void EditorManager::init()
VariableManager::registerFileVariables(kCurrentDocumentPrefix, tr("Current document"),
[]() -> QString {
- IDocument *document = currentDocument();
+ IDocument *document = EditorManager::currentDocument();
return document ? document->filePath() : QString();
});
VariableManager::registerIntVariable(kCurrentDocumentXPos,
tr("X-coordinate of the current editor's upper left corner, relative to screen."),
[]() -> int {
- IEditor *editor = currentEditor();
+ IEditor *editor = EditorManager::currentEditor();
return editor ? editor->widget()->mapToGlobal(QPoint(0, 0)).x() : 0;
});
VariableManager::registerIntVariable(kCurrentDocumentYPos,
tr("Y-coordinate of the current editor's upper left corner, relative to screen."),
[]() -> int {
- IEditor *editor = currentEditor();
+ IEditor *editor = EditorManager::currentEditor();
return editor ? editor->widget()->mapToGlobal(QPoint(0, 0)).y() : 0;
});
}
-void EditorManager::updateAutoSave()
+QWidget *EditorManagerPrivate::mainEditorArea()
{
- if (d->m_autoSaveEnabled)
- d->m_autoSaveTimer->start(d->m_autoSaveInterval * (60 * 1000));
- else
- d->m_autoSaveTimer->stop();
+ return d->m_editorAreas.at(0);
}
-EditorToolBar *EditorManager::createToolBar(QWidget *parent)
+IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileName, Id editorId,
+ EditorManager::OpenEditorFlags flags, bool *newEditor)
{
- return new EditorToolBar(parent);
+ if (debugEditorManager)
+ qDebug() << Q_FUNC_INFO << fileName << editorId.name();
+
+ QString fn = fileName;
+ QFileInfo fi(fn);
+ int lineNumber = -1;
+ if ((flags & EditorManager::CanContainLineNumber) && !fi.exists()) {
+ lineNumber = extractLineNumber(&fn);
+ if (lineNumber != -1)
+ fi.setFile(fn);
+ }
+
+ if (fn.isEmpty())
+ return 0;
+
+ if (newEditor)
+ *newEditor = false;
+
+ const QList<IEditor *> editors = DocumentModel::editorsForFilePath(fn);
+ if (!editors.isEmpty()) {
+ IEditor *editor = editors.first();
+ editor = activateEditor(view, editor, flags);
+ if (editor && flags & EditorManager::CanContainLineNumber)
+ editor->gotoLine(lineNumber, -1);
+ return editor;
+ }
+
+ QString realFn = autoSaveName(fn);
+ QFileInfo rfi(realFn);
+ if (!fi.exists() || !rfi.exists() || fi.lastModified() >= rfi.lastModified()) {
+ QFile::remove(realFn);
+ realFn = fn;
+ }
+
+ IEditor *editor = createEditor(editorId, fn);
+ // If we could not open the file in the requested editor, fall
+ // back to the default editor:
+ if (!editor)
+ editor = createEditor(Id(), fn);
+ QTC_ASSERT(editor, return 0);
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ QString errorString;
+ if (!editor->open(&errorString, fn, realFn)) {
+ QApplication::restoreOverrideCursor();
+ QMessageBox::critical(ICore::mainWindow(), EditorManager::tr("File Error"), errorString);
+ delete editor;
+ return 0;
+ }
+ if (realFn != fn)
+ editor->document()->setRestoredFrom(realFn);
+ addEditor(editor);
+
+ if (newEditor)
+ *newEditor = true;
+
+ IEditor *result = activateEditor(view, editor, flags);
+ if (editor == result)
+ restoreEditorState(editor);
+
+ if (flags & EditorManager::CanContainLineNumber)
+ editor->gotoLine(lineNumber, -1);
+
+ QApplication::restoreOverrideCursor();
+ return result;
+}
+
+IEditor *EditorManagerPrivate::activateEditorForDocument(EditorView *view, IDocument *document,
+ EditorManager::OpenEditorFlags flags)
+{
+ Q_ASSERT(view);
+ IEditor *editor = view->editorForDocument(document);
+ if (!editor) {
+ const QList<IEditor*> editors = DocumentModel::editorsForDocument(document);
+ if (editors.isEmpty())
+ return 0;
+ editor = editors.first();
+ }
+ return activateEditor(view, editor, flags);
+}
+
+EditorView *EditorManagerPrivate::viewForEditor(IEditor *editor)
+{
+ QWidget *w = editor->widget();
+ while (w) {
+ w = w->parentWidget();
+ if (EditorView *view = qobject_cast<EditorView *>(w))
+ return view;
+ }
+ return 0;
+}
+
+MakeWritableResult EditorManagerPrivate::makeFileWritable(IDocument *document)
+{
+ if (!document)
+ return Failed;
+ // TODO: dialog parent is wrong
+ ReadOnlyFilesDialog roDialog(document, ICore::mainWindow(), document->isSaveAsAllowed());
+ switch (roDialog.exec()) {
+ case ReadOnlyFilesDialog::RO_MakeWritable:
+ case ReadOnlyFilesDialog::RO_OpenVCS:
+ return MadeWritable;
+ case ReadOnlyFilesDialog::RO_SaveAs:
+ return SavedAs;
+ default:
+ return Failed;
+ }
}
-void EditorManager::removeEditor(IEditor *editor)
+/*!
+ Implements the logic of the escape key shortcut (ReturnToEditor).
+ Should only be called by the shortcut handler.
+ \internal
+*/
+void EditorManagerPrivate::doEscapeKeyFocusMoveMagic()
+{
+ // use cases to cover:
+ // 1. if app focus is in mode or external window without editor view (e.g. Design, Projects, ext. Help)
+ // if there are extra views (e.g. output)
+ // hide them
+ // otherwise
+ // activate & raise the current editor view (can be external)
+ // if that is in edit mode
+ // activate edit mode and unmaximize output pane
+ // 2. if app focus is in external window with editor view
+ // hide find if necessary
+ // 2. if app focus is in mode with editor view
+ // if current editor view is in external window
+ // raise and activate current editor view
+ // otherwise if the current editor view is not app focus
+ // move focus to editor view in mode and unmaximize output pane
+ // otherwise if the current view is app focus
+ // if mode is not edit mode
+ // if there are extra views (find, help, output)
+ // hide them
+ // otherwise
+ // activate edit mode and unmaximize output pane
+ // otherwise (i.e. mode is edit mode)
+ // hide extra views (find, help, output)
+
+ QWidget *activeWindow = qApp->activeWindow();
+ if (!activeWindow)
+ return;
+ QWidget *focus = qApp->focusWidget();
+ EditorView *editorView = currentEditorView();
+ bool editorViewActive = (focus && focus == editorView->focusWidget());
+ bool editorViewVisible = editorView->isVisible();
+
+ bool stuffHidden = false;
+ FindToolBarPlaceHolder *findPane = FindToolBarPlaceHolder::getCurrent();
+ if (findPane && findPane->isVisible() && findPane->isUsedByWidget(focus)) {
+ findPane->hide();
+ stuffHidden = true;
+ }
+ if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
+ QWidget *outputPane = OutputPanePlaceHolder::getCurrent();
+ if (outputPane && outputPane->isVisible() && outputPane->window() == activeWindow) {
+ OutputPaneManager::instance()->slotHide();
+ stuffHidden = true;
+ }
+ QWidget *rightPane = RightPanePlaceHolder::current();
+ if (rightPane && rightPane->isVisible() && rightPane->window() == activeWindow) {
+ RightPaneWidget::instance()->setShown(false);
+ stuffHidden = true;
+ }
+ }
+ if (stuffHidden)
+ return;
+
+ if (!editorViewActive && editorViewVisible) {
+ setFocusToEditorViewAndUnmaximizePanes(editorView);
+ return;
+ }
+
+ if (!editorViewActive && !editorViewVisible) {
+ // assumption is that editorView is in main window then
+ ModeManager::activateMode(Id(Constants::MODE_EDIT));
+ QTC_CHECK(editorView->isVisible());
+ setFocusToEditorViewAndUnmaximizePanes(editorView);
+ return;
+ }
+
+ if (editorView->window() == ICore::mainWindow()) {
+ // we are in a editor view and there's nothing to hide, switch to edit
+ ModeManager::activateMode(Id(Constants::MODE_EDIT));
+ QTC_CHECK(editorView->isVisible());
+ // next call works only because editor views in main window are shared between modes
+ setFocusToEditorViewAndUnmaximizePanes(editorView);
+ }
+}
+
+OpenEditorsWindow *EditorManagerPrivate::windowPopup()
+{
+ return d->m_windowPopup;
+}
+
+void EditorManagerPrivate::showPopupOrSelectDocument()
+{
+ if (QApplication::keyboardModifiers() == Qt::NoModifier) {
+ windowPopup()->selectAndHide();
+ } else {
+ QWidget *activeWindow = qApp->activeWindow();
+ // decide where to show the popup
+ // if the active window has editors, we want that editor area as a reference
+ // TODO: this does not work correctly with multiple editor areas in the same window
+ EditorArea *activeEditorArea = 0;
+ foreach (EditorArea *area, d->m_editorAreas) {
+ if (area->window() == activeWindow) {
+ activeEditorArea = area;
+ break;
+ }
+ }
+ // otherwise we take the "current" editor area
+ if (!activeEditorArea)
+ activeEditorArea = findEditorArea(EditorManagerPrivate::currentEditorView());
+ QTC_ASSERT(activeEditorArea, activeEditorArea = d->m_editorAreas.first());
+
+ // editor area in main window is invisible when invoked from Design Mode.
+ QWidget *referenceWidget = activeEditorArea->isVisible() ? activeEditorArea : activeEditorArea->window();
+ QTC_CHECK(referenceWidget->isVisible());
+ const QPoint p = referenceWidget->mapToGlobal(QPoint(0, 0));
+ OpenEditorsWindow *popup = windowPopup();
+ popup->setMaximumSize(qMax(popup->minimumWidth(), referenceWidget->width() / 2),
+ qMax(popup->minimumHeight(), referenceWidget->height() / 2));
+ popup->adjustSize();
+ popup->move((referenceWidget->width() - popup->width()) / 2 + p.x(),
+ (referenceWidget->height() - popup->height()) / 2 + p.y());
+ popup->setVisible(true);
+ }
+}
+
+// Run the OpenWithDialog and return the editor id
+// selected by the user.
+Id EditorManagerPrivate::getOpenWithEditorId(const QString &fileName, bool *isExternalEditor)
+{
+ // Collect editors that can open the file
+ MimeType mt = MimeDatabase::findByFile(fileName);
+ //Unable to determine mime type of fileName. Falling back to text/plain",
+ if (!mt)
+ mt = MimeDatabase::findByType(QLatin1String("text/plain"));
+ QList<Id> allEditorIds;
+ QStringList allEditorDisplayNames;
+ QList<Id> externalEditorIds;
+ // Built-in
+ const EditorManager::EditorFactoryList editors = EditorManager::editorFactories(mt, false);
+ const int size = editors.size();
+ for (int i = 0; i < size; i++) {
+ allEditorIds.push_back(editors.at(i)->id());
+ allEditorDisplayNames.push_back(editors.at(i)->displayName());
+ }
+ // External editors
+ const EditorManager::ExternalEditorList exEditors = EditorManager::externalEditors(mt, false);
+ const int esize = exEditors.size();
+ for (int i = 0; i < esize; i++) {
+ externalEditorIds.push_back(exEditors.at(i)->id());
+ allEditorIds.push_back(exEditors.at(i)->id());
+ allEditorDisplayNames.push_back(exEditors.at(i)->displayName());
+ }
+ if (allEditorIds.empty())
+ return Id();
+ QTC_ASSERT(allEditorIds.size() == allEditorDisplayNames.size(), return Id());
+ // Run dialog.
+ OpenWithDialog dialog(fileName, ICore::mainWindow());
+ dialog.setEditors(allEditorDisplayNames);
+ dialog.setCurrentEditor(0);
+ if (dialog.exec() != QDialog::Accepted)
+ return Id();
+ const Id selectedId = allEditorIds.at(dialog.editor());
+ if (isExternalEditor)
+ *isExternalEditor = externalEditorIds.contains(selectedId);
+ return selectedId;
+}
+
+void EditorManagerPrivate::saveSettings()
+{
+ SettingsDatabase *settings = ICore::settingsDatabase();
+ settings->beginTransaction();
+ settings->setValue(QLatin1String(documentStatesKey), d->m_editorStates);
+ settings->setValue(QLatin1String(reloadBehaviorKey), d->m_reloadSetting);
+ settings->setValue(QLatin1String(autoSaveEnabledKey), d->m_autoSaveEnabled);
+ settings->setValue(QLatin1String(autoSaveIntervalKey), d->m_autoSaveInterval);
+ settings->endTransaction();
+}
+
+void EditorManagerPrivate::readSettings()
+{
+ // TODO remove
+ // Backward compatibility to old locations for these settings
+ QSettings *qs = ICore::settings();
+ if (qs->contains(QLatin1String(documentStatesKey))) {
+ d->m_editorStates = qs->value(QLatin1String(documentStatesKey))
+ .value<QMap<QString, QVariant> >();
+ qs->remove(QLatin1String(documentStatesKey));
+ }
+
+ SettingsDatabase *settings = ICore::settingsDatabase();
+ if (settings->contains(QLatin1String(documentStatesKey)))
+ d->m_editorStates = settings->value(QLatin1String(documentStatesKey))
+ .value<QMap<QString, QVariant> >();
+
+ if (settings->contains(QLatin1String(reloadBehaviorKey)))
+ d->m_reloadSetting = (IDocument::ReloadSetting)settings->value(QLatin1String(reloadBehaviorKey)).toInt();
+
+ if (settings->contains(QLatin1String(autoSaveEnabledKey))) {
+ d->m_autoSaveEnabled = settings->value(QLatin1String(autoSaveEnabledKey)).toBool();
+ d->m_autoSaveInterval = settings->value(QLatin1String(autoSaveIntervalKey)).toInt();
+ }
+ updateAutoSave();
+}
+
+void EditorManagerPrivate::setReloadSetting(IDocument::ReloadSetting behavior)
+{
+ d->m_reloadSetting = behavior;
+}
+
+IDocument::ReloadSetting EditorManagerPrivate::reloadSetting()
+{
+ return d->m_reloadSetting;
+}
+
+void EditorManagerPrivate::setAutoSaveEnabled(bool enabled)
+{
+ d->m_autoSaveEnabled = enabled;
+ updateAutoSave();
+}
+
+bool EditorManagerPrivate::autoSaveEnabled()
+{
+ return d->m_autoSaveEnabled;
+}
+
+void EditorManagerPrivate::setAutoSaveInterval(int interval)
+{
+ d->m_autoSaveInterval = interval;
+ updateAutoSave();
+}
+
+int EditorManagerPrivate::autoSaveInterval()
+{
+ return d->m_autoSaveInterval;
+}
+
+IEditor *EditorManagerPrivate::createEditor(Id editorId, const QString &fileName)
+{
+ if (debugEditorManager)
+ qDebug() << Q_FUNC_INFO << editorId.name() << fileName;
+
+ EditorManager::EditorFactoryList factories;
+ if (!editorId.isValid()) {
+ const QFileInfo fileInfo(fileName);
+ // Find by mime type
+ MimeType mimeType = MimeDatabase::findByFile(fileInfo);
+ if (!mimeType) {
+ qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
+ Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData());
+ mimeType = MimeDatabase::findByType(QLatin1String("text/plain"));
+ }
+ // open text files > 48 MB in binary editor
+ if (fileInfo.size() > EditorManager::maxTextFileSize()
+ && mimeType.type().startsWith(QLatin1String("text"))) {
+ mimeType = MimeDatabase::findByType(QLatin1String("application/octet-stream"));
+ }
+ factories = EditorManager::editorFactories(mimeType, true);
+ } else {
+ // Find by editor id
+ if (IEditorFactory *factory = findById<IEditorFactory>(editorId))
+ factories.push_back(factory);
+ }
+ if (factories.empty()) {
+ qWarning("%s: unable to find an editor factory for the file '%s', editor Id '%s'.",
+ Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData());
+ return 0;
+ }
+
+ IEditor *editor = factories.front()->createEditor();
+ if (editor) {
+ QTC_CHECK(editor->document()->id().isValid()); // sanity check that the editor has an id set
+ connect(editor->document(), SIGNAL(changed()), d, SLOT(handleDocumentStateChange()));
+ emit m_instance->editorCreated(editor, fileName);
+ }
+
+ return editor;
+}
+
+void EditorManagerPrivate::addEditor(IEditor *editor)
+{
+ if (!editor)
+ return;
+ ICore::addContextObject(editor);
+
+ bool isNewDocument = false;
+ DocumentModel::addEditor(editor, &isNewDocument);
+ if (isNewDocument) {
+ const bool isTemporary = editor->document()->isTemporary();
+ const bool addWatcher = !isTemporary;
+ DocumentManager::addDocument(editor->document(), addWatcher);
+ if (!isTemporary)
+ DocumentManager::addToRecentFiles(editor->document()->filePath(),
+ editor->document()->id());
+ }
+ emit m_instance->editorOpened(editor);
+}
+
+void EditorManagerPrivate::removeEditor(IEditor *editor)
{
bool lastOneForDocument = false;
DocumentModel::removeEditor(editor, &lastOneForDocument);
@@ -520,31 +909,144 @@ void EditorManager::removeEditor(IEditor *editor)
ICore::removeContextObject(editor);
}
-void EditorManager::handleContextChange(const QList<Core::IContext *> &context)
+IEditor *EditorManagerPrivate::placeEditor(EditorView *view, IEditor *editor)
{
- if (debugEditorManager)
- qDebug() << Q_FUNC_INFO;
- d->m_scheduledCurrentEditor = 0;
- IEditor *editor = 0;
- foreach (IContext *c, context)
- if ((editor = qobject_cast<IEditor*>(c)))
- break;
- if (editor && editor != d->m_currentEditor) {
- // Delay actually setting the current editor to after the current event queue has been handled
- // Without doing this, e.g. clicking into projects tree or locator would always open editors
- // in the main window. That is because clicking anywhere in the main window (even over e.g.
- // the locator line edit) first activates the window and sets focus to its focus widget.
- // Only afterwards the focus is shifted to the widget that received the click.
- d->m_scheduledCurrentEditor = editor;
- QTimer::singleShot(0, m_instance, SLOT(setCurrentEditorFromContextChange()));
+ Q_ASSERT(view && editor);
+
+ if (view->hasEditor(editor))
+ return editor;
+ if (IEditor *e = view->editorForDocument(editor->document()))
+ return e;
+
+ if (EditorView *sourceView = viewForEditor(editor)) {
+ // try duplication or pull editor over to new view
+ bool duplicateSupported = editor->duplicateSupported();
+ if (editor != sourceView->currentEditor() || !duplicateSupported) {
+ // pull the IEditor over to the new view
+ sourceView->removeEditor(editor);
+ view->addEditor(editor);
+ view->setCurrentEditor(editor);
+ if (!sourceView->currentEditor()) {
+ EditorView *replacementView = 0;
+ if (IEditor *replacement = pickUnusedEditor(&replacementView)) {
+ if (replacementView)
+ replacementView->removeEditor(replacement);
+ sourceView->addEditor(replacement);
+ sourceView->setCurrentEditor(replacement);
+ }
+ }
+ return editor;
+ } else if (duplicateSupported) {
+ editor = duplicateEditor(editor);
+ Q_ASSERT(editor);
+ }
+ }
+ view->addEditor(editor);
+ return editor;
+}
+
+IEditor *EditorManagerPrivate::duplicateEditor(IEditor *editor)
+{
+ if (!editor->duplicateSupported())
+ return 0;
+
+ IEditor *duplicate = editor->duplicate();
+ duplicate->restoreState(editor->saveState());
+ emit m_instance->editorCreated(duplicate, duplicate->document()->filePath());
+ addEditor(duplicate);
+ return duplicate;
+}
+
+IEditor *EditorManagerPrivate::activateEditor(EditorView *view, IEditor *editor,
+ EditorManager::OpenEditorFlags flags)
+{
+ Q_ASSERT(view);
+
+ if (!editor) {
+ if (!d->m_currentEditor)
+ setCurrentEditor(0, (flags & EditorManager::IgnoreNavigationHistory));
+ return 0;
+ }
+
+ editor = placeEditor(view, editor);
+
+ if (!(flags & EditorManager::DoNotChangeCurrentEditor)) {
+ setCurrentEditor(editor, (flags & EditorManager::IgnoreNavigationHistory));
+ if (!(flags & EditorManager::DoNotMakeVisible)) {
+ // switch to design mode?
+ if (editor->isDesignModePreferred()) {
+ ModeManager::activateMode(Core::Constants::MODE_DESIGN);
+ ModeManager::setFocusToCurrentMode();
+ } else {
+ int index;
+ findEditorArea(view, &index);
+ if (index == 0) // main window --> we might need to switch mode
+ if (!editor->widget()->isVisible())
+ ModeManager::activateMode(Core::Constants::MODE_EDIT);
+ editor->widget()->setFocus();
+ ICore::raiseWindow(editor->widget());
+ }
+ }
+ } else if (!(flags & EditorManager::DoNotMakeVisible)) {
+ view->setCurrentEditor(editor);
+ }
+ return editor;
+}
+
+void EditorManagerPrivate::activateEditorForEntry(EditorView *view, DocumentModel::Entry *entry, EditorManager::OpenEditorFlags flags)
+{
+ QTC_ASSERT(view, return);
+ if (!entry) { // no document
+ view->setCurrentEditor(0);
+ setCurrentView(view);
+ setCurrentEditor(0);
+ return;
+ }
+ IDocument *document = entry->document;
+ if (document) {
+ activateEditorForDocument(view, document, flags);
+ return;
+ }
+
+ if (!openEditor(view, entry->fileName(), entry->id(), flags))
+ DocumentModel::removeEntry(entry);
+}
+
+void EditorManagerPrivate::activateView(EditorView *view)
+{
+ QTC_ASSERT(view, return);
+ if (IEditor *editor = view->currentEditor()) {
+ setCurrentEditor(editor, true);
+ editor->widget()->setFocus();
+ ICore::raiseWindow(editor->widget());
} else {
- if (editor && !editor->document()->isTemporary())
- DocumentManager::setCurrentFile(editor->document()->filePath());
- updateActions();
+ setCurrentView(view);
}
}
-void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory)
+void EditorManagerPrivate::restoreEditorState(IEditor *editor)
+{
+ QTC_ASSERT(editor, return);
+ QString fileName = editor->document()->filePath();
+ editor->restoreState(d->m_editorStates.value(fileName).toByteArray());
+}
+
+int EditorManagerPrivate::visibleDocumentsCount()
+{
+ const QList<IEditor *> editors = EditorManager::visibleEditors();
+ const int editorsCount = editors.count();
+ if (editorsCount < 2)
+ return editorsCount;
+
+ QSet<const IDocument *> visibleDocuments;
+ foreach (IEditor *editor, editors) {
+ if (const IDocument *document = editor->document())
+ visibleDocuments << document;
+ }
+ return visibleDocuments.count();
+}
+
+void EditorManagerPrivate::setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory)
{
if (editor)
setCurrentView(0);
@@ -552,7 +1054,7 @@ void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHisto
if (d->m_currentEditor == editor)
return;
if (d->m_currentEditor && !ignoreNavigationHistory)
- addCurrentPositionToNavigationHistory();
+ EditorManager::addCurrentPositionToNavigationHistory();
d->m_currentEditor = editor;
if (editor) {
@@ -566,8 +1068,7 @@ void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHisto
emit m_instance->currentEditorChanged(editor);
}
-
-void EditorManager::setCurrentView(Internal::EditorView *view)
+void EditorManagerPrivate::setCurrentView(EditorView *view)
{
if (view == d->m_currentView)
return;
@@ -586,66 +1087,50 @@ void EditorManager::setCurrentView(Internal::EditorView *view)
}
}
-Internal::EditorView *EditorManager::currentEditorView()
-{
- EditorView *view = d->m_currentView;
- if (!view) {
- if (d->m_currentEditor) {
- view = viewForEditor(d->m_currentEditor);
- QTC_ASSERT(view, view = d->m_root.first()->findFirstView());
- }
- QTC_CHECK(view);
- if (!view) { // should not happen, we should always have either currentview or currentdocument
- foreach (SplitterOrView *root, d->m_root) {
- if (root->window()->isActiveWindow()) {
- view = root->findFirstView();
- break;
- }
- }
- QTC_ASSERT(view, view = d->m_root.first()->findFirstView());
- }
- }
- return view;
-}
-
-EditorView *EditorManager::viewForEditor(IEditor *editor)
-{
- QWidget *w = editor->widget();
- while (w) {
- w = w->parentWidget();
- if (EditorView *view = qobject_cast<EditorView *>(w))
- return view;
- }
- return 0;
-}
-
-SplitterOrView *EditorManager::findRoot(const EditorView *view, int *rootIndex)
+EditorArea *EditorManagerPrivate::findEditorArea(const EditorView *view, int *areaIndex)
{
SplitterOrView *current = view->parentSplitterOrView();
while (current) {
- int index = d->m_root.indexOf(current);
- if (index >= 0) {
- if (rootIndex)
- *rootIndex = index;
- return current;
+ if (EditorArea *area = qobject_cast<EditorArea *>(current)) {
+ int index = d->m_editorAreas.indexOf(area);
+ QTC_ASSERT(index >= 0, return 0);
+ if (areaIndex)
+ *areaIndex = index;
+ return area;
}
current = current->findParentSplitter();
}
- QTC_CHECK(false); // we should never have views without a root
+ QTC_CHECK(false); // we should never have views without a editor area
return 0;
}
-IDocument *EditorManager::currentDocument()
+void EditorManagerPrivate::closeView(EditorView *view)
{
- return d->m_currentEditor ? d->m_currentEditor->document() : 0;
-}
+ if (!view)
+ return;
-IEditor *EditorManager::currentEditor()
-{
- return d->m_currentEditor;
+ emptyView(view);
+
+ SplitterOrView *splitterOrView = view->parentSplitterOrView();
+ Q_ASSERT(splitterOrView);
+ Q_ASSERT(splitterOrView->view() == view);
+ SplitterOrView *splitter = splitterOrView->findParentSplitter();
+ Q_ASSERT(splitterOrView->hasEditors() == false);
+ splitterOrView->hide();
+ delete splitterOrView;
+
+ splitter->unsplit();
+
+ EditorView *newCurrent = splitter->findFirstView();
+ if (newCurrent) {
+ if (IEditor *e = newCurrent->currentEditor())
+ EditorManagerPrivate::activateEditor(newCurrent, e);
+ else
+ EditorManagerPrivate::setCurrentView(newCurrent);
+ }
}
-void EditorManager::emptyView(Core::Internal::EditorView *view)
+void EditorManagerPrivate::emptyView(EditorView *view)
{
if (!view)
return;
@@ -655,7 +1140,7 @@ void EditorManager::emptyView(Core::Internal::EditorView *view)
if (DocumentModel::editorsForDocument(editor->document()).size() == 1) {
// it's the only editor for that file
// so we need to keep it around (--> in the editor model)
- if (currentEditor() == editor) {
+ if (EditorManager::currentEditor() == editor) {
// we don't want a current editor that is not open in a view
setCurrentView(view);
setCurrentEditor(0);
@@ -676,380 +1161,592 @@ void EditorManager::emptyView(Core::Internal::EditorView *view)
}
}
-void EditorManager::splitNewWindow(Internal::EditorView *view)
+void EditorManagerPrivate::splitNewWindow(EditorView *view)
{
- SplitterOrView *splitter;
IEditor *editor = view->currentEditor();
IEditor *newEditor = 0;
if (editor && editor->duplicateSupported())
- newEditor = m_instance->duplicateEditor(editor);
+ newEditor = EditorManagerPrivate::duplicateEditor(editor);
else
newEditor = editor; // move to the new view
- splitter = new SplitterOrView;
+ auto area = new EditorArea;
QWidget *win = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
layout->setSpacing(0);
win->setLayout(layout);
- layout->addWidget(splitter);
- win->setFocusProxy(splitter);
+ layout->addWidget(area);
+ win->setFocusProxy(area);
win->setAttribute(Qt::WA_DeleteOnClose);
win->setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
win->resize(QSize(800, 600));
static int windowId = 0;
ICore::registerWindow(win, Context(Id("EditorManager.ExternalWindow.").withSuffix(++windowId)));
- IContext *context = new IContext;
- context->setContext(Context(Constants::C_EDITORMANAGER));
- context->setWidget(splitter);
- ICore::addContextObject(context);
- d->m_root.append(splitter);
- d->m_rootContext.append(context);
- connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*)));
+ d->m_editorAreas.append(area);
+ connect(area, SIGNAL(destroyed(QObject*)), d, SLOT(editorAreaDestroyed(QObject*)));
win->show();
ICore::raiseWindow(win);
if (newEditor)
- m_instance->activateEditor(splitter->view(), newEditor, IgnoreNavigationHistory);
+ activateEditor(area->view(), newEditor, EditorManager::IgnoreNavigationHistory);
else
- splitter->view()->setFocus();
- m_instance->updateActions();
+ area->view()->setFocus();
+ updateActions();
}
-void EditorManager::closeView(Core::Internal::EditorView *view)
+IEditor *EditorManagerPrivate::pickUnusedEditor(EditorView **foundView)
{
- if (!view)
- return;
-
- emptyView(view);
-
- SplitterOrView *splitterOrView = view->parentSplitterOrView();
- Q_ASSERT(splitterOrView);
- Q_ASSERT(splitterOrView->view() == view);
- SplitterOrView *splitter = splitterOrView->findParentSplitter();
- Q_ASSERT(splitterOrView->hasEditors() == false);
- splitterOrView->hide();
- delete splitterOrView;
-
- splitter->unsplit();
-
- EditorView *newCurrent = splitter->findFirstView();
- if (newCurrent) {
- if (IEditor *e = newCurrent->currentEditor())
- activateEditor(newCurrent, e);
- else
- setCurrentView(newCurrent);
+ foreach (IEditor *editor, DocumentModel::editorsForOpenedDocuments()) {
+ EditorView *view = viewForEditor(editor);
+ if (!view || view->currentEditor() != editor) {
+ if (foundView)
+ *foundView = view;
+ return editor;
+ }
}
+ return 0;
}
-bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
+/* Adds the file name to the recent files if there is at least one non-temporary editor for it */
+void EditorManagerPrivate::addDocumentToRecentFiles(IDocument *document)
{
- DocumentModel::removeAllRestoredEntries();
- if (closeDocuments(DocumentModel::openedDocuments(), askAboutModifiedEditors))
- return true;
- return false;
+ if (document->isTemporary())
+ return;
+ DocumentModel::Entry *entry = DocumentModel::entryForDocument(document);
+ if (!entry)
+ return;
+ DocumentManager::addToRecentFiles(document->filePath(), entry->id());
}
-void EditorManager::closeAllEditorsExceptVisible()
+void EditorManagerPrivate::updateAutoSave()
{
- DocumentModel::removeAllRestoredEntries();
- QList<IDocument *> documentsToClose = DocumentModel::openedDocuments();
- foreach (IEditor *editor, visibleEditors())
- documentsToClose.removeAll(editor->document());
- closeDocuments(documentsToClose, true);
+ if (d->m_autoSaveEnabled)
+ d->m_autoSaveTimer->start(d->m_autoSaveInterval * (60 * 1000));
+ else
+ d->m_autoSaveTimer->stop();
}
-void EditorManager::closeOtherEditors(IDocument *document)
+void EditorManagerPrivate::setCloseSplitEnabled(SplitterOrView *splitterOrView, bool enable)
{
- DocumentModel::removeAllRestoredEntries();
- QList<IDocument *> documentsToClose = DocumentModel::openedDocuments();
- documentsToClose.removeAll(document);
- closeDocuments(documentsToClose, true);
+ if (splitterOrView->isView())
+ splitterOrView->view()->setCloseSplitEnabled(enable);
+ QSplitter *splitter = splitterOrView->splitter();
+ if (splitter) {
+ for (int i = 0; i < splitter->count(); ++i) {
+ if (SplitterOrView *subSplitterOrView = qobject_cast<SplitterOrView*>(splitter->widget(i)))
+ setCloseSplitEnabled(subSplitterOrView, enable);
+ }
+ }
}
-void EditorManager::closeOtherEditors()
+void EditorManagerPrivate::updateMakeWritableWarning()
{
- IDocument *current = currentDocument();
- QTC_ASSERT(current, return);
- closeOtherEditors(current);
-}
+ IDocument *document = EditorManager::currentDocument();
+ QTC_ASSERT(document, return);
+ bool ww = document->isModified() && document->isFileReadOnly();
+ if (ww != document->hasWriteWarning()) {
+ document->setWriteWarning(ww);
-// SLOT connected to action
-void EditorManager::closeEditor()
-{
- if (!d->m_currentEditor)
- return;
- addCurrentPositionToNavigationHistory();
- closeEditor(d->m_currentEditor);
+ // Do this after setWriteWarning so we don't re-evaluate this part even
+ // if we do not really show a warning.
+ bool promptVCS = false;
+ const QString directory = QFileInfo(document->filePath()).absolutePath();
+ IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
+ if (versionControl && versionControl->openSupportMode(document->filePath()) != IVersionControl::NoOpen) {
+ if (versionControl->settingsFlags() & IVersionControl::AutoOpen) {
+ vcsOpenCurrentEditor();
+ ww = false;
+ } else {
+ promptVCS = true;
+ }
+ }
+
+ if (ww) {
+ // we are about to change a read-only file, warn user
+ if (promptVCS) {
+ InfoBarEntry info(Id(kMakeWritableWarning),
+ tr("<b>Warning:</b> This file was not opened in %1 yet.")
+ .arg(versionControl->displayName()));
+ info.setCustomButtonInfo(tr("Open"), d, SLOT(vcsOpenCurrentEditor()));
+ document->infoBar()->addInfo(info);
+ } else {
+ InfoBarEntry info(Id(kMakeWritableWarning),
+ tr("<b>Warning:</b> You are changing a read-only file."));
+ info.setCustomButtonInfo(tr("Make Writable"), d, SLOT(makeCurrentEditorWritable()));
+ document->infoBar()->addInfo(info);
+ }
+ } else {
+ document->infoBar()->removeInfo(Id(kMakeWritableWarning));
+ }
+ }
}
-static void assignAction(QAction *self, QAction *other)
+void EditorManagerPrivate::setupSaveActions(IDocument *document, QAction *saveAction,
+ QAction *saveAsAction, QAction *revertToSavedAction)
{
- self->setText(other->text());
- self->setIcon(other->icon());
- self->setShortcut(other->shortcut());
- self->setEnabled(other->isEnabled());
- self->setIconVisibleInMenu(other->isIconVisibleInMenu());
+ const bool hasFile = document != 0 && !document->filePath().isEmpty();
+ saveAction->setEnabled(hasFile && document->isModified());
+ saveAsAction->setEnabled(document != 0 && document->isSaveAsAllowed());
+ revertToSavedAction->setEnabled(hasFile);
+
+ const QString documentName = document ? document->displayName() : QString();
+ QString quotedName;
+
+ if (!documentName.isEmpty()) {
+ quotedName = QLatin1Char('"') + documentName + QLatin1Char('"');
+ saveAction->setText(tr("&Save %1").arg(quotedName));
+ saveAsAction->setText(tr("Save %1 &As...").arg(quotedName));
+ revertToSavedAction->setText(document->isModified()
+ ? tr("Revert %1 to Saved").arg(quotedName)
+ : tr("Reload %1").arg(quotedName));
+ }
}
-void EditorManager::addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentModel::Entry *entry)
+void EditorManagerPrivate::updateActions()
{
- QTC_ASSERT(contextMenu, return);
- d->m_contextMenuEntry = entry;
+ IDocument *curDocument = EditorManager::currentDocument();
+ const int openedCount = DocumentModel::entryCount();
- assignAction(d->m_saveCurrentEditorContextAction, ActionManager::command(Constants::SAVE)->action());
- assignAction(d->m_saveAsCurrentEditorContextAction, ActionManager::command(Constants::SAVEAS)->action());
- assignAction(d->m_revertToSavedCurrentEditorContextAction, ActionManager::command(Constants::REVERTTOSAVED)->action());
+ if (curDocument) {
+ if (HostOsInfo::isMacHost())
+ mainEditorArea()->window()->setWindowModified(curDocument->isModified());
+ updateMakeWritableWarning();
+ } else /* curEditor */ if (HostOsInfo::isMacHost()) {
+ mainEditorArea()->window()->setWindowModified(false);
+ }
- IDocument *document = entry ? entry->document : 0;
+ foreach (EditorArea *area, d->m_editorAreas)
+ setCloseSplitEnabled(area, area->isSplitter());
- setupSaveActions(document,
- d->m_saveCurrentEditorContextAction,
- d->m_saveAsCurrentEditorContextAction,
- d->m_revertToSavedCurrentEditorContextAction);
+ QString quotedName;
+ if (curDocument)
+ quotedName = QLatin1Char('"') + curDocument->displayName() + QLatin1Char('"');
+ setupSaveActions(curDocument, d->m_saveAction, d->m_saveAsAction, d->m_revertToSavedAction);
- contextMenu->addAction(d->m_saveCurrentEditorContextAction);
- contextMenu->addAction(d->m_saveAsCurrentEditorContextAction);
- contextMenu->addAction(ActionManager::command(Constants::SAVEALL)->action());
- contextMenu->addAction(d->m_revertToSavedCurrentEditorContextAction);
+ d->m_closeCurrentEditorAction->setEnabled(curDocument);
+ d->m_closeCurrentEditorAction->setText(tr("Close %1").arg(quotedName));
+ d->m_closeAllEditorsAction->setEnabled(openedCount > 0);
+ d->m_closeOtherEditorsAction->setEnabled(openedCount > 1);
+ d->m_closeOtherEditorsAction->setText((openedCount > 1 ? tr("Close All Except %1").arg(quotedName) : tr("Close Others")));
- contextMenu->addSeparator();
+ d->m_closeAllEditorsExceptVisibleAction->setEnabled(visibleDocumentsCount() < openedCount);
- d->m_closeCurrentEditorContextAction->setText(entry
- ? tr("Close \"%1\"").arg(entry->displayName())
- : tr("Close Editor"));
- d->m_closeOtherEditorsContextAction->setText(entry
- ? tr("Close All Except \"%1\"").arg(entry->displayName())
- : tr("Close Other Editors"));
- d->m_closeCurrentEditorContextAction->setEnabled(entry != 0);
- d->m_closeOtherEditorsContextAction->setEnabled(entry != 0);
- d->m_closeAllEditorsContextAction->setEnabled(!DocumentModel::entries().isEmpty());
- d->m_closeAllEditorsExceptVisibleContextAction->setEnabled(visibleDocumentsCount() < DocumentModel::entries().count());
- contextMenu->addAction(d->m_closeCurrentEditorContextAction);
- contextMenu->addAction(d->m_closeAllEditorsContextAction);
- contextMenu->addAction(d->m_closeOtherEditorsContextAction);
- contextMenu->addAction(d->m_closeAllEditorsExceptVisibleContextAction);
+ d->m_gotoNextDocHistoryAction->setEnabled(openedCount != 0);
+ d->m_gotoPreviousDocHistoryAction->setEnabled(openedCount != 0);
+ EditorView *view = currentEditorView();
+ d->m_goBackAction->setEnabled(view ? view->canGoBack() : false);
+ d->m_goForwardAction->setEnabled(view ? view->canGoForward() : false);
+
+ SplitterOrView *viewParent = (view ? view->parentSplitterOrView() : 0);
+ SplitterOrView *parentSplitter = (viewParent ? viewParent->findParentSplitter() : 0);
+ bool hasSplitter = parentSplitter && parentSplitter->isSplitter();
+ d->m_removeCurrentSplitAction->setEnabled(hasSplitter);
+ d->m_removeAllSplitsAction->setEnabled(hasSplitter);
+ d->m_gotoNextSplitAction->setEnabled(hasSplitter || d->m_editorAreas.size() > 1);
}
-void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentModel::Entry *entry)
+void EditorManagerPrivate::updateWindowTitle()
{
- QTC_ASSERT(contextMenu, return);
- bool enabled = entry && !entry->fileName().isEmpty();
- d->m_openGraphicalShellAction->setEnabled(enabled);
- d->m_openTerminalAction->setEnabled(enabled);
- d->m_findInDirectoryAction->setEnabled(enabled);
- contextMenu->addAction(d->m_openGraphicalShellAction);
- contextMenu->addAction(d->m_openTerminalAction);
- contextMenu->addAction(d->m_findInDirectoryAction);
- QMenu *openWith = contextMenu->addMenu(tr("Open With"));
- connect(openWith, SIGNAL(triggered(QAction*)),
- DocumentManager::instance(), SLOT(executeOpenWithMenuAction(QAction*)));
- openWith->setEnabled(enabled);
- if (enabled)
- DocumentManager::populateOpenWithMenu(openWith, entry->fileName());
+ QString windowTitle = tr("Qt Creator");
+ const QString dashSep = QLatin1String(" - ");
+ QString vcsTopic;
+ IDocument *document = EditorManager::currentDocument();
+
+ if (!d->m_titleVcsTopic.isEmpty())
+ vcsTopic = QLatin1String(" [") + d->m_titleVcsTopic + QLatin1Char(']');
+ if (!d->m_titleAddition.isEmpty()) {
+ windowTitle.prepend(dashSep);
+ if (!document)
+ windowTitle.prepend(vcsTopic);
+ windowTitle.prepend(d->m_titleAddition);
+ }
+ if (document) {
+ const QString documentName = document->displayName();
+ if (!documentName.isEmpty())
+ windowTitle.prepend(documentName + vcsTopic + dashSep);
+ QString filePath = QFileInfo(document->filePath()).absoluteFilePath();
+ if (!filePath.isEmpty())
+ ICore::mainWindow()->setWindowFilePath(filePath);
+ } else {
+ ICore::mainWindow()->setWindowFilePath(QString());
+ }
+ ICore::mainWindow()->setWindowTitle(windowTitle);
}
-static void setFocusToEditorViewAndUnmaximizePanes(EditorView *view)
+void EditorManagerPrivate::gotoNextDocHistory()
{
- IEditor *editor = view->currentEditor();
- QWidget *target = editor ? editor->widget() : view;
- QWidget *focus = target->focusWidget();
- QWidget *w = focus ? focus : target;
+ OpenEditorsWindow *dialog = windowPopup();
+ if (dialog->isVisible()) {
+ dialog->selectNextEditor();
+ } else {
+ EditorView *view = currentEditorView();
+ dialog->setEditors(d->m_globalHistory, view);
+ dialog->selectNextEditor();
+ showPopupOrSelectDocument();
+ }
+}
- w->setFocus();
- ICore::raiseWindow(w);
+void EditorManagerPrivate::gotoPreviousDocHistory()
+{
+ OpenEditorsWindow *dialog = windowPopup();
+ if (dialog->isVisible()) {
+ dialog->selectPreviousEditor();
+ } else {
+ EditorView *view = currentEditorView();
+ dialog->setEditors(d->m_globalHistory, view);
+ dialog->selectPreviousEditor();
+ showPopupOrSelectDocument();
+ }
+}
- OutputPanePlaceHolder *holder = OutputPanePlaceHolder::getCurrent();
- if (holder && holder->window() == view->window()) {
- // unmaximize output pane if necessary
- if (holder->isVisible() && holder->isMaximized())
- holder->unmaximize();
+void EditorManagerPrivate::gotoNextSplit()
+{
+ EditorView *view = currentEditorView();
+ if (!view)
+ return;
+ EditorView *nextView = view->findNextView();
+ if (!nextView) {
+ // we are in the "last" view in this editor area
+ int index = -1;
+ EditorArea *area = findEditorArea(view, &index);
+ QTC_ASSERT(area, return);
+ QTC_ASSERT(index >= 0 && index < d->m_editorAreas.size(), return);
+ // find next editor area. this might be the same editor area if there's only one.
+ int nextIndex = index + 1;
+ if (nextIndex >= d->m_editorAreas.size())
+ nextIndex = 0;
+ nextView = d->m_editorAreas.at(nextIndex)->findFirstView();
+ QTC_CHECK(nextView);
}
+
+ if (nextView)
+ activateView(nextView);
}
-/*!
- Implements the logic of the escape key shortcut (ReturnToEditor).
- Should only be called by the shortcut handler.
- \internal
-*/
-void EditorManager::doEscapeKeyFocusMoveMagic()
+void EditorManagerPrivate::makeCurrentEditorWritable()
{
- // use cases to cover:
- // 1. if app focus is in mode or external window without editor view (e.g. Design, Projects, ext. Help)
- // if there are extra views (e.g. output)
- // hide them
- // otherwise
- // activate & raise the current editor view (can be external)
- // if that is in edit mode
- // activate edit mode and unmaximize output pane
- // 2. if app focus is in external window with editor view
- // hide find if necessary
- // 2. if app focus is in mode with editor view
- // if current editor view is in external window
- // raise and activate current editor view
- // otherwise if the current editor view is not app focus
- // move focus to editor view in mode and unmaximize output pane
- // otherwise if the current view is app focus
- // if mode is not edit mode
- // if there are extra views (find, help, output)
- // hide them
- // otherwise
- // activate edit mode and unmaximize output pane
- // otherwise (i.e. mode is edit mode)
- // hide extra views (find, help, output)
+ if (IDocument* doc = EditorManager::currentDocument())
+ makeFileWritable(doc);
+}
- QWidget *activeWindow = qApp->activeWindow();
- if (!activeWindow)
+void EditorManagerPrivate::vcsOpenCurrentEditor()
+{
+ IDocument *document = EditorManager::currentDocument();
+ if (!document)
return;
- QWidget *focus = qApp->focusWidget();
- EditorView *editorView = currentEditorView();
- bool editorViewActive = (focus && focus == editorView->focusWidget());
- bool editorViewVisible = editorView->isVisible();
- bool stuffHidden = false;
- FindToolBarPlaceHolder *findPane = FindToolBarPlaceHolder::getCurrent();
- if (findPane && findPane->isVisible() && findPane->isUsedByWidget(focus)) {
- findPane->hide();
- stuffHidden = true;
+ const QString directory = QFileInfo(document->filePath()).absolutePath();
+ IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
+ if (!versionControl || versionControl->openSupportMode(document->filePath()) == IVersionControl::NoOpen)
+ return;
+
+ if (!versionControl->vcsOpen(document->filePath())) {
+ // TODO: wrong dialog parent
+ QMessageBox::warning(ICore::mainWindow(), tr("Cannot Open File"),
+ tr("Cannot open the file for editing with VCS."));
}
- if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
- QWidget *outputPane = OutputPanePlaceHolder::getCurrent();
- if (outputPane && outputPane->isVisible() && outputPane->window() == activeWindow) {
- OutputPaneManager::instance()->slotHide();
- stuffHidden = true;
- }
- QWidget *rightPane = RightPanePlaceHolder::current();
- if (rightPane && rightPane->isVisible() && rightPane->window() == activeWindow) {
- RightPaneWidget::instance()->setShown(false);
- stuffHidden = true;
+}
+
+void EditorManagerPrivate::handleDocumentStateChange()
+{
+ updateActions();
+ IDocument *document = qobject_cast<IDocument *>(sender());
+ if (!document->isModified())
+ document->removeAutoSaveFile();
+ if (EditorManager::currentDocument() == document) {
+ updateWindowTitle();
+ emit m_instance->currentDocumentStateChanged();
+ }
+}
+
+void EditorManagerPrivate::editorAreaDestroyed(QObject *area)
+{
+ QWidget *activeWin = qApp->activeWindow();
+ EditorArea *newActiveArea = 0;
+ for (int i = 0; i < d->m_editorAreas.size(); ++i) {
+ EditorArea *r = d->m_editorAreas.at(i);
+ if (r == area) {
+ d->m_editorAreas.removeAt(i);
+ --i; // we removed the current one
+ } else if (r->window() == activeWin) {
+ newActiveArea = r;
}
}
- if (stuffHidden)
+ // check if the destroyed editor area had the current view or current editor
+ if (d->m_currentEditor || (d->m_currentView && d->m_currentView->parentSplitterOrView() != area))
return;
+ // we need to set a new current editor or view
+ if (!newActiveArea) {
+ // some window managers behave weird and don't activate another window
+ // or there might be a Qt Creator toplevel activated that doesn't have editor windows
+ newActiveArea = d->m_editorAreas.first();
+ }
- if (!editorViewActive && editorViewVisible) {
- setFocusToEditorViewAndUnmaximizePanes(editorView);
- return;
+ // check if the focusWidget points to some view
+ SplitterOrView *focusSplitterOrView = 0;
+ QWidget *candidate = newActiveArea->focusWidget();
+ while (candidate && candidate != newActiveArea) {
+ if ((focusSplitterOrView = qobject_cast<SplitterOrView *>(candidate)))
+ break;
+ candidate = candidate->parentWidget();
}
+ // focusWidget might have been 0
+ if (!focusSplitterOrView)
+ focusSplitterOrView = newActiveArea->findFirstView()->parentSplitterOrView();
+ QTC_ASSERT(focusSplitterOrView, focusSplitterOrView = newActiveArea);
+ EditorView *focusView = focusSplitterOrView->findFirstView(); // can be just focusSplitterOrView
+ QTC_ASSERT(focusView, focusView = newActiveArea->findFirstView());
+ QTC_ASSERT(focusView, return);
+ if (focusView->currentEditor())
+ setCurrentEditor(focusView->currentEditor());
+ else
+ setCurrentView(focusView);
+}
- if (!editorViewActive && !editorViewVisible) {
- // assumption is that editorView is in main window then
- ModeManager::activateMode(Id(Constants::MODE_EDIT));
- QTC_CHECK(editorView->isVisible());
- setFocusToEditorViewAndUnmaximizePanes(editorView);
- return;
+void EditorManagerPrivate::autoSave()
+{
+ QStringList errors;
+ // FIXME: the saving should be staggered
+ foreach (IDocument *document, DocumentModel::openedDocuments()) {
+ if (!document->isModified() || !document->shouldAutoSave())
+ continue;
+ if (document->filePath().isEmpty()) // FIXME: save them to a dedicated directory
+ continue;
+ QString errorString;
+ if (!document->autoSave(&errorString, autoSaveName(document->filePath())))
+ errors << errorString;
}
+ if (!errors.isEmpty())
+ QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
+ errors.join(QLatin1String("\n")));
+}
- if (editorView->window() == ICore::mainWindow()) {
- // we are in a editor view and there's nothing to hide, switch to edit
- ModeManager::activateMode(Id(Constants::MODE_EDIT));
- QTC_CHECK(editorView->isVisible());
- // next call works only because editor views in main window are shared between modes
- setFocusToEditorViewAndUnmaximizePanes(editorView);
+void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context)
+{
+ if (debugEditorManager)
+ qDebug() << Q_FUNC_INFO;
+ d->m_scheduledCurrentEditor = 0;
+ IEditor *editor = 0;
+ foreach (IContext *c, context)
+ if ((editor = qobject_cast<IEditor*>(c)))
+ break;
+ if (editor && editor != d->m_currentEditor) {
+ // Delay actually setting the current editor to after the current event queue has been handled
+ // Without doing this, e.g. clicking into projects tree or locator would always open editors
+ // in the main window. That is because clicking anywhere in the main window (even over e.g.
+ // the locator line edit) first activates the window and sets focus to its focus widget.
+ // Only afterwards the focus is shifted to the widget that received the click.
+ d->m_scheduledCurrentEditor = editor;
+ QTimer::singleShot(0, d, SLOT(setCurrentEditorFromContextChange()));
+ } else {
+ if (editor && !editor->document()->isTemporary())
+ DocumentManager::setCurrentFile(editor->document()->filePath());
+ updateActions();
}
}
-void EditorManager::saveDocumentFromContextMenu()
+void EditorManagerPrivate::saveDocumentFromContextMenu()
{
IDocument *document = d->m_contextMenuEntry ? d->m_contextMenuEntry->document : 0;
if (document)
saveDocument(document);
}
-void EditorManager::saveDocumentAsFromContextMenu()
+void EditorManagerPrivate::saveDocumentAsFromContextMenu()
{
IDocument *document = d->m_contextMenuEntry ? d->m_contextMenuEntry->document : 0;
if (document)
saveDocumentAs(document);
}
-void EditorManager::revertToSavedFromContextMenu()
+void EditorManagerPrivate::revertToSavedFromContextMenu()
{
IDocument *document = d->m_contextMenuEntry ? d->m_contextMenuEntry->document : 0;
if (document)
revertToSaved(document);
}
-void EditorManager::closeEditorFromContextMenu()
+void EditorManagerPrivate::closeEditorFromContextMenu()
{
IDocument *document = d->m_contextMenuEntry ? d->m_contextMenuEntry->document : 0;
if (document)
- closeEditors(DocumentModel::editorsForDocument(document));
+ EditorManager::closeEditors(DocumentModel::editorsForDocument(document));
}
-void EditorManager::closeOtherEditorsFromContextMenu()
+void EditorManagerPrivate::closeOtherEditorsFromContextMenu()
{
IDocument *document = d->m_contextMenuEntry ? d->m_contextMenuEntry->document : 0;
- closeOtherEditors(document);
+ EditorManager::closeOtherEditors(document);
+}
+
+bool EditorManagerPrivate::saveDocument(IDocument *document)
+{
+ if (!document)
+ return false;
+
+ document->checkPermissions();
+
+ const QString &fileName = document->filePath();
+
+ if (fileName.isEmpty())
+ return saveDocumentAs(document);
+
+ bool success = false;
+ bool isReadOnly;
+
+ // try saving, no matter what isReadOnly tells us
+ success = DocumentManager::saveDocument(document, QString(), &isReadOnly);
+
+ if (!success && isReadOnly) {
+ MakeWritableResult answer = makeFileWritable(document);
+ if (answer == Failed)
+ return false;
+ if (answer == SavedAs)
+ return true;
+
+ document->checkPermissions();
+
+ success = DocumentManager::saveDocument(document);
+ }
+
+ if (success)
+ addDocumentToRecentFiles(document);
+
+ return success;
+}
+
+bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
+{
+ if (!document)
+ return false;
+
+ const QString filter = MimeDatabase::allFiltersString();
+ QString selectedFilter =
+ MimeDatabase::findByFile(QFileInfo(document->filePath())).filterString();
+ const QString &absoluteFilePath =
+ DocumentManager::getSaveAsFileName(document, filter, &selectedFilter);
+
+ if (absoluteFilePath.isEmpty())
+ return false;
+
+ if (absoluteFilePath != document->filePath()) {
+ // close existing editors for the new file name
+ IDocument *otherDocument = DocumentModel::documentForFilePath(absoluteFilePath);
+ if (otherDocument)
+ EditorManager::closeDocuments(QList<IDocument *>() << otherDocument, false);
+ }
+
+ const bool success = DocumentManager::saveDocument(document, absoluteFilePath);
+ document->checkPermissions();
+
+ // TODO: There is an issue to be treated here. The new file might be of a different mime
+ // type than the original and thus require a different editor. An alternative strategy
+ // would be to close the current editor and open a new appropriate one, but this is not
+ // a good way out either (also the undo stack would be lost). Perhaps the best is to
+ // re-think part of the editors design.
+
+ if (success)
+ addDocumentToRecentFiles(document);
+
+ updateActions();
+ return success;
}
-void EditorManager::showInGraphicalShell()
+void EditorManagerPrivate::closeAllEditorsExceptVisible()
+{
+ DocumentModel::removeAllRestoredEntries();
+ QList<IDocument *> documentsToClose = DocumentModel::openedDocuments();
+ foreach (IEditor *editor, EditorManager::visibleEditors())
+ documentsToClose.removeAll(editor->document());
+ EditorManager::closeDocuments(documentsToClose, true);
+}
+
+void EditorManagerPrivate::revertToSaved(IDocument *document)
+{
+ if (!document)
+ return;
+ const QString fileName = document->filePath();
+ if (fileName.isEmpty())
+ return;
+ if (document->isModified()) {
+ // TODO: wrong dialog parent
+ QMessageBox msgBox(QMessageBox::Question, tr("Revert to Saved"),
+ tr("You will lose your current changes if you proceed reverting %1.").arg(QDir::toNativeSeparators(fileName)),
+ QMessageBox::Yes|QMessageBox::No, ICore::mainWindow());
+ msgBox.button(QMessageBox::Yes)->setText(tr("Proceed"));
+ msgBox.button(QMessageBox::No)->setText(tr("Cancel"));
+ msgBox.setDefaultButton(QMessageBox::No);
+ msgBox.setEscapeButton(QMessageBox::No);
+ if (msgBox.exec() == QMessageBox::No)
+ return;
+
+ }
+ QString errorString;
+ if (!document->reload(&errorString, IDocument::FlagReload, IDocument::TypeContents))
+ QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString);
+}
+
+void EditorManagerPrivate::showInGraphicalShell()
{
if (!d->m_contextMenuEntry || d->m_contextMenuEntry->fileName().isEmpty())
return;
Core::FileUtils::showInGraphicalShell(ICore::mainWindow(), d->m_contextMenuEntry->fileName());
}
-void EditorManager::openTerminal()
+void EditorManagerPrivate::openTerminal()
{
if (!d->m_contextMenuEntry || d->m_contextMenuEntry->fileName().isEmpty())
return;
Core::FileUtils::openTerminal(QFileInfo(d->m_contextMenuEntry->fileName()).path());
}
-void EditorManager::findInDirectory()
+void EditorManagerPrivate::findInDirectory()
{
if (!d->m_contextMenuEntry || d->m_contextMenuEntry->fileName().isEmpty())
return;
emit m_instance->findOnFileSystemRequest(QFileInfo(d->m_contextMenuEntry->fileName()).path());
}
-void EditorManager::rootDestroyed(QObject *root)
+void EditorManagerPrivate::split(Qt::Orientation orientation)
{
- QWidget *activeWin = qApp->activeWindow();
- SplitterOrView *newActiveRoot = 0;
- for (int i = 0; i < d->m_root.size(); ++i) {
- SplitterOrView *r = d->m_root.at(i);
- if (r == root) {
- d->m_root.removeAt(i);
- IContext *context = d->m_rootContext.takeAt(i);
- ICore::removeContextObject(context);
- delete context;
- --i; // we removed the current one
- } else if (r->window() == activeWin) {
- newActiveRoot = r;
- }
- }
- // check if the destroyed root had the current view or current editor
- if (d->m_currentEditor || (d->m_currentView && d->m_currentView->parentSplitterOrView() != root))
- return;
- // we need to set a new current editor or view
- if (!newActiveRoot) {
- // some window managers behave weird and don't activate another window
- // or there might be a Qt Creator toplevel activated that doesn't have editor windows
- newActiveRoot = d->m_root.first();
- }
+ EditorView *view = currentEditorView();
- // check if the focusWidget points to some view
- SplitterOrView *focusSplitterOrView = 0;
- QWidget *candidate = newActiveRoot->focusWidget();
- while (candidate && candidate != newActiveRoot) {
- if ((focusSplitterOrView = qobject_cast<SplitterOrView *>(candidate)))
- break;
- candidate = candidate->parentWidget();
- }
- // focusWidget might have been 0
- if (!focusSplitterOrView)
- focusSplitterOrView = newActiveRoot->findFirstView()->parentSplitterOrView();
- QTC_ASSERT(focusSplitterOrView, focusSplitterOrView = newActiveRoot);
- EditorView *focusView = focusSplitterOrView->findFirstView(); // can be just focusSplitterOrView
- QTC_ASSERT(focusView, focusView = newActiveRoot->findFirstView());
- QTC_ASSERT(focusView, return);
- if (focusView->currentEditor())
- setCurrentEditor(focusView->currentEditor());
- else
- setCurrentView(focusView);
+ if (view)
+ view->parentSplitterOrView()->split(orientation);
+
+ updateActions();
}
-void EditorManager::setCurrentEditorFromContextChange()
+void EditorManagerPrivate::split()
+{
+ split(Qt::Vertical);
+}
+
+void EditorManagerPrivate::splitNewWindow()
+{
+ splitNewWindow(currentEditorView());
+}
+
+void EditorManagerPrivate::removeCurrentSplit()
+{
+ EditorView *viewToClose = currentEditorView();
+
+ QTC_ASSERT(viewToClose, return);
+ QTC_ASSERT(!qobject_cast<EditorArea *>(viewToClose->parentSplitterOrView()), return);
+
+ closeView(viewToClose);
+ updateActions();
+}
+
+void EditorManagerPrivate::removeAllSplits()
+{
+ EditorView *view = currentEditorView();
+ QTC_ASSERT(view, return);
+ EditorArea *currentArea = findEditorArea(view);
+ QTC_ASSERT(currentArea, return);
+ currentArea->unsplitAll();
+}
+
+void EditorManagerPrivate::setCurrentEditorFromContextChange()
{
if (!d->m_scheduledCurrentEditor)
return;
@@ -1061,6 +1758,167 @@ void EditorManager::setCurrentEditorFromContextChange()
}
+EditorView *EditorManagerPrivate::currentEditorView()
+{
+ EditorView *view = d->m_currentView;
+ if (!view) {
+ if (d->m_currentEditor) {
+ view = EditorManagerPrivate::viewForEditor(d->m_currentEditor);
+ QTC_ASSERT(view, view = d->m_editorAreas.first()->findFirstView());
+ }
+ QTC_CHECK(view);
+ if (!view) { // should not happen, we should always have either currentview or currentdocument
+ foreach (EditorArea *area, d->m_editorAreas) {
+ if (area->window()->isActiveWindow()) {
+ view = area->findFirstView();
+ break;
+ }
+ }
+ QTC_ASSERT(view, view = d->m_editorAreas.first()->findFirstView());
+ }
+ }
+ return view;
+}
+
+
+EditorManager *EditorManager::instance() { return m_instance; }
+
+EditorManager::EditorManager(QObject *parent) :
+ QObject(parent)
+{
+ m_instance = this;
+ d = new EditorManagerPrivate(this);
+ d->init();
+}
+
+EditorManager::~EditorManager()
+{
+ delete d;
+ m_instance = 0;
+}
+
+IDocument *EditorManager::currentDocument()
+{
+ return d->m_currentEditor ? d->m_currentEditor->document() : 0;
+}
+
+IEditor *EditorManager::currentEditor()
+{
+ return d->m_currentEditor;
+}
+
+bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
+{
+ DocumentModel::removeAllRestoredEntries();
+ if (closeDocuments(DocumentModel::openedDocuments(), askAboutModifiedEditors))
+ return true;
+ return false;
+}
+
+void EditorManager::closeOtherEditors(IDocument *document)
+{
+ DocumentModel::removeAllRestoredEntries();
+ QList<IDocument *> documentsToClose = DocumentModel::openedDocuments();
+ documentsToClose.removeAll(document);
+ closeDocuments(documentsToClose, true);
+}
+
+// SLOT connected to action
+void EditorManager::closeEditor()
+{
+ if (!d->m_currentEditor)
+ return;
+ addCurrentPositionToNavigationHistory();
+ closeEditor(d->m_currentEditor);
+}
+
+void EditorManager::closeOtherEditors()
+{
+ closeOtherEditors(currentDocument());
+}
+
+static void assignAction(QAction *self, QAction *other)
+{
+ self->setText(other->text());
+ self->setIcon(other->icon());
+ self->setShortcut(other->shortcut());
+ self->setEnabled(other->isEnabled());
+ self->setIconVisibleInMenu(other->isIconVisibleInMenu());
+}
+
+void EditorManager::addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentModel::Entry *entry)
+{
+ QTC_ASSERT(contextMenu, return);
+ d->m_contextMenuEntry = entry;
+
+ assignAction(d->m_saveCurrentEditorContextAction, ActionManager::command(Constants::SAVE)->action());
+ assignAction(d->m_saveAsCurrentEditorContextAction, ActionManager::command(Constants::SAVEAS)->action());
+ assignAction(d->m_revertToSavedCurrentEditorContextAction, ActionManager::command(Constants::REVERTTOSAVED)->action());
+
+ IDocument *document = entry ? entry->document : 0;
+
+ EditorManagerPrivate::setupSaveActions(document,
+ d->m_saveCurrentEditorContextAction,
+ d->m_saveAsCurrentEditorContextAction,
+ d->m_revertToSavedCurrentEditorContextAction);
+
+ contextMenu->addAction(d->m_saveCurrentEditorContextAction);
+ contextMenu->addAction(d->m_saveAsCurrentEditorContextAction);
+ contextMenu->addAction(ActionManager::command(Constants::SAVEALL)->action());
+ contextMenu->addAction(d->m_revertToSavedCurrentEditorContextAction);
+
+ contextMenu->addSeparator();
+
+ d->m_closeCurrentEditorContextAction->setText(entry
+ ? tr("Close \"%1\"").arg(entry->displayName())
+ : tr("Close Editor"));
+ d->m_closeOtherEditorsContextAction->setText(entry
+ ? tr("Close All Except \"%1\"").arg(entry->displayName())
+ : tr("Close Other Editors"));
+ d->m_closeCurrentEditorContextAction->setEnabled(entry != 0);
+ d->m_closeOtherEditorsContextAction->setEnabled(entry != 0);
+ d->m_closeAllEditorsContextAction->setEnabled(!DocumentModel::entries().isEmpty());
+ d->m_closeAllEditorsExceptVisibleContextAction->setEnabled(
+ EditorManagerPrivate::visibleDocumentsCount() < DocumentModel::entries().count());
+ contextMenu->addAction(d->m_closeCurrentEditorContextAction);
+ contextMenu->addAction(d->m_closeAllEditorsContextAction);
+ contextMenu->addAction(d->m_closeOtherEditorsContextAction);
+ contextMenu->addAction(d->m_closeAllEditorsExceptVisibleContextAction);
+}
+
+void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentModel::Entry *entry)
+{
+ QTC_ASSERT(contextMenu, return);
+ bool enabled = entry && !entry->fileName().isEmpty();
+ d->m_openGraphicalShellAction->setEnabled(enabled);
+ d->m_openTerminalAction->setEnabled(enabled);
+ d->m_findInDirectoryAction->setEnabled(enabled);
+ contextMenu->addAction(d->m_openGraphicalShellAction);
+ contextMenu->addAction(d->m_openTerminalAction);
+ contextMenu->addAction(d->m_findInDirectoryAction);
+ QMenu *openWith = contextMenu->addMenu(tr("Open With"));
+ connect(openWith, SIGNAL(triggered(QAction*)),
+ DocumentManager::instance(), SLOT(executeOpenWithMenuAction(QAction*)));
+ openWith->setEnabled(enabled);
+ if (enabled)
+ DocumentManager::populateOpenWithMenu(openWith, entry->fileName());
+}
+
+void EditorManager::saveDocument()
+{
+ EditorManagerPrivate::saveDocument(currentDocument());
+}
+
+void EditorManager::saveDocumentAs()
+{
+ EditorManagerPrivate::saveDocumentAs(currentDocument());
+}
+
+void EditorManager::revertToSaved()
+{
+ EditorManagerPrivate::revertToSaved(currentDocument());
+}
+
void EditorManager::closeEditor(Core::IEditor *editor, bool askAboutModifiedEditors)
{
if (!editor)
@@ -1083,7 +1941,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
if (editorsToClose.isEmpty())
return true;
- EditorView *currentView = currentEditorView();
+ EditorView *currentView = EditorManagerPrivate::currentEditorView();
bool closingFailed = false;
QSet<IEditor*> acceptedEditors;
@@ -1126,7 +1984,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
return false;
// close Editor History list
- windowPopup()->setVisible(false);
+ EditorManagerPrivate::windowPopup()->setVisible(false);
QList<EditorView*> closedViews;
@@ -1140,14 +1998,14 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
d->m_editorStates.insert(editor->document()->filePath(), QVariant(state));
}
- removeEditor(editor);
- if (EditorView *view = viewForEditor(editor)) {
+ EditorManagerPrivate::removeEditor(editor);
+ if (EditorView *view = EditorManagerPrivate::viewForEditor(editor)) {
if (editor == view->currentEditor())
closedViews += view;
if (d->m_currentEditor == editor) {
// avoid having a current editor without view
- setCurrentView(view);
- setCurrentEditor(0);
+ EditorManagerPrivate::setCurrentView(view);
+ EditorManagerPrivate::setCurrentEditor(0);
}
view->removeEditor(editor);
}
@@ -1162,20 +2020,20 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
flags = OpenEditorFlags(DoNotChangeCurrentEditor);
IEditor *newCurrent = view->currentEditor();
if (!newCurrent)
- newCurrent = pickUnusedEditor();
+ newCurrent = EditorManagerPrivate::pickUnusedEditor();
if (newCurrent) {
- activateEditor(view, newCurrent, flags);
+ EditorManagerPrivate::activateEditor(view, newCurrent, flags);
} else {
DocumentModel::Entry *entry = DocumentModel::firstRestoredEntry();
if (entry) {
- activateEditorForEntry(view, entry, flags);
+ EditorManagerPrivate::activateEditorForEntry(view, entry, flags);
} else {
// no "restored" ones, so any entry left should have a document
const QList<DocumentModel::Entry *> documents = DocumentModel::entries();
if (!documents.isEmpty()) {
IDocument *document = documents.last()->document;
if (document)
- activateEditorForDocument(view, document, flags);
+ EditorManagerPrivate::activateEditorForDocument(view, document, flags);
}
}
}
@@ -1188,166 +2046,39 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
if (currentView && !currentViewHandled) {
if (IEditor *editor = currentView->currentEditor())
- activateEditor(currentView, editor);
+ EditorManagerPrivate::activateEditor(currentView, editor);
else
- setCurrentView(currentView);
+ EditorManagerPrivate::setCurrentView(currentView);
}
if (!currentEditor()) {
emit m_instance->currentEditorChanged(0);
- updateActions();
- updateWindowTitle();
+ EditorManagerPrivate::updateActions();
+ EditorManagerPrivate::updateWindowTitle();
}
return !closingFailed;
}
-Core::IEditor *EditorManager::pickUnusedEditor(EditorView **foundView)
-{
- foreach (IEditor *editor, DocumentModel::editorsForOpenedDocuments()) {
- EditorView *view = viewForEditor(editor);
- if (!view || view->currentEditor() != editor) {
- if (foundView)
- *foundView = view;
- return editor;
- }
- }
- return 0;
-}
-
void EditorManager::activateEditorForEntry(DocumentModel::Entry *entry, OpenEditorFlags flags)
{
- activateEditorForEntry(currentEditorView(), entry, flags);
-}
-
-void EditorManager::activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry, OpenEditorFlags flags)
-{
- QTC_ASSERT(view, return);
- if (!entry) { // no document
- view->setCurrentEditor(0);
- setCurrentView(view);
- setCurrentEditor(0);
- return;
- }
- IDocument *document = entry->document;
- if (document) {
- activateEditorForDocument(view, document, flags);
- return;
- }
-
- if (!openEditor(view, entry->fileName(), entry->id(), flags))
- DocumentModel::removeEntry(entry);
-}
-
-void EditorManager::activateView(EditorView *view)
-{
- QTC_ASSERT(view, return);
- if (IEditor *editor = view->currentEditor()) {
- setCurrentEditor(editor, true);
- editor->widget()->setFocus();
- ICore::raiseWindow(editor->widget());
- } else {
- setCurrentView(view);
- }
-}
-
-Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core::IEditor *editor)
-{
- Q_ASSERT(view && editor);
-
- if (view->hasEditor(editor))
- return editor;
- if (IEditor *e = view->editorForDocument(editor->document()))
- return e;
-
- // try duplication or pull editor over to new view
- bool duplicateSupported = editor->duplicateSupported();
- if (EditorView *sourceView = viewForEditor(editor)) {
- if (editor != sourceView->currentEditor() || !duplicateSupported) {
- // pull the IEditor over to the new view
- sourceView->removeEditor(editor);
- view->addEditor(editor);
- view->setCurrentEditor(editor);
- if (!sourceView->currentEditor()) {
- EditorView *replacementView = 0;
- if (IEditor *replacement = pickUnusedEditor(&replacementView)) {
- if (replacementView)
- replacementView->removeEditor(replacement);
- sourceView->addEditor(replacement);
- sourceView->setCurrentEditor(replacement);
- }
- }
- return editor;
- } else if (duplicateSupported) {
- editor = duplicateEditor(editor);
- Q_ASSERT(editor);
- }
- }
- view->addEditor(editor);
- return editor;
+ EditorManagerPrivate::activateEditorForEntry(EditorManagerPrivate::currentEditorView(),
+ entry, flags);
}
void EditorManager::activateEditor(Core::IEditor *editor, OpenEditorFlags flags)
{
QTC_ASSERT(editor, return);
- EditorView *view = viewForEditor(editor);
+ EditorView *view = EditorManagerPrivate::viewForEditor(editor);
// an IEditor doesn't have to belong to a view, it might be kept in storage by the editor model
if (!view)
- view = m_instance->currentEditorView();
- m_instance->activateEditor(view, editor, flags);
-}
-
-Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags)
-{
- Q_ASSERT(view);
-
- if (!editor) {
- if (!d->m_currentEditor)
- setCurrentEditor(0, (flags & IgnoreNavigationHistory));
- return 0;
- }
-
- editor = placeEditor(view, editor);
-
- if (!(flags & DoNotChangeCurrentEditor)) {
- setCurrentEditor(editor, (flags & IgnoreNavigationHistory));
- if (!(flags & DoNotMakeVisible)) {
- // switch to design mode?
- if (editor->isDesignModePreferred()) {
- ModeManager::activateMode(Core::Constants::MODE_DESIGN);
- ModeManager::setFocusToCurrentMode();
- } else {
- int rootIndex;
- findRoot(view, &rootIndex);
- if (rootIndex == 0) // main window --> we might need to switch mode
- if (!editor->widget()->isVisible())
- ModeManager::activateMode(Core::Constants::MODE_EDIT);
- editor->widget()->setFocus();
- ICore::raiseWindow(editor->widget());
- }
- }
- } else if (!(flags & DoNotMakeVisible)) {
- view->setCurrentEditor(editor);
- }
- return editor;
+ view = EditorManagerPrivate::currentEditorView();
+ EditorManagerPrivate::activateEditor(view, editor, flags);
}
IEditor *EditorManager::activateEditorForDocument(IDocument *document, OpenEditorFlags flags)
{
- return activateEditorForDocument(currentEditorView(), document, flags);
-}
-
-Core::IEditor *EditorManager::activateEditorForDocument(Core::Internal::EditorView *view, Core::IDocument *document, OpenEditorFlags flags)
-{
- Q_ASSERT(view);
- IEditor *editor = view->editorForDocument(document);
- if (!editor) {
- const QList<IEditor*> editors = DocumentModel::editorsForDocument(document);
- if (editors.isEmpty())
- return 0;
- editor = editors.first();
- }
- return activateEditor(view, editor, flags);
+ return EditorManagerPrivate::activateEditorForDocument(EditorManagerPrivate::currentEditorView(), document, flags);
}
/* For something that has a 'QStringList mimeTypes' (IEditorFactory
@@ -1405,131 +2136,18 @@ EditorManager::ExternalEditorList
return rc;
}
-/* For something that has a 'QString id' (IEditorFactory
- * or IExternalEditor), find the one matching a id. */
-template <class EditorFactoryLike>
-EditorFactoryLike *findById(Core::Id id)
-{
- return ExtensionSystem::PluginManager::getObject<EditorFactoryLike>(
- [&id](EditorFactoryLike *efl) {
- return id == efl->id();
- });
-}
-
-IEditor *EditorManager::createEditor(Id editorId, const QString &fileName)
-{
- if (debugEditorManager)
- qDebug() << Q_FUNC_INFO << editorId.name() << fileName;
-
- EditorFactoryList factories;
- if (!editorId.isValid()) {
- const QFileInfo fileInfo(fileName);
- // Find by mime type
- MimeType mimeType = MimeDatabase::findByFile(fileInfo);
- if (!mimeType) {
- qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
- Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData());
- mimeType = MimeDatabase::findByType(QLatin1String("text/plain"));
- }
- // open text files > 48 MB in binary editor
- if (fileInfo.size() > maxTextFileSize() && mimeType.type().startsWith(QLatin1String("text")))
- mimeType = MimeDatabase::findByType(QLatin1String("application/octet-stream"));
- factories = editorFactories(mimeType, true);
- } else {
- // Find by editor id
- if (IEditorFactory *factory = findById<IEditorFactory>(editorId))
- factories.push_back(factory);
- }
- if (factories.empty()) {
- qWarning("%s: unable to find an editor factory for the file '%s', editor Id '%s'.",
- Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData());
- return 0;
- }
-
- IEditor *editor = factories.front()->createEditor();
- if (editor) {
- QTC_CHECK(editor->document()->id().isValid()); // sanity check that the editor has an id set
- connect(editor->document(), SIGNAL(changed()), m_instance, SLOT(handleDocumentStateChange()));
- emit m_instance->editorCreated(editor, fileName);
- }
-
- return editor;
-}
-
-void EditorManager::addEditor(IEditor *editor)
-{
- if (!editor)
- return;
- ICore::addContextObject(editor);
-
- bool isNewDocument = false;
- DocumentModel::addEditor(editor, &isNewDocument);
- if (isNewDocument) {
- const bool isTemporary = editor->document()->isTemporary();
- const bool addWatcher = !isTemporary;
- DocumentManager::addDocument(editor->document(), addWatcher);
- if (!isTemporary)
- DocumentManager::addToRecentFiles(editor->document()->filePath(),
- editor->document()->id());
- }
- emit m_instance->editorOpened(editor);
-}
-
-// Run the OpenWithDialog and return the editor id
-// selected by the user.
-Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
- bool *isExternalEditor)
-{
- // Collect editors that can open the file
- MimeType mt = MimeDatabase::findByFile(fileName);
- //Unable to determine mime type of fileName. Falling back to text/plain",
- if (!mt)
- mt = MimeDatabase::findByType(QLatin1String("text/plain"));
- QList<Id> allEditorIds;
- QStringList allEditorDisplayNames;
- QList<Id> externalEditorIds;
- // Built-in
- const EditorFactoryList editors = editorFactories(mt, false);
- const int size = editors.size();
- for (int i = 0; i < size; i++) {
- allEditorIds.push_back(editors.at(i)->id());
- allEditorDisplayNames.push_back(editors.at(i)->displayName());
- }
- // External editors
- const ExternalEditorList exEditors = externalEditors(mt, false);
- const int esize = exEditors.size();
- for (int i = 0; i < esize; i++) {
- externalEditorIds.push_back(exEditors.at(i)->id());
- allEditorIds.push_back(exEditors.at(i)->id());
- allEditorDisplayNames.push_back(exEditors.at(i)->displayName());
- }
- if (allEditorIds.empty())
- return Id();
- QTC_ASSERT(allEditorIds.size() == allEditorDisplayNames.size(), return Id());
- // Run dialog.
- OpenWithDialog dialog(fileName, ICore::mainWindow());
- dialog.setEditors(allEditorDisplayNames);
- dialog.setCurrentEditor(0);
- if (dialog.exec() != QDialog::Accepted)
- return Id();
- const Id selectedId = allEditorIds.at(dialog.editor());
- if (isExternalEditor)
- *isExternalEditor = externalEditorIds.contains(selectedId);
- return selectedId;
-}
-
IEditor *EditorManager::openEditor(const QString &fileName, Id editorId,
OpenEditorFlags flags, bool *newEditor)
{
if (flags & EditorManager::OpenInOtherSplit) {
if (flags & EditorManager::NoNewSplits)
- m_instance->gotoNextSplit();
+ EditorManagerPrivate::gotoNextSplit();
else
- m_instance->gotoOtherSplit();
+ EditorManager::gotoOtherSplit();
}
- return m_instance->openEditor(m_instance->currentEditorView(),
- fileName, editorId, flags, newEditor);
+ return EditorManagerPrivate::openEditor(EditorManagerPrivate::currentEditorView(),
+ fileName, editorId, flags, newEditor);
}
IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column,
@@ -1545,28 +2163,6 @@ IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int colu
return editor;
}
-static int extractLineNumber(QString *fileName)
-{
- int i = fileName->length() - 1;
- for (; i >= 0; --i) {
- if (!fileName->at(i).isNumber())
- break;
- }
- if (i == -1)
- return -1;
- const QChar c = fileName->at(i);
- if (c == QLatin1Char(':') || c == QLatin1Char('+')) {
- bool ok;
- const QString suffix = fileName->mid(i + 1);
- const int result = suffix.toInt(&ok);
- if (suffix.isEmpty() || ok) {
- fileName->truncate(i);
- return result;
- }
- }
- return -1;
-}
-
// Extract line number suffix. Return the suffix (e.g. ":132") and truncates the filename accordingly.
QString EditorManager::splitLineNumber(QString *fileName)
{
@@ -1590,85 +2186,11 @@ QString EditorManager::splitLineNumber(QString *fileName)
return QString();
}
-static QString autoSaveName(const QString &fileName)
-{
- return fileName + QLatin1String(".autosave");
-}
-
bool EditorManager::isAutoSaveFile(const QString &fileName)
{
return fileName.endsWith(QLatin1String(".autosave"));
}
-IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QString &fileName,
- Id editorId, OpenEditorFlags flags, bool *newEditor)
-{
- if (debugEditorManager)
- qDebug() << Q_FUNC_INFO << fileName << editorId.name();
-
- QString fn = fileName;
- QFileInfo fi(fn);
- int lineNumber = -1;
- if ((flags & EditorManager::CanContainLineNumber) && !fi.exists()) {
- lineNumber = extractLineNumber(&fn);
- if (lineNumber != -1)
- fi.setFile(fn);
- }
-
- if (fn.isEmpty())
- return 0;
-
- if (newEditor)
- *newEditor = false;
-
- const QList<IEditor *> editors = DocumentModel::editorsForFilePath(fn);
- if (!editors.isEmpty()) {
- IEditor *editor = editors.first();
- editor = activateEditor(view, editor, flags);
- if (editor && flags & EditorManager::CanContainLineNumber)
- editor->gotoLine(lineNumber, -1);
- return editor;
- }
-
- QString realFn = autoSaveName(fn);
- QFileInfo rfi(realFn);
- if (!fi.exists() || !rfi.exists() || fi.lastModified() >= rfi.lastModified()) {
- QFile::remove(realFn);
- realFn = fn;
- }
-
- IEditor *editor = createEditor(editorId, fn);
- // If we could not open the file in the requested editor, fall
- // back to the default editor:
- if (!editor)
- editor = createEditor(Id(), fn);
- QTC_ASSERT(editor, return 0);
- QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- QString errorString;
- if (!editor->open(&errorString, fn, realFn)) {
- QApplication::restoreOverrideCursor();
- QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString);
- delete editor;
- return 0;
- }
- if (realFn != fn)
- editor->document()->setRestoredFrom(realFn);
- addEditor(editor);
-
- if (newEditor)
- *newEditor = true;
-
- IEditor *result = activateEditor(view, editor, flags);
- if (editor == result)
- restoreEditorState(editor);
-
- if (flags & EditorManager::CanContainLineNumber)
- editor->gotoLine(lineNumber, -1);
-
- QApplication::restoreOverrideCursor();
- return result;
-}
-
bool EditorManager::openExternalEditor(const QString &fileName, Core::Id editorId)
{
IExternalEditor *ee = findById<IExternalEditor>(editorId);
@@ -1701,9 +2223,9 @@ IEditor *EditorManager::openEditorWithContents(Id editorId,
if (flags & EditorManager::OpenInOtherSplit) {
if (flags & EditorManager::NoNewSplits)
- m_instance->gotoNextSplit();
+ EditorManagerPrivate::gotoNextSplit();
else
- m_instance->gotoOtherSplit();
+ EditorManager::gotoOtherSplit();
}
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
@@ -1737,7 +2259,7 @@ IEditor *EditorManager::openEditorWithContents(Id editorId,
*titlePattern = title;
}
- IEditor *edt = createEditor(editorId, title);
+ IEditor *edt = EditorManagerPrivate::createEditor(editorId, title);
if (!edt) {
QApplication::restoreOverrideCursor();
return 0;
@@ -1754,372 +2276,32 @@ IEditor *EditorManager::openEditorWithContents(Id editorId,
edt->document()->setDisplayName(title);
- m_instance->addEditor(edt);
+ EditorManagerPrivate::addEditor(edt);
QApplication::restoreOverrideCursor();
activateEditor(edt, flags);
return edt;
}
-void EditorManager::restoreEditorState(IEditor *editor)
-{
- QTC_ASSERT(editor, return);
- QString fileName = editor->document()->filePath();
- editor->restoreState(d->m_editorStates.value(fileName).toByteArray());
-}
-
bool EditorManager::saveEditor(IEditor *editor)
{
- return saveDocument(editor->document());
-}
-
-bool EditorManager::saveDocument(IDocument *documentParam)
-{
- IDocument *document = documentParam;
- if (!document && currentDocument())
- document = currentDocument();
- if (!document)
- return false;
-
- document->checkPermissions();
-
- const QString &fileName = document->filePath();
-
- if (fileName.isEmpty())
- return saveDocumentAs(document);
-
- bool success = false;
- bool isReadOnly;
-
- // try saving, no matter what isReadOnly tells us
- success = DocumentManager::saveDocument(document, QString(), &isReadOnly);
-
- if (!success && isReadOnly) {
- MakeWritableResult answer =
- makeFileWritable(document);
- if (answer == Failed)
- return false;
- if (answer == SavedAs)
- return true;
-
- document->checkPermissions();
-
- success = DocumentManager::saveDocument(document);
- }
-
- if (success)
- addDocumentToRecentFiles(document);
-
- return success;
-}
-
-void EditorManager::autoSave()
-{
- QStringList errors;
- // FIXME: the saving should be staggered
- foreach (IDocument *document, DocumentModel::openedDocuments()) {
- if (!document->isModified() || !document->shouldAutoSave())
- continue;
- if (document->filePath().isEmpty()) // FIXME: save them to a dedicated directory
- continue;
- QString errorString;
- if (!document->autoSave(&errorString, autoSaveName(document->filePath())))
- errors << errorString;
- }
- if (!errors.isEmpty())
- QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
- errors.join(QLatin1String("\n")));
-}
-
-MakeWritableResult EditorManager::makeFileWritable(IDocument *document)
-{
- if (!document)
- return Failed;
-
- ReadOnlyFilesDialog roDialog(document, ICore::mainWindow(), document->isSaveAsAllowed());
- switch (roDialog.exec()) {
- case ReadOnlyFilesDialog::RO_MakeWritable:
- case ReadOnlyFilesDialog::RO_OpenVCS:
- return MadeWritable;
- case ReadOnlyFilesDialog::RO_SaveAs:
- return SavedAs;
- default:
- return Failed;
- }
-}
-
-bool EditorManager::saveDocumentAs(IDocument *documentParam)
-{
- IDocument *document = documentParam;
- if (!document && currentDocument())
- document = currentDocument();
- if (!document)
- return false;
-
- const QString filter = MimeDatabase::allFiltersString();
- QString selectedFilter =
- MimeDatabase::findByFile(QFileInfo(document->filePath())).filterString();
- const QString &absoluteFilePath =
- DocumentManager::getSaveAsFileName(document, filter, &selectedFilter);
-
- if (absoluteFilePath.isEmpty())
- return false;
-
- if (absoluteFilePath != document->filePath()) {
- // close existing editors for the new file name
- IDocument *otherDocument = DocumentModel::documentForFilePath(absoluteFilePath);
- if (otherDocument)
- closeDocuments(QList<IDocument *>() << otherDocument, false);
- }
-
- const bool success = DocumentManager::saveDocument(document, absoluteFilePath);
- document->checkPermissions();
-
- // TODO: There is an issue to be treated here. The new file might be of a different mime
- // type than the original and thus require a different editor. An alternative strategy
- // would be to close the current editor and open a new appropriate one, but this is not
- // a good way out either (also the undo stack would be lost). Perhaps the best is to
- // re-think part of the editors design.
-
- if (success)
- addDocumentToRecentFiles(document);
-
- updateActions();
- return success;
-}
-
-/* Adds the file name to the recent files if there is at least one non-temporary editor for it */
-void EditorManager::addDocumentToRecentFiles(IDocument *document)
-{
- if (document->isTemporary())
- return;
- DocumentModel::Entry *entry = DocumentModel::entryForDocument(document);
- if (!entry)
- return;
- DocumentManager::addToRecentFiles(document->filePath(), entry->id());
-}
-
-void EditorManager::gotoNextDocHistory()
-{
- OpenEditorsWindow *dialog = windowPopup();
- if (dialog->isVisible()) {
- dialog->selectNextEditor();
- } else {
- EditorView *view = currentEditorView();
- dialog->setEditors(d->m_globalHistory, view);
- dialog->selectNextEditor();
- showPopupOrSelectDocument();
- }
-}
-
-void EditorManager::gotoPreviousDocHistory()
-{
- OpenEditorsWindow *dialog = windowPopup();
- if (dialog->isVisible()) {
- dialog->selectPreviousEditor();
- } else {
- EditorView *view = currentEditorView();
- dialog->setEditors(d->m_globalHistory, view);
- dialog->selectPreviousEditor();
- showPopupOrSelectDocument();
- }
-}
-
-void EditorManager::makeCurrentEditorWritable()
-{
- if (IDocument* doc = currentDocument())
- makeFileWritable(doc);
-}
-
-void EditorManager::vcsOpenCurrentEditor()
-{
- IDocument *document = currentDocument();
- if (!document)
- return;
-
- const QString directory = QFileInfo(document->filePath()).absolutePath();
- IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
- if (!versionControl || versionControl->openSupportMode(document->filePath()) == IVersionControl::NoOpen)
- return;
-
- if (!versionControl->vcsOpen(document->filePath())) {
- QMessageBox::warning(ICore::mainWindow(), tr("Cannot Open File"),
- tr("Cannot open the file for editing with VCS."));
- }
-}
-
-void EditorManager::updateWindowTitle()
-{
- QString windowTitle = tr("Qt Creator");
- const QString dashSep = QLatin1String(" - ");
- QString vcsTopic;
- IDocument *document = currentDocument();
-
- if (!d->m_titleVcsTopic.isEmpty())
- vcsTopic = QLatin1String(" [") + d->m_titleVcsTopic + QLatin1Char(']');
- if (!d->m_titleAddition.isEmpty()) {
- windowTitle.prepend(dashSep);
- if (!document)
- windowTitle.prepend(vcsTopic);
- windowTitle.prepend(d->m_titleAddition);
- }
- if (document) {
- const QString documentName = document->displayName();
- if (!documentName.isEmpty())
- windowTitle.prepend(documentName + vcsTopic + dashSep);
- QString filePath = QFileInfo(document->filePath()).absoluteFilePath();
- if (!filePath.isEmpty())
- ICore::mainWindow()->setWindowFilePath(filePath);
- } else {
- ICore::mainWindow()->setWindowFilePath(QString());
- }
- ICore::mainWindow()->setWindowTitle(windowTitle);
-}
-
-void EditorManager::handleDocumentStateChange()
-{
- updateActions();
- IDocument *document = qobject_cast<IDocument *>(sender());
- if (!document->isModified())
- document->removeAutoSaveFile();
- if (currentDocument() == document) {
- updateWindowTitle();
- emit currentDocumentStateChanged();
- }
-}
-
-void EditorManager::updateMakeWritableWarning()
-{
- IDocument *document = currentDocument();
- QTC_ASSERT(document, return);
- bool ww = document->isModified() && document->isFileReadOnly();
- if (ww != document->hasWriteWarning()) {
- document->setWriteWarning(ww);
-
- // Do this after setWriteWarning so we don't re-evaluate this part even
- // if we do not really show a warning.
- bool promptVCS = false;
- const QString directory = QFileInfo(document->filePath()).absolutePath();
- IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
- if (versionControl && versionControl->openSupportMode(document->filePath()) != IVersionControl::NoOpen) {
- if (versionControl->settingsFlags() & IVersionControl::AutoOpen) {
- vcsOpenCurrentEditor();
- ww = false;
- } else {
- promptVCS = true;
- }
- }
-
- if (ww) {
- // we are about to change a read-only file, warn user
- if (promptVCS) {
- InfoBarEntry info(Id(kMakeWritableWarning),
- tr("<b>Warning:</b> This file was not opened in %1 yet.")
- .arg(versionControl->displayName()));
- info.setCustomButtonInfo(tr("Open"), m_instance, SLOT(vcsOpenCurrentEditor()));
- document->infoBar()->addInfo(info);
- } else {
- InfoBarEntry info(Id(kMakeWritableWarning),
- tr("<b>Warning:</b> You are changing a read-only file."));
- info.setCustomButtonInfo(tr("Make Writable"), m_instance, SLOT(makeCurrentEditorWritable()));
- document->infoBar()->addInfo(info);
- }
- } else {
- document->infoBar()->removeInfo(Id(kMakeWritableWarning));
- }
- }
-}
-
-void EditorManager::setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction)
-{
- const bool hasFile = document != 0 && !document->filePath().isEmpty();
- saveAction->setEnabled(hasFile && document->isModified());
- saveAsAction->setEnabled(document != 0 && document->isSaveAsAllowed());
- revertToSavedAction->setEnabled(hasFile);
-
- const QString documentName = document ? document->displayName() : QString();
- QString quotedName;
-
- if (!documentName.isEmpty()) {
- quotedName = QLatin1Char('"') + documentName + QLatin1Char('"');
- saveAction->setText(tr("&Save %1").arg(quotedName));
- saveAsAction->setText(tr("Save %1 &As...").arg(quotedName));
- revertToSavedAction->setText(document->isModified()
- ? tr("Revert %1 to Saved").arg(quotedName)
- : tr("Reload %1").arg(quotedName));
- }
-}
-
-void EditorManager::updateActions()
-{
- IDocument *curDocument = currentDocument();
- const int openedCount = DocumentModel::entryCount();
-
- if (curDocument) {
- if (HostOsInfo::isMacHost())
- m_instance->window()->setWindowModified(curDocument->isModified());
- updateMakeWritableWarning();
- } else /* curEditor */ if (HostOsInfo::isMacHost()) {
- m_instance->window()->setWindowModified(false);
- }
-
- foreach (SplitterOrView *root, d->m_root)
- setCloseSplitEnabled(root, root->isSplitter());
-
- QString quotedName;
- if (curDocument)
- quotedName = QLatin1Char('"') + curDocument->displayName() + QLatin1Char('"');
- setupSaveActions(curDocument, d->m_saveAction, d->m_saveAsAction, d->m_revertToSavedAction);
-
- d->m_closeCurrentEditorAction->setEnabled(curDocument);
- d->m_closeCurrentEditorAction->setText(tr("Close %1").arg(quotedName));
- d->m_closeAllEditorsAction->setEnabled(openedCount > 0);
- d->m_closeOtherEditorsAction->setEnabled(openedCount > 1);
- d->m_closeOtherEditorsAction->setText((openedCount > 1 ? tr("Close All Except %1").arg(quotedName) : tr("Close Others")));
-
- d->m_closeAllEditorsExceptVisibleAction->setEnabled(visibleDocumentsCount() < openedCount);
-
- d->m_gotoNextDocHistoryAction->setEnabled(openedCount != 0);
- d->m_gotoPreviousDocHistoryAction->setEnabled(openedCount != 0);
- EditorView *view = currentEditorView();
- d->m_goBackAction->setEnabled(view ? view->canGoBack() : false);
- d->m_goForwardAction->setEnabled(view ? view->canGoForward() : false);
-
- SplitterOrView *viewParent = (view ? view->parentSplitterOrView() : 0);
- SplitterOrView *parentSplitter = (viewParent ? viewParent->findParentSplitter() : 0);
- bool hasSplitter = parentSplitter && parentSplitter->isSplitter();
- d->m_removeCurrentSplitAction->setEnabled(hasSplitter);
- d->m_removeAllSplitsAction->setEnabled(hasSplitter);
- d->m_gotoNextSplitAction->setEnabled(hasSplitter || d->m_root.size() > 1);
-}
-
-void EditorManager::setCloseSplitEnabled(SplitterOrView *splitterOrView, bool enable)
-{
- if (splitterOrView->isView())
- splitterOrView->view()->setCloseSplitEnabled(enable);
- QSplitter *splitter = splitterOrView->splitter();
- if (splitter) {
- for (int i = 0; i < splitter->count(); ++i) {
- if (SplitterOrView *subSplitterOrView = qobject_cast<SplitterOrView*>(splitter->widget(i)))
- setCloseSplitEnabled(subSplitterOrView, enable);
- }
- }
+ return EditorManagerPrivate::saveDocument(editor->document());
}
bool EditorManager::hasSplitter()
{
- EditorView *view = currentEditorView();
+ EditorView *view = EditorManagerPrivate::currentEditorView();
QTC_ASSERT(view, return false);
- SplitterOrView *root = findRoot(view);
- QTC_ASSERT(root, return false);
- return root->isSplitter();
+ EditorArea *area = EditorManagerPrivate::findEditorArea(view);
+ QTC_ASSERT(area, return false);
+ return area->isSplitter();
}
QList<IEditor*> EditorManager::visibleEditors()
{
QList<IEditor *> editors;
- foreach (SplitterOrView *root, d->m_root) {
- if (root->isSplitter()) {
- EditorView *firstView = root->findFirstView();
+ foreach (EditorArea *area, d->m_editorAreas) {
+ if (area->isSplitter()) {
+ EditorView *firstView = area->findFirstView();
EditorView *view = firstView;
if (view) {
do {
@@ -2130,28 +2312,13 @@ QList<IEditor*> EditorManager::visibleEditors()
} while (view);
}
} else {
- if (root->editor())
- editors.append(root->editor());
+ if (area->editor())
+ editors.append(area->editor());
}
}
return editors;
}
-int EditorManager::visibleDocumentsCount()
-{
- const QList<IEditor *> editors = visibleEditors();
- const int editorsCount = editors.count();
- if (editorsCount < 2)
- return editorsCount;
-
- QSet<const IDocument *> visibleDocuments;
- foreach (IEditor *editor, editors) {
- if (const IDocument *document = editor->document())
- visibleDocuments << document;
- }
- return visibleDocuments.count();
-}
-
bool EditorManager::closeDocuments(const QList<IDocument *> &document, bool askAboutModifiedEditors)
{
return m_instance->closeEditors(DocumentModel::editorsForDocuments(document), askAboutModifiedEditors);
@@ -2159,66 +2326,27 @@ bool EditorManager::closeDocuments(const QList<IDocument *> &document, bool askA
void EditorManager::addCurrentPositionToNavigationHistory(IEditor *editor, const QByteArray &saveState)
{
- currentEditorView()->addCurrentPositionToNavigationHistory(editor, saveState);
- updateActions();
+ EditorManagerPrivate::currentEditorView()->addCurrentPositionToNavigationHistory(editor, saveState);
+ EditorManagerPrivate::updateActions();
}
void EditorManager::cutForwardNavigationHistory()
{
- currentEditorView()->cutForwardNavigationHistory();
- updateActions();
+ EditorManagerPrivate::currentEditorView()->cutForwardNavigationHistory();
+ EditorManagerPrivate::updateActions();
}
void EditorManager::goBackInNavigationHistory()
{
- currentEditorView()->goBackInNavigationHistory();
- updateActions();
+ EditorManagerPrivate::currentEditorView()->goBackInNavigationHistory();
+ EditorManagerPrivate::updateActions();
return;
}
void EditorManager::goForwardInNavigationHistory()
{
- currentEditorView()->goForwardInNavigationHistory();
- updateActions();
-}
-
-OpenEditorsWindow *EditorManager::windowPopup()
-{
- return d->m_windowPopup;
-}
-
-void EditorManager::showPopupOrSelectDocument()
-{
- if (QApplication::keyboardModifiers() == Qt::NoModifier) {
- windowPopup()->selectAndHide();
- } else {
- QWidget *activeWindow = qApp->activeWindow();
- // decide where to show the popup
- // if the active window has editors, we want that root as a reference
- SplitterOrView *activeRoot = 0;
- foreach (SplitterOrView *root, d->m_root) {
- if (root->window() == activeWindow) {
- activeRoot = root;
- break;
- }
- }
- // otherwise we take the "current" root
- if (!activeRoot)
- activeRoot = findRoot(currentEditorView());
- QTC_ASSERT(activeRoot, activeRoot = d->m_root.first());
-
- // root in main window is invisible when invoked from Design Mode.
- QWidget *referenceWidget = activeRoot->isVisible() ? activeRoot : activeRoot->window();
- QTC_CHECK(referenceWidget->isVisible());
- const QPoint p = referenceWidget->mapToGlobal(QPoint(0, 0));
- OpenEditorsWindow *popup = windowPopup();
- popup->setMaximumSize(qMax(popup->minimumWidth(), referenceWidget->width() / 2),
- qMax(popup->minimumHeight(), referenceWidget->height() / 2));
- popup->adjustSize();
- popup->move((referenceWidget->width() - popup->width()) / 2 + p.x(),
- (referenceWidget->height() - popup->height()) / 2 + p.y());
- popup->setVisible(true);
- }
+ EditorManagerPrivate::currentEditorView()->goForwardInNavigationHistory();
+ EditorManagerPrivate::updateActions();
}
// Save state of all non-teporary editors.
@@ -2257,7 +2385,7 @@ QByteArray EditorManager::saveState()
stream << entry->fileName() << entry->displayName() << entry->id();
}
- stream << d->m_root.first()->saveState(); // TODO
+ stream << d->m_editorAreas.first()->saveState(); // TODO
return bytes;
}
@@ -2266,10 +2394,10 @@ bool EditorManager::restoreState(const QByteArray &state)
{
closeAllEditors(true);
// remove extra windows
- for (int i = d->m_root.count() - 1; i > 0 /* keep first alive */; --i)
- delete d->m_root.at(i); // automatically removes it from list
- if (d->m_root.first()->isSplitter())
- removeAllSplits();
+ for (int i = d->m_editorAreas.count() - 1; i > 0 /* keep first alive */; --i)
+ delete d->m_editorAreas.at(i); // automatically removes it from list
+ if (d->m_editorAreas.first()->isSplitter())
+ EditorManagerPrivate::removeAllSplits();
QDataStream stream(state);
QByteArray version;
@@ -2306,12 +2434,12 @@ bool EditorManager::restoreState(const QByteArray &state)
QByteArray splitterstates;
stream >> splitterstates;
- d->m_root.first()->restoreState(splitterstates); // TODO
+ d->m_editorAreas.first()->restoreState(splitterstates); // TODO
// splitting and stuff results in focus trouble, that's why we set the focus again after restoration
if (d->m_currentEditor) {
d->m_currentEditor->widget()->setFocus();
- } else if (Internal::EditorView *view = currentEditorView()) {
+ } else if (Internal::EditorView *view = EditorManagerPrivate::currentEditorView()) {
if (IEditor *e = view->currentEditor())
e->widget()->setFocus();
else
@@ -2323,121 +2451,19 @@ bool EditorManager::restoreState(const QByteArray &state)
return true;
}
-static const char documentStatesKey[] = "EditorManager/DocumentStates";
-static const char reloadBehaviorKey[] = "EditorManager/ReloadBehavior";
-static const char autoSaveEnabledKey[] = "EditorManager/AutoSaveEnabled";
-static const char autoSaveIntervalKey[] = "EditorManager/AutoSaveInterval";
-
-void EditorManager::saveSettings()
-{
- SettingsDatabase *settings = ICore::settingsDatabase();
- settings->beginTransaction();
- settings->setValue(QLatin1String(documentStatesKey), d->m_editorStates);
- settings->setValue(QLatin1String(reloadBehaviorKey), d->m_reloadSetting);
- settings->setValue(QLatin1String(autoSaveEnabledKey), d->m_autoSaveEnabled);
- settings->setValue(QLatin1String(autoSaveIntervalKey), d->m_autoSaveInterval);
- settings->endTransaction();
-}
-
-void EditorManager::readSettings()
-{
- // Backward compatibility to old locations for these settings
- QSettings *qs = ICore::settings();
- if (qs->contains(QLatin1String(documentStatesKey))) {
- d->m_editorStates = qs->value(QLatin1String(documentStatesKey))
- .value<QMap<QString, QVariant> >();
- qs->remove(QLatin1String(documentStatesKey));
- }
-
- SettingsDatabase *settings = ICore::settingsDatabase();
- if (settings->contains(QLatin1String(documentStatesKey)))
- d->m_editorStates = settings->value(QLatin1String(documentStatesKey))
- .value<QMap<QString, QVariant> >();
-
- if (settings->contains(QLatin1String(reloadBehaviorKey)))
- d->m_reloadSetting = (IDocument::ReloadSetting)settings->value(QLatin1String(reloadBehaviorKey)).toInt();
-
- if (settings->contains(QLatin1String(autoSaveEnabledKey))) {
- d->m_autoSaveEnabled = settings->value(QLatin1String(autoSaveEnabledKey)).toBool();
- d->m_autoSaveInterval = settings->value(QLatin1String(autoSaveIntervalKey)).toInt();
- }
- updateAutoSave();
-}
-
-
-void EditorManager::revertToSaved()
-{
- revertToSaved(currentDocument());
-}
-
-void EditorManager::revertToSaved(Core::IDocument *document)
-{
- if (!document)
- return;
- const QString fileName = document->filePath();
- if (fileName.isEmpty())
- return;
- if (document->isModified()) {
- QMessageBox msgBox(QMessageBox::Question, tr("Revert to Saved"),
- tr("You will lose your current changes if you proceed reverting %1.").arg(QDir::toNativeSeparators(fileName)),
- QMessageBox::Yes|QMessageBox::No, ICore::mainWindow());
- msgBox.button(QMessageBox::Yes)->setText(tr("Proceed"));
- msgBox.button(QMessageBox::No)->setText(tr("Cancel"));
- msgBox.setDefaultButton(QMessageBox::No);
- msgBox.setEscapeButton(QMessageBox::No);
- if (msgBox.exec() == QMessageBox::No)
- return;
-
- }
- QString errorString;
- if (!document->reload(&errorString, IDocument::FlagReload, IDocument::TypeContents))
- QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString);
-}
-
void EditorManager::showEditorStatusBar(const QString &id,
const QString &infoText,
const QString &buttonText,
QObject *object, const char *member)
{
- currentEditorView()->showEditorStatusBar(id, infoText, buttonText, object, member);
+ EditorManagerPrivate::currentEditorView()->showEditorStatusBar(id, infoText, buttonText, object, member);
}
void EditorManager::hideEditorStatusBar(const QString &id)
{
- currentEditorView()->hideEditorStatusBar(id);
-}
-
-void EditorManager::setReloadSetting(IDocument::ReloadSetting behavior)
-{
- d->m_reloadSetting = behavior;
-}
-
-IDocument::ReloadSetting EditorManager::reloadSetting()
-{
- return d->m_reloadSetting;
-}
-
-void EditorManager::setAutoSaveEnabled(bool enabled)
-{
- d->m_autoSaveEnabled = enabled;
- updateAutoSave();
-}
-
-bool EditorManager::autoSaveEnabled()
-{
- return d->m_autoSaveEnabled;
-}
-
-void EditorManager::setAutoSaveInterval(int interval)
-{
- d->m_autoSaveInterval = interval;
- updateAutoSave();
-}
-
-int EditorManager::autoSaveInterval()
-{
- return d->m_autoSaveInterval;
+ // TODO: what if the current editor view betwenn show and hideEditorStatusBar changed?
+ EditorManagerPrivate::currentEditorView()->hideEditorStatusBar(id);
}
QTextCodec *EditorManager::defaultTextCodec()
@@ -2451,88 +2477,9 @@ QTextCodec *EditorManager::defaultTextCodec()
return QTextCodec::codecForLocale();
}
-Core::IEditor *EditorManager::duplicateEditor(Core::IEditor *editor)
-{
- if (!editor->duplicateSupported())
- return 0;
-
- IEditor *duplicate = editor->duplicate();
- duplicate->restoreState(editor->saveState());
- emit m_instance->editorCreated(duplicate, duplicate->document()->filePath());
- addEditor(duplicate);
- return duplicate;
-}
-
-void EditorManager::split(Qt::Orientation orientation)
-{
- EditorView *view = currentEditorView();
-
- if (view)
- view->parentSplitterOrView()->split(orientation);
-
- updateActions();
-}
-
-void EditorManager::split()
-{
- split(Qt::Vertical);
-}
-
void EditorManager::splitSideBySide()
{
- split(Qt::Horizontal);
-}
-
-void EditorManager::splitNewWindow()
-{
- splitNewWindow(currentEditorView());
-}
-
-void EditorManager::removeCurrentSplit()
-{
- EditorView *viewToClose = currentEditorView();
-
- QTC_ASSERT(viewToClose, return);
- QTC_ASSERT(!d->m_root.contains(viewToClose->parentSplitterOrView()), return);
-
- closeView(viewToClose);
- updateActions();
-}
-
-void EditorManager::removeAllSplits()
-{
- EditorView *view = currentEditorView();
- QTC_ASSERT(view, return);
- SplitterOrView *root = findRoot(view);
- QTC_ASSERT(root, return);
- root->unsplitAll();
-}
-
-/*!
- * Moves focus to the next split, cycling through windows.
- */
-void EditorManager::gotoNextSplit()
-{
- EditorView *view = currentEditorView();
- if (!view)
- return;
- EditorView *nextView = view->findNextView();
- if (!nextView) {
- // we are in the "last" view in this root
- int rootIndex = -1;
- SplitterOrView *root = findRoot(view, &rootIndex);
- QTC_ASSERT(root, return);
- QTC_ASSERT(rootIndex >= 0 && rootIndex < d->m_root.size(), return);
- // find next root. this might be the same root if there's only one.
- int nextRootIndex = rootIndex + 1;
- if (nextRootIndex >= d->m_root.size())
- nextRootIndex = 0;
- nextView = d->m_root.at(nextRootIndex)->findFirstView();
- QTC_CHECK(nextView);
- }
-
- if (nextView)
- activateView(nextView);
+ EditorManagerPrivate::split(Qt::Horizontal);
}
/*!
@@ -2543,33 +2490,33 @@ void EditorManager::gotoNextSplit()
*/
void EditorManager::gotoOtherSplit()
{
- EditorView *view = currentEditorView();
+ EditorView *view = EditorManagerPrivate::currentEditorView();
if (!view)
return;
EditorView *nextView = view->findNextView();
if (!nextView) {
- // we are in the "last" view in this root
- int rootIndex = -1;
- SplitterOrView *root = findRoot(view, &rootIndex);
- QTC_ASSERT(root, return);
- QTC_ASSERT(rootIndex >= 0 && rootIndex < d->m_root.size(), return);
+ // we are in the "last" view in this editor area
+ int index = -1;
+ EditorArea *area = EditorManagerPrivate::findEditorArea(view, &index);
+ QTC_ASSERT(area, return);
+ QTC_ASSERT(index >= 0 && index < d->m_editorAreas.size(), return);
// stay in same window if it is split
- if (root->isSplitter()) {
- nextView = root->findFirstView();
+ if (area->isSplitter()) {
+ nextView = area->findFirstView();
QTC_CHECK(nextView != view);
} else {
- // find next root. this might be the same root if there's only one.
- int nextRootIndex = rootIndex + 1;
- if (nextRootIndex >= d->m_root.size())
- nextRootIndex = 0;
- nextView = d->m_root.at(nextRootIndex)->findFirstView();
+ // find next editor area. this might be the same editor area if there's only one.
+ int nextIndex = index + 1;
+ if (nextIndex >= d->m_editorAreas.size())
+ nextIndex = 0;
+ nextView = d->m_editorAreas.at(nextIndex)->findFirstView();
QTC_CHECK(nextView);
- // if we had only one root with only one view, we end up at the startpoint
+ // if we had only one editor area with only one view, we end up at the startpoint
// in that case we need to split
if (nextView == view) {
- QTC_CHECK(!root->isSplitter());
+ QTC_CHECK(!area->isSplitter());
splitSideBySide(); // that deletes 'view'
- view = root->findFirstView();
+ view = area->findFirstView();
nextView = view->findNextView();
QTC_CHECK(nextView != view);
QTC_CHECK(nextView);
@@ -2578,7 +2525,7 @@ void EditorManager::gotoOtherSplit()
}
if (nextView)
- activateView(nextView);
+ EditorManagerPrivate::activateView(nextView);
}
qint64 EditorManager::maxTextFileSize()
@@ -2589,7 +2536,7 @@ qint64 EditorManager::maxTextFileSize()
void EditorManager::setWindowTitleAddition(const QString &addition)
{
d->m_titleAddition = addition;
- updateWindowTitle();
+ EditorManagerPrivate::updateWindowTitle();
}
QString EditorManager::windowTitleAddition()
@@ -2600,7 +2547,7 @@ QString EditorManager::windowTitleAddition()
void EditorManager::setWindowTitleVcsTopic(const QString &topic)
{
d->m_titleVcsTopic = topic;
- m_instance->updateWindowTitle();
+ EditorManagerPrivate::updateWindowTitle();
}
QString EditorManager::windowTitleVcsTopic()
diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h
index d0c264023c..9dcd84117d 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.h
+++ b/src/plugins/coreplugin/editormanager/editormanager.h
@@ -66,6 +66,7 @@ enum MakeWritableResult {
namespace Internal {
class EditorClosingCoreListener;
+class EditorManagerPrivate;
class EditorView;
class MainWindow;
class OpenEditorsViewFactory;
@@ -85,7 +86,7 @@ private:
Core::IMode *m_mode;
};
-class CORE_EXPORT EditorManager : public QWidget
+class CORE_EXPORT EditorManager : public QObject
{
Q_OBJECT
@@ -95,8 +96,6 @@ public:
static EditorManager *instance();
- static EditorToolBar *createToolBar(QWidget *parent = 0);
-
enum OpenEditorFlag {
NoFlags = 0,
DoNotChangeCurrentEditor = 1,
@@ -117,30 +116,23 @@ public:
static IEditor *openEditorWithContents(Id editorId, QString *titlePattern = 0,
const QByteArray &contents = QByteArray(),
OpenEditorFlags flags = NoFlags);
- static IEditor *openEditor(Internal::EditorView *view, const QString &fileName,
- Id id = Id(), OpenEditorFlags flags = NoFlags, bool *newEditor = 0);
static bool openExternalEditor(const QString &fileName, Id editorId);
static QStringList getOpenFileNames();
- static Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0);
static IDocument *currentDocument();
static IEditor *currentEditor();
- static Internal::EditorView *currentEditorView();
static QList<IEditor *> visibleEditors();
static void activateEditor(IEditor *editor, OpenEditorFlags flags = 0);
static void activateEditorForEntry(DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
static IEditor *activateEditorForDocument(IDocument *document, OpenEditorFlags flags = 0);
- static IEditor *activateEditorForDocument(Internal::EditorView *view, IDocument *document, OpenEditorFlags flags = 0);
static bool closeDocuments(const QList<IDocument *> &documents, bool askAboutModifiedEditors = true);
static void closeEditor(DocumentModel::Entry *entry);
static void closeOtherEditors(IDocument *document);
- static Internal::EditorView *viewForEditor(IEditor *editor);
-
static void addCurrentPositionToNavigationHistory(IEditor *editor = 0, const QByteArray &saveState = QByteArray());
static void cutForwardNavigationHistory();
@@ -149,35 +141,19 @@ public:
static bool closeEditors(const QList<IEditor *> &editorsToClose, bool askAboutModifiedEditors = true);
static void closeEditor(IEditor *editor, bool askAboutModifiedEditors = true);
- static MakeWritableResult makeFileWritable(IDocument *document);
-
static QByteArray saveState();
static bool restoreState(const QByteArray &state);
static bool hasSplitter();
- static void saveSettings();
- static void readSettings();
-
- static Internal::OpenEditorsWindow *windowPopup();
- static void showPopupOrSelectDocument();
-
static void showEditorStatusBar(const QString &id,
const QString &infoText,
const QString &buttonText = QString(),
QObject *object = 0, const char *member = 0);
-
static void hideEditorStatusBar(const QString &id);
static EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true);
static ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true);
- static void setReloadSetting(IDocument::ReloadSetting behavior);
- static IDocument::ReloadSetting reloadSetting();
-
- static void setAutoSaveEnabled(bool enabled);
- static bool autoSaveEnabled();
- static void setAutoSaveInterval(int interval);
- static int autoSaveInterval();
static bool isAutoSaveFile(const QString &fileName);
static QTextCodec *defaultTextCodec();
@@ -203,92 +179,22 @@ signals:
void findOnFileSystemRequest(const QString &path);
public slots:
- static bool closeAllEditors(bool askAboutModifiedEditors = true);
- static void closeAllEditorsExceptVisible();
-
- static bool saveDocument(Core::IDocument *documentParam = 0);
- static bool saveDocumentAs(Core::IDocument *documentParam = 0);
+ static void saveDocument();
+ static void saveDocumentAs();
static void revertToSaved();
- static void revertToSaved(IDocument *document);
+ static bool closeAllEditors(bool askAboutModifiedEditors = true);
static void closeEditor();
static void closeOtherEditors();
- static void doEscapeKeyFocusMoveMagic();
-
-private slots:
- static void gotoNextDocHistory();
- static void gotoPreviousDocHistory();
- static void handleContextChange(const QList<Core::IContext *> &context);
- static void updateActions();
- static void makeCurrentEditorWritable();
- static void vcsOpenCurrentEditor();
- static void updateWindowTitle();
- void handleDocumentStateChange();
- static void autoSave();
-
- static void saveDocumentFromContextMenu();
- static void saveDocumentAsFromContextMenu();
- static void revertToSavedFromContextMenu();
-
- static void closeEditorFromContextMenu();
- static void closeOtherEditorsFromContextMenu();
-
- static void showInGraphicalShell();
- static void openTerminal();
- static void findInDirectory();
-
- static void rootDestroyed(QObject *root);
- static void setCurrentEditorFromContextChange();
-
- static void gotoNextSplit();
-
-public slots:
- static void goBackInNavigationHistory();
- static void goForwardInNavigationHistory();
- static void split(Qt::Orientation orientation);
- static void split();
static void splitSideBySide();
- static void splitNewWindow();
- static void removeCurrentSplit();
- static void removeAllSplits();
static void gotoOtherSplit();
+ static void goBackInNavigationHistory();
+ static void goForwardInNavigationHistory();
private:
- explicit EditorManager(QWidget *parent);
+ explicit EditorManager(QObject *parent);
~EditorManager();
- static void init();
-
- static IEditor *createEditor(Id id = Id(), const QString &fileName = QString());
- static void addEditor(IEditor *editor);
- static void removeEditor(IEditor *editor);
-
- static void restoreEditorState(IEditor *editor);
-
- static IEditor *placeEditor(Internal::EditorView *view, IEditor *editor);
- static IEditor *duplicateEditor(IEditor *editor);
- static IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = NoFlags);
- static void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry,
- OpenEditorFlags flags = NoFlags);
- static void activateView(Internal::EditorView *view);
- static int visibleDocumentsCount();
-
- static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
- static void setCurrentView(Internal::EditorView *view);
- static Internal::SplitterOrView *findRoot(const Internal::EditorView *view, int *rootIndex = 0);
-
- static void closeView(Internal::EditorView *view);
- static void emptyView(Internal::EditorView *view);
- static void splitNewWindow(Internal::EditorView *view);
- static IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0);
- static void addDocumentToRecentFiles(IDocument *document);
- static void updateAutoSave();
- static void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable);
- static void updateMakeWritableWarning();
- static void setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction);
friend class Core::Internal::MainWindow;
- friend class Core::Internal::SplitterOrView;
- friend class Core::Internal::EditorView;
- friend class Core::EditorToolBar;
};
} // namespace Core
diff --git a/src/plugins/coreplugin/editormanager/editormanager_p.h b/src/plugins/coreplugin/editormanager/editormanager_p.h
new file mode 100644
index 0000000000..01cb23d337
--- /dev/null
+++ b/src/plugins/coreplugin/editormanager/editormanager_p.h
@@ -0,0 +1,230 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef EDITORMANAGER_P_H
+#define EDITORMANAGER_P_H
+
+#include "documentmodel.h"
+#include "editorarea.h"
+#include "editormanager.h"
+#include "editorview.h"
+#include "ieditor.h"
+
+#include <coreplugin/idocument.h>
+
+#include <QList>
+#include <QObject>
+#include <QPointer>
+#include <QString>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QTimer;
+QT_END_NAMESPACE
+
+namespace Core {
+
+class EditorManager;
+
+namespace Internal {
+
+class EditorClosingCoreListener;
+class MainWindow;
+class OpenEditorsViewFactory;
+class OpenEditorsWindow;
+
+class EditorManagerPrivate : public QObject
+{
+ Q_OBJECT
+
+ friend class Core::EditorManager;
+
+public:
+ static QWidget *mainEditorArea();
+ static EditorView *currentEditorView();
+ static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
+ static IEditor *openEditor(EditorView *view,
+ const QString &fileName,
+ Id editorId = Id(),
+ EditorManager::OpenEditorFlags flags = EditorManager::NoFlags,
+ bool *newEditor = 0);
+ static IEditor *duplicateEditor(IEditor *editor);
+ static IEditor *activateEditor(EditorView *view, IEditor *editor,
+ EditorManager::OpenEditorFlags flags = EditorManager::NoFlags);
+ static IEditor *activateEditorForDocument(EditorView *view, IDocument *document,
+ EditorManager::OpenEditorFlags flags = 0);
+ static void activateEditorForEntry(EditorView *view, DocumentModel::Entry *entry,
+ EditorManager::OpenEditorFlags flags = EditorManager::NoFlags);
+ static EditorView *viewForEditor(IEditor *editor);
+ static void setCurrentView(EditorView *view);
+
+ static MakeWritableResult makeFileWritable(IDocument *document);
+ static void doEscapeKeyFocusMoveMagic();
+
+ static Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0);
+
+ static void saveSettings();
+ static void readSettings();
+ static void setReloadSetting(IDocument::ReloadSetting behavior);
+ static IDocument::ReloadSetting reloadSetting();
+ static void setAutoSaveEnabled(bool enabled);
+ static bool autoSaveEnabled();
+ static void setAutoSaveInterval(int interval);
+ static int autoSaveInterval();
+
+ static void splitNewWindow(Internal::EditorView *view);
+ static void closeView(Internal::EditorView *view);
+ static void emptyView(Internal::EditorView *view);
+
+ static void updateActions();
+
+public slots:
+ static bool saveDocument(Core::IDocument *document);
+ static bool saveDocumentAs(Core::IDocument *document);
+ static void makeCurrentEditorWritable();
+ static void vcsOpenCurrentEditor();
+
+ static void split(Qt::Orientation orientation);
+ static void removeAllSplits();
+ static void gotoNextSplit();
+
+ void handleDocumentStateChange();
+ static void editorAreaDestroyed(QObject *area);
+
+private slots:
+ static void gotoNextDocHistory();
+ static void gotoPreviousDocHistory();
+
+ static void autoSave();
+ static void handleContextChange(const QList<Core::IContext *> &context);
+
+ static void saveDocumentFromContextMenu();
+ static void saveDocumentAsFromContextMenu();
+ static void revertToSavedFromContextMenu();
+ static void closeEditorFromContextMenu();
+ static void closeOtherEditorsFromContextMenu();
+
+ static void closeAllEditorsExceptVisible();
+ static void revertToSaved(IDocument *document);
+
+ static void showInGraphicalShell();
+ static void openTerminal();
+ static void findInDirectory();
+
+ static void split();
+ static void splitNewWindow();
+ static void removeCurrentSplit();
+
+ static void setCurrentEditorFromContextChange();
+
+private:
+ static OpenEditorsWindow *windowPopup();
+ static void showPopupOrSelectDocument();
+
+ static IEditor *createEditor(Id editorId = Id(), const QString &fileName = QString());
+ static void addEditor(IEditor *editor);
+ static void removeEditor(IEditor *editor);
+ static IEditor *placeEditor(EditorView *view, IEditor *editor);
+ static void activateView(EditorView *view);
+ static void restoreEditorState(IEditor *editor);
+ static int visibleDocumentsCount();
+ static EditorArea *findEditorArea(const EditorView *view, int *areaIndex = 0);
+ static IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0);
+ static void addDocumentToRecentFiles(IDocument *document);
+ static void updateAutoSave();
+ static void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable);
+ static void updateMakeWritableWarning();
+ static void setupSaveActions(IDocument *document, QAction *saveAction,
+ QAction *saveAsAction, QAction *revertToSavedAction);
+ static void updateWindowTitle();
+
+private:
+ explicit EditorManagerPrivate(QObject *parent);
+ ~EditorManagerPrivate();
+ void init();
+
+ QList<EditLocation> m_globalHistory;
+ QList<EditorArea *> m_editorAreas;
+ QPointer<IEditor> m_currentEditor;
+ QPointer<IEditor> m_scheduledCurrentEditor;
+ QPointer<EditorView> m_currentView;
+ QTimer *m_autoSaveTimer;
+
+ // actions
+ QAction *m_revertToSavedAction;
+ QAction *m_saveAction;
+ QAction *m_saveAsAction;
+ QAction *m_closeCurrentEditorAction;
+ QAction *m_closeAllEditorsAction;
+ QAction *m_closeOtherEditorsAction;
+ QAction *m_closeAllEditorsExceptVisibleAction;
+ QAction *m_gotoNextDocHistoryAction;
+ QAction *m_gotoPreviousDocHistoryAction;
+ QAction *m_goBackAction;
+ QAction *m_goForwardAction;
+ QAction *m_splitAction;
+ QAction *m_splitSideBySideAction;
+ QAction *m_splitNewWindowAction;
+ QAction *m_removeCurrentSplitAction;
+ QAction *m_removeAllSplitsAction;
+ QAction *m_gotoNextSplitAction;
+
+ QAction *m_saveCurrentEditorContextAction;
+ QAction *m_saveAsCurrentEditorContextAction;
+ QAction *m_revertToSavedCurrentEditorContextAction;
+
+ QAction *m_closeCurrentEditorContextAction;
+ QAction *m_closeAllEditorsContextAction;
+ QAction *m_closeOtherEditorsContextAction;
+ QAction *m_closeAllEditorsExceptVisibleContextAction;
+ QAction *m_openGraphicalShellAction;
+ QAction *m_openTerminalAction;
+ QAction *m_findInDirectoryAction;
+ DocumentModel::Entry *m_contextMenuEntry;
+
+ OpenEditorsWindow *m_windowPopup;
+ EditorClosingCoreListener *m_coreListener;
+
+ QMap<QString, QVariant> m_editorStates;
+ OpenEditorsViewFactory *m_openEditorsFactory;
+
+ IDocument::ReloadSetting m_reloadSetting;
+
+ QString m_titleAddition;
+ QString m_titleVcsTopic;
+
+ bool m_autoSaveEnabled;
+ int m_autoSaveInterval;
+};
+
+} // Internal
+} // Core
+
+#endif // EDITORMANAGER_P_H
diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp
index 2ca9f1613c..420911dcf7 100644
--- a/src/plugins/coreplugin/editormanager/editorview.cpp
+++ b/src/plugins/coreplugin/editormanager/editorview.cpp
@@ -28,7 +28,9 @@
****************************************************************************/
#include "editorview.h"
+
#include "editormanager.h"
+#include "editormanager_p.h"
#include "documentmodel.h"
#include <coreplugin/editortoolbar.h>
@@ -61,7 +63,7 @@ using namespace Core::Internal;
EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
QWidget(parent),
m_parentSplitterOrView(parentSplitterOrView),
- m_toolBar(EditorManager::createToolBar(this)),
+ m_toolBar(new EditorToolBar(this)),
m_container(new QStackedWidget(this)),
m_infoBarDisplay(new InfoBarDisplay(this)),
m_statusHLine(new QFrame(this)),
@@ -229,7 +231,7 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo
void EditorView::paintEvent(QPaintEvent *)
{
- EditorView *editorView = EditorManager::currentEditorView();
+ EditorView *editorView = EditorManagerPrivate::currentEditorView();
if (editorView != this)
return;
@@ -254,7 +256,7 @@ void EditorView::mousePressEvent(QMouseEvent *e)
void EditorView::focusInEvent(QFocusEvent *)
{
- EditorManager::setCurrentView(this);
+ EditorManagerPrivate::setCurrentView(this);
}
void EditorView::addEditor(IEditor *editor)
@@ -306,39 +308,39 @@ IEditor *EditorView::currentEditor() const
void EditorView::listSelectionActivated(int index)
{
- EditorManager::activateEditorForEntry(this, DocumentModel::entryAtRow(index));
+ EditorManagerPrivate::activateEditorForEntry(this, DocumentModel::entryAtRow(index));
}
void EditorView::splitHorizontally()
{
if (m_parentSplitterOrView)
m_parentSplitterOrView->split(Qt::Vertical);
- EditorManager::updateActions();
+ EditorManagerPrivate::updateActions();
}
void EditorView::splitVertically()
{
if (m_parentSplitterOrView)
m_parentSplitterOrView->split(Qt::Horizontal);
- EditorManager::updateActions();
+ EditorManagerPrivate::updateActions();
}
void EditorView::splitNewWindow()
{
- EditorManager::splitNewWindow(this);
+ EditorManagerPrivate::splitNewWindow(this);
}
void EditorView::closeSplit()
{
- EditorManager::closeView(this);
- EditorManager::updateActions();
+ EditorManagerPrivate::closeView(this);
+ EditorManagerPrivate::updateActions();
}
void EditorView::openDroppedFiles(const QStringList &files)
{
const int count = files.size();
for (int i = 0; i < count; ++i) {
- EditorManager::openEditor(this, files.at(i), Id(),
+ EditorManagerPrivate::openEditor(this, files.at(i), Id(),
i < count - 1 ? EditorManager::DoNotChangeCurrentEditor
| EditorManager::DoNotMakeVisible
: EditorManager::NoFlags);
@@ -486,11 +488,11 @@ void EditorView::goBackInNavigationHistory()
EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition);
IEditor *editor = 0;
if (location.document) {
- editor = EditorManager::activateEditorForDocument(this, location.document,
+ editor = EditorManagerPrivate::activateEditorForDocument(this, location.document,
EditorManager::IgnoreNavigationHistory);
}
if (!editor) {
- editor = EditorManager::openEditor(this, location.fileName, location.id,
+ editor = EditorManagerPrivate::openEditor(this, location.fileName, location.id,
EditorManager::IgnoreNavigationHistory);
if (!editor) {
m_navigationHistory.removeAt(m_currentNavigationHistoryPosition);
@@ -512,11 +514,12 @@ void EditorView::goForwardInNavigationHistory()
EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition);
IEditor *editor = 0;
if (location.document) {
- editor = EditorManager::activateEditorForDocument(this, location.document,
+ editor = EditorManagerPrivate::activateEditorForDocument(this, location.document,
EditorManager::IgnoreNavigationHistory);
}
if (!editor) {
- editor = EditorManager::openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
+ editor = EditorManagerPrivate::openEditor(this, location.fileName, location.id,
+ EditorManager::IgnoreNavigationHistory);
if (!editor) {
//TODO
qDebug() << Q_FUNC_INFO << "can't open file" << location.fileName;
@@ -555,7 +558,7 @@ SplitterOrView::~SplitterOrView()
delete m_layout;
m_layout = 0;
if (m_view)
- EditorManager::emptyView(m_view);
+ EditorManagerPrivate::emptyView(m_view);
delete m_view;
m_view = 0;
delete m_splitter;
@@ -630,7 +633,7 @@ void SplitterOrView::split(Qt::Orientation orientation)
SplitterOrView *view = 0;
SplitterOrView *otherView = 0;
- IEditor *duplicate = e && e->duplicateSupported() ? EditorManager::duplicateEditor(e) : 0;
+ IEditor *duplicate = e && e->duplicateSupported() ? EditorManagerPrivate::duplicateEditor(e) : 0;
m_splitter->addWidget((view = new SplitterOrView(duplicate)));
m_splitter->addWidget((otherView = new SplitterOrView(editorView)));
@@ -648,9 +651,9 @@ void SplitterOrView::split(Qt::Orientation orientation)
}
if (e)
- EditorManager::activateEditor(otherView->view(), e);
+ EditorManagerPrivate::activateEditor(otherView->view(), e);
else
- EditorManager::setCurrentView(otherView->view());
+ EditorManagerPrivate::setCurrentView(otherView->view());
}
void SplitterOrView::unsplitAll()
@@ -665,7 +668,7 @@ void SplitterOrView::unsplitAll()
}
}
- EditorView *currentView = EditorManager::currentEditorView();
+ EditorView *currentView = EditorManagerPrivate::currentEditorView();
if (currentView) {
currentView->parentSplitterOrView()->takeView();
currentView->setParentSplitterOrView(this);
@@ -692,7 +695,7 @@ void SplitterOrView::unsplitAll()
void SplitterOrView::unsplitAll_helper()
{
if (m_view)
- EditorManager::emptyView(m_view);
+ EditorManagerPrivate::emptyView(m_view);
if (m_splitter) {
for (int i = 0; i < m_splitter->count(); ++i) {
if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
@@ -726,7 +729,7 @@ void SplitterOrView::unsplit()
m_view->addEditor(e);
m_view->setCurrentEditor(e);
}
- EditorManager::emptyView(childView);
+ EditorManagerPrivate::emptyView(childView);
} else {
m_view = childSplitterOrView->takeView();
m_view->setParentSplitterOrView(this);
@@ -749,7 +752,7 @@ void SplitterOrView::unsplit()
m_layout->setCurrentWidget(m_view);
}
delete oldSplitter;
- EditorManager::setCurrentView(findFirstView());
+ EditorManagerPrivate::setCurrentView(findFirstView());
}
@@ -812,20 +815,22 @@ void SplitterOrView::restoreState(const QByteArray &state)
stream >> fileName >> id >> editorState;
if (!QFile::exists(fileName))
return;
- IEditor *e = EditorManager::openEditor(view(), fileName, Id::fromString(id), Core::EditorManager::IgnoreNavigationHistory
- | Core::EditorManager::DoNotChangeCurrentEditor);
+ IEditor *e = EditorManagerPrivate::openEditor(view(), fileName, Id::fromString(id),
+ Core::EditorManager::IgnoreNavigationHistory
+ | Core::EditorManager::DoNotChangeCurrentEditor);
if (!e) {
DocumentModel::Entry *entry = DocumentModel::firstRestoredEntry();
- if (entry)
- EditorManager::activateEditorForEntry(view(), entry, Core::EditorManager::IgnoreNavigationHistory
- | Core::EditorManager::DoNotChangeCurrentEditor);
+ if (entry) {
+ EditorManagerPrivate::activateEditorForEntry(view(), entry,
+ EditorManager::IgnoreNavigationHistory | EditorManager::DoNotChangeCurrentEditor);
+ }
}
if (e) {
e->restoreState(editorState);
if (mode == "currenteditor")
- EditorManager::setCurrentEditor(e);
+ EditorManagerPrivate::setCurrentEditor(e);
}
}
}
diff --git a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
index 1e1da4a758..0d326b1934 100644
--- a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
+++ b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
@@ -32,13 +32,8 @@
#include <utils/qtcassert.h>
Core::IEditorFactory::IEditorFactory(QObject *parent)
- : IDocumentFactory(parent)
+ : QObject(parent)
{
- setOpener([](const QString &) -> Core::IDocument * {
- qWarning("This should never be called, use IEditorFactor::createEditor, "
- "or EditorManager::openEditor instead!");
- QTC_CHECK(false);
- return 0;
- });
+
}
diff --git a/src/plugins/coreplugin/editormanager/ieditorfactory.h b/src/plugins/coreplugin/editormanager/ieditorfactory.h
index 9f2236cc52..8021372c76 100644
--- a/src/plugins/coreplugin/editormanager/ieditorfactory.h
+++ b/src/plugins/coreplugin/editormanager/ieditorfactory.h
@@ -36,14 +36,28 @@ namespace Core {
class IEditor;
-class CORE_EXPORT IEditorFactory : public Core::IDocumentFactory
+class CORE_EXPORT IEditorFactory : public QObject
{
Q_OBJECT
public:
IEditorFactory(QObject *parent = 0);
+ QString displayName() const { return m_displayName; }
+ void setDisplayName(const QString &displayName) { m_displayName = displayName; }
+
+ Id id() const { return m_id; }
+ void setId(Id id) { m_id = id; }
virtual IEditor *createEditor() = 0;
+
+ QStringList mimeTypes() const { return m_mimeTypes; }
+ void setMimeTypes(const QStringList &mimeTypes) { m_mimeTypes = mimeTypes; }
+ void addMimeType(const char *mimeType) { m_mimeTypes.append(QLatin1String(mimeType)); }
+ void addMimeType(const QString &mimeType) { m_mimeTypes.append(mimeType); }
+private:
+ Id m_id;
+ QString m_displayName;
+ QStringList m_mimeTypes;
};
} // namespace Core
diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.cpp b/src/plugins/coreplugin/editormanager/openeditorsview.cpp
index 65280205d0..dba0700159 100644
--- a/src/plugins/coreplugin/editormanager/openeditorsview.cpp
+++ b/src/plugins/coreplugin/editormanager/openeditorsview.cpp
@@ -68,7 +68,7 @@ void OpenEditorsDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
if (index.column() == 1 && option.state & QStyle::State_MouseOver) {
const QIcon icon(QLatin1String((option.state & QStyle::State_Selected) ?
- Constants::ICON_CLOSE : Constants::ICON_CLOSE_DARK));
+ Constants::ICON_CLOSE_BUTTON : Constants::ICON_DARK_CLOSE_BUTTON));
QRect iconRect(option.rect.right() - option.rect.height(),
option.rect.top(),
@@ -216,42 +216,19 @@ void OpenEditorsWidget::contextMenuRequested(QPoint pos)
// OpenEditorsViewFactory
///
-NavigationView OpenEditorsViewFactory::createWidget()
-{
- NavigationView n;
- n.widget = new OpenEditorsWidget();
- return n;
-}
-
-QString OpenEditorsViewFactory::displayName() const
-{
- return OpenEditorsWidget::tr("Open Documents");
-}
-
-int OpenEditorsViewFactory::priority() const
-{
- return 200;
-}
-
-Id OpenEditorsViewFactory::id() const
-{
- return "Open Documents";
-}
-
-QKeySequence OpenEditorsViewFactory::activationSequence() const
-{
- return QKeySequence(Core::UseMacShortcuts ? tr("Meta+O") : tr("Alt+O"));
-}
-
OpenEditorsViewFactory::OpenEditorsViewFactory()
{
+ setId("Open Documents");
+ setDisplayName(OpenEditorsWidget::tr("Open Documents"));
+ setActivationSequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+O") : tr("Alt+O")));
+ setPriority(200);
}
-OpenEditorsViewFactory::~OpenEditorsViewFactory()
+NavigationView OpenEditorsViewFactory::createWidget()
{
+ return NavigationView(new OpenEditorsWidget());
}
-
ProxyModel::ProxyModel(QObject *parent) : QAbstractProxyModel(parent)
{
}
diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.h b/src/plugins/coreplugin/editormanager/openeditorsview.h
index d4e8197082..01479ae93d 100644
--- a/src/plugins/coreplugin/editormanager/openeditorsview.h
+++ b/src/plugins/coreplugin/editormanager/openeditorsview.h
@@ -109,13 +109,10 @@ private:
class OpenEditorsViewFactory : public Core::INavigationWidgetFactory
{
Q_OBJECT
+
public:
OpenEditorsViewFactory();
- ~OpenEditorsViewFactory();
- QString displayName() const;
- int priority() const;
- Id id() const;
- QKeySequence activationSequence() const;
+
Core::NavigationView createWidget();
};
diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
index 24ae5fb27c..8f33f6401f 100644
--- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
+++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
@@ -28,8 +28,10 @@
****************************************************************************/
#include "openeditorswindow.h"
+
#include "documentmodel.h"
#include "editormanager.h"
+#include "editormanager_p.h"
#include "editorview.h"
#include <coreplugin/idocument.h>
@@ -196,7 +198,7 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item)
return;
if (IDocument *document = item->data(0, Qt::UserRole).value<IDocument*>()) {
EditorView *view = item->data(0, Qt::UserRole+1).value<EditorView*>();
- EditorManager::activateEditorForDocument(view, document);
+ EditorManagerPrivate::activateEditorForDocument(view, document);
} else {
if (!EditorManager::openEditor(
item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>())) {
diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp
index 38e29bfe98..809af43a8c 100644
--- a/src/plugins/coreplugin/editortoolbar.cpp
+++ b/src/plugins/coreplugin/editortoolbar.cpp
@@ -34,6 +34,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/editormanager/editormanager_p.h>
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -127,8 +128,9 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
d->m_editorList->setContextMenuPolicy(Qt::CustomContextMenu);
d->m_closeEditorButton->setAutoRaise(true);
- d->m_closeEditorButton->setIcon(QIcon(QLatin1String(Constants::ICON_CLOSE_DOCUMENT)));
+ d->m_closeEditorButton->setIcon(QIcon(QLatin1String(Constants::ICON_BUTTON_CLOSE)));
d->m_closeEditorButton->setEnabled(false);
+ d->m_closeEditorButton->setProperty("showborder", true);
d->m_toolBarPlaceholder->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
@@ -164,10 +166,10 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
toplayout->addWidget(d->m_forwardButton);
toplayout->addWidget(d->m_lockButton);
toplayout->addWidget(d->m_editorList);
+ toplayout->addWidget(d->m_closeEditorButton);
toplayout->addWidget(d->m_toolBarPlaceholder, 1); // Custom toolbar stretches
toplayout->addWidget(d->m_splitButton);
toplayout->addWidget(d->m_closeSplitButton);
- toplayout->addWidget(d->m_closeEditorButton);
setLayout(toplayout);
@@ -277,7 +279,7 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags)
{
d->m_isStandalone = flags & FlagsStandalone;
if (d->m_isStandalone) {
- QWidget *em = EditorManager::instance();
+ EditorManager *em = EditorManager::instance();
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(updateEditorListSelection(Core::IEditor*)));
disconnect(d->m_editorList, SIGNAL(activated(int)), this, SIGNAL(listSelectionActivated(int)));
@@ -338,7 +340,7 @@ void EditorToolBar::listContextMenu(QPoint pos)
void EditorToolBar::makeEditorWritable()
{
if (IDocument *current = EditorManager::currentDocument())
- EditorManager::makeFileWritable(current);
+ Internal::EditorManagerPrivate::makeFileWritable(current);
}
void EditorToolBar::setCanGoBack(bool canGoBack)
diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp
index 2b37844d7f..5aa9ca232f 100644
--- a/src/plugins/coreplugin/externaltool.cpp
+++ b/src/plugins/coreplugin/externaltool.cpp
@@ -608,9 +608,10 @@ void ExternalToolRunner::run()
connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError()));
if (!m_resolvedWorkingDirectory.isEmpty())
m_process->setWorkingDirectory(m_resolvedWorkingDirectory);
- m_process->setCommand(m_resolvedExecutable, m_resolvedArguments);
- MessageManager::write(
- tr("Starting external tool \"%1\" %2").arg(m_resolvedExecutable, m_resolvedArguments), MessageManager::Silent);
+ m_process->setCommand(m_resolvedExecutable.toString(), m_resolvedArguments);
+ MessageManager::write(tr("Starting external tool \"%1\" %2")
+ .arg(m_resolvedExecutable.toUserOutput(), m_resolvedArguments),
+ MessageManager::Silent);
m_process->start();
}
@@ -630,8 +631,8 @@ void ExternalToolRunner::finished(int exitCode, QProcess::ExitStatus status)
}
if (m_tool->modifiesCurrentDocument())
DocumentManager::unexpectFileChange(m_expectedFileName);
- MessageManager::write(
- tr("\"%1\" finished").arg(m_resolvedExecutable), MessageManager::Silent);
+ MessageManager::write(tr("\"%1\" finished")
+ .arg(m_resolvedExecutable.toUserOutput()), MessageManager::Silent);
deleteLater();
}
diff --git a/src/plugins/coreplugin/externaltool.h b/src/plugins/coreplugin/externaltool.h
index b47b85c5a0..0729c2e499 100644
--- a/src/plugins/coreplugin/externaltool.h
+++ b/src/plugins/coreplugin/externaltool.h
@@ -30,6 +30,8 @@
#ifndef EXTERNALTOOL_H
#define EXTERNALTOOL_H
+#include <utils/fileutils.h>
+
#include <QObject>
#include <QStringList>
#include <QProcess>
@@ -139,7 +141,7 @@ private:
bool resolve();
const ExternalTool *m_tool; // is a copy of the tool that was passed in
- QString m_resolvedExecutable;
+ Utils::FileName m_resolvedExecutable;
QString m_resolvedArguments;
QString m_resolvedInput;
QString m_resolvedWorkingDirectory;
diff --git a/src/plugins/coreplugin/featureprovider.h b/src/plugins/coreplugin/featureprovider.h
index 5a62a82ac3..27291579b4 100644
--- a/src/plugins/coreplugin/featureprovider.h
+++ b/src/plugins/coreplugin/featureprovider.h
@@ -42,10 +42,8 @@ namespace Core {
class CORE_EXPORT FeatureSet;
-class CORE_EXPORT IFeatureProvider : public QObject
+class CORE_EXPORT IFeatureProvider
{
- Q_OBJECT
-
public:
IFeatureProvider() {}
virtual ~IFeatureProvider() {}
@@ -79,6 +77,11 @@ public:
return *this;
}
+ bool isEmpty() const
+ {
+ return QSet<Feature>::isEmpty();
+ }
+
bool contains(const Feature &feature) const
{
return QSet<Feature>::contains(feature);
@@ -94,6 +97,11 @@ public:
QSet<Feature>::remove(feature);
}
+ void remove(const FeatureSet &features)
+ {
+ QSet<Feature>::subtract(features);
+ }
+
FeatureSet operator|(const Feature &feature) const
{
FeatureSet copy = *this;
@@ -131,6 +139,14 @@ public:
stringList.append(feature.toString());
return stringList;
}
+
+ static FeatureSet fromStringList(const QStringList &list)
+ {
+ FeatureSet features;
+ foreach (const QString &i, list)
+ features |= Feature(Id::fromString(i));
+ return features;
+ }
};
} // namespace Core
diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp
index 872a133d40..7a90335aa3 100644
--- a/src/plugins/coreplugin/fileutils.cpp
+++ b/src/plugins/coreplugin/fileutils.cpp
@@ -80,7 +80,7 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
{
// Mac, Windows support folder or file.
if (HostOsInfo::isWindowsHost()) {
- const QString explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe"));
+ const FileName explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe"));
if (explorer.isEmpty()) {
QMessageBox::warning(parent,
QApplication::translate("Core::Internal",
@@ -93,7 +93,7 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
if (!QFileInfo(pathIn).isDir())
param += QLatin1String("/select,");
param += QDir::toNativeSeparators(pathIn);
- QProcess::startDetached(explorer, param);
+ QProcess::startDetached(explorer.toString(), param);
} else if (HostOsInfo::isMacHost()) {
QStringList scriptArgs;
scriptArgs << QLatin1String("-e")
diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp
index 7aa9a73a36..2125de7109 100644
--- a/src/plugins/coreplugin/find/findtoolbar.cpp
+++ b/src/plugins/coreplugin/find/findtoolbar.cpp
@@ -42,6 +42,7 @@
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
+#include <utils/stylehelper.h>
#include <QDebug>
#include <QSettings>
@@ -92,7 +93,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
connect(m_ui.findEdit, SIGNAL(editingFinished()), this, SLOT(invokeResetIncrementalSearch()));
- m_ui.close->setIcon(QIcon(QLatin1String(Core::Constants::ICON_CLOSE_DOCUMENT)));
+ m_ui.close->setIcon(QIcon(QLatin1String(Core::Constants::ICON_BUTTON_CLOSE)));
connect(m_ui.close, SIGNAL(clicked()), this, SLOT(hideAndResetFocus()));
m_findCompleter->setModel(m_plugin->findCompletionModel());
@@ -565,12 +566,8 @@ void FindToolBar::updateIcons()
bool regexp = effectiveFlags & FindRegularExpression;
bool preserveCase = effectiveFlags & FindPreserveCase;
if (!casesensitive && !wholewords && !regexp && !preserveCase) {
- QPixmap pixmap(17, 17);
- pixmap.fill(Qt::transparent);
- QPainter painter(&pixmap);
- const QPixmap mag = QPixmap(QLatin1String(Core::Constants::ICON_MAGNIFIER));
- painter.drawPixmap(0, (pixmap.height() - mag.height()) / 2, mag);
- m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left, pixmap);
+ m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left,
+ Utils::StyleHelper::dpiSpecificImageFile(QLatin1Literal(Core::Constants::ICON_MAGNIFIER)));
} else {
m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left,
IFindFilter::pixmapForFindFlags(effectiveFlags));
diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp
index f4bb337ad7..1fd52b41e2 100644
--- a/src/plugins/coreplugin/generalsettings.cpp
+++ b/src/plugins/coreplugin/generalsettings.cpp
@@ -33,7 +33,7 @@
#include "infobar.h"
#include "patchtool.h"
#include "vcsmanager.h"
-#include "editormanager/editormanager.h"
+#include "editormanager/editormanager_p.h"
#include <utils/checkablemessagebox.h>
#include <utils/consoleprocess.h>
@@ -113,7 +113,7 @@ QWidget *GeneralSettings::widget()
fillLanguageBox();
m_page->colorButton->setColor(StyleHelper::requestedBaseColor());
- m_page->reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
+ m_page->reloadBehavior->setCurrentIndex(EditorManagerPrivate::reloadSetting());
if (HostOsInfo::isAnyUnixHost()) {
const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
const QString currentTerminal = ConsoleProcess::terminalEmulator(ICore::settings(), false);
@@ -141,8 +141,8 @@ QWidget *GeneralSettings::widget()
m_page->patchChooser->setExpectedKind(PathChooser::ExistingCommand);
m_page->patchChooser->setHistoryCompleter(QLatin1String("General.PatchCommand.History"));
m_page->patchChooser->setPath(PatchTool::patchCommand());
- m_page->autoSaveCheckBox->setChecked(EditorManager::autoSaveEnabled());
- m_page->autoSaveInterval->setValue(EditorManager::autoSaveInterval());
+ m_page->autoSaveCheckBox->setChecked(EditorManagerPrivate::autoSaveEnabled());
+ m_page->autoSaveInterval->setValue(EditorManagerPrivate::autoSaveInterval());
m_page->resetWarningsButton->setEnabled(InfoBar::anyGloballySuppressed()
|| CheckableMessageBox::hasSuppressedQuestions(ICore::settings()));
@@ -175,7 +175,7 @@ void GeneralSettings::apply()
setLanguage(m_page->languageBox->itemData(currentIndex, Qt::UserRole).toString());
// Apply the new base color if accepted
StyleHelper::setBaseColor(m_page->colorButton->color());
- EditorManager::setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
+ EditorManagerPrivate::setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
if (HostOsInfo::isAnyUnixHost()) {
ConsoleProcess::setTerminalEmulator(ICore::settings(),
m_page->terminalComboBox->lineEdit()->text());
@@ -185,8 +185,8 @@ void GeneralSettings::apply()
}
}
PatchTool::setPatchCommand(m_page->patchChooser->path());
- EditorManager::setAutoSaveEnabled(m_page->autoSaveCheckBox->isChecked());
- EditorManager::setAutoSaveInterval(m_page->autoSaveInterval->value());
+ EditorManagerPrivate::setAutoSaveEnabled(m_page->autoSaveCheckBox->isChecked());
+ EditorManagerPrivate::setAutoSaveInterval(m_page->autoSaveInterval->value());
}
void GeneralSettings::finish()
@@ -211,7 +211,7 @@ void GeneralSettings::resetWarnings()
void GeneralSettings::resetTerminal()
{
if (HostOsInfo::isAnyUnixHost())
- m_page->terminalComboBox->lineEdit()->setText(QString());
+ m_page->terminalComboBox->lineEdit()->clear();
}
void GeneralSettings::resetFileBrowser()
diff --git a/src/plugins/coreplugin/idocumentfactory.h b/src/plugins/coreplugin/idocumentfactory.h
index facb2c6c85..16dea6527f 100644
--- a/src/plugins/coreplugin/idocumentfactory.h
+++ b/src/plugins/coreplugin/idocumentfactory.h
@@ -51,13 +51,9 @@ public:
typedef std::function<IDocument *(const QString &fileName)> Opener;
IDocument *open(const QString &filename);
- Id id() const { return m_id; }
QStringList mimeTypes() const { return m_mimeTypes; }
- QString displayName() const { return m_displayName; }
- void setId(Id id) { m_id = id; }
void setOpener(const Opener &opener) { m_opener = opener; }
- void setDisplayName(const QString &displayName) { m_displayName = displayName; }
void setMimeTypes(const QStringList &mimeTypes) { m_mimeTypes = mimeTypes; }
void addMimeType(const char *mimeType) { m_mimeTypes.append(QLatin1String(mimeType)); }
void addMimeType(const QString &mimeType) { m_mimeTypes.append(mimeType); }
diff --git a/src/plugins/coreplugin/images/arrowdown.png b/src/plugins/coreplugin/images/arrowdown.png
index b49843f1d9..f94254fa26 100644
--- a/src/plugins/coreplugin/images/arrowdown.png
+++ b/src/plugins/coreplugin/images/arrowdown.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/arrowdown@2x.png b/src/plugins/coreplugin/images/arrowdown@2x.png
index a984b2d387..17fdf05941 100644
--- a/src/plugins/coreplugin/images/arrowdown@2x.png
+++ b/src/plugins/coreplugin/images/arrowdown@2x.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/arrowup.png b/src/plugins/coreplugin/images/arrowup.png
index e9d7b1e7d4..14aa28454f 100644
--- a/src/plugins/coreplugin/images/arrowup.png
+++ b/src/plugins/coreplugin/images/arrowup.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/arrowup@2x.png b/src/plugins/coreplugin/images/arrowup@2x.png
index a3c4bf6f09..46387753cc 100644
--- a/src/plugins/coreplugin/images/arrowup@2x.png
+++ b/src/plugins/coreplugin/images/arrowup@2x.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/button_close.png b/src/plugins/coreplugin/images/button_close.png
index 221e83f9a7..8a36ba481d 100644
--- a/src/plugins/coreplugin/images/button_close.png
+++ b/src/plugins/coreplugin/images/button_close.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/button_close@2x.png b/src/plugins/coreplugin/images/button_close@2x.png
index 1d1a14fa46..ddc0550a6c 100644
--- a/src/plugins/coreplugin/images/button_close@2x.png
+++ b/src/plugins/coreplugin/images/button_close@2x.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/find.png b/src/plugins/coreplugin/images/find.png
deleted file mode 100644
index cbe2f31521..0000000000
--- a/src/plugins/coreplugin/images/find.png
+++ /dev/null
Binary files differ
diff --git a/src/plugins/coreplugin/images/findnext.png b/src/plugins/coreplugin/images/findnext.png
deleted file mode 100644
index a2889e439f..0000000000
--- a/src/plugins/coreplugin/images/findnext.png
+++ /dev/null
Binary files differ
diff --git a/src/plugins/coreplugin/images/inputfield.png b/src/plugins/coreplugin/images/inputfield.png
index 40bdfc4a04..965e9f55a4 100644
--- a/src/plugins/coreplugin/images/inputfield.png
+++ b/src/plugins/coreplugin/images/inputfield.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/inputfield@2x.png b/src/plugins/coreplugin/images/inputfield@2x.png
new file mode 100644
index 0000000000..b735016485
--- /dev/null
+++ b/src/plugins/coreplugin/images/inputfield@2x.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/inputfield_disabled.png b/src/plugins/coreplugin/images/inputfield_disabled.png
index b713a59c8a..b09e2ce4cf 100644
--- a/src/plugins/coreplugin/images/inputfield_disabled.png
+++ b/src/plugins/coreplugin/images/inputfield_disabled.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/inputfield_disabled@2x.png b/src/plugins/coreplugin/images/inputfield_disabled@2x.png
new file mode 100644
index 0000000000..7ef857806d
--- /dev/null
+++ b/src/plugins/coreplugin/images/inputfield_disabled@2x.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/locked.png b/src/plugins/coreplugin/images/locked.png
index 148a35bc79..ad832b5846 100644
--- a/src/plugins/coreplugin/images/locked.png
+++ b/src/plugins/coreplugin/images/locked.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/locked@2x.png b/src/plugins/coreplugin/images/locked@2x.png
index c3c53cf2b1..b3f1c54ffe 100644
--- a/src/plugins/coreplugin/images/locked@2x.png
+++ b/src/plugins/coreplugin/images/locked@2x.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/panel_button.png b/src/plugins/coreplugin/images/panel_button.png
index 76793ca292..c1fe52a19f 100644
--- a/src/plugins/coreplugin/images/panel_button.png
+++ b/src/plugins/coreplugin/images/panel_button.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/panel_button_checked.png b/src/plugins/coreplugin/images/panel_button_checked.png
index 67f9fbbd6d..15560993c4 100644
--- a/src/plugins/coreplugin/images/panel_button_checked.png
+++ b/src/plugins/coreplugin/images/panel_button_checked.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/panel_button_checked_hover.png b/src/plugins/coreplugin/images/panel_button_checked_hover.png
index 0a820b3f62..2eb10f5f56 100644
--- a/src/plugins/coreplugin/images/panel_button_checked_hover.png
+++ b/src/plugins/coreplugin/images/panel_button_checked_hover.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/panel_button_hover.png b/src/plugins/coreplugin/images/panel_button_hover.png
index d9c99409d1..f9d88f4f14 100644
--- a/src/plugins/coreplugin/images/panel_button_hover.png
+++ b/src/plugins/coreplugin/images/panel_button_hover.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/panel_button_pressed.png b/src/plugins/coreplugin/images/panel_button_pressed.png
index dc522d2387..a053699fee 100644
--- a/src/plugins/coreplugin/images/panel_button_pressed.png
+++ b/src/plugins/coreplugin/images/panel_button_pressed.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/panel_manage_button.png b/src/plugins/coreplugin/images/panel_manage_button.png
index e8ad2a936e..274c4cd979 100644
--- a/src/plugins/coreplugin/images/panel_manage_button.png
+++ b/src/plugins/coreplugin/images/panel_manage_button.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/progressbar.png b/src/plugins/coreplugin/images/progressbar.png
index 806ed87020..92bc919481 100644
--- a/src/plugins/coreplugin/images/progressbar.png
+++ b/src/plugins/coreplugin/images/progressbar.png
Binary files differ
diff --git a/src/plugins/coreplugin/images/progressbar@2x.png b/src/plugins/coreplugin/images/progressbar@2x.png
new file mode 100644
index 0000000000..1d7cf1ac19
--- /dev/null
+++ b/src/plugins/coreplugin/images/progressbar@2x.png
Binary files differ
diff --git a/src/plugins/coreplugin/inavigationwidgetfactory.cpp b/src/plugins/coreplugin/inavigationwidgetfactory.cpp
index 3b5062b498..7fe6326f4c 100644
--- a/src/plugins/coreplugin/inavigationwidgetfactory.cpp
+++ b/src/plugins/coreplugin/inavigationwidgetfactory.cpp
@@ -90,11 +90,59 @@
using namespace Core;
/*!
+ Creates a \l{Core::NavigationViewFactory}.
+*/
+INavigationWidgetFactory::INavigationWidgetFactory()
+ : m_priority(0)
+{
+}
+
+/*!
+ Sets the display name for the factory.
+
+ \sa displayName()
+*/
+void INavigationWidgetFactory::setDisplayName(const QString &displayName)
+{
+ m_displayName = displayName;
+}
+
+/*!
+ Sets the priority for the factory.
+
+ \sa priority()
+*/
+void INavigationWidgetFactory::setPriority(int priority)
+{
+ m_priority = priority;
+}
+
+/*!
+ Sets the id for the factory.
+
+ \sa id()
+*/
+void INavigationWidgetFactory::setId(Id id)
+{
+ m_id = id;
+}
+
+/*!
+ Sets the keyboard activation sequence for the factory.
+
+ \sa activationSequence()
+*/
+void INavigationWidgetFactory::setActivationSequence(const QKeySequence &keys)
+{
+ m_activationSequence = keys;
+}
+
+/*!
Returns the keyboard shortcut to activate an instance of a navigation widget.
*/
QKeySequence INavigationWidgetFactory::activationSequence() const
{
- return QKeySequence();
+ return m_activationSequence;
}
/*!
diff --git a/src/plugins/coreplugin/inavigationwidgetfactory.h b/src/plugins/coreplugin/inavigationwidgetfactory.h
index 62f2335f41..0cd60b6a11 100644
--- a/src/plugins/coreplugin/inavigationwidgetfactory.h
+++ b/src/plugins/coreplugin/inavigationwidgetfactory.h
@@ -34,10 +34,10 @@
#include <QObject>
#include <QList>
+#include <QKeySequence>
QT_BEGIN_NAMESPACE
class QToolButton;
-class QKeySequence;
class QWidget;
QT_END_NAMESPACE
@@ -45,6 +45,8 @@ namespace Core {
struct NavigationView
{
+ NavigationView(QWidget *w = 0) : widget(w) {}
+
QWidget *widget;
QList<QToolButton *> dockToolBarWidgets;
};
@@ -54,12 +56,18 @@ class CORE_EXPORT INavigationWidgetFactory : public QObject
Q_OBJECT
public:
- INavigationWidgetFactory() {}
+ INavigationWidgetFactory();
+
+ void setDisplayName(const QString &displayName);
+ void setPriority(int priority);
+ void setId(Id id);
+ void setActivationSequence(const QKeySequence &keys);
+
+ QString displayName() const { return m_displayName ; }
+ int priority() const { return m_priority; }
+ Id id() const { return m_id; }
+ QKeySequence activationSequence() const;
- virtual QString displayName() const = 0;
- virtual int priority() const = 0;
- virtual Id id() const = 0;
- virtual QKeySequence activationSequence() const;
// This design is not optimal, think about it again once we need to extend it
// It could be implemented as returning an object which has both the widget
// and the docktoolbar widgets
@@ -68,6 +76,12 @@ public:
virtual void saveSettings(int position, QWidget *widget);
virtual void restoreSettings(int position, QWidget *widget);
+
+private:
+ QString m_displayName;
+ int m_priority;
+ Id m_id;
+ QKeySequence m_activationSequence;
};
} // namespace Core
diff --git a/src/plugins/coreplugin/iwizardfactory.cpp b/src/plugins/coreplugin/iwizardfactory.cpp
index 2c487d504d..4d7dfd47ab 100644
--- a/src/plugins/coreplugin/iwizardfactory.cpp
+++ b/src/plugins/coreplugin/iwizardfactory.cpp
@@ -31,8 +31,12 @@
#include <coreplugin/icore.h>
#include <coreplugin/featureprovider.h>
+#include <extensionsystem/pluginspec.h>
#include <extensionsystem/pluginmanager.h>
+#include <utils/algorithm.h>
+#include <utils/qtcassert.h>
+
#include <QStringList>
/*!
@@ -142,6 +146,10 @@
using namespace Core;
+namespace {
+static QList<IFeatureProvider *> s_providerList;
+}
+
/* A utility to find all wizards supporting a view mode and matching a predicate */
template <class Predicate>
QList<IWizardFactory*> findWizardFactories(Predicate predicate)
@@ -184,9 +192,21 @@ bool IWizardFactory::isAvailable(const QString &platformName) const
{
FeatureSet availableFeatures;
- const QList<Core::IFeatureProvider*> featureManagers = ExtensionSystem::PluginManager::getObjects<Core::IFeatureProvider>();
+ // Implicitly create a feature for each plugin loaded:
+ QList<ExtensionSystem::PluginSpec *> activeSpecs;
+ foreach (ExtensionSystem::PluginSpec *s, ExtensionSystem::PluginManager::plugins()) {
+ if (s->state() == ExtensionSystem::PluginSpec::Running)
+ activeSpecs << s;
+ }
- foreach (const Core::IFeatureProvider *featureManager, featureManagers)
+ QStringList plugins = Utils::transform(activeSpecs,
+ [](ExtensionSystem::PluginSpec *s) -> QString {
+ return QStringLiteral("Plugin.") + s->name();
+ });
+ foreach (const QString &n, plugins)
+ availableFeatures |= Feature(Core::Id::fromString(n));
+
+ foreach (const Core::IFeatureProvider *featureManager, s_providerList)
availableFeatures |= featureManager->availableFeatures(platformName);
return availableFeatures.contains(requiredFeatures());
@@ -208,10 +228,7 @@ QStringList IWizardFactory::allAvailablePlatforms()
{
QStringList platforms;
- const QList<Core::IFeatureProvider*> featureManagers =
- ExtensionSystem::PluginManager::getObjects<Core::IFeatureProvider>();
-
- foreach (const Core::IFeatureProvider *featureManager, featureManagers)
+ foreach (const Core::IFeatureProvider *featureManager, s_providerList)
platforms.append(featureManager->availablePlatforms());
return platforms;
@@ -219,13 +236,22 @@ QStringList IWizardFactory::allAvailablePlatforms()
QString IWizardFactory::displayNameForPlatform(const QString &string)
{
- const QList<Core::IFeatureProvider*> featureManagers =
- ExtensionSystem::PluginManager::getObjects<Core::IFeatureProvider>();
-
- foreach (const Core::IFeatureProvider *featureManager, featureManagers) {
+ foreach (const Core::IFeatureProvider *featureManager, s_providerList) {
QString displayName = featureManager->displayNameForPlatform(string);
if (!displayName.isEmpty())
return displayName;
}
return QString();
}
+
+void IWizardFactory::registerFeatureProvider(IFeatureProvider *provider)
+{
+ QTC_ASSERT(!s_providerList.contains(provider), return);
+ s_providerList.append(provider);
+}
+
+void IWizardFactory::destroyFeatureProvider()
+{
+ qDeleteAll(s_providerList);
+ s_providerList.clear();
+}
diff --git a/src/plugins/coreplugin/iwizardfactory.h b/src/plugins/coreplugin/iwizardfactory.h
index 9269e9f970..361aaec2d8 100644
--- a/src/plugins/coreplugin/iwizardfactory.h
+++ b/src/plugins/coreplugin/iwizardfactory.h
@@ -40,6 +40,8 @@
namespace Core {
+namespace Internal { class CorePlugin; }
+
class CORE_EXPORT IWizardFactory
: public QObject
{
@@ -94,7 +96,11 @@ public:
static QStringList allAvailablePlatforms();
static QString displayNameForPlatform(const QString &string);
+ static void registerFeatureProvider(IFeatureProvider *provider);
+
private:
+ static void destroyFeatureProvider();
+
IWizardFactory::WizardKind m_kind;
QIcon m_icon;
QString m_description;
@@ -105,6 +111,8 @@ private:
FeatureSet m_requiredFeatures;
WizardFlags m_flags;
QString m_descriptionImage;
+
+ friend class Internal::CorePlugin;
};
} // namespace Core
diff --git a/src/plugins/coreplugin/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp
index 9376d8a741..6bb51dcf0b 100644
--- a/src/plugins/coreplugin/locator/executefilter.cpp
+++ b/src/plugins/coreplugin/locator/executefilter.cpp
@@ -155,7 +155,7 @@ void ExecuteFilter::runHeadCommand()
{
if (!m_taskQueue.isEmpty()) {
const ExecuteData &d = m_taskQueue.head();
- const QString fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable);
+ const Utils::FileName fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable);
if (fullPath.isEmpty()) {
MessageManager::write(tr("Could not find executable for \"%1\".").arg(d.executable));
m_taskQueue.dequeue();
@@ -164,7 +164,7 @@ void ExecuteFilter::runHeadCommand()
}
MessageManager::write(tr("Starting command \"%1\".").arg(headCommand()));
m_process->setWorkingDirectory(d.workingDirectory);
- m_process->setCommand(fullPath, d.arguments);
+ m_process->setCommand(fullPath.toString(), d.arguments);
m_process->start();
m_process->closeWriteChannel();
if (!m_process->waitForStarted(1000)) {
diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp
index 93d02df015..161819f4ad 100644
--- a/src/plugins/coreplugin/locator/locatorwidget.cpp
+++ b/src/plugins/coreplugin/locator/locatorwidget.cpp
@@ -44,6 +44,7 @@
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
+#include <utils/stylehelper.h>
#include <QColor>
#include <QFileInfo>
@@ -247,7 +248,7 @@ LocatorWidget::LocatorWidget(Locator *qop) :
layout->addWidget(m_fileLineEdit);
setWindowIcon(QIcon(QLatin1String(":/locator/images/locator.png")));
- const QPixmap image = QPixmap(QLatin1String(Core::Constants::ICON_MAGNIFIER));
+ const QPixmap image = Utils::StyleHelper::dpiSpecificImageFile(QLatin1String(Core::Constants::ICON_MAGNIFIER));
m_fileLineEdit->setFiltering(true);
m_fileLineEdit->setButtonPixmap(Utils::FancyLineEdit::Left, image);
m_fileLineEdit->setButtonToolTip(Utils::FancyLineEdit::Left, tr("Options"));
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index da19097ea4..f404d78c72 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -65,6 +65,7 @@
#include <coreplugin/dialogs/settingsdialog.h>
#include <coreplugin/dialogs/shortcutsettings.h>
#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/editormanager/editormanager_p.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icorelistener.h>
#include <coreplugin/inavigationwidgetfactory.h>
@@ -189,7 +190,6 @@ MainWindow::MainWindow() :
m_statusBarManager = new StatusBarManager(this);
m_messageManager = new MessageManager;
m_editorManager = new EditorManager(this);
- m_editorManager->hide();
m_externalToolManager = new ExternalToolManager();
setCentralWidget(m_modeStack);
@@ -336,7 +336,6 @@ void MainWindow::extensionsInitialized()
{
m_windowSupport = new WindowSupport(this, Context("Core.MainWindow"));
m_windowSupport->setCloseActionEnabled(false);
- m_editorManager->init();
m_statusBarManager->extensionsInitalized();
OutputPaneManager::instance()->init();
m_vcsManager->extensionsInitialized();
@@ -742,14 +741,6 @@ void MainWindow::openFile()
openFiles(EditorManager::getOpenFileNames(), ICore::SwitchMode);
}
-static QList<IDocumentFactory*> getNonEditorDocumentFactories()
-{
- return ExtensionSystem::PluginManager::getObjects<IDocumentFactory>(
- [](IDocumentFactory *factory) {
- return !qobject_cast<IEditorFactory *>(factory);
- });
-}
-
static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fileFactories,
const QFileInfo &fi)
{
@@ -775,13 +766,13 @@ static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fil
*/
IDocument *MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags flags)
{
- QList<IDocumentFactory*> nonEditorFileFactories = getNonEditorDocumentFactories();
+ QList<IDocumentFactory*> documentFactories = ExtensionSystem::PluginManager::getObjects<IDocumentFactory>();
IDocument *res = 0;
foreach (const QString &fileName, fileNames) {
const QFileInfo fi(fileName);
const QString absoluteFilePath = fi.absoluteFilePath();
- if (IDocumentFactory *documentFactory = findDocumentFactory(nonEditorFileFactories, fi)) {
+ if (IDocumentFactory *documentFactory = findDocumentFactory(documentFactories, fi)) {
IDocument *document = documentFactory->open(absoluteFilePath);
if (!document) {
if (flags & ICore::StopOnLoadFail)
@@ -810,7 +801,7 @@ IDocument *MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesF
void MainWindow::setFocusToEditor()
{
- m_editorManager->doEscapeKeyFocusMoveMagic();
+ EditorManagerPrivate::doEscapeKeyFocusMoveMagic();
}
void MainWindow::showNewItemDialog(const QString &title,
@@ -856,7 +847,7 @@ void MainWindow::openFileWith()
{
foreach (const QString &fileName, EditorManager::getOpenFileNames()) {
bool isExternal;
- const Id editorId = EditorManager::getOpenWithEditorId(fileName, &isExternal);
+ const Id editorId = EditorManagerPrivate::getOpenWithEditorId(fileName, &isExternal);
if (!editorId.isValid())
continue;
if (isExternal)
@@ -979,7 +970,7 @@ void MainWindow::readSettings()
settings->endGroup();
- m_editorManager->readSettings();
+ EditorManagerPrivate::readSettings();
m_navigationWidget->restoreSettings(settings);
m_rightPaneWidget->readSettings(settings);
}
@@ -1000,7 +991,7 @@ void MainWindow::writeSettings()
DocumentManager::saveSettings();
m_actionManager->saveSettings(settings);
- m_editorManager->saveSettings();
+ EditorManagerPrivate::saveSettings();
m_navigationWidget->saveSettings(settings);
}
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp
index 90789dc0ff..decd4aac87 100644
--- a/src/plugins/coreplugin/manhattanstyle.cpp
+++ b/src/plugins/coreplugin/manhattanstyle.cpp
@@ -130,10 +130,10 @@ public:
};
ManhattanStylePrivate::ManhattanStylePrivate() :
- lineeditImage(QLatin1String(":/core/images/inputfield.png")),
- lineeditImage_disabled(QLatin1String(":/core/images/inputfield_disabled.png")),
+ lineeditImage(Utils::StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/inputfield.png"))),
+ lineeditImage_disabled(Utils::StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/inputfield_disabled.png"))),
extButtonPixmap(QLatin1String(":/core/images/extension.png")),
- closeButtonPixmap(QLatin1String(Core::Constants::ICON_CLOSE))
+ closeButtonPixmap(QLatin1String(Core::Constants::ICON_CLOSE_BUTTON))
{
}
@@ -278,7 +278,7 @@ void ManhattanStyle::polish(QWidget *widget)
widget->setAttribute(Qt::WA_Hover);
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
} else if (qobject_cast<QLabel*>(widget)) {
- widget->setPalette(panelPalette(widget->palette()));
+ widget->setPalette(panelPalette(widget->palette(), lightColored(widget)));
} else if (widget->property("panelwidget_singlerow").toBool()) {
widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight());
} else if (qobject_cast<QStatusBar*>(widget)) {
@@ -463,7 +463,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
hover.setAlpha(50);
painter->setPen(QPen(hover, 1));
- painter->drawRect(option->rect.adjusted(1, 1, -2 ,-2));
+ painter->drawRect(QRectF(option->rect).adjusted(1.5, 1.5, -1.5, -1.5));
}
painter->restore();
}
diff --git a/src/plugins/coreplugin/navigationsubwidget.cpp b/src/plugins/coreplugin/navigationsubwidget.cpp
index 786d2282f1..33ac0bcb34 100644
--- a/src/plugins/coreplugin/navigationsubwidget.cpp
+++ b/src/plugins/coreplugin/navigationsubwidget.cpp
@@ -75,7 +75,7 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget, int pos
splitAction->setIcon(QIcon(QLatin1String(Constants::ICON_SPLIT_HORIZONTAL)));
splitAction->setToolTip(tr("Split"));
QToolButton *close = new QToolButton();
- close->setIcon(QIcon(QLatin1String(Constants::ICON_CLOSE_DOCUMENT)));
+ close->setIcon(QIcon(QLatin1String(Constants::ICON_BUTTON_CLOSE)));
close->setToolTip(tr("Close"));
toolBarLayout->addWidget(splitAction);
diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp
index baaa38615c..94d162edc1 100644
--- a/src/plugins/coreplugin/outputpanemanager.cpp
+++ b/src/plugins/coreplugin/outputpanemanager.cpp
@@ -143,7 +143,7 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) :
m_minMaxAction->setIcon(m_maximizeIcon);
m_minMaxAction->setText(tr("Maximize Output Pane"));
- m_closeButton->setIcon(QIcon(QLatin1String(Constants::ICON_CLOSE_DOCUMENT)));
+ m_closeButton->setIcon(QIcon(QLatin1String(Constants::ICON_BUTTON_CLOSE)));
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide()));
connect(ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings()));
@@ -612,14 +612,14 @@ int OutputPaneManager::currentIndex() const
static QString buttonStyleSheet()
{
- QString styleSheet = QLatin1String("QToolButton { border-image: url(:/core/images/panel_button.png) 2 2 2 19;"
- " border-width: 2px 2px 2px 19px; padding-left: -17; padding-right: 4 } "
- "QToolButton:checked { border-image: url(:/core/images/panel_button_checked.png) 2 2 2 19 } "
+ QString styleSheet = QLatin1String("QToolButton { border-image: url(:/core/images/panel_button.png) 3 3 3 19;"
+ " border-width: 3px 3px 3px 19px; padding-left: -17; padding-right: 4 } "
+ "QToolButton:checked { border-image: url(:/core/images/panel_button_checked.png) 3 3 3 19 } "
"QToolButton::menu-indicator { width:0; height:0 }");
if (!Utils::HostOsInfo::isMacHost()) { // Mac UIs usually don't hover
- styleSheet += QLatin1String("QToolButton:checked:hover { border-image: url(:/core/images/panel_button_checked_hover.png) 2 2 2 19 } "
- "QToolButton:pressed:hover { border-image: url(:/core/images/panel_button_pressed.png) 2 2 2 19 } "
- "QToolButton:hover { border-image: url(:/core/images/panel_button_hover.png) 2 2 2 19 } ");
+ styleSheet += QLatin1String("QToolButton:checked:hover { border-image: url(:/core/images/panel_button_checked_hover.png) 3 3 3 19 } "
+ "QToolButton:pressed:hover { border-image: url(:/core/images/panel_button_pressed.png) 3 3 3 19 } "
+ "QToolButton:hover { border-image: url(:/core/images/panel_button_hover.png) 3 3 3 19 } ");
}
return styleSheet;
}
@@ -751,7 +751,7 @@ void OutputPaneToggleButton::setIconBadgeNumber(int number)
//Do not show yet, we wait until the button has been resized
} else {
- m_label->setText(QString());
+ m_label->clear();
m_label->hide();
}
updateGeometry();
@@ -768,15 +768,15 @@ OutputPaneManageButton::OutputPaneManageButton()
{
setFocusPolicy(Qt::NoFocus);
setCheckable(true);
- setStyleSheet(QLatin1String("QToolButton { border-image: url(:/core/images/panel_manage_button.png) 2 2 2 2;"
- " border-width: 2px 2px 2px 2px } "
+ setStyleSheet(QLatin1String("QToolButton { border-image: url(:/core/images/panel_manage_button.png) 3 3 3 3;"
+ " border-width: 3px 3px 3px 3px } "
"QToolButton::menu-indicator { width:0; height:0 }"));
}
QSize OutputPaneManageButton::sizeHint() const
{
ensurePolished();
- return QSize(18, QApplication::globalStrut().height());
+ return QSize(19, QApplication::globalStrut().height());
}
void OutputPaneManageButton::paintEvent(QPaintEvent *event)
@@ -786,7 +786,7 @@ void OutputPaneManageButton::paintEvent(QPaintEvent *event)
QStyle *s = style();
QStyleOption arrowOpt;
arrowOpt.initFrom(this);
- arrowOpt.rect = QRect(5, rect().center().y() - 3, 9, 9);
+ arrowOpt.rect = QRect(6, rect().center().y() - 3, 9, 9);
arrowOpt.rect.translate(0, -3);
s->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, &p, this);
arrowOpt.rect.translate(0, 6);
diff --git a/src/plugins/coreplugin/outputpanemanager.h b/src/plugins/coreplugin/outputpanemanager.h
index 308ea963ad..a74e52e630 100644
--- a/src/plugins/coreplugin/outputpanemanager.h
+++ b/src/plugins/coreplugin/outputpanemanager.h
@@ -132,8 +132,8 @@ private:
QStackedWidget *m_outputWidgetPane;
QStackedWidget *m_opToolBarWidgets;
QWidget *m_buttonsWidget;
- QPixmap m_minimizeIcon;
- QPixmap m_maximizeIcon;
+ QIcon m_minimizeIcon;
+ QIcon m_maximizeIcon;
bool m_maximised;
int m_outputPaneHeight;
};
diff --git a/src/plugins/coreplugin/progressmanager/progressbar.cpp b/src/plugins/coreplugin/progressmanager/progressbar.cpp
index 40abdbbd01..ddf0071e77 100644
--- a/src/plugins/coreplugin/progressmanager/progressbar.cpp
+++ b/src/plugins/coreplugin/progressmanager/progressbar.cpp
@@ -40,8 +40,8 @@
using namespace Core;
using namespace Core::Internal;
-static const int PROGRESSBAR_HEIGHT = 12;
-static const int CANCELBUTTON_SIZE = 15;
+static const int PROGRESSBAR_HEIGHT = 13;
+static const int CANCELBUTTON_WIDTH = 16;
static const int SEPARATOR_HEIGHT = 2;
ProgressBar::ProgressBar(QWidget *parent)
@@ -200,14 +200,8 @@ namespace { const int INDENT = 6; }
void ProgressBar::mousePressEvent(QMouseEvent *event)
{
if (m_cancelEnabled) {
- QFontMetrics fm(titleFont());
- int titleHeight = m_titleVisible ? fm.height() : 0;
- int separatorHeight = m_separatorVisible ? SEPARATOR_HEIGHT : 0;
- QRect rect(INDENT - 1, titleHeight + separatorHeight + 6, size().width()-2*INDENT + 1, m_progressHeight-1);
- QRect cancelRect(rect.adjusted(rect.width() - CANCELBUTTON_SIZE, 1, -1, 0));
-
if (event->modifiers() == Qt::NoModifier
- && cancelRect.contains(event->pos())) {
+ && m_cancelRect.contains(event->pos())) {
event->accept();
emit clicked();
return;
@@ -235,7 +229,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
// TODO use Utils::StyleHelper white
if (bar.isNull())
- bar.load(QLatin1String(":/core/images/progressbar.png"));
+ bar.load(Utils::StyleHelper::dpiSpecificImageFile(QLatin1String(":/core/images/progressbar.png")));
double range = maximum() - minimum();
double percent = 0.;
@@ -290,17 +284,16 @@ void ProgressBar::paintEvent(QPaintEvent *)
m_progressHeight = PROGRESSBAR_HEIGHT;
m_progressHeight += ((m_progressHeight % 2) + 1) % 2; // make odd
// draw outer rect
- QRect rect(INDENT - 1, titleHeight + separatorHeight + 4, size().width()-2*INDENT + 1, m_progressHeight-1);
- p.setPen(Utils::StyleHelper::panelTextColor());
- Utils::StyleHelper::drawCornerImage(bar, &p, rect, 4, 2, 3, 2);
+ const QRect rect(INDENT - 1, titleHeight + separatorHeight + (m_titleVisible ? 4 : 3),
+ size().width() - 2 * INDENT + 1, m_progressHeight);
+ Utils::StyleHelper::drawCornerImage(bar, &p, rect, 3, 3, 3, 3);
// draw inner rect
QColor c = Utils::StyleHelper::panelTextColor();
c.setAlpha(180);
p.setPen(Qt::NoPen);
-
- QRect inner = rect.adjusted(3, 2, -2, -2);
+ QRectF inner = rect.adjusted(2, 2, -2, -2);
inner.adjust(0, 0, qRound((percent - 1) * inner.width()), 0);
if (m_error) {
QColor red(255, 60, 0, 210);
@@ -314,53 +307,52 @@ void ProgressBar::paintEvent(QPaintEvent *)
// Draw line and shadow after the gradient fill
if (value() > 0 && value() < maximum()) {
- p.fillRect(QRect(inner.right() + 1, inner.top(), 2, inner.height()), QColor(0, 0, 0, 20));
- p.fillRect(QRect(inner.right() + 1, inner.top(), 1, inner.height()), QColor(0, 0, 0, 60));
+ p.fillRect(QRect(inner.right(), inner.top(), 2, inner.height()), QColor(0, 0, 0, 20));
+ p.fillRect(QRect(inner.right(), inner.top(), 1, inner.height()), QColor(0, 0, 0, 60));
}
QLinearGradient grad(inner.topLeft(), inner.bottomLeft());
grad.setColorAt(0, c.lighter(130));
- grad.setColorAt(0.5, c.lighter(106));
- grad.setColorAt(0.51, c.darker(106));
+ grad.setColorAt(0.4, c.lighter(106));
+ grad.setColorAt(0.41, c.darker(106));
grad.setColorAt(1, c.darker(130));
p.setPen(Qt::NoPen);
p.setBrush(grad);
p.drawRect(inner);
p.setBrush(Qt::NoBrush);
p.setPen(QPen(QColor(0, 0, 0, 30), 1));
- p.drawLine(inner.topLeft(), inner.topRight());
- p.drawLine(inner.topLeft(), inner.bottomLeft());
- p.drawLine(inner.topRight(), inner.bottomRight());
- p.drawLine(inner.bottomLeft(), inner.bottomRight());
- p.drawPoint(inner.bottomLeft());
- p.drawPoint(inner.bottomRight());
+
+ p.drawLine(inner.topLeft() + QPointF(0.5, 0.5), inner.topRight() + QPointF(-0.5, 0.5));
+ p.drawLine(inner.topLeft() + QPointF(0.5, 0.5), inner.bottomLeft() + QPointF(0.5, -0.5));
+ p.drawLine(inner.topRight() + QPointF(-0.5, 0.5), inner.bottomRight() + QPointF(-0.5, -0.5));
+ p.drawLine(inner.bottomLeft() + QPointF(0.5, -0.5), inner.bottomRight() + QPointF(-0.5, -0.5));
if (m_cancelEnabled) {
// Draw cancel button
p.setOpacity(m_cancelButtonFader);
if (value() < maximum() && !m_error) {
- QRect cancelRect(rect.adjusted(rect.width() - CANCELBUTTON_SIZE, 1, -1, 0));
- bool hover = cancelRect.contains(mapFromGlobal(QCursor::pos()));
- QLinearGradient grad(cancelRect.topLeft(), cancelRect.bottomLeft());
+ m_cancelRect = QRect(rect.adjusted(rect.width() - CANCELBUTTON_WIDTH + 2, 1, 0, 0));
+ const bool hover = m_cancelRect.contains(mapFromGlobal(QCursor::pos()));
+ const QRectF cancelVisualRect(m_cancelRect.adjusted(0, 1, -2, -2));
+ QLinearGradient grad(cancelVisualRect.topLeft(), cancelVisualRect.bottomLeft());
int intensity = hover ? 90 : 70;
QColor buttonColor(intensity, intensity, intensity, 255);
grad.setColorAt(0, buttonColor.lighter(130));
grad.setColorAt(1, buttonColor.darker(130));
p.setPen(Qt::NoPen);
p.setBrush(grad);
- p.drawRect(cancelRect.adjusted(1, 1, -1, -1));
+ p.drawRect(cancelVisualRect);
p.setPen(QPen(QColor(0, 0, 0, 30)));
- p.drawLine(cancelRect.topLeft() + QPoint(0,1), cancelRect.bottomLeft() + QPoint(0,-1));
+ p.drawLine(cancelVisualRect.topLeft() + QPointF(-0.5, 0.5), cancelVisualRect.bottomLeft() + QPointF(-0.5, -0.5));
p.setPen(QPen(QColor(0, 0, 0, 120)));
- p.drawLine(cancelRect.topLeft() + QPoint(1,1), cancelRect.bottomLeft() + QPoint(1,-1));
+ p.drawLine(cancelVisualRect.topLeft() + QPointF(0.5, 0.5), cancelVisualRect.bottomLeft() + QPointF(0.5, -0.5));
p.setPen(QPen(QColor(255, 255, 255, 30)));
- p.drawLine(cancelRect.topLeft() + QPoint(2,1), cancelRect.bottomLeft() + QPoint(2,-1));
- p.setPen(QPen(hover ? Utils::StyleHelper::panelTextColor() : QColor(180, 180, 180), 1));
- p.setRenderHint(QPainter::Antialiasing);
- p.translate(0.5, 0.5);
- p.drawLine(cancelRect.center()+QPoint(-1,-2), cancelRect.center()+QPoint(+3,+2));
- p.drawLine(cancelRect.center()+QPoint(+3,-2), cancelRect.center()+QPoint(-1,+2));
+ p.drawLine(cancelVisualRect.topLeft() + QPointF(1.5, 0.5), cancelVisualRect.bottomLeft() + QPointF(1.5, -0.5));
+ p.setPen(QPen(hover ? Utils::StyleHelper::panelTextColor() : QColor(180, 180, 180), 1.2, Qt::SolidLine, Qt::FlatCap));
+ p.setRenderHint(QPainter::Antialiasing, true);
+ p.drawLine(cancelVisualRect.topLeft() + QPointF(4.0, 2.0), cancelVisualRect.bottomRight() + QPointF(-3.0, -2.0));
+ p.drawLine(cancelVisualRect.bottomLeft() + QPointF(4.0, -2.0), cancelVisualRect.topRight() + QPointF(-3.0, 2.0));
}
}
}
diff --git a/src/plugins/coreplugin/progressmanager/progressbar.h b/src/plugins/coreplugin/progressmanager/progressbar.h
index d552a0a5d7..ca6a3cd143 100644
--- a/src/plugins/coreplugin/progressmanager/progressbar.h
+++ b/src/plugins/coreplugin/progressmanager/progressbar.h
@@ -93,6 +93,7 @@ private:
float m_cancelButtonFader;
bool m_finished;
bool m_error;
+ QRect m_cancelRect;
};
} // namespace Internal
diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp
index 6a496e5e5f..8cbff84cb1 100644
--- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp
+++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp
@@ -706,18 +706,17 @@ ToggleButton::ToggleButton(QWidget *parent)
QSize ToggleButton::sizeHint() const
{
- return QSize(12, 12);
+ return QSize(13, 12); // Uneven width, because the arrow's width is also uneven.
}
void ToggleButton::paintEvent(QPaintEvent *event)
{
QToolButton::paintEvent(event);
QPainter p(this);
- QStyle *s = style();
QStyleOption arrowOpt;
arrowOpt.initFrom(this);
- arrowOpt.rect = QRect(rect().center().x() - 3, rect().center().y() - 6, 9, 9);
- s->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, &p, this);
+ arrowOpt.rect.adjust(2, 0, -1, -2);
+ Utils::StyleHelper::drawArrow(QStyle::PE_IndicatorArrowUp, &p, &arrowOpt);
}
diff --git a/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp b/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp
index ac21a46b54..b91b4542d1 100644
--- a/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp
+++ b/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp
@@ -41,6 +41,7 @@
#include <QLabel>
#include <coreplugin/icore.h>
+#include <utils/stylehelper.h>
#include "progressmanager_p.h"
@@ -122,13 +123,14 @@ void Core::Internal::ProgressManagerPrivate::doSetApplicationLabel(const QString
if (text.isEmpty()) {
pITask->SetOverlayIcon(winId, NULL, NULL);
} else {
- QPixmap pix = QPixmap(QLatin1String(":/core/images/compile_error_taskbar.png"));
+ QPixmap pix(Utils::StyleHelper::dpiSpecificImageFile(QLatin1String(":/core/images/compile_error_taskbar.png")));
+ pix.setDevicePixelRatio(1); // We want device-pixel sized font depending on the pix.height
QPainter p(&pix);
p.setPen(Qt::white);
QFont font = p.font();
- font.setPointSize(font.pointSize()-2);
+ font.setPixelSize(pix.height() * 0.5);
p.setFont(font);
- p.drawText(QRect(QPoint(0,0), pix.size()), Qt::AlignHCenter|Qt::AlignCenter, text);
+ p.drawText(pix.rect(), Qt::AlignCenter, text);
#if QT_VERSION >= 0x050000
const HICON icon = qt_pixmapToWinHICON(pix);
#else
diff --git a/src/plugins/coreplugin/sidebarwidget.cpp b/src/plugins/coreplugin/sidebarwidget.cpp
index 6c463e7d19..199780254e 100644
--- a/src/plugins/coreplugin/sidebarwidget.cpp
+++ b/src/plugins/coreplugin/sidebarwidget.cpp
@@ -81,7 +81,7 @@ SideBarWidget::SideBarWidget(SideBar *sideBar, const QString &id)
QAction *closeAction = new QAction(tr("Close"), m_toolbar);
closeAction->setToolTip(tr("Close"));
- closeAction->setIcon(QIcon(QLatin1String(Constants::ICON_CLOSE_DOCUMENT)));
+ closeAction->setIcon(QIcon(QLatin1String(Constants::ICON_BUTTON_CLOSE)));
connect(closeAction, SIGNAL(triggered()), this, SIGNAL(closeMe()));
m_toolbar->addAction(closeAction);
diff --git a/src/plugins/coreplugin/styleanimator.cpp b/src/plugins/coreplugin/styleanimator.cpp
index 7a283510fe..d381681f1b 100644
--- a/src/plugins/coreplugin/styleanimator.cpp
+++ b/src/plugins/coreplugin/styleanimator.cpp
@@ -29,17 +29,15 @@
#include "styleanimator.h"
+#include <utils/algorithm.h>
+
#include <QStyleOption>
Animation * StyleAnimator::widgetAnimation(const QWidget *widget) const
{
if (!widget)
return 0;
- foreach (Animation *a, animations) {
- if (a->widget() == widget)
- return a;
- }
- return 0;
+ return Utils::findOrDefault(animations, Utils::equal(&Animation::widget, widget));
}
void Animation::paint(QPainter *painter, const QStyleOption *option)
@@ -65,8 +63,8 @@ void Animation::drawBlendedImage(QPainter *painter, const QRect &rect, float alp
case 32:
{
uchar *mixed_data = m_tempImage.bits();
- const uchar *back_data = m_primaryImage.bits();
- const uchar *front_data = m_secondaryImage.bits();
+ const uchar *back_data = m_primaryImage.constBits();
+ const uchar *front_data = m_secondaryImage.constBits();
for (int sy = 0; sy < sh; sy++) {
quint32 *mixed = (quint32*)mixed_data;
const quint32* back = (const quint32*)back_data;
diff --git a/src/plugins/coreplugin/variablemanager.cpp b/src/plugins/coreplugin/variablemanager.cpp
index e6ad21b9f4..bcc90ea939 100644
--- a/src/plugins/coreplugin/variablemanager.cpp
+++ b/src/plugins/coreplugin/variablemanager.cpp
@@ -43,7 +43,7 @@ static const char kFileBaseNamePostfix[] = ":FileBaseName";
namespace Core {
-class VMMapExpander : public Utils::AbstractQtcMacroExpander
+class VMMapExpander : public Utils::AbstractMacroExpander
{
public:
virtual bool resolveMacro(const QString &name, QString *ret)
@@ -270,19 +270,19 @@ void VariableManager::registerFileVariables(const QByteArray &prefix,
{
registerVariable(prefix + kFilePathPostfix,
QCoreApplication::translate("Core::VariableManager", "%1: Full path including file name.").arg(heading),
- [base]() { return QFileInfo(base()).filePath(); });
+ [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).filePath(); });
registerVariable(prefix + kPathPostfix,
QCoreApplication::translate("Core::VariableManager", "%1: Full path excluding file name.").arg(heading),
- [base]() { return QFileInfo(base()).path(); });
+ [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).path(); });
registerVariable(prefix + kFileNamePostfix,
QCoreApplication::translate("Core::VariableManager", "%1: File name without path.").arg(heading),
- [base]() { return QFileInfo(base()).fileName(); });
+ [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).fileName(); });
registerVariable(prefix + kFileBaseNamePostfix,
QCoreApplication::translate("Core::VariableManager", "%1: File base name without path and suffix.").arg(heading),
- [base]() { return QFileInfo(base()).baseName(); });
+ [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).baseName(); });
}
/*!
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp
index 40e487be1f..605a2176d1 100644
--- a/src/plugins/cpaster/cpasterplugin.cpp
+++ b/src/plugins/cpaster/cpasterplugin.cpp
@@ -50,7 +50,7 @@
#include <coreplugin/messagemanager.h>
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <QtPlugin>
#include <QDebug>
@@ -211,10 +211,10 @@ void CodepasterPlugin::postEditor()
const IDocument *document = editor->document();
const QString mimeType = document->mimeType();
QString data;
- if (const ITextEditor *textEditor = qobject_cast<const ITextEditor *>(editor))
+ if (const BaseTextEditor *textEditor = qobject_cast<const BaseTextEditor *>(editor))
data = textEditor->selectedText();
if (data.isEmpty()) {
- if (const ITextEditorDocument *textDocument = qobject_cast<const ITextEditorDocument *>(document))
+ if (auto textDocument = qobject_cast<const BaseTextDocument *>(document))
data = textDocument->plainText();
}
post(data, mimeType);
diff --git a/src/plugins/cppeditor/cppcanonicalsymbol.cpp b/src/plugins/cppeditor/cppcanonicalsymbol.cpp
index 7bdf1bcac9..22441331b9 100644
--- a/src/plugins/cppeditor/cppcanonicalsymbol.cpp
+++ b/src/plugins/cppeditor/cppcanonicalsymbol.cpp
@@ -41,7 +41,7 @@ using namespace CPlusPlus;
namespace CppEditor {
namespace Internal {
-CanonicalSymbol::CanonicalSymbol(CPPEditorWidget *editor,
+CanonicalSymbol::CanonicalSymbol(CppEditorWidget *editor,
const Document::Ptr &document,
const Snapshot &snapshot)
: m_editorWidget(editor),
diff --git a/src/plugins/cppeditor/cppcanonicalsymbol.h b/src/plugins/cppeditor/cppcanonicalsymbol.h
index 2c41c8f832..a0cc711c84 100644
--- a/src/plugins/cppeditor/cppcanonicalsymbol.h
+++ b/src/plugins/cppeditor/cppcanonicalsymbol.h
@@ -39,12 +39,12 @@ QT_FORWARD_DECLARE_CLASS(QTextCursor)
namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class CanonicalSymbol
{
public:
- CanonicalSymbol(CPPEditorWidget *editorWidget,
+ CanonicalSymbol(CppEditorWidget *editorWidget,
const CPlusPlus::Document::Ptr &document,
const CPlusPlus::Snapshot &snapshot);
@@ -61,7 +61,7 @@ public:
CPlusPlus::TypeOfExpression &typeOfExpression);
private:
- CPPEditorWidget *m_editorWidget;
+ CppEditorWidget *m_editorWidget;
CPlusPlus::Document::Ptr m_document;
CPlusPlus::Snapshot m_snapshot;
diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
index b150788c40..2dbf38b24b 100644
--- a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
+++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
@@ -1330,7 +1330,7 @@ void CppCodeModelInspectorDialog::onWorkingCopyDocumentSelected(const QModelInde
m_ui->workingCopySourceEdit->setPlainText(source);
}
} else {
- m_ui->workingCopySourceEdit->setPlainText(QString());
+ m_ui->workingCopySourceEdit->clear();
}
}
@@ -1369,8 +1369,8 @@ void CppCodeModelInspectorDialog::refresh()
dumper.dumpSnapshot(editorSnapshot, editorSnapshotTitle);
m_ui->snapshotSelector->addItem(editorSnapshotTitle);
}
- CppEditor::Internal::CPPEditorWidget *cppEditorWidget
- = qobject_cast<CppEditor::Internal::CPPEditorWidget *>(editor->editorWidget());
+ CppEditor::Internal::CppEditorWidget *cppEditorWidget
+ = qobject_cast<CppEditor::Internal::CppEditorWidget *>(editor->editorWidget());
if (cppEditorWidget) {
SemanticInfo semanticInfo = cppEditorWidget->semanticInfo();
CPlusPlus::Snapshot snapshot;
@@ -1489,7 +1489,7 @@ void CppCodeModelInspectorDialog::clearDocumentData()
m_ui->docTab->setTabText(DocumentDefinedMacrosTab, docTabName(DocumentDefinedMacrosTab));
m_docMacrosModel->clear();
- m_ui->docPreprocessedSourceEdit->setPlainText(QString());
+ m_ui->docPreprocessedSourceEdit->clear();
m_docSymbolsModel->clear();
@@ -1582,18 +1582,18 @@ void CppCodeModelInspectorDialog::clearProjectPartData()
{
m_partGenericInfoModel->clear();
- m_ui->partProjectFilesEdit->setPlainText(QString());
+ m_ui->partProjectFilesEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartFilesTab, partTabName(ProjectPartFilesTab));
- m_ui->partToolchainDefinesEdit->setPlainText(QString());
- m_ui->partProjectDefinesEdit->setPlainText(QString());
+ m_ui->partToolchainDefinesEdit->clear();
+ m_ui->partProjectDefinesEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartDefinesTab, partTabName(ProjectPartDefinesTab));
- m_ui->partHeaderPathsEdit->setPlainText(QString());
+ m_ui->partHeaderPathsEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartHeaderPathsTab,
partTabName(ProjectPartHeaderPathsTab));
- m_ui->partPrecompiledHeadersEdit->setPlainText(QString());
+ m_ui->partPrecompiledHeadersEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartPrecompiledHeadersTab,
partTabName(ProjectPartPrecompiledHeadersTab));
}
diff --git a/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp b/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp
index 2bd2e2bcec..2dadacfe63 100644
--- a/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp
+++ b/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp
@@ -253,7 +253,7 @@ bool CppDocumentationCommentHelper::handleKeyPressEvent(QKeyEvent *e) const
if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
QTextCursor cursor = m_editorWidget->textCursor();
- if (!m_editorWidget->autoCompleter()->isInComment(cursor))
+ if (!m_editorWidget->editor()->autoCompleter()->isInComment(cursor))
return false;
// We are interested on two particular cases:
@@ -294,7 +294,7 @@ bool CppDocumentationCommentHelper::handleKeyPressEvent(QKeyEvent *e) const
cursor.setPosition(pos);
cursor.insertText(comment);
cursor.setPosition(pos - 3, QTextCursor::KeepAnchor);
- m_editorWidget->baseTextDocument()->autoIndent(cursor);
+ m_editorWidget->textDocument()->autoIndent(cursor);
cursor.endEditBlock();
e->accept();
return true;
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 6507f6d4be..31e4fe0d5a 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -106,24 +106,29 @@ QTimer *newSingleShotTimer(QObject *parent, int msecInterval)
namespace CppEditor {
namespace Internal {
-CPPEditor::CPPEditor(CPPEditorWidget *editor)
+CPPEditor::CPPEditor(CppEditorWidget *editor)
: BaseTextEditor(editor)
{
m_context.add(CppEditor::Constants::C_CPPEDITOR);
m_context.add(ProjectExplorer::Constants::LANG_CXX);
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
setDuplicateSupported(true);
+ setCommentStyle(Utils::CommentDefinition::CppStyle);
+ setCompletionAssistProvider([this] () -> TextEditor::CompletionAssistProvider * {
+ return CppModelManagerInterface::instance()->cppEditorSupport(this)->completionAssistProvider();
+ });
+ setAutoCompleter(new CppAutoCompleter);
}
Q_GLOBAL_STATIC(CppTools::SymbolFinder, symbolFinder)
-class CPPEditorWidgetPrivate
+class CppEditorWidgetPrivate
{
public:
- CPPEditorWidgetPrivate(CPPEditorWidget *q);
+ CppEditorWidgetPrivate(CppEditorWidget *q);
public:
- CPPEditorWidget *q;
+ CppEditorWidget *q;
QPointer<CppTools::CppModelManagerInterface> m_modelManager;
@@ -155,10 +160,10 @@ public:
QToolButton *m_preprocessorButton;
};
-CPPEditorWidgetPrivate::CPPEditorWidgetPrivate(CPPEditorWidget *q)
+CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
: q(q)
, m_modelManager(CppModelManagerInterface::instance())
- , m_cppEditorDocument(qobject_cast<CPPEditorDocument *>(q->baseTextDocument()))
+ , m_cppEditorDocument(qobject_cast<CPPEditorDocument *>(q->textDocument()))
, m_cppEditorOutline(new CppEditorOutline(q))
, m_cppDocumentationCommentHelper(q)
, m_localRenaming(q)
@@ -171,29 +176,28 @@ CPPEditorWidgetPrivate::CPPEditorWidgetPrivate(CPPEditorWidget *q)
{
}
-CPPEditorWidget::CPPEditorWidget(QWidget *parent)
+CppEditorWidget::CppEditorWidget(QWidget *parent)
: TextEditor::BaseTextEditorWidget(new CPPEditorDocument(), parent)
{
- baseTextDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
+ textDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
ctor();
}
-CPPEditorWidget::CPPEditorWidget(CPPEditorWidget *other)
+CppEditorWidget::CppEditorWidget(CppEditorWidget *other)
: TextEditor::BaseTextEditorWidget(other)
{
ctor();
}
-void CPPEditorWidget::ctor()
+void CppEditorWidget::ctor()
{
- d.reset(new CPPEditorWidgetPrivate(this));
+ d.reset(new CppEditorWidgetPrivate(this));
qRegisterMetaType<SemanticInfo>("CppTools::SemanticInfo");
setParenthesesMatchingEnabled(true);
setMarksVisible(true);
setCodeFoldingSupported(true);
- setAutoCompleter(new CppAutoCompleter);
if (d->m_modelManager) {
CppEditorSupport *editorSupport = d->m_modelManager->cppEditorSupport(editor());
@@ -211,40 +215,15 @@ void CPPEditorWidget::ctor()
connect(d->m_declDefLinkFinder, SIGNAL(foundLink(QSharedPointer<FunctionDeclDefLink>)),
this, SLOT(onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefLink>)));
- connect(baseTextDocument(), SIGNAL(filePathChanged(QString,QString)),
+ connect(textDocument(), SIGNAL(filePathChanged(QString,QString)),
this, SLOT(onFilePathChanged()));
connect(&d->m_localRenaming, SIGNAL(finished()),
this, SLOT(onLocalRenamingFinished()));
connect(&d->m_localRenaming, SIGNAL(processKeyPressNormally(QKeyEvent*)),
this, SLOT(onLocalRenamingProcessKeyPressNormally(QKeyEvent*)));
-}
-
-CPPEditorWidget::~CPPEditorWidget()
-{
- if (d->m_modelManager)
- d->m_modelManager->deleteCppEditorSupport(editor());
-}
-
-CPPEditorDocument *CPPEditorWidget::cppEditorDocument() const
-{
- return d->m_cppEditorDocument;
-}
-CppEditorOutline *CPPEditorWidget::outline() const
-{
- return d->m_cppEditorOutline;
-}
-
-TextEditor::BaseTextEditor *CPPEditorWidget::createEditor()
-{
- CPPEditor *editable = new CPPEditor(this);
- createToolBar(editable);
- return editable;
-}
-
-void CPPEditorWidget::createToolBar(CPPEditor *editor)
-{
+ // Tool bar creation
d->m_updateUsesTimer = newSingleShotTimer(this, UPDATE_USES_INTERVAL);
connect(d->m_updateUsesTimer, SIGNAL(timeout()), this, SLOT(updateUsesNow()));
@@ -273,11 +252,32 @@ void CPPEditorWidget::createToolBar(CPPEditor *editor)
connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePreprocessorButtonTooltip()));
updatePreprocessorButtonTooltip();
connect(d->m_preprocessorButton, SIGNAL(clicked()), this, SLOT(showPreProcessorWidget()));
- editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, d->m_preprocessorButton);
- editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, d->m_cppEditorOutline->widget());
+ insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, d->m_preprocessorButton);
+ insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, d->m_cppEditorOutline->widget());
}
-void CPPEditorWidget::paste()
+CppEditorWidget::~CppEditorWidget()
+{
+ if (d->m_modelManager)
+ d->m_modelManager->deleteCppEditorSupport(editor());
+}
+
+CPPEditorDocument *CppEditorWidget::cppEditorDocument() const
+{
+ return d->m_cppEditorDocument;
+}
+
+CppEditorOutline *CppEditorWidget::outline() const
+{
+ return d->m_cppEditorOutline;
+}
+
+TextEditor::BaseTextEditor *CppEditorWidget::createEditor()
+{
+ return new CPPEditor(this);
+}
+
+void CppEditorWidget::paste()
{
if (d->m_localRenaming.handlePaste())
return;
@@ -285,7 +285,7 @@ void CPPEditorWidget::paste()
BaseTextEditorWidget::paste();
}
-void CPPEditorWidget::cut()
+void CppEditorWidget::cut()
{
if (d->m_localRenaming.handlePaste())
return;
@@ -293,7 +293,7 @@ void CPPEditorWidget::cut()
BaseTextEditorWidget::cut();
}
-void CPPEditorWidget::selectAll()
+void CppEditorWidget::selectAll()
{
if (d->m_localRenaming.handleSelectAll())
return;
@@ -303,12 +303,12 @@ void CPPEditorWidget::selectAll()
/// \brief Called by \c CppEditorSupport when the document corresponding to the
/// file in this editor is updated.
-void CPPEditorWidget::onDocumentUpdated()
+void CppEditorWidget::onDocumentUpdated()
{
d->m_cppEditorOutline->update();
}
-const Macro *CPPEditorWidget::findCanonicalMacro(const QTextCursor &cursor, Document::Ptr doc) const
+const Macro *CppEditorWidget::findCanonicalMacro(const QTextCursor &cursor, Document::Ptr doc) const
{
if (!doc)
return 0;
@@ -328,7 +328,7 @@ const Macro *CPPEditorWidget::findCanonicalMacro(const QTextCursor &cursor, Docu
return 0;
}
-void CPPEditorWidget::findUsages()
+void CppEditorWidget::findUsages()
{
if (!d->m_modelManager)
return;
@@ -347,7 +347,7 @@ void CPPEditorWidget::findUsages()
}
}
-void CPPEditorWidget::renameUsages(const QString &replacement)
+void CppEditorWidget::renameUsages(const QString &replacement)
{
if (!d->m_modelManager)
return;
@@ -366,7 +366,7 @@ void CPPEditorWidget::renameUsages(const QString &replacement)
}
}
-void CPPEditorWidget::markSymbolsNow()
+void CppEditorWidget::markSymbolsNow()
{
QTC_ASSERT(d->m_referencesWatcher, return);
if (!d->m_referencesWatcher->isCanceled()
@@ -416,7 +416,7 @@ static QList<int> lazyFindReferences(Scope *scope, QString code, Document::Ptr d
return QList<int>();
}
-void CPPEditorWidget::markSymbols(const QTextCursor &tc, const SemanticInfo &info)
+void CppEditorWidget::markSymbols(const QTextCursor &tc, const SemanticInfo &info)
{
d->m_localRenaming.stop();
@@ -481,7 +481,7 @@ void CPPEditorWidget::markSymbols(const QTextCursor &tc, const SemanticInfo &inf
}
}
-void CPPEditorWidget::renameSymbolUnderCursor()
+void CppEditorWidget::renameSymbolUnderCursor()
{
if (!d->m_modelManager)
return;
@@ -493,7 +493,7 @@ void CPPEditorWidget::renameSymbolUnderCursor()
renameUsages(); // Rename non-local symbol or macro
}
-void CPPEditorWidget::onContentsChanged(int position, int charsRemoved, int charsAdded)
+void CppEditorWidget::onContentsChanged(int position, int charsRemoved, int charsAdded)
{
Q_UNUSED(position)
Q_UNUSED(charsAdded)
@@ -502,7 +502,7 @@ void CPPEditorWidget::onContentsChanged(int position, int charsRemoved, int char
updateUses();
}
-void CPPEditorWidget::updatePreprocessorButtonTooltip()
+void CppEditorWidget::updatePreprocessorButtonTooltip()
{
QTC_ASSERT(d->m_preprocessorButton, return);
Core::Command *cmd = Core::ActionManager::command(Constants::OPEN_PREPROCESSOR_DIALOG);
@@ -510,7 +510,7 @@ void CPPEditorWidget::updatePreprocessorButtonTooltip()
d->m_preprocessorButton->setToolTip(cmd->action()->toolTip());
}
-QList<QTextEdit::ExtraSelection> CPPEditorWidget::createSelectionsFromUses(
+QList<QTextEdit::ExtraSelection> CppEditorWidget::createSelectionsFromUses(
const QList<SemanticInfo::Use> &uses)
{
QList<QTextEdit::ExtraSelection> result;
@@ -539,14 +539,14 @@ QList<QTextEdit::ExtraSelection> CPPEditorWidget::createSelectionsFromUses(
return result;
}
-void CPPEditorWidget::updateUses()
+void CppEditorWidget::updateUses()
{
// Block premature semantic info calculation when editor is created.
if (d->m_modelManager && d->m_modelManager->cppEditorSupport(editor())->initialized())
d->m_updateUsesTimer->start();
}
-void CPPEditorWidget::updateUsesNow()
+void CppEditorWidget::updateUsesNow()
{
if (d->m_localRenaming.isActive())
return;
@@ -554,7 +554,7 @@ void CPPEditorWidget::updateUsesNow()
semanticRehighlight();
}
-void CPPEditorWidget::highlightSymbolUsages(int from, int to)
+void CppEditorWidget::highlightSymbolUsages(int from, int to)
{
if (editorRevision() != d->m_highlightRevision)
return; // outdated
@@ -562,20 +562,20 @@ void CPPEditorWidget::highlightSymbolUsages(int from, int to)
else if (!d->m_highlightWatcher || d->m_highlightWatcher->isCanceled())
return; // aborted
- TextEditor::SyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter();
+ TextEditor::SyntaxHighlighter *highlighter = textDocument()->syntaxHighlighter();
QTC_ASSERT(highlighter, return);
TextEditor::SemanticHighlighter::incrementalApplyExtraAdditionalFormats(
highlighter, d->m_highlightWatcher->future(), from, to, d->m_semanticHighlightFormatMap);
}
-void CPPEditorWidget::finishHighlightSymbolUsages()
+void CppEditorWidget::finishHighlightSymbolUsages()
{
QTC_ASSERT(d->m_highlightWatcher, return);
if (!d->m_highlightWatcher->isCanceled()
&& editorRevision() == d->m_highlightRevision
&& !d->m_lastSemanticInfo.doc.isNull()) {
- TextEditor::SyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter();
+ TextEditor::SyntaxHighlighter *highlighter = textDocument()->syntaxHighlighter();
QTC_CHECK(highlighter);
if (highlighter)
TextEditor::SemanticHighlighter::clearExtraAdditionalFormatsUntilEnd(highlighter,
@@ -584,7 +584,7 @@ void CPPEditorWidget::finishHighlightSymbolUsages()
d->m_highlightWatcher.reset();
}
-void CPPEditorWidget::switchDeclarationDefinition(bool inNextSplit)
+void CppEditorWidget::switchDeclarationDefinition(bool inNextSplit)
{
if (!d->m_modelManager)
return;
@@ -617,7 +617,7 @@ void CPPEditorWidget::switchDeclarationDefinition(bool inNextSplit)
}
// Link to function definition/declaration
- CPPEditorWidget::Link symbolLink;
+ CppEditorWidget::Link symbolLink;
if (functionDeclarationSymbol) {
symbolLink = linkToSymbol(symbolFinder()
->findMatchingDefinition(functionDeclarationSymbol, d->m_modelManager->snapshot()));
@@ -652,14 +652,14 @@ void CPPEditorWidget::switchDeclarationDefinition(bool inNextSplit)
openCppEditorAt(symbolLink, inNextSplit != alwaysOpenLinksInNextSplit());
}
-QString CPPEditorWidget::identifierUnderCursor(QTextCursor *macroCursor)
+QString CppEditorWidget::identifierUnderCursor(QTextCursor *macroCursor)
{
macroCursor->movePosition(QTextCursor::StartOfWord);
macroCursor->movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
return macroCursor->selectedText();
}
-CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, bool resolveTarget,
+CppEditorWidget::Link CppEditorWidget::findLinkAt(const QTextCursor &cursor, bool resolveTarget,
bool inNextSplit)
{
if (!d->m_modelManager)
@@ -672,12 +672,12 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo
inNextSplit);
}
-unsigned CPPEditorWidget::editorRevision() const
+unsigned CppEditorWidget::editorRevision() const
{
return document()->revision();
}
-bool CPPEditorWidget::isOutdated() const
+bool CppEditorWidget::isOutdated() const
{
if (d->m_lastSemanticInfo.revision != editorRevision())
return true;
@@ -685,12 +685,12 @@ bool CPPEditorWidget::isOutdated() const
return false;
}
-SemanticInfo CPPEditorWidget::semanticInfo() const
+SemanticInfo CppEditorWidget::semanticInfo() const
{
return d->m_lastSemanticInfo;
}
-bool CPPEditorWidget::event(QEvent *e)
+bool CppEditorWidget::event(QEvent *e)
{
switch (e->type()) {
case QEvent::ShortcutOverride:
@@ -707,13 +707,13 @@ bool CPPEditorWidget::event(QEvent *e)
return BaseTextEditorWidget::event(e);
}
-void CPPEditorWidget::performQuickFix(int index)
+void CppEditorWidget::performQuickFix(int index)
{
TextEditor::QuickFixOperation::Ptr op = d->m_quickFixes.at(index);
op->perform();
}
-void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e)
+void CppEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{
// ### enable
// updateSemanticInfo(m_semanticHighlighter->semanticInfo(currentSource()));
@@ -769,7 +769,7 @@ void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e)
delete menu;
}
-void CPPEditorWidget::keyPressEvent(QKeyEvent *e)
+void CppEditorWidget::keyPressEvent(QKeyEvent *e)
{
if (d->m_localRenaming.handleKeyPressEvent(e))
return;
@@ -782,8 +782,8 @@ void CPPEditorWidget::keyPressEvent(QKeyEvent *e)
Core::IEditor *CPPEditor::duplicate()
{
- CPPEditorWidget *newEditor = new CPPEditorWidget(
- qobject_cast<CPPEditorWidget *>(editorWidget()));
+ CppEditorWidget *newEditor = new CppEditorWidget(
+ qobject_cast<CppEditorWidget *>(editorWidget()));
CppEditorPlugin::instance()->initializeEditor(newEditor);
return newEditor->editor();
}
@@ -792,23 +792,13 @@ bool CPPEditor::open(QString *errorString, const QString &fileName, const QStrin
{
if (!TextEditor::BaseTextEditor::open(errorString, fileName, realFileName))
return false;
- baseTextDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
+ textDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
return true;
}
-const Utils::CommentDefinition *CPPEditor::commentDefinition() const
-{
- return &m_commentDefinition;
-}
-
-TextEditor::CompletionAssistProvider *CPPEditor::completionAssistProvider()
+void CppEditorWidget::applyFontSettings()
{
- return CppModelManagerInterface::instance()->cppEditorSupport(this)->completionAssistProvider();
-}
-
-void CPPEditorWidget::applyFontSettings()
-{
- const TextEditor::FontSettings &fs = baseTextDocument()->fontSettings();
+ const TextEditor::FontSettings &fs = textDocument()->fontSettings();
d->m_semanticHighlightFormatMap[CppHighlightingSupport::TypeUse] =
fs.toTextCharFormat(TextEditor::C_TYPE);
@@ -836,18 +826,13 @@ void CPPEditorWidget::applyFontSettings()
semanticRehighlight(true);
}
-void CPPEditorWidget::unCommentSelection()
-{
- Utils::unCommentSelection(this);
-}
-
-void CPPEditorWidget::slotCodeStyleSettingsChanged(const QVariant &)
+void CppEditorWidget::slotCodeStyleSettingsChanged(const QVariant &)
{
CppTools::QtStyleCodeFormatter formatter;
formatter.invalidateCache(document());
}
-CPPEditorWidget::Link CPPEditorWidget::linkToSymbol(CPlusPlus::Symbol *symbol)
+CppEditorWidget::Link CppEditorWidget::linkToSymbol(CPlusPlus::Symbol *symbol)
{
if (!symbol)
return Link();
@@ -867,7 +852,7 @@ CPPEditorWidget::Link CPPEditorWidget::linkToSymbol(CPlusPlus::Symbol *symbol)
return Link(filename, line, column);
}
-bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit)
+bool CppEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit)
{
if (!link.hasValidTarget())
return false;
@@ -882,7 +867,7 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit)
flags);
}
-void CPPEditorWidget::semanticRehighlight(bool force)
+void CppEditorWidget::semanticRehighlight(bool force)
{
if (d->m_modelManager) {
const CppEditorSupport::ForceReason forceReason = force
@@ -892,7 +877,7 @@ void CPPEditorWidget::semanticRehighlight(bool force)
}
}
-void CPPEditorWidget::highlighterStarted(QFuture<TextEditor::HighlightingResult> *highlighter,
+void CppEditorWidget::highlighterStarted(QFuture<TextEditor::HighlightingResult> *highlighter,
unsigned revision)
{
d->m_highlightRevision = revision;
@@ -906,7 +891,7 @@ void CPPEditorWidget::highlighterStarted(QFuture<TextEditor::HighlightingResult>
d->m_highlightWatcher->setFuture(QFuture<TextEditor::HighlightingResult>(*highlighter));
}
-void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
+void CppEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
{
if (semanticInfo.revision != editorRevision()) {
// got outdated semantic info
@@ -924,7 +909,7 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
// We can use the semanticInfo's snapshot (and avoid locking), but not its
// document, since it doesn't contain expanded macros.
- LookupContext context(semanticInfo.snapshot.document(baseTextDocument()->filePath()),
+ LookupContext context(semanticInfo.snapshot.document(textDocument()->filePath()),
semanticInfo.snapshot);
SemanticInfo::LocalUseIterator it(semanticInfo.localUses);
@@ -965,7 +950,7 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
updateFunctionDeclDefLink();
}
-TextEditor::IAssistInterface *CPPEditorWidget::createAssistInterface(
+TextEditor::IAssistInterface *CppEditorWidget::createAssistInterface(
TextEditor::AssistKind kind,
TextEditor::AssistReason reason) const
{
@@ -981,25 +966,25 @@ TextEditor::IAssistInterface *CPPEditorWidget::createAssistInterface(
} else if (kind == TextEditor::QuickFix) {
if (!semanticInfo().doc || isOutdated())
return 0;
- return new CppQuickFixAssistInterface(const_cast<CPPEditorWidget *>(this), reason);
+ return new CppQuickFixAssistInterface(const_cast<CppEditorWidget *>(this), reason);
} else {
return BaseTextEditorWidget::createAssistInterface(kind, reason);
}
return 0;
}
-QSharedPointer<FunctionDeclDefLink> CPPEditorWidget::declDefLink() const
+QSharedPointer<FunctionDeclDefLink> CppEditorWidget::declDefLink() const
{
return d->m_declDefLink;
}
-void CPPEditorWidget::onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker)
+void CppEditorWidget::onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker)
{
if (marker.data.canConvert<FunctionDeclDefLink::Marker>())
applyDeclDefLinkChanges(true);
}
-void CPPEditorWidget::updateFunctionDeclDefLink()
+void CppEditorWidget::updateFunctionDeclDefLink()
{
const int pos = textCursor().selectionStart();
@@ -1025,7 +1010,7 @@ void CPPEditorWidget::updateFunctionDeclDefLink()
d->m_updateFunctionDeclDefLinkTimer->start();
}
-void CPPEditorWidget::updateFunctionDeclDefLinkNow()
+void CppEditorWidget::updateFunctionDeclDefLinkNow()
{
if (Core::EditorManager::currentEditor() != editor())
return;
@@ -1047,25 +1032,25 @@ void CPPEditorWidget::updateFunctionDeclDefLinkNow()
d->m_declDefLinkFinder->startFindLinkAt(textCursor(), d->m_lastSemanticInfo.doc, snapshot);
}
-void CPPEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefLink> link)
+void CppEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefLink> link)
{
abortDeclDefLink();
d->m_declDefLink = link;
Core::IDocument *targetDocument
= Core::DocumentModel::documentForFilePath( d->m_declDefLink->targetFile->fileName());
- if (baseTextDocument() != targetDocument) {
- if (TextEditor::ITextEditorDocument *textEditorDocument = qobject_cast<TextEditor::ITextEditorDocument *>(targetDocument))
- connect(textEditorDocument, SIGNAL(contentsChanged()),
+ if (textDocument() != targetDocument) {
+ if (auto textDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
+ connect(textDocument, SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
}
}
-void CPPEditorWidget::onFilePathChanged()
+void CppEditorWidget::onFilePathChanged()
{
QTC_ASSERT(d->m_modelManager, return);
QByteArray additionalDirectives;
- const QString &filePath = baseTextDocument()->filePath();
+ const QString &filePath = textDocument()->filePath();
if (!filePath.isEmpty()) {
const QString &projectFile = ProjectExplorer::SessionManager::value(
QLatin1String(Constants::CPP_PREPROCESSOR_PROJECT_PREFIX) + filePath).toString();
@@ -1081,7 +1066,7 @@ void CPPEditorWidget::onFilePathChanged()
d->m_preprocessorButton->update();
}
-void CPPEditorWidget::applyDeclDefLinkChanges(bool jumpToMatch)
+void CppEditorWidget::applyDeclDefLinkChanges(bool jumpToMatch)
{
if (!d->m_declDefLink)
return;
@@ -1090,21 +1075,21 @@ void CPPEditorWidget::applyDeclDefLinkChanges(bool jumpToMatch)
updateFunctionDeclDefLink();
}
-FollowSymbolUnderCursor *CPPEditorWidget::followSymbolUnderCursorDelegate()
+FollowSymbolUnderCursor *CppEditorWidget::followSymbolUnderCursorDelegate()
{
return d->m_followSymbolUnderCursor.data();
}
-void CPPEditorWidget::abortDeclDefLink()
+void CppEditorWidget::abortDeclDefLink()
{
if (!d->m_declDefLink)
return;
Core::IDocument *targetDocument
= Core::DocumentModel::documentForFilePath(d->m_declDefLink->targetFile->fileName());
- if (baseTextDocument() != targetDocument) {
- if (TextEditor::ITextEditorDocument *textEditorDocument = qobject_cast<TextEditor::ITextEditorDocument *>(targetDocument))
- disconnect(textEditorDocument, SIGNAL(contentsChanged()),
+ if (textDocument() != targetDocument) {
+ if (auto textDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
+ disconnect(textDocument, SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
}
@@ -1112,22 +1097,22 @@ void CPPEditorWidget::abortDeclDefLink()
d->m_declDefLink.clear();
}
-void CPPEditorWidget::onLocalRenamingFinished()
+void CppEditorWidget::onLocalRenamingFinished()
{
semanticRehighlight(true);
}
-void CPPEditorWidget::onLocalRenamingProcessKeyPressNormally(QKeyEvent *e)
+void CppEditorWidget::onLocalRenamingProcessKeyPressNormally(QKeyEvent *e)
{
BaseTextEditorWidget::keyPressEvent(e);
}
-QTextCharFormat CPPEditorWidget::textCharFormat(TextEditor::TextStyle category)
+QTextCharFormat CppEditorWidget::textCharFormat(TextEditor::TextStyle category)
{
- return baseTextDocument()->fontSettings().toTextCharFormat(category);
+ return textDocument()->fontSettings().toTextCharFormat(category);
}
-void CPPEditorWidget::showPreProcessorWidget()
+void CppEditorWidget::showPreProcessorWidget()
{
const QString &fileName = editor()->document()->filePath();
@@ -1138,7 +1123,7 @@ void CPPEditorWidget::showPreProcessorWidget()
if (projectParts.isEmpty())
projectParts << d->m_modelManager->fallbackProjectPart();
- CppPreProcessorDialog preProcessorDialog(this, baseTextDocument()->filePath(), projectParts);
+ CppPreProcessorDialog preProcessorDialog(this, textDocument()->filePath(), projectParts);
if (preProcessorDialog.exec() == QDialog::Accepted) {
QSharedPointer<SnapshotUpdater> updater
= d->m_modelManager->cppEditorSupport(editor())->snapshotUpdater();
diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h
index 99aed4ec35..d938762916 100644
--- a/src/plugins/cppeditor/cppeditor.h
+++ b/src/plugins/cppeditor/cppeditor.h
@@ -50,30 +50,25 @@ namespace CppEditor {
namespace Internal {
class CppEditorOutline;
-class CPPEditorWidget;
-class CPPEditorWidgetPrivate;
+class CppEditorWidget;
+class CppEditorWidgetPrivate;
class FollowSymbolUnderCursor;
class CPPEditor : public TextEditor::BaseTextEditor
{
Q_OBJECT
+
public:
- CPPEditor(CPPEditorWidget *);
+ CPPEditor(CppEditorWidget *);
Core::IEditor *duplicate() QTC_OVERRIDE;
bool open(QString *errorString,
const QString &fileName,
const QString &realFileName) QTC_OVERRIDE;
-
- const Utils::CommentDefinition *commentDefinition() const QTC_OVERRIDE;
- TextEditor::CompletionAssistProvider *completionAssistProvider() QTC_OVERRIDE;
-
-private:
- Utils::CommentDefinition m_commentDefinition;
};
-class CPPEditorWidget : public TextEditor::BaseTextEditorWidget
+class CppEditorWidget : public TextEditor::BaseTextEditorWidget
{
Q_OBJECT
@@ -82,9 +77,9 @@ public:
static QString identifierUnderCursor(QTextCursor *macroCursor);
public:
- CPPEditorWidget(QWidget *parent = 0);
- CPPEditorWidget(CPPEditorWidget *other);
- ~CPPEditorWidget();
+ CppEditorWidget(QWidget *parent = 0);
+ CppEditorWidget(CppEditorWidget *other);
+ ~CppEditorWidget();
CPPEditorDocument *cppEditorDocument() const;
CppEditorOutline *outline() const;
@@ -105,7 +100,6 @@ public slots:
void cut() QTC_OVERRIDE;
void selectAll() QTC_OVERRIDE;
- void unCommentSelection() QTC_OVERRIDE;
void switchDeclarationDefinition(bool inNextSplit);
void showPreProcessorWidget();
@@ -160,11 +154,9 @@ private slots:
private:
static bool openCppEditorAt(const Link &, bool inNextSplit = false);
- CPPEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
+ CppEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
void ctor();
- void createToolBar(CPPEditor *editable);
-
unsigned editorRevision() const;
bool isOutdated() const;
@@ -179,7 +171,7 @@ private:
const QList<TextEditor::HighlightingResult> &uses);
private:
- QScopedPointer<CPPEditorWidgetPrivate> d;
+ QScopedPointer<CppEditorWidgetPrivate> d;
};
} // namespace Internal
diff --git a/src/plugins/cppeditor/cppeditorconstants.h b/src/plugins/cppeditor/cppeditorconstants.h
index 324d614456..0c4af7fbd0 100644
--- a/src/plugins/cppeditor/cppeditorconstants.h
+++ b/src/plugins/cppeditor/cppeditorconstants.h
@@ -46,11 +46,9 @@ const char M_REFACTORING_MENU_INSERTION_POINT[] = "CppEditor.RefactorGroup";
const char UPDATE_CODEMODEL[] = "CppEditor.UpdateCodeModel";
const char INSPECT_CPP_CODEMODEL[] = "CppEditor.InspectCppCodeModel";
-const int TYPE_HIERARCHY_PRIORITY = 700;
const char TYPE_HIERARCHY_ID[] = "CppEditor.TypeHierarchy";
const char OPEN_TYPE_HIERARCHY[] = "CppEditor.OpenTypeHierarchy";
-const int INCLUDE_HIERARCHY_PRIORITY = 800;
const char INCLUDE_HIERARCHY_ID[] = "CppEditor.IncludeHierarchy";
const char OPEN_INCLUDE_HIERARCHY[] = "CppEditor.OpenIncludeHierarchy";
diff --git a/src/plugins/cppeditor/cppeditoroutline.cpp b/src/plugins/cppeditor/cppeditoroutline.cpp
index 67eab7658d..51533ef003 100644
--- a/src/plugins/cppeditor/cppeditoroutline.cpp
+++ b/src/plugins/cppeditor/cppeditoroutline.cpp
@@ -42,14 +42,14 @@
/*!
\class CppEditor::Internal::CppEditorOutline
- \brief A helper class of CPPEditorWidget that provides the outline model
+ \brief A helper class of CppEditorWidget that provides the outline model
and widget, e.g. for the editor's tool bar.
\internal
The caller is responsible for deleting the widget returned by widget().
- \sa CppEditor::Internal::CPPEditorWidget
+ \sa CppEditor::Internal::CppEditorWidget
*/
enum { UpdateOutlineIntervalInMs = 500 };
@@ -95,7 +95,7 @@ QTimer *newSingleShotTimer(QObject *parent, int msInternal)
namespace CppEditor {
namespace Internal {
-CppEditorOutline::CppEditorOutline(CPPEditorWidget *editorWidget)
+CppEditorOutline::CppEditorOutline(CppEditorWidget *editorWidget)
: QObject(editorWidget)
, m_editorWidget(editorWidget)
, m_combo(new Utils::TreeViewComboBox)
@@ -191,7 +191,7 @@ void CppEditorOutline::updateNow()
return;
const CPlusPlus::Snapshot snapshot = cmmi->snapshot();
- const QString filePath = m_editorWidget->baseTextDocument()->filePath();
+ const QString filePath = m_editorWidget->textDocument()->filePath();
CPlusPlus::Document::Ptr document = snapshot.document(filePath);
if (!document)
return;
@@ -249,7 +249,7 @@ void CppEditorOutline::gotoSymbolInEditor()
if (!symbol)
return;
- const TextEditor::BaseTextEditorWidget::Link &link = CPPEditorWidget::linkToSymbol(symbol);
+ const TextEditor::BaseTextEditorWidget::Link &link = CppEditorWidget::linkToSymbol(symbol);
if (!link.hasValidTarget())
return;
diff --git a/src/plugins/cppeditor/cppeditoroutline.h b/src/plugins/cppeditor/cppeditoroutline.h
index 126c8710ed..72acf0b0bd 100644
--- a/src/plugins/cppeditor/cppeditoroutline.h
+++ b/src/plugins/cppeditor/cppeditoroutline.h
@@ -45,7 +45,7 @@ namespace Utils { class TreeViewComboBox; }
namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class CppEditorOutline : public QObject
{
@@ -53,7 +53,7 @@ class CppEditorOutline : public QObject
Q_DISABLE_COPY(CppEditorOutline)
public:
- explicit CppEditorOutline(CPPEditorWidget *editorWidget);
+ explicit CppEditorOutline(CppEditorWidget *editorWidget);
void update();
@@ -83,7 +83,7 @@ private:
const QModelIndex &rootIndex = QModelIndex()) const;
private:
- CPPEditorWidget *m_editorWidget;
+ CppEditorWidget *m_editorWidget;
Utils::TreeViewComboBox *m_combo; // Not owned
CPlusPlus::OverviewModel *m_model;
diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp
index 3cd16607be..678214904b 100644
--- a/src/plugins/cppeditor/cppeditorplugin.cpp
+++ b/src/plugins/cppeditor/cppeditorplugin.cpp
@@ -97,7 +97,7 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
IEditor *CppEditorFactory::createEditor()
{
- CPPEditorWidget *editor = new CPPEditorWidget();
+ CppEditorWidget *editor = new CppEditorWidget();
editor->setRevisionsVisible(true);
m_owner->initializeEditor(editor);
return editor->editor();
@@ -129,7 +129,7 @@ CppEditorPlugin *CppEditorPlugin::instance()
return m_instance;
}
-void CppEditorPlugin::initializeEditor(CPPEditorWidget *editor)
+void CppEditorPlugin::initializeEditor(CppEditorWidget *editor)
{
editor->setLanguageSettingsId(CppTools::Constants::CPP_SETTINGS_ID);
TextEditor::TextEditorSettings::initializeEditor(editor);
@@ -343,38 +343,38 @@ ExtensionSystem::IPlugin::ShutdownFlag CppEditorPlugin::aboutToShutdown()
return SynchronousShutdown;
}
-static CPPEditorWidget *currentCppEditorWidget()
+static CppEditorWidget *currentCppEditorWidget()
{
- return qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
+ return qobject_cast<CppEditorWidget*>(EditorManager::currentEditor()->widget());
}
void CppEditorPlugin::switchDeclarationDefinition()
{
- if (CPPEditorWidget *editorWidget = currentCppEditorWidget())
+ if (CppEditorWidget *editorWidget = currentCppEditorWidget())
editorWidget->switchDeclarationDefinition(/*inNextSplit*/ false);
}
void CppEditorPlugin::openDeclarationDefinitionInNextSplit()
{
- if (CPPEditorWidget *editorWidget = currentCppEditorWidget())
+ if (CppEditorWidget *editorWidget = currentCppEditorWidget())
editorWidget->switchDeclarationDefinition(/*inNextSplit*/ true);
}
void CppEditorPlugin::renameSymbolUnderCursor()
{
- if (CPPEditorWidget *editorWidget = currentCppEditorWidget())
+ if (CppEditorWidget *editorWidget = currentCppEditorWidget())
editorWidget->renameSymbolUnderCursor();
}
void CppEditorPlugin::findUsages()
{
- if (CPPEditorWidget *editorWidget = currentCppEditorWidget())
+ if (CppEditorWidget *editorWidget = currentCppEditorWidget())
editorWidget->findUsages();
}
void CppEditorPlugin::showPreProcessorDialog()
{
- if (CPPEditorWidget *editorWidget = currentCppEditorWidget())
+ if (CppEditorWidget *editorWidget = currentCppEditorWidget())
editorWidget->showPreProcessorWidget();
}
diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h
index ec1f6aa8eb..2e0be1c4a2 100644
--- a/src/plugins/cppeditor/cppeditorplugin.h
+++ b/src/plugins/cppeditor/cppeditorplugin.h
@@ -37,12 +37,12 @@
#include <QtPlugin>
#include <QAction>
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class CppCodeModelInspectorDialog;
class CppQuickFixCollector;
class CppQuickFixAssistProvider;
@@ -63,7 +63,7 @@ public:
ShutdownFlag aboutToShutdown();
// Connect editor to settings changed signals.
- void initializeEditor(CPPEditorWidget *editor);
+ void initializeEditor(CppEditorWidget *editor);
bool sortedOutline() const;
@@ -243,7 +243,7 @@ private:
QPointer<CppCodeModelInspectorDialog> m_cppCodeModelInspectorDialog;
- QPointer<TextEditor::ITextEditor> m_currentEditor;
+ QPointer<TextEditor::BaseTextEditor> m_currentEditor;
};
class CppEditorFactory : public Core::IEditorFactory
diff --git a/src/plugins/cppeditor/cppeditortestcase.cpp b/src/plugins/cppeditor/cppeditortestcase.cpp
index becf8fd8c6..4bb20eedcc 100644
--- a/src/plugins/cppeditor/cppeditortestcase.cpp
+++ b/src/plugins/cppeditor/cppeditortestcase.cpp
@@ -63,14 +63,14 @@ TestCase::~TestCase()
bool TestCase::openCppEditor(const QString &fileName,
Internal::CPPEditor **editor,
- Internal::CPPEditorWidget **editorWidget)
+ Internal::CppEditorWidget **editorWidget)
{
using namespace CppEditor::Internal;
if (CPPEditor *e = dynamic_cast<CPPEditor *>(Core::EditorManager::openEditor(fileName))) {
if (editor)
*editor = e;
if (editorWidget) {
- if (CPPEditorWidget *w = dynamic_cast<CPPEditorWidget *>(e->editorWidget())) {
+ if (CppEditorWidget *w = dynamic_cast<CppEditorWidget *>(e->editorWidget())) {
*editorWidget = w;
return true;
} else {
@@ -85,7 +85,7 @@ bool TestCase::openCppEditor(const QString &fileName,
}
CPlusPlus::Document::Ptr TestCase::waitForRehighlightedSemanticDocument(
- Internal::CPPEditorWidget *editorWidget)
+ Internal::CppEditorWidget *editorWidget)
{
editorWidget->semanticRehighlight(true);
while (editorWidget->semanticInfo().doc.isNull())
diff --git a/src/plugins/cppeditor/cppeditortestcase.h b/src/plugins/cppeditor/cppeditortestcase.h
index afb299df7d..0c94b0bda2 100644
--- a/src/plugins/cppeditor/cppeditortestcase.h
+++ b/src/plugins/cppeditor/cppeditortestcase.h
@@ -39,7 +39,7 @@ namespace CppEditor {
namespace Internal {
class CPPEditor;
-class CPPEditorWidget;
+class CppEditorWidget;
namespace Tests {
@@ -53,7 +53,7 @@ public:
public:
int m_cursorPosition;
Internal::CPPEditor *m_editor;
- Internal::CPPEditorWidget *m_editorWidget;
+ Internal::CppEditorWidget *m_editorWidget;
};
class TestCase : public CppTools::Tests::TestCase
@@ -64,10 +64,10 @@ public:
static bool openCppEditor(const QString &fileName,
Internal::CPPEditor **editor,
- Internal::CPPEditorWidget **editorWidget = 0);
+ Internal::CppEditorWidget **editorWidget = 0);
static CPlusPlus::Document::Ptr waitForRehighlightedSemanticDocument(
- Internal::CPPEditorWidget *editorWidget);
+ Internal::CppEditorWidget *editorWidget);
};
} // namespace Tests
diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp
index aa9d37735a..0db58589ac 100644
--- a/src/plugins/cppeditor/cppelementevaluator.cpp
+++ b/src/plugins/cppeditor/cppelementevaluator.cpp
@@ -87,7 +87,7 @@ void CppElementEvaluator::execute()
return;
const Snapshot &snapshot = m_modelManager->snapshot();
- Document::Ptr doc = snapshot.document(m_editor->baseTextDocument()->filePath());
+ Document::Ptr doc = snapshot.document(m_editor->textDocument()->filePath());
if (!doc)
return;
@@ -301,7 +301,7 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration)
}
tooltip = overview.prettyType(declaration->type(), qualifiedName);
- link = CPPEditorWidget::linkToSymbol(declaration);
+ link = CppEditorWidget::linkToSymbol(declaration);
helpMark = name;
}
diff --git a/src/plugins/cppeditor/cppelementevaluator.h b/src/plugins/cppeditor/cppelementevaluator.h
index c1e6b0b1db..1a8050a854 100644
--- a/src/plugins/cppeditor/cppelementevaluator.h
+++ b/src/plugins/cppeditor/cppelementevaluator.h
@@ -50,7 +50,7 @@ namespace CppTools { class CppModelManagerInterface; }
namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class CppElement;
class CppElementEvaluator
diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
index 9b4cb4934b..d081b6eb80 100644
--- a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
+++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
@@ -306,8 +306,8 @@ inline LookupItem skipForwardDeclarations(const QList<LookupItem> &resolvedSymbo
return result;
}
-CPPEditorWidget::Link attemptFuncDeclDef(const QTextCursor &cursor,
- CPPEditorWidget *, CPlusPlus::Snapshot snapshot, const CPlusPlus::Document::Ptr &document,
+CppEditorWidget::Link attemptFuncDeclDef(const QTextCursor &cursor,
+ CppEditorWidget *, CPlusPlus::Snapshot snapshot, const CPlusPlus::Document::Ptr &document,
SymbolFinder *symbolFinder)
{
Link result;
@@ -365,7 +365,7 @@ CPPEditorWidget::Link attemptFuncDeclDef(const QTextCursor &cursor,
}
if (target) {
- result = CPPEditorWidget::linkToSymbol(target);
+ result = CppEditorWidget::linkToSymbol(target);
unsigned startLine, startColumn, endLine, endColumn;
document->translationUnit()->getTokenStartPosition(name->firstToken(), &startLine,
@@ -396,7 +396,7 @@ Symbol *findDefinition(Symbol *symbol, const Snapshot &snapshot, SymbolFinder *s
} // anonymous namespace
-FollowSymbolUnderCursor::FollowSymbolUnderCursor(CPPEditorWidget *widget)
+FollowSymbolUnderCursor::FollowSymbolUnderCursor(CppEditorWidget *widget)
: m_widget(widget)
, m_virtualFunctionAssistProvider(new VirtualFunctionAssistProvider)
{
@@ -550,7 +550,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
}
// Now we prefer the doc from the snapshot with macros expanded.
- Document::Ptr doc = snapshot.document(m_widget->baseTextDocument()->filePath());
+ Document::Ptr doc = snapshot.document(m_widget->textDocument()->filePath());
if (!doc) {
doc = documentFromSemanticInfo;
if (!doc)
@@ -592,7 +592,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
const Macro *macro = doc->findMacroDefinitionAt(line);
if (macro) {
QTextCursor macroCursor = cursor;
- const QByteArray name = CPPEditorWidget::identifierUnderCursor(&macroCursor).toUtf8();
+ const QByteArray name = CppEditorWidget::identifierUnderCursor(&macroCursor).toUtf8();
if (macro->name() == name)
return link; //already on definition!
} else if (const Document::MacroUse *use = doc->findMacroUseAt(endOfToken - 1)) {
@@ -645,7 +645,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
if (Symbol *d = r.declaration()) {
if (d->isDeclaration() || d->isFunction()) {
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
- if (m_widget->baseTextDocument()->filePath() == fileName) {
+ if (m_widget->textDocument()->filePath() == fileName) {
if (unsigned(lineNumber) == d->line()
&& unsigned(positionInBlock) >= d->column()) { // TODO: check the end
result = r; // take the symbol under cursor.
@@ -723,7 +723,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
// Handle macro uses
QTextCursor macroCursor = cursor;
- const QByteArray name = CPPEditorWidget::identifierUnderCursor(&macroCursor).toUtf8();
+ const QByteArray name = CppEditorWidget::identifierUnderCursor(&macroCursor).toUtf8();
link = findMacroLink(name, documentFromSemanticInfo);
if (link.hasValidTarget()) {
link.linkTextStart = macroCursor.selectionStart();
diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.h b/src/plugins/cppeditor/cppfollowsymbolundercursor.h
index efdeaea313..4dec46914a 100644
--- a/src/plugins/cppeditor/cppfollowsymbolundercursor.h
+++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.h
@@ -43,7 +43,7 @@ namespace CppTools { class SymbolFinder; }
namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class VirtualFunctionAssistProvider;
class FollowSymbolUnderCursor
@@ -51,7 +51,7 @@ class FollowSymbolUnderCursor
public:
typedef TextEditor::BaseTextEditorWidget::Link Link;
- FollowSymbolUnderCursor(CPPEditorWidget *widget);
+ FollowSymbolUnderCursor(CppEditorWidget *widget);
~FollowSymbolUnderCursor();
Link findLink(const QTextCursor &cursor, bool resolveTarget,
@@ -63,7 +63,7 @@ public:
void setVirtualFunctionAssistProvider(VirtualFunctionAssistProvider *provider);
private:
- CPPEditorWidget *m_widget;
+ CppEditorWidget *m_widget;
VirtualFunctionAssistProvider *m_virtualFunctionAssistProvider;
};
diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
index fef082bac8..9647ed5878 100644
--- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
+++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
@@ -287,7 +287,7 @@ static bool namesEqual(const Name *n1, const Name *n2)
return n1 == n2 || (n1 && n2 && n1->match(n2));
}
-void FunctionDeclDefLink::apply(CPPEditorWidget *editor, bool jumpToMatch)
+void FunctionDeclDefLink::apply(CppEditorWidget *editor, bool jumpToMatch)
{
Snapshot snapshot = editor->semanticInfo().snapshot;
@@ -323,7 +323,7 @@ static QList<TextEditor::RefactorMarker> removeMarkersOfType(const QList<TextEdi
return result;
}
-void FunctionDeclDefLink::hideMarker(CPPEditorWidget *editor)
+void FunctionDeclDefLink::hideMarker(CppEditorWidget *editor)
{
if (!hasMarker)
return;
@@ -332,7 +332,7 @@ void FunctionDeclDefLink::hideMarker(CPPEditorWidget *editor)
hasMarker = false;
}
-void FunctionDeclDefLink::showMarker(CPPEditorWidget *editor)
+void FunctionDeclDefLink::showMarker(CppEditorWidget *editor)
{
if (hasMarker)
return;
diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.h b/src/plugins/cppeditor/cppfunctiondecldeflink.h
index 416454acaf..6b76f7c030 100644
--- a/src/plugins/cppeditor/cppfunctiondecldeflink.h
+++ b/src/plugins/cppeditor/cppfunctiondecldeflink.h
@@ -43,7 +43,7 @@
namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class FunctionDeclDefLink;
class FunctionDeclDefLinkFinder : public QObject
@@ -80,9 +80,9 @@ public:
bool isValid() const;
bool isMarkerVisible() const;
- void apply(CPPEditorWidget *editor, bool jumpToMatch);
- void hideMarker(CPPEditorWidget *editor);
- void showMarker(CPPEditorWidget *editor);
+ void apply(CppEditorWidget *editor, bool jumpToMatch);
+ void hideMarker(CppEditorWidget *editor);
+ void showMarker(CppEditorWidget *editor);
Utils::ChangeSet changes(const CPlusPlus::Snapshot &snapshot, int targetOffset = -1);
QTextCursor linkSelection;
diff --git a/src/plugins/cppeditor/cpphighlighter.h b/src/plugins/cppeditor/cpphighlighter.h
index 4afa0e7ffb..7ba48dd905 100644
--- a/src/plugins/cppeditor/cpphighlighter.h
+++ b/src/plugins/cppeditor/cpphighlighter.h
@@ -38,7 +38,7 @@ namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class CppHighlighter : public TextEditor::SyntaxHighlighter
{
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp
index a2f10db8a0..c65f8e5387 100644
--- a/src/plugins/cppeditor/cpphoverhandler.cpp
+++ b/src/plugins/cppeditor/cpphoverhandler.cpp
@@ -54,7 +54,7 @@ bool CppHoverHandler::acceptEditor(IEditor *editor)
return editor->document()->id() == CppEditor::Constants::CPPEDITOR_ID;
}
-void CppHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
+void CppHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos)
{
using namespace TextEditor;
BaseTextEditorWidget *textEditor = qobject_cast<BaseTextEditorWidget *>(editor->widget());
diff --git a/src/plugins/cppeditor/cpphoverhandler.h b/src/plugins/cppeditor/cpphoverhandler.h
index b931f88a58..22a97789a1 100644
--- a/src/plugins/cppeditor/cpphoverhandler.h
+++ b/src/plugins/cppeditor/cpphoverhandler.h
@@ -36,7 +36,7 @@
namespace Core { class IEditor; }
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace CppEditor {
namespace Internal {
@@ -50,7 +50,7 @@ public:
private:
virtual bool acceptEditor(Core::IEditor *editor);
- virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos);
+ virtual void identifyMatch(TextEditor::BaseTextEditor *editor, int pos);
virtual void decorateToolTip();
};
diff --git a/src/plugins/cppeditor/cppincludehierarchy.cpp b/src/plugins/cppeditor/cppincludehierarchy.cpp
index be5457736b..a7cc16aa28 100644
--- a/src/plugins/cppeditor/cppincludehierarchy.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchy.cpp
@@ -67,7 +67,7 @@ public:
void setup(const QString &fileName, const QString &filePath)
{
setText(fileName);
- m_link = CPPEditorWidget::Link(filePath);
+ m_link = CppEditorWidget::Link(filePath);
}
private:
@@ -82,7 +82,7 @@ private:
Constants::CPPEDITOR_ID);
}
- CPPEditorWidget::Link m_link;
+ CppEditorWidget::Link m_link;
};
// CppIncludeHierarchyWidget
@@ -138,17 +138,17 @@ void CppIncludeHierarchyWidget::perform()
if (!m_editor)
return;
- CPPEditorWidget *widget = qobject_cast<CPPEditorWidget *>(m_editor->widget());
+ CppEditorWidget *widget = qobject_cast<CppEditorWidget *>(m_editor->widget());
if (!widget)
return;
m_model->clear();
- m_model->buildHierarchy(m_editor, widget->baseTextDocument()->filePath());
+ m_model->buildHierarchy(m_editor, widget->textDocument()->filePath());
if (m_model->isEmpty())
return;
- m_inspectedFile->setup(widget->baseTextDocument()->displayName(),
- widget->baseTextDocument()->filePath());
+ m_inspectedFile->setup(widget->textDocument()->displayName(),
+ widget->textDocument()->filePath());
//expand "Includes"
m_treeView->expand(m_model->index(0, 0));
@@ -207,30 +207,9 @@ CppIncludeHierarchyStackedWidget::~CppIncludeHierarchyStackedWidget()
// CppIncludeHierarchyFactory
CppIncludeHierarchyFactory::CppIncludeHierarchyFactory()
{
-}
-
-CppIncludeHierarchyFactory::~CppIncludeHierarchyFactory()
-{
-}
-
-QString CppIncludeHierarchyFactory::displayName() const
-{
- return tr("Include Hierarchy");
-}
-
-int CppIncludeHierarchyFactory::priority() const
-{
- return Constants::INCLUDE_HIERARCHY_PRIORITY;
-}
-
-Core::Id CppIncludeHierarchyFactory::id() const
-{
- return Core::Id(Constants::INCLUDE_HIERARCHY_ID);
-}
-
-QKeySequence CppIncludeHierarchyFactory::activationSequence() const
-{
- return QKeySequence();
+ setDisplayName(tr("Include Hierarchy"));
+ setPriority(800);
+ setId(Constants::INCLUDE_HIERARCHY_ID);
}
Core::NavigationView CppIncludeHierarchyFactory::createWidget()
diff --git a/src/plugins/cppeditor/cppincludehierarchy.h b/src/plugins/cppeditor/cppincludehierarchy.h
index c03a36084c..587895ca34 100644
--- a/src/plugins/cppeditor/cppincludehierarchy.h
+++ b/src/plugins/cppeditor/cppincludehierarchy.h
@@ -55,7 +55,7 @@ namespace CppEditor {
namespace Internal {
class CPPEditor;
-class CPPEditorWidget;
+class CppEditorWidget;
class CppInclude;
class CppIncludeLabel;
class CppIncludeHierarchyModel;
@@ -79,7 +79,7 @@ private:
void showNoIncludeHierarchyLabel();
void showIncludeHierarchy();
- CPPEditorWidget *m_cppEditor;
+ CppEditorWidget *m_cppEditor;
CppIncludeHierarchyTreeView *m_treeView;
CppIncludeHierarchyModel *m_model;
Utils::AnnotatedItemDelegate *m_delegate;
@@ -106,12 +106,7 @@ class CppIncludeHierarchyFactory : public Core::INavigationWidgetFactory
Q_OBJECT
public:
CppIncludeHierarchyFactory();
- virtual ~CppIncludeHierarchyFactory();
- QString displayName() const;
- int priority() const;
- Core::Id id() const;
- QKeySequence activationSequence() const;
Core::NavigationView createWidget();
};
diff --git a/src/plugins/cppeditor/cpplocalrenaming.cpp b/src/plugins/cppeditor/cpplocalrenaming.cpp
index 4a5dd34644..d2a0c02282 100644
--- a/src/plugins/cppeditor/cpplocalrenaming.cpp
+++ b/src/plugins/cppeditor/cpplocalrenaming.cpp
@@ -36,16 +36,16 @@
/*!
\class CppEditor::Internal::CppLocalRenaming
- \brief A helper class of CPPEditorWidget that implements renaming local usages.
+ \brief A helper class of CppEditorWidget that implements renaming local usages.
\internal
Local use selections must be first set/updated with updateLocalUseSelections().
- Afterwards the local renaming can be started with start(). The CPPEditorWidget
+ Afterwards the local renaming can be started with start(). The CppEditorWidget
can then delegate work related to the local renaming mode to the handle*
functions.
- \sa CppEditor::Internal::CPPEditorWidget
+ \sa CppEditor::Internal::CppEditorWidget
*/
namespace {
@@ -296,7 +296,7 @@ void CppLocalRenaming::updateEditorWidgetWithSelections()
QTextCharFormat CppLocalRenaming::textCharFormat(TextEditor::TextStyle category) const
{
- return m_editorWidget->baseTextDocument()->fontSettings().toTextCharFormat(category);
+ return m_editorWidget->textDocument()->fontSettings().toTextCharFormat(category);
}
void CppLocalRenaming::finishRenameChange()
diff --git a/src/plugins/cppeditor/cppoutline.cpp b/src/plugins/cppeditor/cppoutline.cpp
index 145d9606cf..874f12f924 100644
--- a/src/plugins/cppeditor/cppoutline.cpp
+++ b/src/plugins/cppeditor/cppoutline.cpp
@@ -90,7 +90,7 @@ bool CppOutlineFilterModel::filterAcceptsRow(int sourceRow,
}
-CppOutlineWidget::CppOutlineWidget(CPPEditorWidget *editor) :
+CppOutlineWidget::CppOutlineWidget(CppEditorWidget *editor) :
TextEditor::IOutlineWidget(),
m_editor(editor),
m_treeView(new CppOutlineTreeView(this)),
@@ -193,7 +193,7 @@ bool CppOutlineWidgetFactory::supportsEditor(Core::IEditor *editor) const
TextEditor::IOutlineWidget *CppOutlineWidgetFactory::createWidget(Core::IEditor *editor)
{
CPPEditor *cppEditor = qobject_cast<CPPEditor*>(editor);
- CPPEditorWidget *cppEditorWidget = qobject_cast<CPPEditorWidget*>(cppEditor->widget());
+ CppEditorWidget *cppEditorWidget = qobject_cast<CppEditorWidget*>(cppEditor->widget());
QTC_ASSERT(cppEditorWidget, return 0);
CppOutlineWidget *widget = new CppOutlineWidget(cppEditorWidget);
diff --git a/src/plugins/cppeditor/cppoutline.h b/src/plugins/cppeditor/cppoutline.h
index 291f0a59cb..0092bd9b4f 100644
--- a/src/plugins/cppeditor/cppoutline.h
+++ b/src/plugins/cppeditor/cppoutline.h
@@ -68,7 +68,7 @@ class CppOutlineWidget : public TextEditor::IOutlineWidget
{
Q_OBJECT
public:
- CppOutlineWidget(CPPEditorWidget *editor);
+ CppOutlineWidget(CppEditorWidget *editor);
// IOutlineWidget
virtual QList<QAction*> filterMenuActions() const;
@@ -84,7 +84,7 @@ private:
bool syncCursor();
private:
- CPPEditorWidget *m_editor;
+ CppEditorWidget *m_editor;
CppOutlineTreeView *m_treeView;
CPlusPlus::OverviewModel *m_model;
CppOutlineFilterModel *m_proxyModel;
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index 3e28a2025a..88516ad276 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -251,7 +251,7 @@ private:
/// Apply the factory on the source and get back the resultIndex'th result or a null pointer.
QSharedPointer<TextEditor::QuickFixOperation> QuickFixTestCase::getFix(
- CppQuickFixFactory *factory, CPPEditorWidget *editorWidget, int resultIndex)
+ CppQuickFixFactory *factory, CppEditorWidget *editorWidget, int resultIndex)
{
CppQuickFixInterface qfi(new CppQuickFixAssistInterface(editorWidget, ExplicitlyInvoked));
TextEditor::QuickFixOperations results;
diff --git a/src/plugins/cppeditor/cppquickfix_test.h b/src/plugins/cppeditor/cppquickfix_test.h
index a898c8bb36..4d43044e35 100644
--- a/src/plugins/cppeditor/cppquickfix_test.h
+++ b/src/plugins/cppeditor/cppquickfix_test.h
@@ -84,7 +84,7 @@ public:
CppQuickFixFactory *factory, const QString &incPath);
private:
QSharedPointer<TextEditor::QuickFixOperation> getFix(CppQuickFixFactory *factory,
- CPPEditorWidget *editorWidget,
+ CppEditorWidget *editorWidget,
int resultIndex = 0);
private:
diff --git a/src/plugins/cppeditor/cppquickfixassistant.cpp b/src/plugins/cppeditor/cppquickfixassistant.cpp
index f656250d37..5ccf31b71f 100644
--- a/src/plugins/cppeditor/cppquickfixassistant.cpp
+++ b/src/plugins/cppeditor/cppquickfixassistant.cpp
@@ -84,10 +84,10 @@ const IAssistProvider *CppQuickFixAssistProcessor::provider() const
// --------------------------
// CppQuickFixAssistInterface
// --------------------------
-CppQuickFixAssistInterface::CppQuickFixAssistInterface(CPPEditorWidget *editor,
+CppQuickFixAssistInterface::CppQuickFixAssistInterface(CppEditorWidget *editor,
TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(),
- editor->baseTextDocument()->filePath(), reason)
+ editor->textDocument()->filePath(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot())
@@ -119,7 +119,7 @@ const LookupContext &CppQuickFixAssistInterface::context() const
return m_context;
}
-CPPEditorWidget *CppQuickFixAssistInterface::editor() const
+CppEditorWidget *CppQuickFixAssistInterface::editor() const
{
return m_editor;
}
diff --git a/src/plugins/cppeditor/cppquickfixassistant.h b/src/plugins/cppeditor/cppquickfixassistant.h
index daad9dc503..843438b43a 100644
--- a/src/plugins/cppeditor/cppquickfixassistant.h
+++ b/src/plugins/cppeditor/cppquickfixassistant.h
@@ -47,18 +47,18 @@ typedef QSharedPointer<CppRefactoringFile> CppRefactoringFilePtr;
namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class CppQuickFixAssistInterface : public TextEditor::DefaultAssistInterface
{
public:
- CppQuickFixAssistInterface(CPPEditorWidget *editor, TextEditor::AssistReason reason);
+ CppQuickFixAssistInterface(CppEditorWidget *editor, TextEditor::AssistReason reason);
const QList<CPlusPlus::AST *> &path() const;
CPlusPlus::Snapshot snapshot() const;
CppTools::SemanticInfo semanticInfo() const;
const CPlusPlus::LookupContext &context() const;
- CPPEditorWidget *editor() const;
+ CppEditorWidget *editor() const;
CppTools::CppRefactoringFilePtr currentFile() const;
@@ -66,7 +66,7 @@ public:
bool isCursorOn(const CPlusPlus::AST *ast) const;
private:
- CPPEditorWidget *m_editor;
+ CppEditorWidget *m_editor;
CppTools::SemanticInfo m_semanticInfo;
CPlusPlus::Snapshot m_snapshot;
CppTools::CppRefactoringFilePtr m_currentFile;
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp
index dfdcfbc18f..fb88ef661b 100644
--- a/src/plugins/cppeditor/cppquickfixes.cpp
+++ b/src/plugins/cppeditor/cppquickfixes.cpp
@@ -4093,7 +4093,7 @@ public:
void perform()
{
- CPPEditorWidget *editor = assistInterface()->editor();
+ CppEditorWidget *editor = assistInterface()->editor();
QSharedPointer<FunctionDeclDefLink> link = editor->declDefLink();
if (link == m_link)
editor->applyDeclDefLinkChanges(/*don't jump*/false);
diff --git a/src/plugins/cppeditor/cppsnippetprovider.cpp b/src/plugins/cppeditor/cppsnippetprovider.cpp
index c71c126762..0b28166002 100644
--- a/src/plugins/cppeditor/cppsnippetprovider.cpp
+++ b/src/plugins/cppeditor/cppsnippetprovider.cpp
@@ -63,6 +63,6 @@ QString CppSnippetProvider::displayName() const
void CppSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *editor) const
{
editor->setSyntaxHighlighter(new CppHighlighter);
- editor->baseTextDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
- editor->setAutoCompleter(new CppAutoCompleter);
+ editor->textDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
+ editor->editor()->setAutoCompleter(new CppAutoCompleter);
}
diff --git a/src/plugins/cppeditor/cpptypehierarchy.cpp b/src/plugins/cppeditor/cpptypehierarchy.cpp
index d7162a2da2..7136f05a0b 100644
--- a/src/plugins/cppeditor/cpptypehierarchy.cpp
+++ b/src/plugins/cppeditor/cpptypehierarchy.cpp
@@ -65,7 +65,7 @@ QStandardItem *itemForClass(const CppClass &cppClass)
item->setData(cppClass.qualifiedName, AnnotationRole);
item->setData(cppClass.icon, Qt::DecorationRole);
QVariant link;
- link.setValue(CPPEditorWidget::Link(cppClass.link));
+ link.setValue(CppEditorWidget::Link(cppClass.link));
item->setData(link, LinkRole);
return item;
}
@@ -102,7 +102,7 @@ public:
void clear()
{
QLabel::clear();
- m_link = CPPEditorWidget::Link();
+ m_link = CppEditorWidget::Link();
}
private:
@@ -117,7 +117,7 @@ private:
Constants::CPPEDITOR_ID);
}
- CPPEditorWidget::Link m_link;
+ CppEditorWidget::Link m_link;
};
// CppTypeHierarchyWidget
@@ -174,7 +174,7 @@ void CppTypeHierarchyWidget::perform()
if (!editor)
return;
- CPPEditorWidget *widget = qobject_cast<CPPEditorWidget *>(editor->widget());
+ CppEditorWidget *widget = qobject_cast<CppEditorWidget *>(editor->widget());
if (!widget)
return;
@@ -241,53 +241,19 @@ void CppTypeHierarchyWidget::onItemClicked(const QModelIndex &index)
Constants::CPPEDITOR_ID);
}
-// CppTypeHierarchyStackedWidget
-CppTypeHierarchyStackedWidget::CppTypeHierarchyStackedWidget(QWidget *parent) :
- QStackedWidget(parent),
- m_typeHiearchyWidgetInstance(new CppTypeHierarchyWidget)
-{
- addWidget(m_typeHiearchyWidgetInstance);
-}
-
-CppTypeHierarchyStackedWidget::~CppTypeHierarchyStackedWidget()
-{
- delete m_typeHiearchyWidgetInstance;
-}
-
// CppTypeHierarchyFactory
CppTypeHierarchyFactory::CppTypeHierarchyFactory()
-{}
-
-CppTypeHierarchyFactory::~CppTypeHierarchyFactory()
-{}
-
-QString CppTypeHierarchyFactory::displayName() const
-{
- return tr("Type Hierarchy");
-}
-
-int CppTypeHierarchyFactory::priority() const
-{
- return Constants::TYPE_HIERARCHY_PRIORITY;
-}
-
-Core::Id CppTypeHierarchyFactory::id() const
-{
- return Core::Id(Constants::TYPE_HIERARCHY_ID);
-}
-
-QKeySequence CppTypeHierarchyFactory::activationSequence() const
{
- return QKeySequence();
+ setDisplayName(tr("Type Hierarchy"));
+ setPriority(700);
+ setId(Constants::TYPE_HIERARCHY_ID);
}
Core::NavigationView CppTypeHierarchyFactory::createWidget()
{
- CppTypeHierarchyStackedWidget *w = new CppTypeHierarchyStackedWidget;
- static_cast<CppTypeHierarchyWidget *>(w->currentWidget())->perform();
- Core::NavigationView navigationView;
- navigationView.widget = w;
- return navigationView;
+ auto w = new CppTypeHierarchyWidget;
+ w->perform();
+ return Core::NavigationView(w);
}
} // namespace Internal
diff --git a/src/plugins/cppeditor/cpptypehierarchy.h b/src/plugins/cppeditor/cpptypehierarchy.h
index aaefdc543e..1195e2538e 100644
--- a/src/plugins/cppeditor/cpptypehierarchy.h
+++ b/src/plugins/cppeditor/cpptypehierarchy.h
@@ -56,7 +56,7 @@ class AnnotatedItemDelegate;
namespace CppEditor {
namespace Internal {
-class CPPEditorWidget;
+class CppEditorWidget;
class CppClass;
class CppClassLabel;
@@ -81,7 +81,7 @@ private:
void showTypeHierarchy();
void clearTypeHierarchy();
- CPPEditorWidget *m_cppEditor;
+ CppEditorWidget *m_cppEditor;
Utils::NavigationTreeView *m_treeView;
QWidget *m_hierarchyWidget;
QStackedLayout *m_stackLayout;
@@ -91,30 +91,13 @@ private:
QLabel *m_noTypeHierarchyAvailableLabel;
};
-// @todo: Pretty much the same design as the OutlineWidgetStack. Maybe we can generalize the
-// outline factory so that it works for different widgets that support the same editor.
-class CppTypeHierarchyStackedWidget : public QStackedWidget
-{
- Q_OBJECT
-public:
- CppTypeHierarchyStackedWidget(QWidget *parent = 0);
- virtual ~CppTypeHierarchyStackedWidget();
-
-private:
- CppTypeHierarchyWidget *m_typeHiearchyWidgetInstance;
-};
-
class CppTypeHierarchyFactory : public Core::INavigationWidgetFactory
{
Q_OBJECT
+
public:
CppTypeHierarchyFactory();
- virtual ~CppTypeHierarchyFactory();
- virtual QString displayName() const;
- virtual int priority() const;
- virtual Core::Id id() const;
- virtual QKeySequence activationSequence() const;
virtual Core::NavigationView createWidget();
};
diff --git a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
index ec76a966b4..65e9be1d04 100644
--- a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
+++ b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
@@ -132,7 +132,7 @@ public:
{
QTC_ASSERT(m_params.function, return 0);
- BasicProposalItem *hintItem = new VirtualFunctionProposalItem(CPPEditorWidget::Link());
+ BasicProposalItem *hintItem = new VirtualFunctionProposalItem(CppEditorWidget::Link());
hintItem->setText(QCoreApplication::translate("VirtualFunctionsAssistProcessor",
"...searching overrides"));
hintItem->setOrder(-1000);
@@ -181,7 +181,7 @@ private:
BasicProposalItem *itemFromFunction(Function *func) const
{
- const CPPEditorWidget::Link link = CPPEditorWidget::linkToSymbol(maybeDefinitionFor(func));
+ const CppEditorWidget::Link link = CppEditorWidget::linkToSymbol(maybeDefinitionFor(func));
QString text = m_overview.prettyName(LookupContext::fullyQualifiedName(func));
if (func->isPureVirtual())
text += QLatin1String(" = 0");
diff --git a/src/plugins/cppeditor/fileandtokenactions_test.cpp b/src/plugins/cppeditor/fileandtokenactions_test.cpp
index f98eebbc49..cab09696c5 100644
--- a/src/plugins/cppeditor/fileandtokenactions_test.cpp
+++ b/src/plugins/cppeditor/fileandtokenactions_test.cpp
@@ -92,7 +92,7 @@ public:
{
public:
/// Every Action is expected to undo its changes.
- virtual void run(CPPEditorWidget *editorWidget) = 0;
+ virtual void run(CppEditorWidget *editorWidget) = 0;
virtual ~AbstractAction() {}
};
typedef QSharedPointer<AbstractAction> ActionPointer;
@@ -113,7 +113,7 @@ public:
static void undoChangesInAllEditorWidgets();
/// Execute actions for the current cursor position of editorWidget.
- static void executeActionsOnEditorWidget(CPPEditorWidget *editorWidget, Actions actions);
+ static void executeActionsOnEditorWidget(CppEditorWidget *editorWidget, Actions actions);
private:
/// Move word camel case wise from current cursor position until given token (not included)
@@ -187,7 +187,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti
// Open editor
QCOMPARE(DocumentModel::openedDocuments().size(), 0);
CPPEditor *editor;
- CPPEditorWidget *editorWidget;
+ CppEditorWidget *editorWidget;
QVERIFY(openCppEditor(filePath, &editor, &editorWidget));
QCOMPARE(DocumentModel::openedDocuments().size(), 1);
@@ -276,7 +276,7 @@ void TestActionsTestCase::undoChangesInAllEditorWidgets()
}
}
-void TestActionsTestCase::executeActionsOnEditorWidget(CPPEditorWidget *editorWidget,
+void TestActionsTestCase::executeActionsOnEditorWidget(CppEditorWidget *editorWidget,
TestActionsTestCase::Actions actions)
{
foreach (const ActionPointer &action, actions)
@@ -291,7 +291,7 @@ void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationU
{
QVERIFY(translationUnit);
QVERIFY(editor);
- CPPEditorWidget *editorWidget = dynamic_cast<CPPEditorWidget *>(editor->editorWidget());
+ CppEditorWidget *editorWidget = dynamic_cast<CppEditorWidget *>(editor->editorWidget());
QVERIFY(editorWidget);
unsigned line, column;
@@ -329,7 +329,7 @@ class NoOpTokenAction : public TestActionsTestCase::AbstractAction
{
public:
/// Do nothing on each token
- void run(CPPEditorWidget *) {}
+ void run(CppEditorWidget *) {}
};
class FollowSymbolUnderCursorTokenAction : public TestActionsTestCase::AbstractAction
@@ -337,10 +337,10 @@ class FollowSymbolUnderCursorTokenAction : public TestActionsTestCase::AbstractA
public:
/// Follow symbol under cursor
/// Warning: May block if file does not exists (e.g. a not generated ui_* file).
- void run(CPPEditorWidget *editorWidget);
+ void run(CppEditorWidget *editorWidget);
};
-void FollowSymbolUnderCursorTokenAction::run(CPPEditorWidget *editorWidget)
+void FollowSymbolUnderCursorTokenAction::run(CppEditorWidget *editorWidget)
{
// Follow link
IEditor *editorBefore = EditorManager::currentEditor();
@@ -363,10 +363,10 @@ class SwitchDeclarationDefinitionTokenAction : public TestActionsTestCase::Abstr
{
public:
/// Switch Declaration/Definition on each token
- void run(CPPEditorWidget *);
+ void run(CppEditorWidget *);
};
-void SwitchDeclarationDefinitionTokenAction::run(CPPEditorWidget *)
+void SwitchDeclarationDefinitionTokenAction::run(CppEditorWidget *)
{
// Switch Declaration/Definition
IEditor *editorBefore = EditorManager::currentEditor();
@@ -388,10 +388,10 @@ class FindUsagesTokenAction : public TestActionsTestCase::AbstractAction
{
public:
/// Find Usages on each token
- void run(CPPEditorWidget *);
+ void run(CppEditorWidget *);
};
-void FindUsagesTokenAction::run(CPPEditorWidget *)
+void FindUsagesTokenAction::run(CppEditorWidget *)
{
CppEditor::Internal::CppEditorPlugin::instance()->findUsages();
QApplication::processEvents();
@@ -401,10 +401,10 @@ class RenameSymbolUnderCursorTokenAction : public TestActionsTestCase::AbstractA
{
public:
/// Rename Symbol Under Cursor on each token (Renaming is not applied)
- void run(CPPEditorWidget *);
+ void run(CppEditorWidget *);
};
-void RenameSymbolUnderCursorTokenAction::run(CPPEditorWidget *)
+void RenameSymbolUnderCursorTokenAction::run(CppEditorWidget *)
{
CppEditor::Internal::CppEditorPlugin::instance()->renameSymbolUnderCursor();
QApplication::processEvents();
@@ -414,10 +414,10 @@ class OpenTypeHierarchyTokenAction : public TestActionsTestCase::AbstractAction
{
public:
/// Open Type Hierarchy on each token
- void run(CPPEditorWidget *);
+ void run(CppEditorWidget *);
};
-void OpenTypeHierarchyTokenAction::run(CPPEditorWidget *)
+void OpenTypeHierarchyTokenAction::run(CppEditorWidget *)
{
CppEditor::Internal::CppEditorPlugin::instance()->openTypeHierarchy();
QApplication::processEvents();
@@ -428,10 +428,10 @@ class InvokeCompletionTokenAction : public TestActionsTestCase::AbstractAction
public:
/// Invoke completion menu on each token.
/// Warning: May create tool tip artefacts if focus is lost.
- void run(CPPEditorWidget *editorWidget);
+ void run(CppEditorWidget *editorWidget);
};
-void InvokeCompletionTokenAction::run(CPPEditorWidget *editorWidget)
+void InvokeCompletionTokenAction::run(CppEditorWidget *editorWidget)
{
// Invoke assistant and wait until it is finished
QEventLoop loop;
@@ -447,18 +447,18 @@ void InvokeCompletionTokenAction::run(CPPEditorWidget *editorWidget)
// editorWidget->setFocus();
QApplication::processEvents();
- TestActionsTestCase::undoChangesInDocument(editorWidget->baseTextDocument());
+ TestActionsTestCase::undoChangesInDocument(editorWidget->textDocument());
}
class RunAllQuickFixesTokenAction : public TestActionsTestCase::AbstractAction
{
public:
/// Trigger all Quick Fixes and apply the matching ones
- void run(CPPEditorWidget *editorWidget);
+ void run(CppEditorWidget *editorWidget);
};
// TODO: Some QuickFixes operate on selections.
-void RunAllQuickFixesTokenAction::run(CPPEditorWidget *editorWidget)
+void RunAllQuickFixesTokenAction::run(CppEditorWidget *editorWidget)
{
// Calling editorWidget->invokeAssist(QuickFix) would be not enough
// since we also want to execute the ones that match.
@@ -497,10 +497,10 @@ void RunAllQuickFixesTokenAction::run(CPPEditorWidget *editorWidget)
class SwitchHeaderSourceFileAction : public TestActionsTestCase::AbstractAction
{
public:
- void run(CPPEditorWidget *);
+ void run(CppEditorWidget *);
};
-void SwitchHeaderSourceFileAction::run(CPPEditorWidget *)
+void SwitchHeaderSourceFileAction::run(CppEditorWidget *)
{
// Switch Header/Source
IEditor *editorBefore = EditorManager::currentEditor();
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 38486016ed..5c5adb7d4e 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -113,7 +113,7 @@ typedef QByteArray _;
class VirtualFunctionTestAssistProvider : public VirtualFunctionAssistProvider
{
public:
- VirtualFunctionTestAssistProvider(CPPEditorWidget *editorWidget)
+ VirtualFunctionTestAssistProvider(CppEditorWidget *editorWidget)
: m_editorWidget(editorWidget)
{}
@@ -170,7 +170,7 @@ public:
OverrideItemList m_finalItems;
private:
- CPPEditorWidget *m_editorWidget;
+ CppEditorWidget *m_editorWidget;
};
class TestDocument;
@@ -308,7 +308,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
// Trigger the action
switch (action) {
case FollowSymbolUnderCursorAction: {
- CPPEditorWidget *widget = initialTestFile->m_editorWidget;
+ CppEditorWidget *widget = initialTestFile->m_editorWidget;
FollowSymbolUnderCursor *delegate = widget->followSymbolUnderCursorDelegate();
VirtualFunctionAssistProvider *original = delegate->virtualFunctionAssistProvider();
diff --git a/src/plugins/cpptools/cppcodestylesettingspage.cpp b/src/plugins/cpptools/cppcodestylesettingspage.cpp
index 5a3b055e23..084e8c2d64 100644
--- a/src/plugins/cpptools/cppcodestylesettingspage.cpp
+++ b/src/plugins/cpptools/cppcodestylesettingspage.cpp
@@ -465,7 +465,7 @@ void CppCodeStylePreferencesWidget::updatePreview()
const TextEditor::TabSettings ts = cppCodeStylePreferences->currentTabSettings();
QtStyleCodeFormatter formatter(ts, ccss);
foreach (TextEditor::SnippetEditorWidget *preview, m_previews) {
- preview->baseTextDocument()->setTabSettings(ts);
+ preview->textDocument()->setTabSettings(ts);
preview->setCodeStyle(cppCodeStylePreferences);
QTextDocument *doc = preview->document();
@@ -475,7 +475,7 @@ void CppCodeStylePreferencesWidget::updatePreview()
QTextCursor tc = preview->textCursor();
tc.beginEditBlock();
while (block.isValid()) {
- preview->baseTextDocument()->indenter()->indentBlock(doc, block, QChar::Null, ts);
+ preview->textDocument()->indenter()->indentBlock(doc, block, QChar::Null, ts);
block = block.next();
}
@@ -492,7 +492,7 @@ void CppCodeStylePreferencesWidget::decorateEditors(const TextEditor::FontSettin
});
foreach (TextEditor::SnippetEditorWidget *editor, m_previews) {
- editor->baseTextDocument()->setFontSettings(fontSettings);
+ editor->textDocument()->setFontSettings(fontSettings);
if (provider)
provider->decorateEditor(editor);
}
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index e50a2a01b2..d76c4c9d98 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -34,7 +34,7 @@
#include <texteditor/codeassist/iassistproposal.h>
#include <texteditor/convenience.h>
-#include <texteditor/plaintexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <utils/changeset.h>
#include <utils/fileutils.h>
@@ -103,7 +103,7 @@ public:
QStringList completions;
CppCompletionAssistInterface *ai
= new CppCompletionAssistInterface(m_editorWidget->document(), m_position,
- m_editorWidget->baseTextDocument()->filePath(),
+ m_editorWidget->textDocument()->filePath(),
ExplicitlyInvoked, m_snapshot,
ProjectPart::HeaderPaths());
CppCompletionAssistProcessor processor;
@@ -306,8 +306,6 @@ void CppToolsPlugin::test_completion()
expectedCompletions.sort();
QEXPECT_FAIL("enum_in_function_in_struct_in_function", "doesn't work", Abort);
- QEXPECT_FAIL("nested_class_in_template_class_QTCREATORBUG-11752",
- "related to infiniteLoopLocalTypedef_QTCREATORBUG-11999", Abort);
QCOMPARE(actualCompletions, expectedCompletions);
}
@@ -2264,6 +2262,26 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("foo")
<< QLatin1String("Foo"));
+ QTest::newRow("infiniteLoopLocalTypedef_QTCREATORBUG-11999") << _(
+ "template <typename T>\n"
+ "struct Temp\n"
+ "{\n"
+ " struct Nested\n"
+ " {\n"
+ " typedef Temp<T> TempT;\n"
+ " T t;\n"
+ " };\n"
+ " Nested nested;\n"
+ "};\n"
+ "struct Foo { int foo; };\n"
+ "void fun() {\n"
+ " Temp<Foo> tempFoo;\n"
+ " @\n"
+ "}\n"
+ ) << _("tempFoo.nested.t.") << (QStringList()
+ << QLatin1String("foo")
+ << QLatin1String("Foo"));
+
QTest::newRow("lambda_parameter") << _(
"auto func = [](int arg1) { return @; };\n"
) << _("ar") << (QStringList()
@@ -2295,6 +2313,35 @@ void CppToolsPlugin::test_completion_data()
) << _("derived.t.") << (QStringList()
<< QLatin1String("foo")
<< QLatin1String("Foo"));
+
+ QTest::newRow("template_specialization_and_initialization_with_pointer1") << _(
+ "template <typename T>\n"
+ "struct S {};\n"
+ "template <typename T>\n"
+ "struct S<T*> { T *t; };\n"
+ "struct Foo { int foo; };\n"
+ "void fun() {\n"
+ " S<Foo*> s;\n"
+ " @\n"
+ "}\n"
+ ) << _("s.t->") << (QStringList()
+ << QLatin1String("foo")
+ << QLatin1String("Foo"));
+
+ // this is not a valid code(is not compile) but it caused a crash
+ QTest::newRow("template_specialization_and_initialization_with_pointer2") << _(
+ "template <typename T1, typename T2 = int>\n"
+ "struct S {};\n"
+ "template <typename T1, typename T2>\n"
+ "struct S<T1*> { T1 *t; };\n"
+ "struct Foo { int foo; };\n"
+ "void fun() {\n"
+ " S<Foo*> s;\n"
+ " @\n"
+ "}\n"
+ ) << _("s.t->") << (QStringList()
+ << QLatin1String("foo")
+ << QLatin1String("Foo"));
}
void CppToolsPlugin::test_completion_member_access_operator()
diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp
index d1f1322223..ab4f0078fc 100644
--- a/src/plugins/cpptools/cppcompletionassist.cpp
+++ b/src/plugins/cpptools/cppcompletionassist.cpp
@@ -305,7 +305,7 @@ void CppAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor *e
// Determine the length of characters that should just be kept on the editor, but do
// not consider content that ends as an identifier (which could be undesired).
- const int lineEnd = editor->position(TextEditor::ITextEditor::EndOfLine);
+ const int lineEnd = editor->position(TextEditor::BaseTextEditor::EndOfLine);
const QString inEditor = editor->textDocument()->textAt(editor->position(),
lineEnd - editor->position());
int preserveLength = 0;
diff --git a/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp b/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
index 65f2c8468a..b0781dac35 100644
--- a/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
+++ b/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
@@ -32,7 +32,9 @@
#include "cpptoolsplugin.h"
#include "cpptoolstestcase.h"
-#include <texteditor/plaintexteditor.h>
+#include <coreplugin/coreconstants.h>
+
+#include <texteditor/basetexteditor.h>
#include <utils/fileutils.h>
@@ -100,20 +102,22 @@ public:
QVERIFY(ast);
// Open file
- QScopedPointer<TextEditor::BaseTextEditorWidget> editorWidget(
- new TextEditor::PlainTextEditorWidget);
+ auto textDocument = new TextEditor::BaseTextDocument;
+ textDocument->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
+ TextEditor::BaseTextEditorWidget editorWidget(textDocument, 0);
+ editorWidget.setupAsPlainEditor();
QString error;
- editorWidget->open(&error, document->fileName(), document->fileName());
+ editorWidget.open(&error, document->fileName(), document->fileName());
QVERIFY(error.isEmpty());
// Set cursor position
- QTextCursor cursor = editorWidget->textCursor();
+ QTextCursor cursor = editorWidget.textCursor();
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, cursorPosition);
- editorWidget->setTextCursor(cursor);
+ editorWidget.setTextCursor(cursor);
- QTextDocument *textDocument = editorWidget->document();
+ QTextDocument *qtextDocument = editorWidget.document();
CppRefactoringFilePtr cppRefactoringFile
- = CppRefactoringChanges::file(editorWidget.data(), document);
+ = CppRefactoringChanges::file(&editorWidget, document);
// Prepare for formatting
Overview overview;
@@ -126,11 +130,11 @@ public:
Utils::ChangeSet change = formatter.format(ast); // ChangeSet may be empty.
// Apply change
- QTextCursor changeCursor(textDocument);
+ QTextCursor changeCursor(qtextDocument);
change.apply(&changeCursor);
// Compare
- QCOMPARE(textDocument->toPlainText(), expectedSource);
+ QCOMPARE(qtextDocument->toPlainText(), expectedSource);
}
};
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index 56f31d9218..f6d0ec1ce3 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -121,7 +121,7 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
, m_initialized(false)
, m_lastHighlightRevision(0)
, m_lastHighlightOnCompleteSemanticInfo(true)
- , m_highlightingSupport(modelManager->highlightingSupport(textEditor->baseTextDocument()))
+ , m_highlightingSupport(modelManager->highlightingSupport(textEditor->textDocument()))
, m_completionAssistProvider(
modelManager->completionAssistProvider(textEditor->document()->mimeType()))
{
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.h b/src/plugins/cpptools/cpptoolseditorsupport.h
index 18bf08fb5b..f859d55b1a 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.h
+++ b/src/plugins/cpptools/cpptoolseditorsupport.h
@@ -51,7 +51,7 @@ class DeclarationAST;
namespace TextEditor {
class BaseTextEditor;
-class ITextMark;
+class TextMark;
} // namespace TextEditor
namespace CppTools {
diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp
index d3cb9514eb..f2c8e455c4 100644
--- a/src/plugins/cpptools/cpptoolsplugin.cpp
+++ b/src/plugins/cpptools/cpptoolsplugin.cpp
@@ -48,6 +48,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>
+#include <coreplugin/variablemanager.h>
#include <coreplugin/vcsmanager.h>
#include <cppeditor/cppeditorconstants.h>
@@ -96,6 +97,16 @@ void CppToolsPlugin::clearHeaderSourceCache()
m_headerSourceMapping.clear();
}
+Utils::FileName CppToolsPlugin::licenseTemplatePath()
+{
+ return Utils::FileName::fromString(m_instance->m_fileSettings->licenseTemplatePath);
+}
+
+QString CppToolsPlugin::licenseTemplate()
+{
+ return m_instance->m_fileSettings->licenseTemplate();
+}
+
const QStringList &CppToolsPlugin::headerSearchPaths()
{
return m_instance->m_fileSettings->headerSearchPaths;
@@ -173,6 +184,13 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
mcpptools->addAction(command);
connect(openInNextSplitAction, SIGNAL(triggered()), this, SLOT(switchHeaderSourceInNextSplit()));
+ Core::VariableManager::registerVariable("Cpp:LicenseTemplate",
+ tr("The license template."),
+ [this]() { return CppToolsPlugin::licenseTemplate(); });
+ Core::VariableManager::registerFileVariables("Cpp:LicenseTemplatePath",
+ tr("The configured path to the license template."),
+ [this]() { return CppToolsPlugin::licenseTemplatePath().toString(); });
+
return true;
}
diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h
index 771bc542c6..27de8d0ba4 100644
--- a/src/plugins/cpptools/cpptoolsplugin.h
+++ b/src/plugins/cpptools/cpptoolsplugin.h
@@ -42,6 +42,8 @@ class QFileInfo;
class QDir;
QT_END_NAMESPACE
+namespace Utils { class FileName; }
+
namespace CppTools {
class CppToolsSettings;
@@ -67,6 +69,8 @@ public:
static const QStringList &headerPrefixes();
static const QStringList &sourcePrefixes();
static void clearHeaderSourceCache();
+ static Utils::FileName licenseTemplatePath();
+ static QString licenseTemplate();
bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized();
diff --git a/src/plugins/cpptools/stringtable.cpp b/src/plugins/cpptools/stringtable.cpp
index 9617430d4a..b5acd3f5d0 100644
--- a/src/plugins/cpptools/stringtable.cpp
+++ b/src/plugins/cpptools/stringtable.cpp
@@ -29,6 +29,8 @@
#include "stringtable.h"
+#include <utils/qtcassert.h>
+
#include <QDebug>
#include <QThreadPool>
#include <QTime>
@@ -58,6 +60,9 @@ QString StringTable::insert(const QString &string)
if (string.isEmpty())
return string;
+#if QT_VERSION >= 0x050000 && QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+ QTC_ASSERT(const_cast<QString&>(string).data_ptr()->ref.isSharable(), return string);
+#endif
m_stopGCRequested.fetchAndStoreAcquire(true);
@@ -83,12 +88,13 @@ enum {
DebugStringTable = 0
};
-static inline int qstringRefCount(const QString &string)
+static inline bool isQStringInUse(const QString &string)
{
#if QT_VERSION >= 0x050000
- return const_cast<QString&>(string).data_ptr()->ref.atomic.load();
+ QArrayData *data_ptr = const_cast<QString&>(string).data_ptr();
+ return data_ptr->ref.isShared() || data_ptr->ref.isStatic();
#else
- return const_cast<QString&>(string).data_ptr()->ref;
+ return const_cast<QString&>(string).data_ptr()->ref != 1;
#endif
}
@@ -108,7 +114,7 @@ void StringTable::GC()
if (m_stopGCRequested.testAndSetRelease(true, false))
return;
- if (qstringRefCount(*i) == 1)
+ if (!isQStringInUse(*i))
i = m_strings.erase(i);
else
++i;
diff --git a/src/plugins/cvs/checkoutwizard.cpp b/src/plugins/cvs/checkoutwizard.cpp
index 6c7cfca6d4..ce4b3ab4fc 100644
--- a/src/plugins/cvs/checkoutwizard.cpp
+++ b/src/plugins/cvs/checkoutwizard.cpp
@@ -80,7 +80,7 @@ VcsBase::Command *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
QTC_ASSERT(cwp, return 0);
const CvsSettings settings = CvsPlugin::instance()->settings();
- const QString binary = settings.binaryPath();
+ const Utils::FileName binary = settings.binaryPath();
QStringList args;
const QString repository = cwp->repository();
diff --git a/src/plugins/cvs/cvsconstants.h b/src/plugins/cvs/cvsconstants.h
index 835c720568..bb360fd2dc 100644
--- a/src/plugins/cvs/cvsconstants.h
+++ b/src/plugins/cvs/cvsconstants.h
@@ -33,12 +33,6 @@
namespace Cvs {
namespace Constants {
-const char CVS_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.cvs.submit";
-const char CVSCOMMITEDITOR[] = "CVS Commit Editor";
-const char CVSCOMMITEDITOR_ID[] = "CVS Commit Editor";
-const char CVSCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "CVS Commit Editor");
-const char SUBMIT_CURRENT[] = "CVS.SubmitCurrentLog";
-const char DIFF_SELECTED[] = "CVS.DiffSelectedFilesInLog";
enum { debug = 0 };
} // namespace Constants
diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp
index af1b9c0b9d..bb62828c6d 100644
--- a/src/plugins/cvs/cvscontrol.cpp
+++ b/src/plugins/cvs/cvscontrol.cpp
@@ -55,10 +55,10 @@ Core::Id CvsControl::id() const
bool CvsControl::isConfigured() const
{
- const QString binary = m_plugin->settings().binaryPath();
+ const Utils::FileName binary = m_plugin->settings().binaryPath();
if (binary.isEmpty())
return false;
- QFileInfo fi(binary);
+ QFileInfo fi = binary.toFileInfo();
return fi.exists() && fi.isFile() && fi.isExecutable();
}
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index c155c2ea79..2efc277ea0 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -75,8 +75,9 @@
#include <QTest>
#endif
-using namespace VcsBase;
using namespace Core;
+using namespace VcsBase;
+using namespace Utils;
namespace Cvs {
namespace Internal {
@@ -92,30 +93,37 @@ static inline QString msgLogParsingFailed()
return CvsPlugin::tr("Parsing of the log output failed");
}
-static const char CMD_ID_CVS_MENU[] = "CVS.Menu";
-static const char CMD_ID_ADD[] = "CVS.Add";
-static const char CMD_ID_DELETE_FILE[] = "CVS.Delete";
-static const char CMD_ID_EDIT_FILE[] = "CVS.EditFile";
-static const char CMD_ID_UNEDIT_FILE[] = "CVS.UneditFile";
-static const char CMD_ID_UNEDIT_REPOSITORY[] = "CVS.UneditRepository";
-static const char CMD_ID_REVERT[] = "CVS.Revert";
-static const char CMD_ID_DIFF_PROJECT[] = "CVS.DiffAll";
-static const char CMD_ID_DIFF_CURRENT[] = "CVS.DiffCurrent";
-static const char CMD_ID_COMMIT_ALL[] = "CVS.CommitAll";
-static const char CMD_ID_REVERT_ALL[] = "CVS.RevertAll";
-static const char CMD_ID_COMMIT_CURRENT[] = "CVS.CommitCurrent";
-static const char CMD_ID_FILELOG_CURRENT[] = "CVS.FilelogCurrent";
-static const char CMD_ID_ANNOTATE_CURRENT[] = "CVS.AnnotateCurrent";
-static const char CMD_ID_STATUS[] = "CVS.Status";
-static const char CMD_ID_UPDATE[] = "CVS.Update";
-static const char CMD_ID_PROJECTLOG[] = "CVS.ProjectLog";
-static const char CMD_ID_PROJECTCOMMIT[] = "CVS.ProjectCommit";
-static const char CMD_ID_REPOSITORYLOG[] = "CVS.RepositoryLog";
-static const char CMD_ID_REPOSITORYDIFF[] = "CVS.RepositoryDiff";
-static const char CMD_ID_REPOSITORYSTATUS[] = "CVS.RepositoryStatus";
-static const char CMD_ID_REPOSITORYUPDATE[] = "CVS.RepositoryUpdate";
-
-static const VcsBaseEditorParameters editorParameters[] = {
+const char CMD_ID_CVS_MENU[] = "CVS.Menu";
+const char CMD_ID_ADD[] = "CVS.Add";
+const char CMD_ID_DELETE_FILE[] = "CVS.Delete";
+const char CMD_ID_EDIT_FILE[] = "CVS.EditFile";
+const char CMD_ID_UNEDIT_FILE[] = "CVS.UneditFile";
+const char CMD_ID_UNEDIT_REPOSITORY[] = "CVS.UneditRepository";
+const char CMD_ID_REVERT[] = "CVS.Revert";
+const char CMD_ID_DIFF_PROJECT[] = "CVS.DiffAll";
+const char CMD_ID_DIFF_CURRENT[] = "CVS.DiffCurrent";
+const char CMD_ID_COMMIT_ALL[] = "CVS.CommitAll";
+const char CMD_ID_REVERT_ALL[] = "CVS.RevertAll";
+const char CMD_ID_COMMIT_CURRENT[] = "CVS.CommitCurrent";
+const char CMD_ID_FILELOG_CURRENT[] = "CVS.FilelogCurrent";
+const char CMD_ID_ANNOTATE_CURRENT[] = "CVS.AnnotateCurrent";
+const char CMD_ID_STATUS[] = "CVS.Status";
+const char CMD_ID_UPDATE[] = "CVS.Update";
+const char CMD_ID_PROJECTLOG[] = "CVS.ProjectLog";
+const char CMD_ID_PROJECTCOMMIT[] = "CVS.ProjectCommit";
+const char CMD_ID_REPOSITORYLOG[] = "CVS.RepositoryLog";
+const char CMD_ID_REPOSITORYDIFF[] = "CVS.RepositoryDiff";
+const char CMD_ID_REPOSITORYSTATUS[] = "CVS.RepositoryStatus";
+const char CMD_ID_REPOSITORYUPDATE[] = "CVS.RepositoryUpdate";
+
+const char CVS_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.cvs.submit";
+const char CVSCOMMITEDITOR[] = "CVS Commit Editor";
+const char CVSCOMMITEDITOR_ID[] = "CVS Commit Editor";
+const char CVSCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "CVS Commit Editor");
+const char SUBMIT_CURRENT[] = "CVS.SubmitCurrentLog";
+const char DIFF_SELECTED[] = "CVS.DiffSelectedFilesInLog";
+
+const VcsBaseEditorParameters editorParameters[] = {
{
OtherContent,
"CVS Command Log Editor", // id
@@ -143,7 +151,7 @@ static const VcsBaseEditorParameters editorParameters[] = {
static inline const VcsBaseEditorParameters *findType(int ie)
{
const EditorContentType et = static_cast<EditorContentType>(ie);
- return VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VcsBaseEditorParameters), et);
+ return VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters) / sizeof(editorParameters[0]), et);
}
static inline QString debugCodec(const QTextCodec *c)
@@ -211,11 +219,11 @@ bool CvsPlugin::isCommitEditorOpen() const
}
static const VcsBaseSubmitEditorParameters submitParameters = {
- Constants::CVS_SUBMIT_MIMETYPE,
- Constants::CVSCOMMITEDITOR_ID,
- Constants::CVSCOMMITEDITOR_DISPLAY_NAME,
- Constants::CVSCOMMITEDITOR,
- VcsBase::VcsBaseSubmitEditorParameters::DiffFiles
+ CVS_SUBMIT_MIMETYPE,
+ CVSCOMMITEDITOR_ID,
+ CVSCOMMITEDITOR_DISPLAY_NAME,
+ CVSCOMMITEDITOR,
+ VcsBaseSubmitEditorParameters::DiffFiles
};
bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
@@ -251,13 +259,13 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
addAutoReleasedObject(new CheckoutWizardFactory);
const QString prefix = QLatin1String("cvs");
- m_commandLocator = new Core::CommandLocator("CVS", prefix, prefix);
+ m_commandLocator = new CommandLocator("CVS", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
// Register actions
- ActionContainer *toolsContainer = Core::ActionManager::actionContainer(M_TOOLS);
+ ActionContainer *toolsContainer = ActionManager::actionContainer(M_TOOLS);
- ActionContainer *cvsMenu = Core::ActionManager::createMenu(Id(CMD_ID_CVS_MENU));
+ ActionContainer *cvsMenu = ActionManager::createMenu(Id(CMD_ID_CVS_MENU));
cvsMenu->menu()->setTitle(tr("&CVS"));
toolsContainer->addMenu(cvsMenu);
m_menuAction = cvsMenu->menu()->menuAction();
@@ -266,8 +274,8 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
Command *command;
- m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_diffCurrentAction,
+ m_diffCurrentAction = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_diffCurrentAction,
CMD_ID_DIFF_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+D") : tr("Alt+C,Alt+D")));
@@ -275,8 +283,8 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_filelogCurrentAction,
+ m_filelogCurrentAction = new ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_filelogCurrentAction,
CMD_ID_FILELOG_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_filelogCurrentAction, SIGNAL(triggered()), this,
@@ -284,8 +292,8 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_annotateCurrentAction,
+ m_annotateCurrentAction = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_annotateCurrentAction,
CMD_ID_ANNOTATE_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
@@ -295,8 +303,8 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
cvsMenu->addSeparator(globalcontext);
- m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_addAction, CMD_ID_ADD,
+ m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_addAction, CMD_ID_ADD,
globalcontext);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+A") : tr("Alt+C,Alt+A")));
@@ -304,8 +312,8 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_commitCurrentAction,
+ m_commitCurrentAction = new ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_commitCurrentAction,
CMD_ID_COMMIT_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+C") : tr("Alt+C,Alt+C")));
@@ -313,16 +321,16 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
+ m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_revertAction, CMD_ID_REVERT,
+ m_revertAction = new ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_revertAction, CMD_ID_REVERT,
globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
@@ -331,60 +339,60 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
cvsMenu->addSeparator(globalcontext);
- m_editCurrentAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, globalcontext);
+ m_editCurrentAction = new ParameterAction(tr("Edit"), tr("Edit \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_editCurrentAction, SIGNAL(triggered()), this, SLOT(editCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_uneditCurrentAction = new Utils::ParameterAction(tr("Unedit"), tr("Unedit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, globalcontext);
+ m_uneditCurrentAction = new ParameterAction(tr("Unedit"), tr("Unedit \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_uneditCurrentAction, SIGNAL(triggered()), this, SLOT(uneditCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_uneditRepositoryAction = new QAction(tr("Unedit Repository"), this);
- command = Core::ActionManager::registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, globalcontext);
+ command = ActionManager::registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, globalcontext);
connect(m_uneditRepositoryAction, SIGNAL(triggered()), this, SLOT(uneditCurrentRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
cvsMenu->addSeparator(globalcontext);
- m_diffProjectAction = new Utils::ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
+ m_diffProjectAction = new ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS,
+ m_statusProjectAction = new ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS,
globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
+ m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext);
+ m_updateProjectAction = new ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- m_commitProjectAction = new Utils::ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, globalcontext);
+ m_commitProjectAction = new ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, globalcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(commitProject()));
cvsMenu->addAction(command);
@@ -393,59 +401,59 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
cvsMenu->addSeparator(globalcontext);
m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
- command = Core::ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext);
+ command = ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext);
connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
- command = Core::ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext);
+ command = ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext);
connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_logRepositoryAction = new QAction(tr("Repository Log"), this);
- command = Core::ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
+ command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_updateRepositoryAction = new QAction(tr("Update Repository"), this);
- command = Core::ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext);
+ command = ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext);
connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_commitAllAction = new QAction(tr("Commit All Files"), this);
- command = Core::ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
+ command = ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
globalcontext);
connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
- command = Core::ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
- globalcontext);
+ command = ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
+ globalcontext);
connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
// Actions of the submit editor
- Context cvscommitcontext(Constants::CVSCOMMITEDITOR);
+ Context cvscommitcontext(CVSCOMMITEDITOR);
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- command = Core::ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, cvscommitcontext);
+ command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, cvscommitcontext);
command->setAttribute(Command::CA_UpdateText);
connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- command = Core::ActionManager::registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, cvscommitcontext);
+ command = ActionManager::registerAction(m_submitDiffAction , DIFF_SELECTED, cvscommitcontext);
m_submitUndoAction = new QAction(tr("&Undo"), this);
- command = Core::ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext);
+ command = ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext);
m_submitRedoAction = new QAction(tr("&Redo"), this);
- command = Core::ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext);
+ command = ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext);
return true;
}
@@ -512,7 +520,7 @@ static void setDiffBaseDirectory(IEditor *editor, const QString &db)
CvsSubmitEditor *CvsPlugin::openCVSSubmitEditor(const QString &fileName)
{
- IEditor *editor = EditorManager::openEditor(fileName, Constants::CVSCOMMITEDITOR_ID);
+ IEditor *editor = EditorManager::openEditor(fileName, CVSCOMMITEDITOR_ID);
CvsSubmitEditor *submitEditor = qobject_cast<CvsSubmitEditor*>(editor);
QTC_CHECK(submitEditor);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
@@ -685,7 +693,7 @@ void CvsPlugin::startCommit(const QString &workingDir, const QString &file)
m_commitRepository = workingDir;
// Create a new submit change file containing the submit template
- Utils::TempFileSaver saver;
+ TempFileSaver saver;
saver.setAutoRemove(false);
// TODO: Retrieve submit template from
const QString submitTemplate;
@@ -758,12 +766,12 @@ void CvsPlugin::filelog(const QString &workingDir,
// Re-use an existing view if possible to support
// the common usage pattern of continuously changing and diffing a file
const QString tag = VcsBaseEditorWidget::editorTag(LogOutput, workingDir, QStringList(file));
- if (Core::IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
+ if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->document()->setContents(response.stdOut.toUtf8());
- Core::EditorManager::activateEditor(editor);
+ EditorManager::activateEditor(editor);
} else {
const QString title = QString::fromLatin1("cvs log %1").arg(id);
- Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, LogOutput, source, codec);
+ IEditor *newEditor = showOutputInEditor(title, response.stdOut, LogOutput, source, codec);
VcsBaseEditorWidget::tagEditor(newEditor, tag);
if (enableAnnotationContextMenu)
VcsBaseEditorWidget::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
@@ -1125,7 +1133,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
unsigned flags,
QTextCodec *outputCodec) const
{
- const QString executable = m_settings.binaryPath();
+ const FileName executable = m_settings.binaryPath();
CvsResponse response;
if (executable.isEmpty()) {
response.result = CvsResponse::OtherError;
@@ -1133,7 +1141,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
return response;
}
// Run, connect stderr to the output window
- const Utils::SynchronousProcessResponse sp_resp =
+ const SynchronousProcessResponse sp_resp =
runVcs(workingDirectory, executable, m_settings.addOptions(arguments),
timeOut, flags, outputCodec);
@@ -1141,20 +1149,20 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
response.stdErr = sp_resp.stdErr;
response.stdOut = sp_resp.stdOut;
switch (sp_resp.result) {
- case Utils::SynchronousProcessResponse::Finished:
+ case SynchronousProcessResponse::Finished:
response.result = CvsResponse::Ok;
break;
- case Utils::SynchronousProcessResponse::FinishedError:
+ case SynchronousProcessResponse::FinishedError:
response.result = CvsResponse::NonNullExitCode;
break;
- case Utils::SynchronousProcessResponse::TerminatedAbnormally:
- case Utils::SynchronousProcessResponse::StartFailed:
- case Utils::SynchronousProcessResponse::Hang:
+ case SynchronousProcessResponse::TerminatedAbnormally:
+ case SynchronousProcessResponse::StartFailed:
+ case SynchronousProcessResponse::Hang:
break;
}
if (response.result != CvsResponse::Ok)
- response.message = sp_resp.exitMessage(executable, timeOut);
+ response.message = sp_resp.exitMessage(executable.toString(), timeOut);
return response;
}
@@ -1177,7 +1185,7 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
if (!e)
return 0;
s.replace(QLatin1Char(' '), QLatin1Char('_'));
- e->baseTextDocument()->setSuggestedFileName(s);
+ e->textDocument()->setSuggestedFileName(s);
e->setForceReadOnly(true);
if (!source.isEmpty())
e->setSource(source);
diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h
index bc725da768..29ad8c3cb3 100644
--- a/src/plugins/cvs/cvsplugin.h
+++ b/src/plugins/cvs/cvsplugin.h
@@ -43,7 +43,6 @@ QT_END_NAMESPACE
namespace Core {
class CommandLocator;
-class IEditorFactory;
class IVersionControl;
}
diff --git a/src/plugins/cvs/settingspage.cpp b/src/plugins/cvs/settingspage.cpp
index e6d1a16499..16717868ee 100644
--- a/src/plugins/cvs/settingspage.cpp
+++ b/src/plugins/cvs/settingspage.cpp
@@ -66,7 +66,7 @@ CvsSettings SettingsPageWidget::settings() const
void SettingsPageWidget::setSettings(const CvsSettings &s)
{
- m_ui.commandPathChooser->setPath(s.binaryPath());
+ m_ui.commandPathChooser->setFileName(s.binaryPath());
m_ui.rootLineEdit->setText(s.stringValue(CvsSettings::cvsRootKey));
m_ui.diffOptionsLineEdit->setText(s.stringValue(CvsSettings::diffOptionsKey));
m_ui.timeOutSpinBox->setValue(s.intValue(CvsSettings::timeoutKey));
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 1614486ca0..ac94225b88 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -336,15 +336,14 @@ void BreakHandler::saveBreakpoints()
map.insert(_("message"), data.message);
list.append(map);
}
- DebuggerCore::setSessionValue("Breakpoints", list);
+ setSessionValue("Breakpoints", list);
//qDebug() << "SAVED BREAKPOINTS" << this << list.size();
}
void BreakHandler::loadBreakpoints()
{
- QTC_ASSERT(debuggerCore(), return);
//qDebug() << "LOADING BREAKPOINTS...";
- QVariant value = DebuggerCore::sessionValue("Breakpoints");
+ QVariant value = sessionValue("Breakpoints");
QList<QVariant> list = value.toList();
//clear();
foreach (const QVariant &var, list) {
@@ -686,7 +685,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
}
switch (role) {
case Qt::ToolTipRole:
- if (debuggerCore()->boolSetting(UseToolTipsInBreakpointsView))
+ if (boolSetting(UseToolTipsInBreakpointsView))
return QVariant(it->toToolTip());
break;
}
@@ -1217,7 +1216,7 @@ void BreakHandler::gotoLocation(BreakpointModelId id) const
{
ConstIterator it = m_storage.find(id);
BREAK_ASSERT(it != m_storage.end(), return);
- DebuggerEngine *engine = debuggerCore()->currentEngine();
+ DebuggerEngine *engine = currentEngine();
if (it->data.type == BreakpointByAddress) {
if (engine)
engine->gotoLocation(it->data.address);
@@ -1468,10 +1467,8 @@ void BreakHandler::BreakpointItem::updateMarker(BreakpointModelId id)
if (marker && (file != marker->fileName() || line != marker->lineNumber()))
destroyMarker();
- if (!marker && !file.isEmpty() && line > 0) {
+ if (!marker && !file.isEmpty() && line > 0)
marker = new BreakpointMarker(id, file, line);
- marker->init();
- }
}
QIcon BreakHandler::BreakpointItem::icon() const
diff --git a/src/plugins/debugger/breakpointmarker.cpp b/src/plugins/debugger/breakpointmarker.cpp
index d631d9c084..4b861039e3 100644
--- a/src/plugins/debugger/breakpointmarker.cpp
+++ b/src/plugins/debugger/breakpointmarker.cpp
@@ -43,10 +43,10 @@ namespace Internal {
BreakpointMarker::BreakpointMarker(BreakpointModelId id,
const QString &fileName, int lineNumber)
- : BaseTextMark(fileName, lineNumber), m_id(id)
+ : TextMark(fileName, lineNumber), m_id(id)
{
setIcon(breakHandler()->icon(m_id));
- setPriority(TextEditor::ITextMark::NormalPriority);
+ setPriority(TextEditor::TextMark::NormalPriority);
//qDebug() << "CREATE MARKER " << fileName << lineNumber;
}
@@ -62,7 +62,7 @@ void BreakpointMarker::removedFromEditor()
void BreakpointMarker::updateLineNumber(int lineNumber)
{
- BaseTextMark::updateLineNumber(lineNumber);
+ TextMark::updateLineNumber(lineNumber);
breakHandler()->updateLineNumberFromMarker(m_id, lineNumber);
}
@@ -78,7 +78,7 @@ void BreakpointMarker::clicked()
void BreakpointMarker::updateFileName(const QString &fileName)
{
- BaseTextMark::updateFileName(fileName);
+ TextMark::updateFileName(fileName);
breakHandler()->updateFileNameFromMarker(m_id, fileName);
}
diff --git a/src/plugins/debugger/breakpointmarker.h b/src/plugins/debugger/breakpointmarker.h
index b41daab79c..454042cd5c 100644
--- a/src/plugins/debugger/breakpointmarker.h
+++ b/src/plugins/debugger/breakpointmarker.h
@@ -32,13 +32,13 @@
#include "breakpoint.h"
-#include <texteditor/basetextmark.h>
+#include <texteditor/textmark.h>
namespace Debugger {
namespace Internal {
// The red blob on the left side in the cpp editor.
-class BreakpointMarker : public TextEditor::BaseTextMark
+class BreakpointMarker : public TextEditor::TextMark
{
public:
BreakpointMarker(BreakpointModelId id, const QString &fileName, int lineNumber);
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp
index c6a5bd0c06..461729779e 100644
--- a/src/plugins/debugger/breakwindow.cpp
+++ b/src/plugins/debugger/breakwindow.cpp
@@ -655,7 +655,7 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) :
m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
QFormLayout *formLayout = new QFormLayout;
- if (debuggerCore()->currentEngine()->hasCapability(BreakConditionCapability))
+ if (currentEngine()->hasCapability(BreakConditionCapability))
formLayout->addRow(tr("&Condition:"), m_lineEditCondition);
formLayout->addRow(tr("&Ignore count:"), m_spinBoxIgnoreCount);
formLayout->addRow(tr("&Thread specification:"), m_lineEditThreadSpec);
@@ -678,7 +678,7 @@ BreakTreeView::BreakTreeView()
{
setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png")));
setSelectionMode(QAbstractItemView::ExtendedSelection);
- connect(debuggerCore()->action(UseAddressInBreakpointsView),
+ connect(action(UseAddressInBreakpointsView),
SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool)));
}
@@ -816,11 +816,11 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator();
menu.addAction(synchronizeAction);
menu.addSeparator();
- menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView));
- if (debuggerCore()->currentEngine()->hasCapability(MemoryAddressCapability))
- menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView));
+ menu.addAction(action(UseToolTipsInBreakpointsView));
+ if (currentEngine()->hasCapability(MemoryAddressCapability))
+ menu.addAction(action(UseAddressInBreakpointsView));
menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index 9fcc912688..f1bcf88274 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -55,7 +55,7 @@
#include <coreplugin/icore.h>
#include <projectexplorer/taskhub.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <utils/synchronousprocess.h>
#include <utils/qtcprocess.h>
@@ -195,7 +195,7 @@ namespace Internal {
static inline bool isCreatorConsole(const DebuggerStartParameters &sp)
{
- return !debuggerCore()->boolSetting(UseCdbConsole) && sp.useTerminal
+ return !boolSetting(UseCdbConsole) && sp.useTerminal
&& (sp.startMode == StartInternal || sp.startMode == StartExternal);
}
@@ -345,11 +345,11 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp) :
m_watchPointY(0),
m_ignoreCdbOutput(false)
{
- connect(debuggerCore()->action(OperateByInstruction), SIGNAL(triggered(bool)),
+ connect(action(OperateByInstruction), SIGNAL(triggered(bool)),
this, SLOT(operateByInstructionTriggered(bool)));
- connect(debuggerCore()->action(VerboseLog), SIGNAL(triggered(bool)),
+ connect(action(VerboseLog), SIGNAL(triggered(bool)),
this, SLOT(verboseLogTriggered(bool)));
- connect(debuggerCore()->action(CreateFullBacktrace), SIGNAL(triggered()),
+ connect(action(CreateFullBacktrace), SIGNAL(triggered()),
this, SLOT(createFullBacktrace()));
setObjectName(QLatin1String("CdbEngine"));
connect(&m_process, SIGNAL(finished(int)), this, SLOT(processFinished()));
@@ -366,8 +366,8 @@ void CdbEngine::init()
m_specialStopMode = NoSpecialStop;
m_nextCommandToken = 0;
m_currentBuiltinCommandIndex = -1;
- m_operateByInstructionPending = debuggerCore()->action(OperateByInstruction)->isChecked();
- m_verboseLogPending = debuggerCore()->boolSetting(VerboseLog);
+ m_operateByInstructionPending = action(OperateByInstruction)->isChecked();
+ m_verboseLogPending = boolSetting(VerboseLog);
m_operateByInstruction = true; // Default CDB setting
m_verboseLog = false; // Default CDB setting
m_notifyEngineShutdownOnTermination = false;
@@ -447,7 +447,7 @@ void CdbEngine::syncVerboseLog(bool verboseLog)
postCommand(m_verboseLog ? QByteArray("!sym noisy") : QByteArray("!sym quiet"), 0);
}
-bool CdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
+bool CdbEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &contextIn)
{
if (debug)
@@ -597,9 +597,9 @@ void CdbEngine::setupEngine()
if (debug)
qDebug(">setupEngine");
// Nag to add symbol server and cache
- QStringList symbolPaths = debuggerCore()->stringListSetting(CdbSymbolPaths);
+ QStringList symbolPaths = stringListSetting(CdbSymbolPaths);
if (CdbSymbolPathListEditor::promptToAddSymbolPaths(&symbolPaths))
- debuggerCore()->action(CdbSymbolPaths)->setValue(symbolPaths);
+ action(CdbSymbolPaths)->setValue(symbolPaths);
init();
if (!m_logTime.elapsed())
@@ -680,18 +680,18 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
<< QLatin1String(".idle_cmd ") + QString::fromLatin1(m_extensionCommandPrefixBA) + QLatin1String("idle");
if (sp.useTerminal) // Separate console
arguments << QLatin1String("-2");
- if (debuggerCore()->boolSetting(IgnoreFirstChanceAccessViolation))
+ if (boolSetting(IgnoreFirstChanceAccessViolation))
arguments << QLatin1String("-x");
- const QStringList &symbolPaths = debuggerCore()->stringListSetting(CdbSymbolPaths);
+ const QStringList &symbolPaths = stringListSetting(CdbSymbolPaths);
if (!symbolPaths.isEmpty())
arguments << QLatin1String("-y") << symbolPaths.join(QString(QLatin1Char(';')));
- const QStringList &sourcePaths = debuggerCore()->stringListSetting(CdbSourcePaths);
+ const QStringList &sourcePaths = stringListSetting(CdbSourcePaths);
if (!sourcePaths.isEmpty())
arguments << QLatin1String("-srcpath") << sourcePaths.join(QString(QLatin1Char(';')));
// Compile argument string preserving quotes
- QString nativeArguments = debuggerCore()->stringSetting(CdbAdditionalArguments);
+ QString nativeArguments = stringSetting(CdbAdditionalArguments);
switch (sp.startMode) {
case StartInternal:
case StartExternal:
@@ -786,9 +786,9 @@ void CdbEngine::setupInferior()
postCommand("sxn ibp", 0); // Do not break on initial breakpoints.
postCommand(".asm source_line", 0); // Source line in assembly
postCommand(m_extensionCommandPrefixBA + "setparameter maxStringLength="
- + debuggerCore()->action(MaximalStringLength)->value().toByteArray()
+ + action(MaximalStringLength)->value().toByteArray()
+ " maxStackDepth="
- + debuggerCore()->action(MaximalStackDepth)->value().toByteArray()
+ + action(MaximalStackDepth)->value().toByteArray()
, 0);
postExtensionCommand("pid", QByteArray(), 0, &CdbEngine::handlePid);
}
@@ -827,13 +827,12 @@ void CdbEngine::runEngine()
if (debug)
qDebug("runEngine");
- const QStringList &breakEvents =
- debuggerCore()->stringListSetting(CdbBreakEvents);
+ const QStringList breakEvents = stringListSetting(CdbBreakEvents);
foreach (const QString &breakEvent, breakEvents)
postCommand(QByteArray("sxe ") + breakEvent.toLatin1(), 0);
// Break functions: each function must be fully qualified,
// else the debugger will slow down considerably.
- if (debuggerCore()->boolSetting(CdbBreakOnCrtDbgReport)) {
+ if (boolSetting(CdbBreakOnCrtDbgReport)) {
const QByteArray module = msvcRunTime(startParameters().toolChainAbi.osFlavor());
const QByteArray debugModule = module + 'D';
const QByteArray wideFunc = QByteArray(CdbOptionsPage::crtDbgReport).append('W');
@@ -846,13 +845,13 @@ void CdbEngine::runEngine()
postBuiltinCommand(breakAtFunctionCommand(wideFunc, debugModule), 0,
&CdbEngine::handleBreakInsert);
}
- if (debuggerCore()->boolSetting(BreakOnWarning)) {
+ if (boolSetting(BreakOnWarning)) {
postBuiltinCommand("bm /( QtCored4!qWarning", 0,
&CdbEngine::handleBreakInsert); // 'bm': All overloads.
postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::warning", 0,
&CdbEngine::handleBreakInsert);
}
- if (debuggerCore()->boolSetting(BreakOnFatal)) {
+ if (boolSetting(BreakOnFatal)) {
postBuiltinCommand("bm /( QtCored4!qFatal", 0,
&CdbEngine::handleBreakInsert); // 'bm': All overloads.
postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::fatal", 0,
@@ -1061,9 +1060,9 @@ void CdbEngine::handleAddWatch(const CdbExtensionCommandPtr &reply)
void CdbEngine::addLocalsOptions(ByteArrayInputStream &str) const
{
- if (debuggerCore()->boolSetting(VerboseLog))
+ if (boolSetting(VerboseLog))
str << blankSeparator << "-v";
- if (debuggerCore()->boolSetting(UseDebuggingHelpers))
+ if (boolSetting(UseDebuggingHelpers))
str << blankSeparator << "-c";
const QByteArray typeFormats = watchHandler()->typeFormatRequests();
if (!typeFormats.isEmpty())
@@ -1521,7 +1520,7 @@ void CdbEngine::updateLocals(bool forNewStackFrame)
addLocalsOptions(str);
// Uninitialized variables if desired. Quote as safeguard against shadowed
// variables in case of errors in uninitializedVariables().
- if (debuggerCore()->boolSetting(UseCodeModel)) {
+ if (boolSetting(UseCodeModel)) {
QStringList uninitializedVariables;
getUninitializedVariables(debuggerCore()->cppCodeModelSnapshot(),
frame.function, frame.file, frame.line, &uninitializedVariables);
@@ -1932,7 +1931,7 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply)
{
const int flags = reply->cookie.toInt();
if (reply->success) {
- if (debuggerCore()->boolSetting(VerboseLog))
+ if (boolSetting(VerboseLog))
showMessage(QLatin1String("Locals: ") + QString::fromLatin1(reply->reply), LogDebug);
QList<WatchData> watchData;
WatchHandler *handler = watchHandler();
@@ -2915,7 +2914,7 @@ void CdbEngine::attemptBreakpointSynchronization()
case BreakpointInsertRequested:
if (!m_autoBreakPointCorrection
&& parameters.type == BreakpointByFileAndLine
- && debuggerCore()->boolSetting(CdbBreakPointCorrection)) {
+ && boolSetting(CdbBreakPointCorrection)) {
if (lineCorrection.isNull())
lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(),
CppTools::CppModelManagerInterface::instance()->workingCopy()));
diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h
index 8aad2eec96..b33a0363f2 100644
--- a/src/plugins/debugger/cdb/cdbengine.h
+++ b/src/plugins/debugger/cdb/cdbengine.h
@@ -76,7 +76,7 @@ public:
// Factory function that returns 0 if the debug engine library cannot be found.
- virtual bool setToolTipExpression(TextEditor::ITextEditor *editor,
+ virtual bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &ctx);
virtual void setupEngine();
virtual void setupInferior();
diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp
index e709191ecc..0da4608011 100644
--- a/src/plugins/debugger/cdb/cdboptionspage.cpp
+++ b/src/plugins/debugger/cdb/cdboptionspage.cpp
@@ -182,15 +182,14 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent)
m_ui.breakCrtDbgReportCheckBox
->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(CdbOptionsPage::crtDbgReport, hint));
- DebuggerCore *dc = debuggerCore();
- group.insert(dc->action(CdbAdditionalArguments), m_ui.additionalArgumentsLineEdit);
- group.insert(dc->action(CdbBreakOnCrtDbgReport), m_ui.breakCrtDbgReportCheckBox);
- group.insert(dc->action(UseCdbConsole), m_ui.consoleCheckBox);
- group.insert(dc->action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox);
- group.insert(dc->action(IgnoreFirstChanceAccessViolation),
+ group.insert(action(CdbAdditionalArguments), m_ui.additionalArgumentsLineEdit);
+ group.insert(action(CdbBreakOnCrtDbgReport), m_ui.breakCrtDbgReportCheckBox);
+ group.insert(action(UseCdbConsole), m_ui.consoleCheckBox);
+ group.insert(action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox);
+ group.insert(action(IgnoreFirstChanceAccessViolation),
m_ui.ignoreFirstChanceAccessViolationCheckBox);
- m_breakEventWidget->setBreakEvents(dc->stringListSetting(CdbBreakEvents));
+ m_breakEventWidget->setBreakEvents(stringListSetting(CdbBreakEvents));
}
QStringList CdbOptionsPageWidget::breakEvents() const
@@ -226,7 +225,7 @@ void CdbOptionsPage::apply()
if (!m_widget)
return;
m_widget->group.apply(Core::ICore::settings());
- debuggerCore()->action(CdbBreakEvents)->setValue(m_widget->breakEvents());
+ action(CdbBreakEvents)->setValue(m_widget->breakEvents());
}
void CdbOptionsPage::finish()
@@ -274,9 +273,8 @@ CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) :
layout->addWidget(gbSymbolPath);
layout->addWidget(gbSourcePath);
- DebuggerCore *dc = debuggerCore();
- group.insert(dc->action(CdbSymbolPaths), m_symbolPathListEditor);
- group.insert(dc->action(CdbSourcePaths), m_sourcePathListEditor);
+ group.insert(action(CdbSymbolPaths), m_symbolPathListEditor);
+ group.insert(action(CdbSourcePaths), m_sourcePathListEditor);
}
CdbPathsPage::CdbPathsPage()
diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp
index 23a30e75e7..87f0229de1 100644
--- a/src/plugins/debugger/commonoptionspage.cpp
+++ b/src/plugins/debugger/commonoptionspage.cpp
@@ -177,48 +177,47 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
verticalLayout->addWidget(sourcesMappingWidget);
verticalLayout->addStretch();
- DebuggerCore *dc = debuggerCore();
m_group->clear();
- m_group->insert(dc->action(ListSourceFiles),
+ m_group->insert(action(ListSourceFiles),
checkBoxListSourceFiles);
- m_group->insert(dc->action(UseAlternatingRowColors),
+ m_group->insert(action(UseAlternatingRowColors),
checkBoxUseAlternatingRowColors);
- m_group->insert(dc->action(UseToolTipsInMainEditor),
+ m_group->insert(action(UseToolTipsInMainEditor),
checkBoxUseToolTipsInMainEditor);
- m_group->insert(dc->action(CloseBuffersOnExit),
+ m_group->insert(action(CloseBuffersOnExit),
checkBoxCloseBuffersOnExit);
- m_group->insert(dc->action(SwitchModeOnExit),
+ m_group->insert(action(SwitchModeOnExit),
checkBoxSwitchModeOnExit);
- m_group->insert(dc->action(BreakpointsFullPathByDefault),
+ m_group->insert(action(BreakpointsFullPathByDefault),
checkBoxBreakpointsFullPath);
- m_group->insert(dc->action(RaiseOnInterrupt),
+ m_group->insert(action(RaiseOnInterrupt),
checkBoxBringToForegroundOnInterrrupt);
- m_group->insert(dc->action(ShowQmlObjectTree),
+ m_group->insert(action(ShowQmlObjectTree),
checkBoxShowQmlObjectTree);
- m_group->insert(dc->action(WarnOnReleaseBuilds),
+ m_group->insert(action(WarnOnReleaseBuilds),
checkBoxWarnOnReleaseBuilds);
- m_group->insert(dc->action(StationaryEditorWhileStepping),
+ m_group->insert(action(StationaryEditorWhileStepping),
checkBoxKeepEditorStationaryWhileStepping);
- m_group->insert(dc->action(FontSizeFollowsEditor),
+ m_group->insert(action(FontSizeFollowsEditor),
checkBoxFontSizeFollowsEditor);
- m_group->insert(dc->action(AutoDerefPointers), 0);
- m_group->insert(dc->action(UseToolTipsInLocalsView), 0);
- m_group->insert(dc->action(AlwaysAdjustColumnWidths), 0);
- m_group->insert(dc->action(UseToolTipsInBreakpointsView), 0);
- m_group->insert(dc->action(UseToolTipsInStackView), 0);
- m_group->insert(dc->action(UseAddressInBreakpointsView), 0);
- m_group->insert(dc->action(UseAddressInStackView), 0);
- m_group->insert(dc->action(MaximalStackDepth), spinBoxMaximalStackDepth);
- m_group->insert(dc->action(ShowStdNamespace), 0);
- m_group->insert(dc->action(ShowQtNamespace), 0);
- m_group->insert(dc->action(SortStructMembers), 0);
- m_group->insert(dc->action(LogTimeStamps), 0);
- m_group->insert(dc->action(VerboseLog), 0);
- m_group->insert(dc->action(BreakOnThrow), 0);
- m_group->insert(dc->action(BreakOnCatch), 0);
+ m_group->insert(action(AutoDerefPointers), 0);
+ m_group->insert(action(UseToolTipsInLocalsView), 0);
+ m_group->insert(action(AlwaysAdjustColumnWidths), 0);
+ m_group->insert(action(UseToolTipsInBreakpointsView), 0);
+ m_group->insert(action(UseToolTipsInStackView), 0);
+ m_group->insert(action(UseAddressInBreakpointsView), 0);
+ m_group->insert(action(UseAddressInStackView), 0);
+ m_group->insert(action(MaximalStackDepth), spinBoxMaximalStackDepth);
+ m_group->insert(action(ShowStdNamespace), 0);
+ m_group->insert(action(ShowQtNamespace), 0);
+ m_group->insert(action(SortStructMembers), 0);
+ m_group->insert(action(LogTimeStamps), 0);
+ m_group->insert(action(VerboseLog), 0);
+ m_group->insert(action(BreakOnThrow), 0);
+ m_group->insert(action(BreakOnCatch), 0);
if (Utils::HostOsInfo::isWindowsHost()) {
- Utils::SavedAction *registerAction = dc->action(RegisterForPostMortem);
+ Utils::SavedAction *registerAction = action(RegisterForPostMortem);
m_group->insert(registerAction,
checkBoxRegisterForPostMortem);
connect(registerAction, SIGNAL(toggled(bool)),
@@ -342,7 +341,6 @@ QWidget *LocalsAndExpressionsOptionsPage::widget()
{
if (!m_widget) {
m_widget = new QWidget;
- DebuggerCore *dc = debuggerCore();
auto debuggingHelperGroupBox = new QGroupBox(m_widget);
debuggingHelperGroupBox->setTitle(tr("Use Debugging Helper"));
@@ -359,7 +357,7 @@ QWidget *LocalsAndExpressionsOptionsPage::widget()
auto checkBoxUseCodeModel = new QCheckBox(debuggingHelperGroupBox);
checkBoxUseCodeModel->setText(tr("Use code model"));
- checkBoxUseCodeModel->setToolTip(dc->action(UseCodeModel)->toolTip());
+ checkBoxUseCodeModel->setToolTip(action(UseCodeModel)->toolTip());
checkBoxUseCodeModel->setToolTip(tr("Makes use of Qt Creator's code model "
"to find out if a variable has already been assigned a "
"value at the point the debugger interrupts."));
@@ -411,13 +409,13 @@ QWidget *LocalsAndExpressionsOptionsPage::widget()
layout->addStretch();
m_group.clear();
- m_group.insert(dc->action(UseDebuggingHelpers), debuggingHelperGroupBox);
- m_group.insert(dc->action(UseCodeModel), checkBoxUseCodeModel);
- m_group.insert(dc->action(ShowThreadNames), checkBoxShowThreadNames);
- m_group.insert(dc->action(ShowStdNamespace), checkBoxShowStdNamespace);
- m_group.insert(dc->action(ShowQtNamespace), checkBoxShowQtNamespace);
- m_group.insert(dc->action(DisplayStringLimit), spinBoxDisplayStringLimit);
- m_group.insert(dc->action(MaximalStringLength), spinBoxMaximalStringLength);
+ m_group.insert(action(UseDebuggingHelpers), debuggingHelperGroupBox);
+ m_group.insert(action(UseCodeModel), checkBoxUseCodeModel);
+ m_group.insert(action(ShowThreadNames), checkBoxShowThreadNames);
+ m_group.insert(action(ShowStdNamespace), checkBoxShowStdNamespace);
+ m_group.insert(action(ShowQtNamespace), checkBoxShowQtNamespace);
+ m_group.insert(action(DisplayStringLimit), spinBoxDisplayStringLimit);
+ m_group.insert(action(MaximalStringLength), spinBoxMaximalStringLength);
#ifndef QT_DEBUG
#if 0
diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h
index 81c2408ddf..f25c42ed21 100644
--- a/src/plugins/debugger/debuggercore.h
+++ b/src/plugins/debugger/debuggercore.h
@@ -57,7 +57,6 @@ class DebuggerEngine;
namespace Internal {
class BreakHandler;
-class SnapshotHandler;
class Symbol;
class Section;
class GlobalDebuggerOptions;
@@ -75,20 +74,12 @@ class DebuggerCore : public QObject
public:
DebuggerCore() {}
- static QVariant sessionValue(const QByteArray &name);
- static void setSessionValue(const QByteArray &name, const QVariant &value);
- static QVariant configValue(const QByteArray &name);
- static void setConfigValue(const QByteArray &name, const QVariant &value);
-
virtual void updateState(DebuggerEngine *engine) = 0;
virtual void updateWatchersWindow(bool showWatch, bool showReturn) = 0;
virtual QIcon locationMarkIcon() const = 0;
virtual const CPlusPlus::Snapshot &cppCodeModelSnapshot() const = 0;
virtual bool hasSnapshots() const = 0;
virtual void openTextEditor(const QString &titlePattern, const QString &contents) = 0;
- virtual BreakHandler *breakHandler() const = 0;
- virtual SnapshotHandler *snapshotHandler() const = 0;
- virtual DebuggerEngine *currentEngine() const = 0;
virtual bool isActiveDebugLanguage(int language) const = 0;
// void runTest(const QString &fileName);
@@ -104,8 +95,6 @@ public:
virtual bool initialize(const QStringList &arguments, QString *errorMessage) = 0;
virtual QWidget *mainWindow() const = 0;
virtual bool isDockVisible(const QString &objectName) const = 0;
-// virtual QString debuggerForAbi(const ProjectExplorer::Abi &abi,
-// DebuggerEngineType et = NoEngineType) const = 0;
virtual void showModuleSymbols(const QString &moduleName,
const QVector<Symbol> &symbols) = 0;
virtual void showModuleSections(const QString &moduleName,
@@ -113,10 +102,6 @@ public:
virtual void openMemoryEditor() = 0;
virtual void languagesChanged() = 0;
- virtual Utils::SavedAction *action(int code) const = 0;
- virtual bool boolSetting(int code) const = 0;
- virtual QString stringSetting(int code) const = 0;
- virtual QStringList stringListSetting(int code) const = 0;
virtual void setThreads(const QStringList &list, int index) = 0;
virtual QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const = 0;
@@ -127,9 +112,23 @@ public slots:
virtual void attachExternalApplication(ProjectExplorer::RunControl *rc) = 0;
};
+// Some convenience.
+QVariant sessionValue(const QByteArray &name);
+void setSessionValue(const QByteArray &name, const QVariant &value);
+QVariant configValue(const QByteArray &name);
+void setConfigValue(const QByteArray &name, const QVariant &value);
+
+Utils::SavedAction *action(int code);
+bool boolSetting(int code);
+QString stringSetting(int code);
+QStringList stringListSetting(int code);
+
+BreakHandler *breakHandler();
+DebuggerEngine *currentEngine();
+
// This is the only way to access the global object.
DebuggerCore *debuggerCore();
-inline BreakHandler *breakHandler() { return debuggerCore()->breakHandler(); }
+
QMessageBox *showMessageBox(int icon, const QString &title,
const QString &text, int buttons = 0);
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 9ccd0f0b0b..de3d8130a8 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -57,7 +57,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/taskhub.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <utils/savedaction.h>
#include <utils/qtcassert.h>
@@ -174,7 +174,7 @@ public:
m_isStateDebugging(false)
{
connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
- connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
+ connect(action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
SLOT(reloadDisassembly()));
VariableManager::registerFileVariables(PrefixDebugExecutable,
@@ -307,7 +307,7 @@ public:
DisassemblerAgent m_disassemblerAgent;
MemoryAgent m_memoryAgent;
- QScopedPointer<TextEditor::BaseTextMark> m_locationMark;
+ QScopedPointer<TextEditor::TextMark> m_locationMark;
QTimer m_locationTimer;
bool m_isStateDebugging;
@@ -521,8 +521,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
if (!d->m_startParameters.environment.size())
d->m_startParameters.environment = Utils::Environment();
- debuggerCore()->action(OperateByInstruction)
- ->setEnabled(hasCapability(DisassemblerCapability));
+ action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability));
QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished,
qDebug() << state());
@@ -543,7 +542,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
d->resetLocation();
if ((hasCapability(OperateByInstructionCapability) &&
- debuggerCore()->boolSetting(OperateByInstruction)) || !loc.hasDebugInfo()) {
+ boolSetting(OperateByInstruction)) || !loc.hasDebugInfo()) {
d->m_disassemblerAgent.setLocation(loc);
return;
}
@@ -559,16 +558,15 @@ void DebuggerEngine::gotoLocation(const Location &loc)
EditorManager::IgnoreNavigationHistory, &newEditor);
QTC_ASSERT(editor, return); // Unreadable file?
- editor->gotoLine(line, 0, !debuggerCore()->boolSetting(StationaryEditorWhileStepping));
+ editor->gotoLine(line, 0, !boolSetting(StationaryEditorWhileStepping));
if (newEditor)
editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true);
if (loc.needsMarker()) {
- d->m_locationMark.reset(new TextEditor::BaseTextMark(file, line));
+ d->m_locationMark.reset(new TextEditor::TextMark(file, line));
d->m_locationMark->setIcon(debuggerCore()->locationMarkIcon());
- d->m_locationMark->setPriority(TextEditor::ITextMark::HighPriority);
- d->m_locationMark->init();
+ d->m_locationMark->setPriority(TextEditor::TextMark::HighPriority);
}
//qDebug() << "MEMORY: " << d->m_memoryAgent.hasVisibleEditor();
@@ -954,7 +952,7 @@ void DebuggerEngine::notifyInferiorSpontaneousStop()
QTC_ASSERT(state() == InferiorRunOk, qDebug() << this << state());
showStatusMessage(tr("Stopped."));
setState(InferiorStopOk);
- if (debuggerCore()->boolSetting(RaiseOnInterrupt))
+ if (boolSetting(RaiseOnInterrupt))
ICore::raiseWindow(debuggerCore()->mainWindow());
}
@@ -1361,7 +1359,7 @@ DebuggerRunControl *DebuggerEngine::runControl() const
return d->runControl();
}
-bool DebuggerEngine::setToolTipExpression(TextEditor::ITextEditor *,
+bool DebuggerEngine::setToolTipExpression(TextEditor::BaseTextEditor *,
const DebuggerToolTipContext &)
{
return false;
@@ -1621,7 +1619,7 @@ void DebuggerEngine::executeDebuggerCommand(const QString &, DebuggerLanguages)
BreakHandler *DebuggerEngine::breakHandler() const
{
- return debuggerCore()->breakHandler();
+ return Internal::breakHandler();
}
bool DebuggerEngine::isDying() const
@@ -1753,7 +1751,7 @@ void DebuggerEngine::setStateDebugging(bool on)
void DebuggerEngine::checkForReleaseBuild(const DebuggerStartParameters &sp)
{
- if (!debuggerCore()->boolSetting(WarnOnReleaseBuilds) || !(sp.languages & CppLanguage))
+ if (!boolSetting(WarnOnReleaseBuilds) || !(sp.languages & CppLanguage))
return;
QString binary = sp.executable;
if (binary.isEmpty())
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 718df1f198..75f6716bc9 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -45,7 +45,7 @@ class QMessageBox;
class QAbstractItemModel;
QT_END_NAMESPACE
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace Core { class IOptionsPage; }
namespace Debugger {
@@ -143,7 +143,7 @@ public:
const DebuggerStartParameters &startParameters() const;
DebuggerStartParameters &startParameters();
- virtual bool setToolTipExpression(TextEditor::ITextEditor *editor,
+ virtual bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const Internal::DebuggerToolTipContext &);
virtual void updateWatchData(const Internal::WatchData &data,
diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp
index fd1fbf490c..8e0d10cb5f 100644
--- a/src/plugins/debugger/debuggermainwindow.cpp
+++ b/src/plugins/debugger/debuggermainwindow.cpp
@@ -443,7 +443,8 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
QWidget *editorAndFindWidget = new QWidget;
editorAndFindWidget->setLayout(editorHolderLayout);
- editorHolderLayout->addWidget(new EditorManagerPlaceHolder(mode));
+ auto editorManagerPlaceHolder = new EditorManagerPlaceHolder(mode);
+ editorHolderLayout->addWidget(editorManagerPlaceHolder);
editorHolderLayout->addWidget(new FindToolBarPlaceHolder(editorAndFindWidget));
MiniSplitter *documentAndRightPane = new MiniSplitter;
@@ -502,6 +503,7 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
// Navigation and right-side window.
MiniSplitter *splitter = new MiniSplitter;
+ splitter->setFocusProxy(editorManagerPlaceHolder);
splitter->addWidget(new NavigationWidgetPlaceHolder(mode));
splitter->addWidget(mainWindowSplitter);
splitter->setStretchFactor(0, 0);
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 284b513a45..99f46413a4 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -533,7 +533,7 @@ public:
static QWidget *addSearch(BaseTreeView *treeView, const QString &title,
const char *objectName)
{
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
+ QAction *act = action(UseAlternatingRowColors);
treeView->setAlternatingRowColors(act->isChecked());
QObject::connect(act, SIGNAL(toggled(bool)),
treeView, SLOT(setAlternatingRowColorsHelper(bool)));
@@ -552,74 +552,31 @@ static QString executableForPid(qint64 pid)
return QString();
}
-class AbiKitMatcher : public KitMatcher
+static std::function<bool(const Kit *)> cdbMatcher(char wordWidth = 0)
{
-public:
- explicit AbiKitMatcher(const QList<Abi> &abis) : m_abis(abis) {}
- bool matches(const Kit *k) const
- {
- if (const ToolChain *tc = ToolChainKitInformation::toolChain(k)) {
- return m_abis.contains(tc->targetAbi())
- && DebuggerKitInformation::isValidDebugger(k);
- }
- return false;
- }
-
-private:
- const QList<Abi> m_abis;
-};
-
-class CompatibleAbiKitMatcher : public KitMatcher
-{
-public:
- explicit CompatibleAbiKitMatcher(const QList<Abi> &abis) : m_abis(abis) {}
- bool matches(const Kit *k) const
- {
- if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
- foreach (const Abi &a, m_abis)
- if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k))
- return true;
- return false;
- }
-
-private:
- const QList<Abi> m_abis;
-};
-
-class CdbMatcher : KitMatcher
-{
-public:
- CdbMatcher(char wordWidth = 0) : m_wordWidth(wordWidth) {}
-
- bool matches(const Kit *k) const
- {
+ return [wordWidth](const Kit *k) -> bool {
if (DebuggerKitInformation::engineType(k) != CdbEngineType
|| !DebuggerKitInformation::isValidDebugger(k)) {
return false;
}
- if (m_wordWidth) {
+ if (wordWidth) {
const ToolChain *tc = ToolChainKitInformation::toolChain(k);
- return tc && m_wordWidth == tc->targetAbi().wordWidth();
+ return tc && wordWidth == tc->targetAbi().wordWidth();
}
return true;
- }
+ };
+}
- // Find a CDB kit for debugging unknown processes.
- // On a 64bit OS, prefer a 64bit debugger.
- static Kit *findUniversalCdbKit()
- {
- if (Utils::is64BitWindowsSystem()) {
- CdbMatcher matcher64(64);
- if (Kit *cdb64Kit = KitManager::find(matcher64))
- return cdb64Kit;
- }
- CdbMatcher matcher;
- return KitManager::find(matcher);
+// Find a CDB kit for debugging unknown processes.
+// On a 64bit OS, prefer a 64bit debugger.
+static Kit *findUniversalCdbKit()
+{
+ if (Utils::is64BitWindowsSystem()) {
+ if (Kit *cdb64Kit = KitManager::find(cdbMatcher(64)))
+ return cdb64Kit;
}
-
-private:
- const char m_wordWidth;
-};
+ return KitManager::find(cdbMatcher());
+}
bool fillParameters(DebuggerStartParameters *sp, const Kit *kit, QString *errorMessage /* = 0 */)
{
@@ -640,9 +597,24 @@ bool fillParameters(DebuggerStartParameters *sp, const Kit *kit, QString *errorM
abis = Abi::abisOfBinary(Utils::FileName::fromString(sp->executable));
}
if (!abis.isEmpty()) {
- kit = KitManager::find(AbiKitMatcher(abis));
- if (!kit)
- kit = KitManager::find(CompatibleAbiKitMatcher(abis));
+ // Try exact abis.
+ kit = KitManager::find(std::function<bool (const Kit *)>([abis](const Kit *k) -> bool {
+ if (const ToolChain *tc = ToolChainKitInformation::toolChain(k)) {
+ return abis.contains(tc->targetAbi())
+ && DebuggerKitInformation::isValidDebugger(k);
+ }
+ return false;
+ }));
+ if (!kit) {
+ // Or something compatible.
+ kit = KitManager::find(std::function<bool (const Kit *)>([abis](const Kit *k) -> bool {
+ if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
+ foreach (const Abi &a, abis)
+ if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k))
+ return true;
+ return false;
+ }));
+ }
}
if (!kit)
kit = KitManager::defaultKit();
@@ -690,7 +662,7 @@ bool fillParameters(DebuggerStartParameters *sp, const Kit *kit, QString *errorM
static bool currentTextEditorPosition(ContextData *data)
{
- ITextEditor *textEditor = ITextEditor::currentTextEditor();
+ BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor();
if (!textEditor)
return false;
const IDocument *document = textEditor->document();
@@ -743,7 +715,6 @@ public:
void connectEngine(DebuggerEngine *engine);
void disconnectEngine() { connectEngine(0); }
- DebuggerEngine *currentEngine() const { return m_currentEngine; }
DebuggerEngine *dummyEngine();
void setThreads(const QStringList &list, int index)
@@ -864,10 +835,10 @@ public slots:
void editorOpened(Core::IEditor *editor);
void updateBreakMenuItem(Core::IEditor *editor);
void setBusyCursor(bool busy);
- void requestMark(TextEditor::ITextEditor *editor,
+ void requestMark(TextEditor::BaseTextEditor *editor,
int lineNumber,
- TextEditor::ITextEditor::MarkRequestKind kind);
- void requestContextMenu(TextEditor::ITextEditor *editor,
+ TextEditor::BaseTextEditor::MarkRequestKind kind);
+ void requestContextMenu(TextEditor::BaseTextEditor *editor,
int lineNumber, QMenu *menu);
void activatePreviousMode();
@@ -925,9 +896,6 @@ public slots:
bool isReverseDebugging() const;
- BreakHandler *breakHandler() const { return m_breakHandler; }
- SnapshotHandler *snapshotHandler() const { return m_snapshotHandler; }
-
void displayDebugger(DebuggerEngine *engine, bool updateEngine = true);
void dumpLog();
@@ -1060,11 +1028,10 @@ public slots:
void handleExecRunToSelectedFunction()
{
- ITextEditor *textEditor = ITextEditor::currentTextEditor();
+ BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor();
QTC_ASSERT(textEditor, return);
- QPlainTextEdit *ed = qobject_cast<QPlainTextEdit*>(textEditor->widget());
- if (!ed)
- return;
+ QPlainTextEdit *ed = textEditor->editorWidget();
+ QTC_ASSERT(ed, return);
QTextCursor cursor = ed->textCursor();
QString functionName = cursor.selectedText();
if (functionName.isEmpty()) {
@@ -1132,15 +1099,10 @@ public slots:
{
// Requires a selection, but that's the only case we want anyway.
IEditor *editor = EditorManager::currentEditor();
- if (!editor)
- return;
- ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor);
+ BaseTextEditor *textEditor = qobject_cast<BaseTextEditor*>(editor);
if (!textEditor)
return;
- QTextCursor tc;
- QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit*>(editor->widget());
- if (ptEdit)
- tc = ptEdit->textCursor();
+ QTextCursor tc = textEditor->editorWidget()->textCursor();
QString exp;
if (tc.hasSelection()) {
exp = tc.selectedText();
@@ -1192,11 +1154,6 @@ public slots:
void openTextEditor(const QString &titlePattern0, const QString &contents);
void showMessage(const QString &msg, int channel, int timeout = -1);
- SavedAction *action(int code) const;
- bool boolSetting(int code) const;
- QString stringSetting(int code) const;
- QStringList stringListSetting(int code) const;
-
void showModuleSymbols(const QString &moduleName, const Symbols &symbols);
void showModuleSections(const QString &moduleName, const Sections &sections);
@@ -1470,7 +1427,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
return false;
}
DebuggerStartParameters sp;
- if (!fillParameters(&sp, CdbMatcher::findUniversalCdbKit(), errorMessage))
+ if (!fillParameters(&sp, findUniversalCdbKit(), errorMessage))
return false;
sp.startMode = AttachCrashedExternal;
sp.crashParameter = it->section(QLatin1Char(':'), 0, 0);
@@ -1531,12 +1488,12 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
return true;
}
-void DebuggerCore::setConfigValue(const QByteArray &name, const QVariant &value)
+void setConfigValue(const QByteArray &name, const QVariant &value)
{
ICore::settings()->setValue(_("DebugMode/" + name), value);
}
-QVariant DebuggerCore::configValue(const QByteArray &name)
+QVariant configValue(const QByteArray &name)
{
return ICore::settings()->value(_("DebugMode/" + name));
}
@@ -1649,7 +1606,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
{
const QByteArray connectionKey = "CdbRemoteConnection";
DebuggerStartParameters sp;
- Kit *kit = CdbMatcher::findUniversalCdbKit();
+ Kit *kit = findUniversalCdbKit();
QTC_ASSERT(kit && fillParameters(&sp, kit), return);
sp.startMode = AttachToRemoteServer;
sp.closeMode = KillAtClose;
@@ -1900,24 +1857,24 @@ void DebuggerPluginPrivate::runScheduled()
void DebuggerPluginPrivate::editorOpened(IEditor *editor)
{
- ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
+ BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(editor);
if (!textEditor)
return;
connect(textEditor,
- SIGNAL(markRequested(TextEditor::ITextEditor*,int,TextEditor::ITextEditor::MarkRequestKind)),
- SLOT(requestMark(TextEditor::ITextEditor*,int,TextEditor::ITextEditor::MarkRequestKind)));
+ SIGNAL(markRequested(TextEditor::BaseTextEditor*,int,TextEditor::BaseTextEditor::MarkRequestKind)),
+ SLOT(requestMark(TextEditor::BaseTextEditor*,int,TextEditor::BaseTextEditor::MarkRequestKind)));
connect(textEditor,
- SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
- SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+ SIGNAL(markContextMenuRequested(TextEditor::BaseTextEditor*,int,QMenu*)),
+ SLOT(requestContextMenu(TextEditor::BaseTextEditor*,int,QMenu*)));
}
void DebuggerPluginPrivate::updateBreakMenuItem(IEditor *editor)
{
- ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
+ BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(editor);
m_breakAction->setEnabled(textEditor != 0);
}
-void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
+void DebuggerPluginPrivate::requestContextMenu(BaseTextEditor *editor,
int lineNumber, QMenu *menu)
{
BreakpointMenuContextData args;
@@ -1925,7 +1882,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
bool contextUsable = true;
BreakpointModelId id = BreakpointModelId();
- ITextEditorDocument *document = editor->textDocument();
+ BaseTextDocument *document = editor->textDocument();
args.fileName = document->filePath();
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
QString line = document->plainText()
@@ -2037,7 +1994,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
void DebuggerPluginPrivate::toggleBreakpoint()
{
- ITextEditor *textEditor = ITextEditor::currentTextEditor();
+ BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor();
QTC_ASSERT(textEditor, return);
const int lineNumber = textEditor->currentLine();
if (textEditor->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
@@ -2063,7 +2020,7 @@ void DebuggerPluginPrivate::toggleBreakpointByFileAndLine(const QString &fileNam
handler->removeBreakpoint(id);
} else {
BreakpointParameters data(BreakpointByFileAndLine);
- if (debuggerCore()->boolSetting(BreakpointsFullPathByDefault))
+ if (boolSetting(BreakpointsFullPathByDefault))
data.pathUsage = BreakpointUseFullPath;
data.tracepoint = !tracePointMessage.isEmpty();
data.message = tracePointMessage;
@@ -2090,11 +2047,11 @@ void DebuggerPluginPrivate::toggleBreakpointByAddress(quint64 address,
}
}
-void DebuggerPluginPrivate::requestMark(ITextEditor *editor,
+void DebuggerPluginPrivate::requestMark(BaseTextEditor *editor,
int lineNumber,
- ITextEditor::MarkRequestKind kind)
+ BaseTextEditor::MarkRequestKind kind)
{
- if (kind != ITextEditor::BreakpointRequest)
+ if (kind != BaseTextEditor::BreakpointRequest)
return;
if (IDocument *document = editor->document()) {
@@ -2570,12 +2527,12 @@ const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const
return m_codeModelSnapshot;
}
-void DebuggerCore::setSessionValue(const QByteArray &key, const QVariant &value)
+void setSessionValue(const QByteArray &key, const QVariant &value)
{
SessionManager::setValue(QString::fromUtf8(key), value);
}
-QVariant DebuggerCore::sessionValue(const QByteArray &key)
+QVariant sessionValue(const QByteArray &key)
{
return SessionManager::value(QString::fromUtf8(key));
}
@@ -3292,7 +3249,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
modeContextObject->setContext(Core::Context(CC::C_EDITORMANAGER));
modeContextObject->setWidget(widget);
Core::ICore::addContextObject(modeContextObject);
- widget->setFocusProxy(EditorManager::instance());
debugMode->setWidget(widget);
m_plugin->addAutoReleasedObject(debugMode);
@@ -3401,25 +3357,35 @@ void DebuggerPluginPrivate::extensionsInitialized()
// time gdb -i mi -ex 'b debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
}
-SavedAction *DebuggerPluginPrivate::action(int code) const
+DebuggerEngine *currentEngine()
+{
+ return theDebuggerCore->m_currentEngine;
+}
+
+SavedAction *action(int code)
{
- return m_debuggerSettings->item(code);
+ return theDebuggerCore->m_debuggerSettings->item(code);
}
-bool DebuggerPluginPrivate::boolSetting(int code) const
+bool boolSetting(int code)
{
- return m_debuggerSettings->item(code)->value().toBool();
+ return theDebuggerCore->m_debuggerSettings->item(code)->value().toBool();
}
-QString DebuggerPluginPrivate::stringSetting(int code) const
+QString stringSetting(int code)
{
- QString raw = m_debuggerSettings->item(code)->value().toString();
+ QString raw = theDebuggerCore->m_debuggerSettings->item(code)->value().toString();
return VariableManager::expandedString(raw);
}
-QStringList DebuggerPluginPrivate::stringListSetting(int code) const
+QStringList stringListSetting(int code)
+{
+ return theDebuggerCore->m_debuggerSettings->item(code)->value().toStringList();
+}
+
+BreakHandler *breakHandler()
{
- return m_debuggerSettings->item(code)->value().toStringList();
+ return theDebuggerCore->m_breakHandler;
}
void DebuggerPluginPrivate::showModuleSymbols(const QString &moduleName,
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index 6d29ec7718..70aa7c4e9b 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -172,7 +172,7 @@ void DebuggerRunControl::start()
if (d->m_engine->startParameters().startMode == StartInternal) {
QStringList unhandledIds;
- foreach (const BreakpointModelId &id, debuggerCore()->breakHandler()->allBreakpointIds()) {
+ foreach (const BreakpointModelId &id, breakHandler()->allBreakpointIds()) {
if (d->m_engine->breakHandler()->breakpointData(id).enabled
&& !d->m_engine->acceptsBreakpoint(id))
unhandledIds.append(id.toString());
@@ -429,7 +429,7 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
DebuggerStartParameters sp = sp0;
- if (!debuggerCore()->boolSetting(AutoEnrichParameters)) {
+ if (!boolSetting(AutoEnrichParameters)) {
const QString sysroot = sp.sysRoot;
if (sp.debugInfoLocation.isEmpty())
sp.debugInfoLocation = sysroot + QLatin1String("/usr/lib/debug");
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index 2b5afab64a..8a767b6e1a 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -1185,7 +1185,7 @@ void DebuggerToolTipManager::sessionAboutToChange()
void DebuggerToolTipManager::loadSessionData()
{
- const QString data = DebuggerCore::sessionValue(sessionSettingsKeyC).toString();
+ const QString data = sessionValue(sessionSettingsKeyC).toString();
QXmlStreamReader r(data);
r.readNextStartElement();
if (r.tokenType() == QXmlStreamReader::StartElement && r.name() == QLatin1String(sessionDocumentC))
@@ -1207,7 +1207,7 @@ void DebuggerToolTipManager::saveSessionData()
tw->saveSessionData(w);
w.writeEndDocument();
- DebuggerCore::setSessionValue(sessionSettingsKeyC, QVariant(data));
+ setSessionValue(sessionSettingsKeyC, QVariant(data));
}
void DebuggerToolTipManager::closeAllToolTips()
@@ -1277,8 +1277,8 @@ void DebuggerToolTipManager::slotEditorOpened(IEditor *e)
connect(toolTipEditor.widget->verticalScrollBar(), SIGNAL(valueChanged(int)),
this, SLOT(slotUpdateVisibleToolTips()));
connect(toolTipEditor.editor,
- SIGNAL(tooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)),
- SLOT(slotTooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)));
+ SIGNAL(tooltipOverrideRequested(TextEditor::BaseTextEditor*,QPoint,int,bool*)),
+ SLOT(slotTooltipOverrideRequested(TextEditor::BaseTextEditor*,QPoint,int,bool*)));
}
}
@@ -1324,7 +1324,7 @@ void DebuggerToolTipManager::leavingDebugMode()
}
void DebuggerToolTipManager::slotTooltipOverrideRequested
- (ITextEditor *editor, const QPoint &point, int pos, bool *handled)
+ (BaseTextEditor *editor, const QPoint &point, int pos, bool *handled)
{
QTC_ASSERT(handled, return);
QTC_ASSERT(editor, return);
@@ -1347,18 +1347,17 @@ void DebuggerToolTipManager::slotTooltipOverrideRequested
}
}
-bool DebuggerToolTipManager::tryHandleToolTipOverride(ITextEditor *editor, const QPoint &point, int pos)
+bool DebuggerToolTipManager::tryHandleToolTipOverride(BaseTextEditor *editor, const QPoint &point, int pos)
{
- DebuggerCore *core = debuggerCore();
- if (!core->boolSetting(UseToolTipsInMainEditor))
+ if (!boolSetting(UseToolTipsInMainEditor))
return false;
- DebuggerEngine *currentEngine = core->currentEngine();
- if (!currentEngine || !currentEngine->canDisplayTooltip())
+ DebuggerEngine *engine = currentEngine();
+ if (!engine || !engine->canDisplayTooltip())
return false;
DebuggerToolTipContext context;
- context.engineType = currentEngine->objectName();
+ context.engineType = engine->objectName();
context.fileName = editor->document()->filePath();
context.position = pos;
context.mousePosition = point;
@@ -1370,18 +1369,18 @@ bool DebuggerToolTipManager::tryHandleToolTipOverride(ITextEditor *editor, const
return false;
// Prefer a filter on an existing local variable if it can be found.
- if (const WatchData *localVariable = currentEngine->watchHandler()->findCppLocalVariable(context.expression)) {
+ if (const WatchData *localVariable = engine->watchHandler()->findCppLocalVariable(context.expression)) {
context.expression = QLatin1String(localVariable->exp);
if (context.expression.isEmpty())
context.expression = localVariable->name;
context.iname = localVariable->iname;
- showToolTip(context, currentEngine);
+ showToolTip(context, engine);
return true;
}
context.iname = "tooltip." + context.expression.toLatin1().toHex();
- if (currentEngine->setToolTipExpression(editor, context))
+ if (engine->setToolTipExpression(editor, context))
return true;
// Other tooltip, close all in case mouse never entered the tooltip
diff --git a/src/plugins/debugger/debuggertooltipmanager.h b/src/plugins/debugger/debuggertooltipmanager.h
index 2957c9e633..08ed4764cc 100644
--- a/src/plugins/debugger/debuggertooltipmanager.h
+++ b/src/plugins/debugger/debuggertooltipmanager.h
@@ -41,7 +41,7 @@ class QDebug;
QT_END_NAMESPACE
namespace Core { class IEditor; }
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace Debugger {
class DebuggerEngine;
@@ -132,11 +132,11 @@ private slots:
static void slotUpdateVisibleToolTips();
void slotDebuggerStateChanged(Debugger::DebuggerState);
void slotEditorOpened(Core::IEditor *);
- void slotTooltipOverrideRequested(TextEditor::ITextEditor *editor,
+ void slotTooltipOverrideRequested(TextEditor::BaseTextEditor *editor,
const QPoint &point, int pos, bool *handled);
private:
- bool tryHandleToolTipOverride(TextEditor::ITextEditor *editor,
+ bool tryHandleToolTipOverride(TextEditor::BaseTextEditor *editor,
const QPoint &point, int pos);
};
diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp
index 54fb20cdd9..3410b83e50 100644
--- a/src/plugins/debugger/disassembleragent.cpp
+++ b/src/plugins/debugger/disassembleragent.cpp
@@ -43,7 +43,7 @@
#include <coreplugin/mimedatabase.h>
#include <texteditor/basetextdocument.h>
-#include <texteditor/plaintexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <utils/qtcassert.h>
@@ -103,8 +103,8 @@ public:
QPointer<BaseTextDocument> document;
Location location;
QPointer<DebuggerEngine> engine;
- ITextMark locationMark;
- QList<ITextMark *> breakpointMarks;
+ TextMark locationMark;
+ QList<TextMark *> breakpointMarks;
QList<CacheEntry> cache;
QString mimeType;
bool resetLocationScheduled;
@@ -112,12 +112,12 @@ public:
DisassemblerAgentPrivate::DisassemblerAgentPrivate()
: document(0),
- locationMark(0),
+ locationMark(QString(), 0),
mimeType(_("text/x-qtcreator-generic-asm")),
resetLocationScheduled(false)
{
locationMark.setIcon(debuggerCore()->locationMarkIcon());
- locationMark.setPriority(TextEditor::ITextMark::HighPriority);
+ locationMark.setPriority(TextEditor::TextMark::HighPriority);
}
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
@@ -188,7 +188,7 @@ void DisassemblerAgent::resetLocation()
return;
if (d->resetLocationScheduled) {
d->resetLocationScheduled = false;
- d->document->markableInterface()->removeMark(&d->locationMark);
+ d->document->removeMark(&d->locationMark);
}
}
@@ -239,8 +239,8 @@ void DisassemblerAgentPrivate::configureMimeType()
MimeType mtype = MimeDatabase::findByType(mimeType);
if (mtype) {
foreach (IEditor *editor, DocumentModel::editorsForDocument(document))
- if (PlainTextEditorWidget *widget = qobject_cast<PlainTextEditorWidget *>(editor->widget()))
- widget->configure(mtype);
+ if (BaseTextEditorWidget *widget = qobject_cast<BaseTextEditorWidget *>(editor->widget()))
+ widget->configureMimeType(mtype);
} else {
qWarning("Assembler mimetype '%s' not found.", qPrintable(mimeType));
}
@@ -315,9 +315,9 @@ void DisassemblerAgent::updateLocationMarker()
const DisassemblerLines contents = d->contentsAtCurrentLocation();
int lineNumber = contents.lineForAddress(d->location.address());
if (d->location.needsMarker()) {
- d->document->markableInterface()->removeMark(&d->locationMark);
+ d->document->removeMark(&d->locationMark);
d->locationMark.updateLineNumber(lineNumber);
- d->document->markableInterface()->addMark(&d->locationMark);
+ d->document->addMark(&d->locationMark);
}
// Center cursor.
@@ -337,8 +337,8 @@ void DisassemblerAgent::updateBreakpointMarkers()
return;
const DisassemblerLines contents = d->contentsAtCurrentLocation();
- foreach (TextEditor::ITextMark *marker, d->breakpointMarks)
- d->document->markableInterface()->removeMark(marker);
+ foreach (TextEditor::TextMark *marker, d->breakpointMarks)
+ d->document->removeMark(marker);
qDeleteAll(d->breakpointMarks);
d->breakpointMarks.clear();
foreach (BreakpointModelId id, ids) {
@@ -348,11 +348,11 @@ void DisassemblerAgent::updateBreakpointMarkers()
const int lineNumber = contents.lineForAddress(address);
if (!lineNumber)
continue;
- ITextMark *marker = new ITextMark(lineNumber);
+ TextMark *marker = new TextMark(QString(), lineNumber);
marker->setIcon(handler->icon(id));
- marker->setPriority(ITextMark::NormalPriority);
+ marker->setPriority(TextMark::NormalPriority);
d->breakpointMarks.append(marker);
- d->document->markableInterface()->addMark(marker);
+ d->document->addMark(marker);
}
}
diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp
index 1f9930c7c9..83cb42701c 100644
--- a/src/plugins/debugger/gdb/coregdbadapter.cpp
+++ b/src/plugins/debugger/gdb/coregdbadapter.cpp
@@ -34,6 +34,7 @@
#include <debugger/debuggerstartparameters.h>
#include <debugger/debuggerstringutils.h>
+#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QDir>
@@ -89,19 +90,62 @@ void GdbCoreEngine::setupEngine()
unpackCoreIfNeeded();
}
-QString readExecutableNameFromCore(const QString &debuggerCommand, const QString &coreFile, bool *isCore)
+static QString findExecutableFromName(const QString &fileNameFromCore, const QString &coreFile)
{
+ if (QFileInfo(fileNameFromCore).isFile())
+ return fileNameFromCore;
+ if (fileNameFromCore.isEmpty())
+ return QString();
+
+ // turn the filename into an absolute path, using the location of the core as a hint
+ QString absPath;
+ QFileInfo fi(fileNameFromCore);
+ if (fi.isAbsolute()) {
+ absPath = fileNameFromCore;
+ } else {
+ QFileInfo coreInfo(coreFile);
+ QDir coreDir = coreInfo.dir();
+ absPath = FileUtils::resolvePath(coreDir.absolutePath(), fileNameFromCore);
+ }
+ if (QFileInfo(absPath).isFile() || absPath.isEmpty())
+ return absPath;
+
+ // remove possible trailing arguments
+ QLatin1Char sep(' ');
+ QStringList pathFragments = absPath.split(sep);
+ while (pathFragments.size() > 0) {
+ QString joined_path = pathFragments.join(sep);
+ if (QFileInfo(joined_path).isFile()) {
+ return joined_path;
+ }
+ pathFragments.pop_back();
+ }
+
+ return QString();
+}
+
+GdbCoreEngine::CoreInfo
+GdbCoreEngine::readExecutableNameFromCore(const QString &debuggerCommand, const QString &coreFile)
+{
+ CoreInfo cinfo;
#if 0
- ElfReader reader(coreFileName());
- return QString::fromLocal8Bit(reader.readCoreName(isCore));
+ ElfReader reader(coreFile);
+ cinfo.isCore = false;
+ cinfo.rawStringFromCore = QString::fromLocal8Bit(reader.readCoreName(&cinfo.isCore));
+ cinfo.foundExecutableName = findExecutableFromName(cinfo.rawStringFromCore, coreFile);
#else
QStringList args;
args.append(QLatin1String("-nx"));
args.append(QLatin1String("-batch"));
args.append(QLatin1String("-c"));
args.append(coreFile);
+
QProcess proc;
+ QStringList envLang = QProcess::systemEnvironment();
+ envLang.replaceInStrings(QRegExp(QLatin1String("^LC_ALL=.*")), QLatin1String("LC_ALL=C"));
+ proc.setEnvironment(envLang);
proc.start(debuggerCommand, args);
+
if (proc.waitForFinished()) {
QByteArray ba = proc.readAllStandardOutput();
// Core was generated by `/data/dev/creator-2.6/bin/qtcreator'.
@@ -111,13 +155,15 @@ QString readExecutableNameFromCore(const QString &debuggerCommand, const QString
pos1 += 23;
int pos2 = ba.indexOf('\'', pos1);
if (pos2 != -1) {
- *isCore = true;
- return QString::fromLocal8Bit(ba.mid(pos1, pos2 - pos1));
+ cinfo.isCore = true;
+ cinfo.rawStringFromCore = QString::fromLocal8Bit(ba.mid(pos1, pos2 - pos1));
+ cinfo.foundExecutableName = findExecutableFromName(cinfo.rawStringFromCore, coreFile);
}
}
}
- return QString();
+ cinfo.isCore = false;
#endif
+ return cinfo;
}
void GdbCoreEngine::continueSetupEngine()
@@ -131,17 +177,12 @@ void GdbCoreEngine::continueSetupEngine()
m_tempCoreFile.close();
}
if (isCore && m_executable.isEmpty()) {
- // Read executable from core.
- isCore = false;
- m_executable = readExecutableNameFromCore(
- startParameters().debuggerCommand,
- coreFileName(), &isCore);
-
- if (isCore) {
- // Strip off command line arguments. FIXME: make robust.
- int idx = m_executable.indexOf(QLatin1Char(' '));
- if (idx >= 0)
- m_executable.truncate(idx);
+ GdbCoreEngine::CoreInfo cinfo = readExecutableNameFromCore(
+ startParameters().debuggerCommand,
+ coreFileName());
+
+ if (cinfo.isCore) {
+ m_executable = cinfo.foundExecutableName;
if (m_executable.isEmpty()) {
showMessageBox(QMessageBox::Warning,
tr("Error Loading Symbols"),
diff --git a/src/plugins/debugger/gdb/coregdbadapter.h b/src/plugins/debugger/gdb/coregdbadapter.h
index 81a4ac9ce0..9356e9dd90 100644
--- a/src/plugins/debugger/gdb/coregdbadapter.h
+++ b/src/plugins/debugger/gdb/coregdbadapter.h
@@ -43,8 +43,6 @@ namespace Internal {
//
///////////////////////////////////////////////////////////////////////
-QString readExecutableNameFromCore(const QString &cmd, const QString &coreFile, bool *isCore);
-
class GdbCoreEngine : public GdbEngine
{
Q_OBJECT
@@ -53,6 +51,13 @@ public:
explicit GdbCoreEngine(const DebuggerStartParameters &startParameters);
~GdbCoreEngine();
+ struct CoreInfo
+ {
+ QString rawStringFromCore;
+ QString foundExecutableName; // empty if no corresponding exec could be found
+ bool isCore;
+ };
+ static CoreInfo readExecutableNameFromCore(const QString &debuggerCmd, const QString &coreFile);
private:
void setupEngine();
void setupInferior();
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index e635cbbd45..c24875231a 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -67,7 +67,7 @@
#include <projectexplorer/devicesupport/deviceprocess.h>
#include <projectexplorer/itaskhandler.h>
#include <projectexplorer/taskhub.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
@@ -230,13 +230,13 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
m_commandTimer.setSingleShot(true);
connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout()));
- connect(debuggerCore()->action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)),
+ connect(action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)),
SLOT(reloadLocals()));
- connect(debuggerCore()->action(CreateFullBacktrace), SIGNAL(triggered()),
+ connect(action(CreateFullBacktrace), SIGNAL(triggered()),
SLOT(createFullBacktrace()));
- connect(debuggerCore()->action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
+ connect(action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
SLOT(reloadLocals()));
- connect(debuggerCore()->action(UseDynamicType), SIGNAL(valueChanged(QVariant)),
+ connect(action(UseDynamicType), SIGNAL(valueChanged(QVariant)),
SLOT(reloadLocals()));
}
@@ -668,7 +668,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
break;
}
- if (debuggerCore()->boolSetting(IdentifyDebugInfoPackages)) {
+ if (boolSetting(IdentifyDebugInfoPackages)) {
// From SuSE's gdb: >&"Missing separate debuginfo for ...\n"
// ">&"Try: zypper install -C \"debuginfo(build-id)=c084ee5876ed1ac12730181c9f07c3e027d8e943\"\n"
if (data.startsWith("Missing separate debuginfo for ")) {
@@ -994,7 +994,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
int GdbEngine::commandTimeoutTime() const
{
- int time = debuggerCore()->action(GdbWatchdogTimeout)->value().toInt();
+ int time = action(GdbWatchdogTimeout)->value().toInt();
return 1000 * qMax(40, time);
}
@@ -1132,7 +1132,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
}
GdbCommand cmd = m_cookieForToken.take(token);
- if (debuggerCore()->boolSetting(LogTimeStamps)) {
+ if (boolSetting(LogTimeStamps)) {
showMessage(_("Response time: %1: %2 s")
.arg(_(cmd.command))
.arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.),
@@ -1412,7 +1412,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
//qDebug() << "BP " << rid << data.toString();
// Quickly set the location marker.
- if (lineNumber && !debuggerCore()->boolSetting(OperateByInstruction)
+ if (lineNumber && !boolSetting(OperateByInstruction)
&& QFileInfo(fullName).exists()
&& !isQmlStepBreakpoint(rid)
&& !isQFatalBreakpoint(rid))
@@ -1500,7 +1500,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
// Jump over well-known frames.
static int stepCounter = 0;
- if (debuggerCore()->boolSetting(SkipKnownFrames)) {
+ if (boolSetting(SkipKnownFrames)) {
if (reason == "end-stepping-range" || reason == "function-finished") {
//showMessage(frame.toString());
QString funcName = _(frame["func"].data());
@@ -1537,7 +1537,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
if (!m_systemDumpersLoaded) {
m_systemDumpersLoaded = true;
- if (m_gdbVersion >= 70400 && debuggerCore()->boolSetting(LoadGdbDumpers))
+ if (m_gdbVersion >= 70400 && boolSetting(LoadGdbDumpers))
postCommand("importPlainDumpers");
}
@@ -1653,8 +1653,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
showMessage(_(name + " CONSIDERED HARMLESS. CONTINUING."));
} else {
showMessage(_("HANDLING SIGNAL " + name));
- if (debuggerCore()->boolSetting(UseMessageBoxForSignals)
- && !isStopperThread)
+ if (boolSetting(UseMessageBoxForSignals) && !isStopperThread)
showStoppedBySignalMessageBox(_(meaning), _(name));
if (!name.isEmpty() && !meaning.isEmpty())
reasontr = msgStoppedBySignal(_(meaning), _(name));
@@ -1737,7 +1736,7 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
if (response.resultClass == GdbResultDone) {
bool needSetup = false;
- const QString path = debuggerCore()->stringSetting(ExtraDumperFile);
+ const QString path = stringSetting(ExtraDumperFile);
if (!path.isEmpty()) {
QFileInfo fi(path);
postCommand("python sys.path.insert(1, '" + fi.absolutePath().toUtf8() + "')");
@@ -1745,7 +1744,7 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
needSetup = true;
}
- const QString commands = debuggerCore()->stringSetting(ExtraDumperCommands);
+ const QString commands = stringSetting(ExtraDumperCommands);
if (!commands.isEmpty()) {
postCommand(commands.toLocal8Bit());
needSetup = true;
@@ -1856,7 +1855,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName)
startParameters().localMountDir);
}
- if (!debuggerCore()->boolSetting(AutoEnrichParameters))
+ if (!boolSetting(AutoEnrichParameters))
return cleanFilePath;
const QString sysroot = startParameters().sysRoot;
@@ -2318,7 +2317,7 @@ void GdbEngine::setTokenBarrier()
QTC_ASSERT(good, return);
PENDING_DEBUG("\n--- token barrier ---\n");
showMessage(_("--- token barrier ---"), LogMiscInput);
- if (debuggerCore()->boolSetting(LogTimeStamps))
+ if (boolSetting(LogTimeStamps))
showMessage(LogWindow::logTimeStamp(), LogMiscInput);
m_oldestAcceptableToken = currentToken();
m_stackNeeded = false;
@@ -3318,7 +3317,7 @@ void GdbEngine::reloadStack(bool forceGotoLocation)
{
PENDING_DEBUG("RELOAD STACK");
QByteArray cmd = "-stack-list-frames";
- int stackDepth = debuggerCore()->action(MaximalStackDepth)->value().toInt();
+ int stackDepth = action(MaximalStackDepth)->value().toInt();
if (stackDepth)
cmd += " 0 " + QByteArray::number(stackDepth);
postCommand(cmd, Discardable, CB(handleStackListFrames),
@@ -3379,8 +3378,8 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
}
bool canExpand = !cookie.isFull
- && (n >= debuggerCore()->action(MaximalStackDepth)->value().toInt());
- debuggerCore()->action(ExpandStack)->setEnabled(canExpand);
+ && (n >= action(MaximalStackDepth)->value().toInt());
+ action(ExpandStack)->setEnabled(canExpand);
stackHandler()->setFrames(stackFrames, canExpand);
// We can't jump to any file if we don't have any frames.
@@ -3392,7 +3391,7 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
// a few exceptions:
// Always jump to frame #0 when stepping by instruction.
- if (debuggerCore()->boolSetting(OperateByInstruction))
+ if (boolSetting(OperateByInstruction))
targetFrame = 0;
// If there is no frame with source, jump to frame #0.
@@ -3453,9 +3452,9 @@ void GdbEngine::handleThreadInfo(const GdbResponse &response)
selectThread(other);
}
updateViews(); // Adjust Threads combobox.
- if (debuggerCore()->boolSetting(ShowThreadNames)) {
+ if (boolSetting(ShowThreadNames)) {
postCommand("threadnames " +
- debuggerCore()->action(MaximalStackDepth)->value().toByteArray(),
+ action(MaximalStackDepth)->value().toByteArray(),
Discardable, CB(handleThreadNames));
}
reloadStack(false); // Will trigger register reload.
@@ -3636,7 +3635,7 @@ void GdbEngine::handleRegisterListValues(const GdbResponse &response)
// qDebug() << "GdbEngine::showToolTip " << expression << m_toolTipContext.iname << m_toolTipContext;
// if (m_toolTipContext.iname.startsWith("tooltip")
-// && (!debuggerCore()->boolSetting(UseToolTipsInMainEditor)
+// && (!boolSetting(UseToolTipsInMainEditor)
// || !watchHandler()->isValidToolTip(m_toolTipContext.iname))) {
// watchHandler()->removeData(m_toolTipContext.iname);
// return;
@@ -3651,7 +3650,7 @@ void GdbEngine::resetLocation()
DebuggerEngine::resetLocation();
}
-bool GdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
+bool GdbEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &context)
{
if (state() != InferiorStopOk || !isCppEditor(editor)) {
@@ -3728,7 +3727,7 @@ void GdbEngine::rebuildWatchModel()
static int count = 0;
++count;
PENDING_DEBUG("REBUILDING MODEL" << count);
- if (debuggerCore()->boolSetting(LogTimeStamps))
+ if (boolSetting(LogTimeStamps))
showMessage(LogWindow::logTimeStamp(), LogMiscInput);
showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
showStatusMessage(tr("Finished retrieving data"), 400);
@@ -3939,7 +3938,7 @@ public:
void GdbEngine::fetchDisassembler(DisassemblerAgent *agent)
{
- if (debuggerCore()->boolSetting(IntelFlavor))
+ if (boolSetting(IntelFlavor))
postCommand("set disassembly-flavor intel");
else
postCommand("set disassembly-flavor att");
@@ -4144,7 +4143,7 @@ void GdbEngine::startGdb(const QStringList &args)
QStringList gdbArgs;
gdbArgs << _("-i");
gdbArgs << _("mi");
- if (!debuggerCore()->boolSetting(LoadGdbInit))
+ if (!boolSetting(LoadGdbInit))
gdbArgs << _("-n");
gdbArgs += args;
@@ -4286,7 +4285,7 @@ void GdbEngine::startGdb(const QStringList &args)
postCommand("set auto-solib-add on", ConsoleCommand);
}
- if (debuggerCore()->boolSetting(MultiInferior)) {
+ if (boolSetting(MultiInferior)) {
//postCommand("set follow-exec-mode new");
postCommand("set detach-on-fork off");
}
@@ -4328,7 +4327,7 @@ void GdbEngine::loadInitScript()
).arg(script));
}
} else {
- const QString commands = debuggerCore()->stringSetting(GdbStartupCommands);
+ const QString commands = stringSetting(GdbStartupCommands);
if (!commands.isEmpty())
postCommand(commands.toLocal8Bit());
}
@@ -4494,13 +4493,13 @@ void GdbEngine::finishInferiorSetup()
if (startParameters().startMode == AttachCore) {
notifyInferiorSetupOk(); // No breakpoints in core files.
} else {
- if (debuggerCore()->boolSetting(BreakOnAbort))
+ if (boolSetting(BreakOnAbort))
postCommand("-break-insert -f abort");
- if (debuggerCore()->boolSetting(BreakOnWarning)) {
+ if (boolSetting(BreakOnWarning)) {
postCommand("-break-insert -f '" + qtNamespace() + "qWarning'");
postCommand("-break-insert -f '" + qtNamespace() + "QMessageLogger::warning'");
}
- if (debuggerCore()->boolSetting(BreakOnFatal)) {
+ if (boolSetting(BreakOnFatal)) {
postCommand("-break-insert -f '" + qtNamespace() + "qFatal'",
CB(handleBreakOnQFatal), QVariant(false));
postCommand("-break-insert -f '" + qtNamespace() + "QMessageLogger::fatal'",
@@ -4666,10 +4665,9 @@ bool GdbEngine::isHiddenBreakpoint(const BreakpointResponseId &id) const
bool GdbEngine::usesExecInterrupt() const
{
- // debuggerCore()->boolSetting(TargetAsync)
DebuggerStartMode mode = startParameters().startMode;
return (mode == AttachToRemoteServer || mode == AttachToRemoteProcess)
- && debuggerCore()->boolSetting(TargetAsync);
+ && boolSetting(TargetAsync);
}
void GdbEngine::scheduleTestResponse(int testCase, const QByteArray &response)
@@ -4691,7 +4689,7 @@ void GdbEngine::requestDebugInformation(const DebugInfoTask &task)
bool GdbEngine::attemptQuickStart() const
{
// Don't try if the user does not ask for it.
- if (!debuggerCore()->boolSetting(AttemptQuickStart))
+ if (!boolSetting(AttemptQuickStart))
return false;
// Don't try if there are breakpoints we might be able to handle.
@@ -4827,9 +4825,9 @@ void GdbEngine::updateLocalsPython(const UpdateParameters &params)
expanded += "formats:" + handler->individualFormatRequests();
QByteArray cutOff = " stringcutoff:"
- + debuggerCore()->action(MaximalStringLength)->value().toByteArray()
+ + action(MaximalStringLength)->value().toByteArray()
+ " displaystringlimit:"
- + debuggerCore()->action(DisplayStringLimit)->value().toByteArray();
+ + action(DisplayStringLimit)->value().toByteArray();
QByteArray watchers;
@@ -4882,11 +4880,11 @@ void GdbEngine::updateLocalsPython(const UpdateParameters &params)
QByteArray options;
if (alwaysVerbose)
options += "pe,";
- if (debuggerCore()->boolSetting(UseDebuggingHelpers))
+ if (boolSetting(UseDebuggingHelpers))
options += "fancy,";
- if (debuggerCore()->boolSetting(AutoDerefPointers))
+ if (boolSetting(AutoDerefPointers))
options += "autoderef,";
- if (debuggerCore()->boolSetting(UseDynamicType))
+ if (boolSetting(UseDynamicType))
options += "dyntype,";
if (options.isEmpty())
options += "defaults,";
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index b30e40d5bf..b03682d2e8 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -407,7 +407,7 @@ protected:
//
// Watch specific stuff
//
- virtual bool setToolTipExpression(TextEditor::ITextEditor *editor,
+ virtual bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &);
virtual void assignValueInDebugger(const WatchData *data,
const QString &expr, const QVariant &value);
diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp
index 34965c77b0..7a913b6422 100644
--- a/src/plugins/debugger/gdb/gdboptionspage.cpp
+++ b/src/plugins/debugger/gdb/gdboptionspage.cpp
@@ -268,23 +268,22 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
gridLayout->addWidget(groupBoxPostAttachCommands, 2, 1, 2, 1);
gridLayout->addWidget(groupBoxCustomDumperCommands, 4, 1, 2, 1);
- DebuggerCore *dc = debuggerCore();
- group.insert(dc->action(GdbStartupCommands), textEditStartupCommands);
- group.insert(dc->action(ExtraDumperFile), pathChooserExtraDumperFile);
- group.insert(dc->action(ExtraDumperCommands), textEditCustomDumperCommands);
- group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands);
- group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit);
- group.insert(dc->action(LoadGdbDumpers), checkBoxLoadGdbDumpers);
- group.insert(dc->action(UseDynamicType), checkBoxUseDynamicType);
- group.insert(dc->action(AdjustBreakpointLocations), checkBoxAdjustBreakpointLocations);
- group.insert(dc->action(GdbWatchdogTimeout), spinBoxGdbWatchdogTimeout);
- group.insert(dc->action(IntelFlavor), checkBoxIntelFlavor);
- group.insert(dc->action(IdentifyDebugInfoPackages), checkBoxIdentifyDebugInfoPackages);
- group.insert(dc->action(UseMessageBoxForSignals), checkBoxUseMessageBoxForSignals);
- group.insert(dc->action(SkipKnownFrames), checkBoxSkipKnownFrames);
+ group.insert(action(GdbStartupCommands), textEditStartupCommands);
+ group.insert(action(ExtraDumperFile), pathChooserExtraDumperFile);
+ group.insert(action(ExtraDumperCommands), textEditCustomDumperCommands);
+ group.insert(action(GdbPostAttachCommands), textEditPostAttachCommands);
+ group.insert(action(LoadGdbInit), checkBoxLoadGdbInit);
+ group.insert(action(LoadGdbDumpers), checkBoxLoadGdbDumpers);
+ group.insert(action(UseDynamicType), checkBoxUseDynamicType);
+ group.insert(action(AdjustBreakpointLocations), checkBoxAdjustBreakpointLocations);
+ group.insert(action(GdbWatchdogTimeout), spinBoxGdbWatchdogTimeout);
+ group.insert(action(IntelFlavor), checkBoxIntelFlavor);
+ group.insert(action(IdentifyDebugInfoPackages), checkBoxIdentifyDebugInfoPackages);
+ group.insert(action(UseMessageBoxForSignals), checkBoxUseMessageBoxForSignals);
+ group.insert(action(SkipKnownFrames), checkBoxSkipKnownFrames);
//lineEditSelectedPluginBreakpointsPattern->
- // setEnabled(dc->action(SelectedPluginBreakpoints)->value().toBool());
+ // setEnabled(action(SelectedPluginBreakpoints)->value().toBool());
//connect(radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
// lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
}
@@ -425,15 +424,14 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
QGridLayout *gridLayout = new QGridLayout(this);
gridLayout->addWidget(groupBoxDangerous, 0, 0, 2, 1);
- DebuggerCore *dc = debuggerCore();
- group.insert(dc->action(AutoEnrichParameters), checkBoxAutoEnrichParameters);
- group.insert(dc->action(TargetAsync), checkBoxTargetAsync);
- group.insert(dc->action(BreakOnWarning), checkBoxBreakOnWarning);
- group.insert(dc->action(BreakOnFatal), checkBoxBreakOnFatal);
- group.insert(dc->action(BreakOnAbort), checkBoxBreakOnAbort);
- group.insert(dc->action(AttemptQuickStart), checkBoxAttemptQuickStart);
- group.insert(dc->action(MultiInferior), checkBoxMultiInferior);
- group.insert(dc->action(EnableReverseDebugging), checkBoxEnableReverseDebugging);
+ group.insert(action(AutoEnrichParameters), checkBoxAutoEnrichParameters);
+ group.insert(action(TargetAsync), checkBoxTargetAsync);
+ group.insert(action(BreakOnWarning), checkBoxBreakOnWarning);
+ group.insert(action(BreakOnFatal), checkBoxBreakOnFatal);
+ group.insert(action(BreakOnAbort), checkBoxBreakOnAbort);
+ group.insert(action(AttemptQuickStart), checkBoxAttemptQuickStart);
+ group.insert(action(MultiInferior), checkBoxMultiInferior);
+ group.insert(action(EnableReverseDebugging), checkBoxEnableReverseDebugging);
}
GdbOptionsPage2::GdbOptionsPage2()
diff --git a/src/plugins/debugger/gdb/gdbplainengine.cpp b/src/plugins/debugger/gdb/gdbplainengine.cpp
index 366395db64..3a6ba6ba66 100644
--- a/src/plugins/debugger/gdb/gdbplainengine.cpp
+++ b/src/plugins/debugger/gdb/gdbplainengine.cpp
@@ -101,7 +101,7 @@ void GdbPlainEngine::handleExecRun(const GdbResponse &response)
showMessage(_("INFERIOR STARTED"));
showMessage(msgInferiorSetupOk(), StatusBar);
// FIXME: That's the wrong place for it.
- if (debuggerCore()->boolSetting(EnableReverseDebugging))
+ if (boolSetting(EnableReverseDebugging))
postCommand("target record");
} else {
QString msg = fromLocalEncoding(response.data["msg"].data());
diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
index ca6e95771d..71aeaea732 100644
--- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
+++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
@@ -202,7 +202,7 @@ void GdbRemoteServerEngine::setupInferior()
// gdb/mi/mi-main.c:1958: internal-error:
// mi_execute_async_cli_command: Assertion `is_running (inferior_ptid)'
// failed.\nA problem internal to GDB has been detected,[...]
- if (debuggerCore()->boolSetting(TargetAsync))
+ if (boolSetting(TargetAsync))
postCommand("set target-async on", CB(handleSetTargetAsync));
if (executableFileName.isEmpty()) {
@@ -277,7 +277,7 @@ void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &response)
// gdb server will stop the remote application itself.
showMessage(_("INFERIOR STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar);
- QString postAttachCommands = debuggerCore()->stringSetting(GdbPostAttachCommands);
+ QString postAttachCommands = stringSetting(GdbPostAttachCommands);
if (!postAttachCommands.isEmpty()) {
foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n')))
postCommand(cmd.toLatin1());
@@ -297,7 +297,7 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const GdbResponse &respon
if (response.resultClass == GdbResultDone) {
showMessage(_("ATTACHED TO GDB SERVER STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar);
- QString postAttachCommands = debuggerCore()->stringSetting(GdbPostAttachCommands);
+ QString postAttachCommands = stringSetting(GdbPostAttachCommands);
if (!postAttachCommands.isEmpty()) {
foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n')))
postCommand(cmd.toLatin1());
@@ -432,7 +432,7 @@ void GdbRemoteServerEngine::handleExecRun(const GdbResponse &response)
void GdbRemoteServerEngine::interruptInferior2()
{
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
- if (debuggerCore()->boolSetting(TargetAsync)) {
+ if (boolSetting(TargetAsync)) {
postCommand("-exec-interrupt", GdbEngine::Immediate,
CB(handleInterruptInferior));
} else if (m_isQnxGdb && Utils::HostOsInfo::isWindowsHost()) {
diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp
index a66db55f42..ac4c09ef46 100644
--- a/src/plugins/debugger/lldb/lldbengine.cpp
+++ b/src/plugins/debugger/lldb/lldbengine.cpp
@@ -54,7 +54,7 @@
#include <utils/savedaction.h>
#include <utils/qtcprocess.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <coreplugin/idocument.h>
#include <coreplugin/icore.h>
@@ -105,15 +105,15 @@ LldbEngine::LldbEngine(const DebuggerStartParameters &startParameters)
#endif
}
- connect(debuggerCore()->action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)),
+ connect(action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)),
SLOT(updateLocals()));
- connect(debuggerCore()->action(CreateFullBacktrace), SIGNAL(triggered()),
+ connect(action(CreateFullBacktrace), SIGNAL(triggered()),
SLOT(createFullBacktrace()));
- connect(debuggerCore()->action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
+ connect(action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
SLOT(updateLocals()));
- connect(debuggerCore()->action(UseDynamicType), SIGNAL(valueChanged(QVariant)),
+ connect(action(UseDynamicType), SIGNAL(valueChanged(QVariant)),
SLOT(updateLocals()));
- connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
+ connect(action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
SLOT(updateAll()));
}
@@ -275,7 +275,7 @@ void LldbEngine::setupInferior()
{
const DebuggerStartParameters &sp = startParameters();
- const QString path = debuggerCore()->stringSetting(ExtraDumperFile);
+ const QString path = stringSetting(ExtraDumperFile);
if (!path.isEmpty()) {
QFileInfo fi(path);
@@ -288,7 +288,7 @@ void LldbEngine::setupInferior()
runCommand(cmd2);
}
- const QString commands = debuggerCore()->stringSetting(ExtraDumperCommands);
+ const QString commands = stringSetting(ExtraDumperCommands);
if (!commands.isEmpty()) {
Command cmd("executeDebuggerCommand");
cmd.arg(commands.toUtf8());
@@ -837,7 +837,7 @@ void LldbEngine::resetLocation()
DebuggerEngine::resetLocation();
}
-bool LldbEngine::setToolTipExpression(TextEditor::ITextEditor *editor, const DebuggerToolTipContext &context)
+bool LldbEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &context)
{
if (state() != InferiorStopOk || !isCppEditor(editor)) {
//qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED "
@@ -873,7 +873,7 @@ void LldbEngine::reloadFullStack()
void LldbEngine::updateStack()
{
Command cmd("reportStack");
- cmd.arg("stacklimit", debuggerCore()->action(MaximalStackDepth)->value().toInt());
+ cmd.arg("stacklimit", action(MaximalStackDepth)->value().toInt());
runCommand(cmd);
}
@@ -917,9 +917,9 @@ void LldbEngine::doUpdateLocals(UpdateParameters params)
const static bool alwaysVerbose = !qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty();
cmd.arg("passexceptions", alwaysVerbose);
- cmd.arg("fancy", debuggerCore()->boolSetting(UseDebuggingHelpers));
- cmd.arg("autoderef", debuggerCore()->boolSetting(AutoDerefPointers));
- cmd.arg("dyntype", debuggerCore()->boolSetting(UseDynamicType));
+ cmd.arg("fancy", boolSetting(UseDebuggingHelpers));
+ cmd.arg("autoderef", boolSetting(AutoDerefPointers));
+ cmd.arg("dyntype", boolSetting(UseDynamicType));
cmd.arg("partial", params.tryPartial);
cmd.arg("tooltiponly", params.tooltipOnly);
@@ -1102,7 +1102,7 @@ void LldbEngine::refreshStack(const GdbMi &stack)
frames.append(frame);
}
bool canExpand = stack["hasmore"].toInt();
- debuggerCore()->action(ExpandStack)->setEnabled(canExpand);
+ action(ExpandStack)->setEnabled(canExpand);
handler->setFrames(frames, canExpand);
}
@@ -1219,7 +1219,7 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
void LldbEngine::refreshLocation(const GdbMi &reportedLocation)
{
- if (debuggerCore()->boolSetting(OperateByInstruction)) {
+ if (boolSetting(OperateByInstruction)) {
Location loc(reportedLocation["addr"].toAddress());
loc.setNeedsMarker(true);
gotoLocation(loc);
@@ -1249,7 +1249,7 @@ void LldbEngine::fetchDisassembler(DisassemblerAgent *agent)
cmd.arg("cookie", id);
cmd.arg("address", loc.address());
cmd.arg("function", loc.functionName());
- cmd.arg("flavor", debuggerCore()->boolSetting(IntelFlavor) ? "intel" : "att");
+ cmd.arg("flavor", boolSetting(IntelFlavor) ? "intel" : "att");
runCommand(cmd);
}
diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h
index 38ff85ba82..57ddf51795 100644
--- a/src/plugins/debugger/lldb/lldbengine.h
+++ b/src/plugins/debugger/lldb/lldbengine.h
@@ -108,7 +108,7 @@ private:
void abortDebugger();
void resetLocation();
- bool setToolTipExpression(TextEditor::ITextEditor *editor,
+ bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &);
void continueInferior();
diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp
index edfdb6b77b..ee5c19980e 100644
--- a/src/plugins/debugger/loadcoredialog.cpp
+++ b/src/plugins/debugger/loadcoredialog.cpp
@@ -367,10 +367,12 @@ void AttachCoreDialog::coreFileChanged(const QString &core)
Kit *k = d->kitChooser->currentKit();
QTC_ASSERT(k, return);
FileName cmd = DebuggerKitInformation::debuggerCommand(k);
- bool isCore = false;
- const QString exe = readExecutableNameFromCore(cmd.toString(), core, &isCore);
- if (!exe.isEmpty())
- d->localExecFileName->setFileName(FileName::fromString(exe));
+ GdbCoreEngine::CoreInfo cinfo =
+ GdbCoreEngine::readExecutableNameFromCore(cmd.toString(), core);
+ if (!cinfo.foundExecutableName.isEmpty())
+ d->localExecFileName->setFileName(FileName::fromString(cinfo.foundExecutableName));
+ else if (!d->localExecFileName->isValid() && !cinfo.rawStringFromCore.isEmpty())
+ d->localExecFileName->setFileName(FileName::fromString(cinfo.rawStringFromCore));
}
changed();
}
diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp
index 74a3f3f525..0311ab4c88 100644
--- a/src/plugins/debugger/logwindow.cpp
+++ b/src/plugins/debugger/logwindow.cpp
@@ -172,11 +172,11 @@ public:
QMenu *menu = createStandardContextMenu();
menu->addAction(m_clearContentsAction);
menu->addAction(m_saveContentsAction); // X11 clipboard is unreliable for long texts
- menu->addAction(debuggerCore()->action(LogTimeStamps));
- menu->addAction(debuggerCore()->action(VerboseLog));
+ menu->addAction(action(LogTimeStamps));
+ menu->addAction(action(VerboseLog));
menu->addAction(m_reloadDebuggingHelpersAction);
menu->addSeparator();
- menu->addAction(debuggerCore()->action(SettingsDialog));
+ menu->addAction(action(SettingsDialog));
menu->exec(ev->globalPos());
delete menu;
}
@@ -225,7 +225,7 @@ void DebuggerPane::saveContents()
void DebuggerPane::reloadDebuggingHelpers()
{
- debuggerCore()->currentEngine()->reloadDebuggingHelpers();
+ currentEngine()->reloadDebuggingHelpers();
}
/////////////////////////////////////////////////////////////////////
@@ -433,18 +433,18 @@ LogWindow::LogWindow(QWidget *parent)
void LogWindow::executeLine()
{
m_ignoreNextInputEcho = true;
- debuggerCore()->currentEngine()->
+ currentEngine()->
executeDebuggerCommand(m_inputText->textCursor().block().text(), CppLanguage);
}
void LogWindow::repeatLastCommand()
{
- debuggerCore()->currentEngine()->debugLastCommand();
+ currentEngine()->debugLastCommand();
}
void LogWindow::sendCommand()
{
- DebuggerEngine *engine = debuggerCore()->currentEngine();
+ DebuggerEngine *engine = currentEngine();
if (engine->acceptsDebuggerCommands())
engine->executeDebuggerCommand(m_commandEdit->text(), CppLanguage);
else
@@ -462,7 +462,7 @@ void LogWindow::showOutput(int channel, const QString &output)
QString out;
out.reserve(output.size() + 1000);
- if (output.at(0) != QLatin1Char('~') && debuggerCore()->boolSetting(LogTimeStamps)) {
+ if (output.at(0) != QLatin1Char('~') && boolSetting(LogTimeStamps)) {
out.append(charForChannel(LogTime));
out.append(logTimeStamp());
out.append(nchar);
@@ -521,7 +521,7 @@ void LogWindow::showInput(int channel, const QString &input)
m_inputText->setTextCursor(cursor);
return;
}
- if (debuggerCore()->boolSetting(LogTimeStamps))
+ if (boolSetting(LogTimeStamps))
m_inputText->append(logTimeStamp());
m_inputText->append(input);
QTextCursor cursor = m_inputText->textCursor();
diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp
index 546f639ba6..b87a40d625 100644
--- a/src/plugins/debugger/moduleswindow.cpp
+++ b/src/plugins/debugger/moduleswindow.cpp
@@ -38,9 +38,8 @@
#include <utils/savedaction.h>
#include <QDebug>
-#include <QProcess>
-
#include <QMenu>
+#include <QProcess>
#include <QResizeEvent>
@@ -63,7 +62,7 @@ ModulesTreeView::ModulesTreeView()
void ModulesTreeView::moduleActivated(const QModelIndex &index)
{
- DebuggerEngine *engine = debuggerCore()->currentEngine();
+ DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return);
if (index.isValid())
engine->gotoLocation(index.sibling(index.row(), 1).data().toString());
@@ -81,7 +80,7 @@ void ModulesTreeView::contextMenuEvent(QContextMenuEvent *ev)
fileName = index.sibling(index.row(), 1).data().toString();
}
- DebuggerEngine *engine = debuggerCore()->currentEngine();
+ DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return);
const bool enabled = engine->debuggerActionsEnabled();
const bool canReload = engine->hasCapability(ReloadModuleCapability);
@@ -150,7 +149,7 @@ void ModulesTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(actShowModuleSymbols);
menu.addAction(actShowModuleSections);
menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp
index ea8e04e8dd..60ef9dcb09 100644
--- a/src/plugins/debugger/pdb/pdbengine.cpp
+++ b/src/plugins/debugger/pdb/pdbengine.cpp
@@ -48,7 +48,7 @@
#include <utils/qtcassert.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <coreplugin/idocument.h>
#include <coreplugin/icore.h>
@@ -452,7 +452,7 @@ static WatchData m_toolTip;
static QPoint m_toolTipPos;
static QHash<QString, WatchData> m_toolTipCache;
-bool PdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
+bool PdbEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &ctx)
{
Q_UNUSED(editor)
@@ -730,9 +730,9 @@ void PdbEngine::updateLocals()
}
QByteArray options;
- if (debuggerCore()->boolSetting(UseDebuggingHelpers))
+ if (boolSetting(UseDebuggingHelpers))
options += "fancy,";
- if (debuggerCore()->boolSetting(AutoDerefPointers))
+ if (boolSetting(AutoDerefPointers))
options += "autoderef,";
if (options.isEmpty())
options += "defaults,";
diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h
index bb91567fdf..eddc04796d 100644
--- a/src/plugins/debugger/pdb/pdbengine.h
+++ b/src/plugins/debugger/pdb/pdbengine.h
@@ -75,7 +75,7 @@ private:
void shutdownInferior();
void shutdownEngine();
- bool setToolTipExpression(TextEditor::ITextEditor *editor,
+ bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &);
void continueInferior();
diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp
index 8cea03a430..439d4bf31c 100644
--- a/src/plugins/debugger/qml/qmlcppengine.cpp
+++ b/src/plugins/debugger/qml/qmlcppengine.cpp
@@ -35,7 +35,7 @@
#include <debugger/watchhandler.h>
#include <utils/qtcassert.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <qmljseditor/qmljseditorconstants.h>
#include <cppeditor/cppeditorconstants.h>
#include <qmljs/consolemanagerinterface.h>
@@ -89,7 +89,7 @@ bool QmlCppEngine::canDisplayTooltip() const
return m_cppEngine->canDisplayTooltip() || m_qmlEngine->canDisplayTooltip();
}
-bool QmlCppEngine::setToolTipExpression(TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
+bool QmlCppEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &ctx)
{
QTC_ASSERT(editor, return false);
bool success = false;
diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h
index 5320fe3ed7..10256ff168 100644
--- a/src/plugins/debugger/qml/qmlcppengine.h
+++ b/src/plugins/debugger/qml/qmlcppengine.h
@@ -46,7 +46,7 @@ public:
~QmlCppEngine();
bool canDisplayTooltip() const;
- bool setToolTipExpression(TextEditor::ITextEditor *editor,
+ bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &);
void updateWatchData(const WatchData &data,
const WatchUpdateFlags &flags);
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index c36ec7cb4a..73b10d98af 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -54,6 +54,7 @@
#include <utils/qtcassert.h>
#include <texteditor/basetextdocument.h>
+#include <texteditor/basetexteditor.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/helpmanager.h>
#include <coreplugin/icore.h>
@@ -341,9 +342,9 @@ QmlEngine::~QmlEngine()
{
QList<Core::IEditor *> editorsToClose;
- QHash<QString, QWeakPointer<TextEditor::ITextEditor> >::iterator iter;
+ QHash<QString, QWeakPointer<TextEditor::BaseTextEditor> >::iterator iter;
for (iter = m_sourceEditors.begin(); iter != m_sourceEditors.end(); ++iter) {
- QWeakPointer<TextEditor::ITextEditor> textEditPtr = iter.value();
+ QWeakPointer<TextEditor::BaseTextEditor> textEditPtr = iter.value();
if (textEditPtr)
editorsToClose << textEditPtr.data();
}
@@ -983,7 +984,7 @@ void QmlEngine::requestModuleSymbols(const QString &moduleName)
//
//////////////////////////////////////////////////////////////////////
-bool QmlEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
+bool QmlEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &ctx)
{
// This is processed by QML inspector, which has dependencies to
@@ -1057,7 +1058,7 @@ QmlJS::ConsoleItem *constructLogItemTree(QmlJS::ConsoleItem *parent,
const QString &key = QString())
{
using namespace QmlJS;
- bool sorted = debuggerCore()->boolSetting(SortStructMembers);
+ bool sorted = boolSetting(SortStructMembers);
if (!result.isValid())
return 0;
diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h
index cb0e9d6a85..c0fbab6740 100644
--- a/src/plugins/debugger/qml/qmlengine.h
+++ b/src/plugins/debugger/qml/qmlengine.h
@@ -89,7 +89,7 @@ public:
signals:
void tooltipRequested(const QPoint &mousePos,
- TextEditor::ITextEditor *editor, int cursorPos);
+ TextEditor::BaseTextEditor *editor, int cursorPos);
void aboutToNotifyInferiorSetupOk();
private slots:
@@ -128,7 +128,7 @@ private:
void shutdownInferior();
void shutdownEngine();
- bool setToolTipExpression(TextEditor::ITextEditor *editor,
+ bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &);
void continueInferior();
@@ -190,7 +190,7 @@ private:
QTimer m_noDebugOutputTimer;
QmlDebug::QmlOutputParser m_outputParser;
QHash<QString, QTextDocument*> m_sourceDocuments;
- QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors;
+ QHash<QString, QWeakPointer<TextEditor::BaseTextEditor> > m_sourceEditors;
InteractiveInterpreter m_interpreter;
QHash<QString,BreakpointModelId> pendingBreakpoints;
QList<quint32> queryIds;
diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
index 914b7b388f..e5ae7b8214 100644
--- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
@@ -76,8 +76,8 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
, m_inspectorToolsContext("Debugger.QmlInspector")
, m_selectAction(new QAction(this))
, m_zoomAction(new QAction(this))
- , m_showAppOnTopAction(debuggerCore()->action(ShowAppOnTop))
- , m_updateOnSaveAction(debuggerCore()->action(QmlUpdateOnSave))
+ , m_showAppOnTopAction(action(ShowAppOnTop))
+ , m_updateOnSaveAction(action(QmlUpdateOnSave))
, m_engineClientConnected(false)
{
if (!m_engine->isMasterEngine())
@@ -325,8 +325,7 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
QmlLiveTextPreview *preview
= new QmlLiveTextPreview(doc, initdoc, this, this);
- preview->setApplyChangesToQmlInspector(
- debuggerCore()->action(QmlUpdateOnSave)->isChecked());
+ preview->setApplyChangesToQmlInspector(action(QmlUpdateOnSave)->isChecked());
connect(preview, SIGNAL(reloadRequest()),
this, SLOT(onReload()));
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index af89017804..a3310fb583 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -62,7 +62,7 @@ QmlInspectorAgent::QmlInspectorAgent(DebuggerEngine *engine, QObject *parent)
, m_objectToSelect(-1)
{
m_debugIdToIname.insert(-1, QByteArray("inspect"));
- connect(debuggerCore()->action(ShowQmlObjectTree),
+ connect(action(ShowQmlObjectTree),
SIGNAL(valueChanged(QVariant)), SLOT(updateState()));
m_delayQueryTimer.setSingleShot(true);
m_delayQueryTimer.setInterval(100);
@@ -177,8 +177,7 @@ quint32 QmlInspectorAgent::setBindingForObject(int objectDebugId,
if (propertyName == QLatin1String("id"))
return 0; // Crashes the QMLViewer.
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return 0;
log(LogSend, QString::fromLatin1("SET_BINDING %1 %2 %3 %4").arg(
@@ -206,8 +205,7 @@ quint32 QmlInspectorAgent::setMethodBodyForObject(int objectDebugId,
if (objectDebugId == -1)
return 0;
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return 0;
log(LogSend, QString::fromLatin1("SET_METHOD_BODY %1 %2 %3").arg(
@@ -232,8 +230,7 @@ quint32 QmlInspectorAgent::resetBindingForObject(int objectDebugId,
if (objectDebugId == -1)
return 0;
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return 0;
log(LogSend, QString::fromLatin1("RESET_BINDING %1 %2").arg(
@@ -331,8 +328,7 @@ bool QmlInspectorAgent::addObjectWatch(int objectDebugId)
if (objectDebugId == -1)
return false;
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return false;
// already set
@@ -412,8 +408,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client)
QString QmlInspectorAgent::displayName(int objectDebugId) const
{
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return QString();
if (m_debugIdToIname.contains(objectDebugId)) {
@@ -429,7 +424,7 @@ void QmlInspectorAgent::updateState()
{
if (m_engineClient
&& (m_engineClient->state() == QmlDebugClient::Enabled)
- && debuggerCore()->boolSetting(ShowQmlObjectTree)) {
+ && boolSetting(ShowQmlObjectTree)) {
reloadEngines();
} else {
clearObjectTree();
@@ -550,8 +545,7 @@ void QmlInspectorAgent::queryEngineContext()
{
qCDebug(qmlInspectorLog) << __FUNCTION__;
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return;
log(LogSend, QLatin1String("LIST_OBJECTS"));
@@ -564,8 +558,7 @@ void QmlInspectorAgent::fetchObject(int debugId)
{
qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')';
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return;
log(LogSend, QLatin1String("FETCH_OBJECT ") + QString::number(debugId));
@@ -583,8 +576,7 @@ void QmlInspectorAgent::fetchContextObjectsForLocation(const QString &file,
qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << file << ':' << lineNumber
<< ':' << columnNumber << ')';
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return;
log(LogSend, QString::fromLatin1("FETCH_OBJECTS_FOR_LOCATION %1:%2:%3").arg(file)
@@ -601,8 +593,7 @@ void QmlInspectorAgent::updateObjectTree(const ContextReference &context)
{
qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << context << ')';
- if (!isConnected()
- || !debuggerCore()->boolSetting(ShowQmlObjectTree))
+ if (!isConnected() || !boolSetting(ShowQmlObjectTree))
return;
foreach (const ObjectReference & obj, context.objects())
diff --git a/src/plugins/debugger/qml/qmllivetextpreview.cpp b/src/plugins/debugger/qml/qmllivetextpreview.cpp
index 33e6dc72a6..b5e97e5acb 100644
--- a/src/plugins/debugger/qml/qmllivetextpreview.cpp
+++ b/src/plugins/debugger/qml/qmllivetextpreview.cpp
@@ -714,7 +714,7 @@ void QmlLiveTextPreview::showSyncWarning(
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
- Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
+ Core::InfoBar *infoBar = editor->textDocument()->infoBar();
Core::InfoBarEntry info(Core::Id(INFO_OUT_OF_SYNC), errorMessage);
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
if (toolsClient && toolsClient->supportReload())
@@ -735,7 +735,7 @@ void QmlLiveTextPreview::removeOutofSyncInfo()
{
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
- Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
+ Core::InfoBar *infoBar = editor->textDocument()->infoBar();
infoBar->removeInfo(Core::Id(INFO_OUT_OF_SYNC));
}
}
diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
index 1316793217..650911b395 100644
--- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
+++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
@@ -1591,7 +1591,7 @@ QmlJS::ConsoleItem *constructLogItemTree(QmlJS::ConsoleItem *parent,
const QVariant &refsVal)
{
using namespace QmlJS;
- bool sorted = debuggerCore()->boolSetting(SortStructMembers);
+ bool sorted = boolSetting(SortStructMembers);
if (!objectData.value.isValid())
return 0;
diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp
index c641469a23..9c437af96d 100644
--- a/src/plugins/debugger/registerwindow.cpp
+++ b/src/plugins/debugger/registerwindow.cpp
@@ -50,11 +50,6 @@
namespace Debugger {
namespace Internal {
-static DebuggerEngine *currentEngine()
-{
- return debuggerCore()->currentEngine();
-}
-
static RegisterHandler *currentHandler()
{
DebuggerEngine *engine = currentEngine();
@@ -226,7 +221,7 @@ void RegisterTreeView::contextMenuEvent(QContextMenuEvent *ev)
act2->setChecked(base == 2);
menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(SettingsDialog));
const QPoint position = ev->globalPos();
QAction *act = menu.exec(position);
diff --git a/src/plugins/debugger/snapshotwindow.cpp b/src/plugins/debugger/snapshotwindow.cpp
index 86de243705..4469055cd3 100644
--- a/src/plugins/debugger/snapshotwindow.cpp
+++ b/src/plugins/debugger/snapshotwindow.cpp
@@ -93,7 +93,7 @@ void SnapshotTreeView::contextMenuEvent(QContextMenuEvent *ev)
actRemove->setEnabled(idx.isValid());
menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
diff --git a/src/plugins/debugger/sourceagent.cpp b/src/plugins/debugger/sourceagent.cpp
index bade9f6961..957ffd1a4a 100644
--- a/src/plugins/debugger/sourceagent.cpp
+++ b/src/plugins/debugger/sourceagent.cpp
@@ -35,6 +35,7 @@
#include "stackhandler.h"
#include <texteditor/basetexteditor.h>
+#include <texteditor/textmark.h>
#include <cppeditor/cppeditorconstants.h>
@@ -59,9 +60,9 @@ public:
~SourceAgentPrivate();
public:
- QPointer<TextEditor::ITextEditor> editor;
+ QPointer<TextEditor::BaseTextEditor> editor;
QPointer<DebuggerEngine> engine;
- TextEditor::ITextMark *locationMark;
+ TextEditor::TextMark *locationMark;
QString path;
QString producer;
};
@@ -109,23 +110,21 @@ void SourceAgent::setContent(const QString &filePath, const QString &content)
if (!d->editor) {
QString titlePattern = d->producer + QLatin1String(": ")
+ QFileInfo(filePath).fileName();
- d->editor = qobject_cast<ITextEditor *>(
+ d->editor = qobject_cast<BaseTextEditor *>(
EditorManager::openEditorWithContents(
CppEditor::Constants::CPPEDITOR_ID,
&titlePattern, content.toUtf8()));
QTC_ASSERT(d->editor, return);
d->editor->document()->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, true);
- BaseTextEditorWidget *baseTextEdit =
- qobject_cast<BaseTextEditorWidget *>(d->editor->widget());
+ BaseTextEditorWidget *baseTextEdit = d->editor->editorWidget();
if (baseTextEdit)
baseTextEdit->setRequestMarkEnabled(true);
} else {
EditorManager::activateEditor(d->editor);
}
- QPlainTextEdit *plainTextEdit =
- qobject_cast<QPlainTextEdit *>(d->editor->widget());
+ QPlainTextEdit *plainTextEdit = d->editor->editorWidget();
QTC_ASSERT(plainTextEdit, return);
plainTextEdit->setReadOnly(true);
@@ -137,16 +136,16 @@ void SourceAgent::updateLocationMarker()
QTC_ASSERT(d->editor, return);
if (d->locationMark)
- d->editor->textDocument()->markableInterface()->removeMark(d->locationMark);
+ d->editor->textDocument()->removeMark(d->locationMark);
delete d->locationMark;
d->locationMark = 0;
if (d->engine->stackHandler()->currentFrame().file == d->path) {
int lineNumber = d->engine->stackHandler()->currentFrame().line;
- d->locationMark = new TextEditor::ITextMark(lineNumber);
+ d->locationMark = new TextEditor::TextMark(QString(), lineNumber);
d->locationMark->setIcon(debuggerCore()->locationMarkIcon());
- d->locationMark->setPriority(TextEditor::ITextMark::HighPriority);
- d->editor->textDocument()->markableInterface()->addMark(d->locationMark);
- QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(d->editor->widget());
+ d->locationMark->setPriority(TextEditor::TextMark::HighPriority);
+ d->editor->textDocument()->addMark(d->locationMark);
+ QPlainTextEdit *plainTextEdit = d->editor->editorWidget();
QTC_ASSERT(plainTextEdit, return);
QTextCursor tc = plainTextEdit->textCursor();
QTextBlock block = tc.document()->findBlockByNumber(lineNumber - 1);
diff --git a/src/plugins/debugger/sourcefileswindow.cpp b/src/plugins/debugger/sourcefileswindow.cpp
index b8849f1666..e91bd96d81 100644
--- a/src/plugins/debugger/sourcefileswindow.cpp
+++ b/src/plugins/debugger/sourcefileswindow.cpp
@@ -58,14 +58,14 @@ SourceFilesTreeView::SourceFilesTreeView()
void SourceFilesTreeView::rowActivated(const QModelIndex &index)
{
- DebuggerEngine *engine = debuggerCore()->currentEngine();
+ DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return);
engine->gotoLocation(index.data().toString());
}
void SourceFilesTreeView::contextMenuEvent(QContextMenuEvent *ev)
{
- DebuggerEngine *engine = debuggerCore()->currentEngine();
+ DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return);
QModelIndex index = indexAt(ev->pos());
index = index.sibling(index.row(), 0);
@@ -89,7 +89,7 @@ void SourceFilesTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(act1);
menu.addAction(act2);
menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp
index 5c6bf31860..975ac007a6 100644
--- a/src/plugins/debugger/sourceutils.cpp
+++ b/src/plugins/debugger/sourceutils.cpp
@@ -323,7 +323,7 @@ bool isCppEditor(Core::IEditor *editor)
}
// Return the Cpp expression, and, if desired, the function
-QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
+QString cppExpressionAt(TextEditor::BaseTextEditor *editor, int pos,
int *line, int *column, QString *function /* = 0 */)
{
using namespace CppTools;
diff --git a/src/plugins/debugger/sourceutils.h b/src/plugins/debugger/sourceutils.h
index 6882c6ce99..cce80ac6eb 100644
--- a/src/plugins/debugger/sourceutils.h
+++ b/src/plugins/debugger/sourceutils.h
@@ -32,7 +32,7 @@
#include <QString>
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace Core { class IEditor; }
namespace CPlusPlus { class Snapshot; }
@@ -41,7 +41,7 @@ namespace Internal {
// Editor tooltip support
bool isCppEditor(Core::IEditor *editor);
-QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
+QString cppExpressionAt(TextEditor::BaseTextEditor *editor, int pos,
int *line, int *column, QString *function = 0);
QString fixCppExpression(const QString &exp);
QString cppFunctionAt(const QString &fileName, int line);
diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp
index e13c7577a0..073e4c8c1f 100644
--- a/src/plugins/debugger/stackhandler.cpp
+++ b/src/plugins/debugger/stackhandler.cpp
@@ -63,7 +63,7 @@ StackHandler::StackHandler()
m_contentsValid = false;
m_currentIndex = -1;
m_canExpand = false;
- connect(debuggerCore()->action(OperateByInstruction), SIGNAL(triggered()),
+ connect(action(OperateByInstruction), SIGNAL(triggered()),
this, SLOT(resetModel()));
}
@@ -123,7 +123,7 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const
? m_positionIcon : m_emptyIcon;
}
- if (role == Qt::ToolTipRole && debuggerCore()->boolSetting(UseToolTipsInStackView))
+ if (role == Qt::ToolTipRole && boolSetting(UseToolTipsInStackView))
return frame.toToolTip();
return QVariant();
@@ -151,8 +151,7 @@ Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const
if (index.row() == m_stackFrames.size())
return QAbstractTableModel::flags(index);
const StackFrame &frame = m_stackFrames.at(index.row());
- const bool isValid = frame.isUsable()
- || debuggerCore()->boolSetting(OperateByInstruction);
+ const bool isValid = frame.isUsable() || boolSetting(OperateByInstruction);
return isValid && m_contentsValid
? QAbstractTableModel::flags(index) : Qt::ItemFlags();
}
@@ -222,7 +221,7 @@ void StackHandler::prependFrames(const StackFrames &frames)
int StackHandler::firstUsableIndex() const
{
- if (!debuggerCore()->boolSetting(OperateByInstruction)) {
+ if (!boolSetting(OperateByInstruction)) {
for (int i = 0, n = m_stackFrames.size(); i != n; ++i)
if (m_stackFrames.at(i).isUsable())
return i;
diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp
index 99ef7af26e..1fac02b4ea 100644
--- a/src/plugins/debugger/stackwindow.cpp
+++ b/src/plugins/debugger/stackwindow.cpp
@@ -55,20 +55,15 @@
namespace Debugger {
namespace Internal {
-static DebuggerEngine *currentEngine()
-{
- return debuggerCore()->currentEngine();
-}
-
StackTreeView::StackTreeView()
{
setWindowTitle(tr("Stack"));
- connect(debuggerCore()->action(UseAddressInStackView), SIGNAL(toggled(bool)),
+ connect(action(UseAddressInStackView), SIGNAL(toggled(bool)),
SLOT(showAddressColumn(bool)));
- connect(debuggerCore()->action(ExpandStack), SIGNAL(triggered()),
+ connect(action(ExpandStack), SIGNAL(triggered()),
SLOT(reloadFullStack()));
- connect(debuggerCore()->action(MaximalStackDepth), SIGNAL(triggered()),
+ connect(action(MaximalStackDepth), SIGNAL(triggered()),
SLOT(reloadFullStack()));
showAddressColumn(false);
}
@@ -88,7 +83,7 @@ void StackTreeView::setModel(QAbstractItemModel *model)
BaseTreeView::setModel(model);
resizeColumnToContents(0);
resizeColumnToContents(3);
- showAddressColumn(debuggerCore()->action(UseAddressInStackView)->isChecked());
+ showAddressColumn(action(UseAddressInStackView)->isChecked());
}
// Input a function to be disassembled. Accept CDB syntax
@@ -155,7 +150,7 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev)
const quint64 address = frame.address;
QMenu menu;
- menu.addAction(debuggerCore()->action(ExpandStack));
+ menu.addAction(action(ExpandStack));
QAction *actCopyContents = menu.addAction(tr("Copy Contents to Clipboard"));
actCopyContents->setEnabled(model() != 0);
@@ -164,7 +159,7 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev)
actSaveTaskFile->setEnabled(model() != 0);
if (engine->hasCapability(CreateFullBacktraceCapability))
- menu.addAction(debuggerCore()->action(CreateFullBacktrace));
+ menu.addAction(action(CreateFullBacktrace));
QAction *additionalQmlStackAction = 0;
if (engine->hasCapability(AdditionalQmlStackCapability))
@@ -204,12 +199,12 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev)
actLoadSymbols = menu.addAction(tr("Try to Load Unknown Symbols"));
if (engine->hasCapability(MemoryAddressCapability))
- menu.addAction(debuggerCore()->action(UseAddressInStackView));
+ menu.addAction(action(UseAddressInStackView));
menu.addSeparator();
- menu.addAction(debuggerCore()->action(UseToolTipsInStackView));
+ menu.addAction(action(UseToolTipsInStackView));
menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
if (!act)
diff --git a/src/plugins/debugger/threadswindow.cpp b/src/plugins/debugger/threadswindow.cpp
index ba867b8477..cf9d861f5f 100644
--- a/src/plugins/debugger/threadswindow.cpp
+++ b/src/plugins/debugger/threadswindow.cpp
@@ -50,13 +50,13 @@ ThreadsTreeView::ThreadsTreeView()
void ThreadsTreeView::rowActivated(const QModelIndex &index)
{
ThreadId id = ThreadId(index.data(ThreadData::IdRole).toLongLong());
- debuggerCore()->currentEngine()->selectThread(id);
+ currentEngine()->selectThread(id);
}
void ThreadsTreeView::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(SettingsDialog));
menu.exec(ev->globalPos());
}
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index ef16e42bd8..f2478d036f 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -155,14 +155,14 @@ public:
setWindowFlags(windowFlags() | Qt::Window);
setWindowTitle(WatchHandler::tr("Debugger - Qt Creator"));
- QVariant geometry = DebuggerCore::sessionValue("DebuggerSeparateWidgetGeometry");
+ QVariant geometry = sessionValue("DebuggerSeparateWidgetGeometry");
if (geometry.isValid())
setGeometry(geometry.toRect());
}
~SeparatedView()
{
- DebuggerCore::setSessionValue("DebuggerSeparateWidgetGeometry", geometry());
+ setSessionValue("DebuggerSeparateWidgetGeometry", geometry());
}
void removeObject(const QByteArray &key)
@@ -348,11 +348,11 @@ WatchModel::WatchModel(WatchHandler *handler)
m_returnRoot = createItem("return", tr("Return Value"), m_root);
m_tooltipRoot = createItem("tooltip", tr("Tooltip"), m_root);
- connect(debuggerCore()->action(SortStructMembers), SIGNAL(valueChanged(QVariant)),
+ connect(action(SortStructMembers), SIGNAL(valueChanged(QVariant)),
SLOT(reinsertAllData()));
- connect(debuggerCore()->action(ShowStdNamespace), SIGNAL(valueChanged(QVariant)),
+ connect(action(ShowStdNamespace), SIGNAL(valueChanged(QVariant)),
SLOT(reinsertAllData()));
- connect(debuggerCore()->action(ShowQtNamespace), SIGNAL(valueChanged(QVariant)),
+ connect(action(ShowQtNamespace), SIGNAL(valueChanged(QVariant)),
SLOT(reinsertAllData()));
}
@@ -560,9 +560,9 @@ static QString niceTypeHelper(const QByteArray &typeIn)
QString WatchModel::removeNamespaces(QString str) const
{
- if (!debuggerCore()->boolSetting(ShowStdNamespace))
+ if (!boolSetting(ShowStdNamespace))
str.remove(QLatin1String("std::"));
- if (!debuggerCore()->boolSetting(ShowQtNamespace)) {
+ if (!boolSetting(ShowQtNamespace)) {
const QString qtNamespace = QString::fromLatin1(engine()->qtNamespace());
if (!qtNamespace.isEmpty())
str.remove(qtNamespace);
@@ -1151,7 +1151,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
}
case Qt::ToolTipRole:
- return debuggerCore()->boolSetting(UseToolTipsInLocalsView)
+ return boolSetting(UseToolTipsInLocalsView)
? data.toToolTip() : QVariant();
case Qt::ForegroundRole: {
@@ -1491,7 +1491,7 @@ bool watchItemSorter(const WatchItem *item1, const WatchItem *item2)
static int findInsertPosition(const QList<WatchItem *> &list, const WatchItem *item)
{
- sortWatchDataAlphabetically = debuggerCore()->boolSetting(SortStructMembers);
+ sortWatchDataAlphabetically = boolSetting(SortStructMembers);
const QList<WatchItem *>::const_iterator it =
qLowerBound(list.begin(), list.end(), item, watchItemSorter);
return it - list.begin();
@@ -1639,7 +1639,7 @@ void WatchModel::setCurrentItem(const QByteArray &iname)
WatchHandler::WatchHandler(DebuggerEngine *engine)
{
m_engine = engine;
- m_watcherCounter = DebuggerCore::sessionValue("Watchers").toStringList().count();
+ m_watcherCounter = sessionValue("Watchers").toStringList().count();
m_model = new WatchModel(this);
m_contentsValid = false;
m_contentsValid = true; // FIXME
@@ -1918,12 +1918,12 @@ QStringList WatchHandler::watchedExpressions()
void WatchHandler::saveWatchers()
{
- DebuggerCore::setSessionValue("Watchers", watchedExpressions());
+ setSessionValue("Watchers", watchedExpressions());
}
void WatchHandler::loadFormats()
{
- QVariant value = DebuggerCore::sessionValue("DefaultFormats");
+ QVariant value = sessionValue("DefaultFormats");
QMapIterator<QString, QVariant> it(value.toMap());
while (it.hasNext()) {
it.next();
@@ -1931,7 +1931,7 @@ void WatchHandler::loadFormats()
theTypeFormats.insert(it.key().toUtf8(), it.value().toInt());
}
- value = DebuggerCore::sessionValue("IndividualFormats");
+ value = sessionValue("IndividualFormats");
it = QMapIterator<QString, QVariant>(value.toMap());
while (it.hasNext()) {
it.next();
@@ -1953,7 +1953,7 @@ void WatchHandler::saveFormats()
formats.insert(QString::fromLatin1(key), format);
}
}
- DebuggerCore::setSessionValue("DefaultFormats", formats);
+ setSessionValue("DefaultFormats", formats);
formats.clear();
it = QHashIterator<QByteArray, int>(theIndividualFormats);
@@ -1964,7 +1964,7 @@ void WatchHandler::saveFormats()
if (!key.isEmpty())
formats.insert(QString::fromLatin1(key), format);
}
- DebuggerCore::setSessionValue("IndividualFormats", formats);
+ setSessionValue("IndividualFormats", formats);
}
void WatchHandler::saveSessionData()
@@ -1978,7 +1978,7 @@ void WatchHandler::loadSessionData()
loadFormats();
theWatcherNames.clear();
m_watcherCounter = 0;
- QVariant value = DebuggerCore::sessionValue("Watchers");
+ QVariant value = sessionValue("Watchers");
m_model->destroyChildren(m_model->m_watchRoot);
foreach (const QString &exp, value.toStringList())
watchExpression(exp);
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index fbaffb1237..b926297a7c 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -86,11 +86,6 @@ namespace Internal {
const char CurrentIndex[] = "CurrentIndex";
-static DebuggerEngine *currentEngine()
-{
- return debuggerCore()->currentEngine();
-}
-
class WatchDelegate : public QItemDelegate
{
public:
@@ -912,15 +907,15 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(&actShowInEditor);
menu.addSeparator();
- menu.addAction(debuggerCore()->action(UseDebuggingHelpers));
- menu.addAction(debuggerCore()->action(UseToolTipsInLocalsView));
- menu.addAction(debuggerCore()->action(AutoDerefPointers));
- menu.addAction(debuggerCore()->action(SortStructMembers));
- menu.addAction(debuggerCore()->action(UseDynamicType));
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(UseDebuggingHelpers));
+ menu.addAction(action(UseToolTipsInLocalsView));
+ menu.addAction(action(AutoDerefPointers));
+ menu.addAction(action(SortStructMembers));
+ menu.addAction(action(UseDynamicType));
+ menu.addAction(action(SettingsDialog));
menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ menu.addAction(action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
@@ -1132,7 +1127,7 @@ public:
void setHistoryCompleter(const QString &key)
{
m_lineEdit->setHistoryCompleter(key);
- m_lineEdit->setText(QString()); // Undo "convenient" population with history item.
+ m_lineEdit->clear(); // Undo "convenient" population with history item.
}
QString text() const
diff --git a/src/plugins/designer/cpp/cpp.pri b/src/plugins/designer/cpp/cpp.pri
index 690ca7fc9f..1527c50cde 100644
--- a/src/plugins/designer/cpp/cpp.pri
+++ b/src/plugins/designer/cpp/cpp.pri
@@ -3,14 +3,11 @@ DEFINES+=CPP_ENABLED
HEADERS+=$$PWD/formclasswizardpage.h \
$$PWD/formclasswizarddialog.h \
$$PWD/formclasswizard.h \
- $$PWD/formclasswizardparameters.h \
- $$PWD/cppsettingspage.h
+ $$PWD/formclasswizardparameters.h
SOURCES+=$$PWD/formclasswizardpage.cpp \
$$PWD/formclasswizarddialog.cpp \
$$PWD/formclasswizard.cpp \
- $$PWD/formclasswizardparameters.cpp \
- $$PWD/cppsettingspage.cpp
+ $$PWD/formclasswizardparameters.cpp
-FORMS+=$$PWD/formclasswizardpage.ui \
-$$PWD/cppsettingspagewidget.ui
+FORMS+=$$PWD/formclasswizardpage.ui
diff --git a/src/plugins/designer/designer.qbs b/src/plugins/designer/designer.qbs
index 433e63d88b..8cef355cf8 100644
--- a/src/plugins/designer/designer.qbs
+++ b/src/plugins/designer/designer.qbs
@@ -15,6 +15,7 @@ QtcPlugin {
Depends { name: "ResourceEditor" }
Depends { name: "TextEditor" }
Depends { name: "ProjectExplorer" }
+ Depends { name: "QtSupport" }
cpp.defines: base.concat(["CPP_ENABLED"])
cpp.includePaths: base.concat([
@@ -66,8 +67,6 @@ QtcPlugin {
name: "cpp"
prefix: "cpp/"
files: [
- "cppsettingspage.cpp", "cppsettingspage.h",
- "cppsettingspagewidget.ui",
"formclasswizard.cpp", "formclasswizard.h",
"formclasswizarddialog.cpp", "formclasswizarddialog.h",
"formclasswizardpage.cpp", "formclasswizardpage.h", "formclasswizardpage.ui",
diff --git a/src/plugins/designer/designer_dependencies.pri b/src/plugins/designer/designer_dependencies.pri
index b4bb0d46b4..ef981aa7d0 100644
--- a/src/plugins/designer/designer_dependencies.pri
+++ b/src/plugins/designer/designer_dependencies.pri
@@ -7,5 +7,6 @@ QTC_PLUGIN_DEPENDS += \
resourceeditor\
cpptools \
projectexplorer \
+ qtsupport \
texteditor \
coreplugin
diff --git a/src/plugins/designer/designerconstants.h b/src/plugins/designer/designerconstants.h
index 205abf0566..60683fd654 100644
--- a/src/plugins/designer/designerconstants.h
+++ b/src/plugins/designer/designerconstants.h
@@ -43,8 +43,6 @@ const char C_DESIGNER_XML_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("Designer", "Form
const char SETTINGS_CATEGORY[] = "P.Designer";
const char SETTINGS_CATEGORY_ICON[] = ":/core/images/category_design.png";
const char SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Designer", "Designer");
-const char SETTINGS_CPP_SETTINGS_ID[] = "Class Generation";
-const char SETTINGS_CPP_SETTINGS_NAME[] = QT_TRANSLATE_NOOP("Designer", "Class Generation");
// Context
const char C_FORMEDITOR[] = "FormEditor.FormEditor";
diff --git a/src/plugins/designer/designerxmleditorwidget.cpp b/src/plugins/designer/designerxmleditorwidget.cpp
index 62f8c8b144..f209a98ceb 100644
--- a/src/plugins/designer/designerxmleditorwidget.cpp
+++ b/src/plugins/designer/designerxmleditorwidget.cpp
@@ -39,11 +39,12 @@ namespace Internal {
DesignerXmlEditorWidget::DesignerXmlEditorWidget(QDesignerFormWindowInterface *form,
QWidget *parent) :
- TextEditor::PlainTextEditorWidget(new FormWindowFile(form), parent),
+ TextEditor::BaseTextEditorWidget(new FormWindowFile(form), parent),
m_designerEditor(new FormWindowEditor(this))
{
+ setupAsPlainEditor();
setReadOnly(true);
- configure(baseTextDocument()->mimeType());
+ configureMimeType(textDocument()->mimeType());
}
TextEditor::BaseTextEditor *DesignerXmlEditorWidget::createEditor()
@@ -60,7 +61,7 @@ FormWindowEditor *DesignerXmlEditorWidget::designerEditor() const
Internal::FormWindowFile *DesignerXmlEditorWidget::formWindowFile() const
{
- return qobject_cast<FormWindowFile *>(baseTextDocument());
+ return qobject_cast<FormWindowFile *>(textDocument());
}
} // namespace Internal
diff --git a/src/plugins/designer/designerxmleditorwidget.h b/src/plugins/designer/designerxmleditorwidget.h
index 3471461006..43855f25e2 100644
--- a/src/plugins/designer/designerxmleditorwidget.h
+++ b/src/plugins/designer/designerxmleditorwidget.h
@@ -32,7 +32,7 @@
#include "formwindowfile.h"
-#include <texteditor/plaintexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <QSharedPointer>
@@ -53,7 +53,7 @@ namespace Internal {
* Internally manages a FormWindowEditor and uses the plain text
* editable embedded in it. */
-class DesignerXmlEditorWidget : public TextEditor::PlainTextEditorWidget
+class DesignerXmlEditorWidget : public TextEditor::BaseTextEditorWidget
{
Q_OBJECT
public:
diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp
index fecadb23e5..c4d284a267 100644
--- a/src/plugins/designer/formeditorplugin.cpp
+++ b/src/plugins/designer/formeditorplugin.cpp
@@ -34,7 +34,6 @@
#ifdef CPP_ENABLED
# include "cpp/formclasswizard.h"
-# include "cpp/cppsettingspage.h"
#endif
#include "settingspage.h"
@@ -49,6 +48,7 @@
#include <coreplugin/designmode.h>
#include <cpptools/cpptoolsconstants.h>
+#include <QApplication>
#include <QDebug>
#include <QLibraryInfo>
#include <QTranslator>
@@ -146,8 +146,6 @@ void FormEditorPlugin::initializeTemplates()
wizard->setDescription(tr("Creates a Qt Designer form along with a matching class (C++ header and source file) "
"for implementation purposes. You can add the form and class to an existing Qt Widget Project."));
addAutoReleasedObject(wizard);
-
- addAutoReleasedObject(new CppSettingsPage);
#endif
}
diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp
index c9c6ba369f..193f7159fb 100644
--- a/src/plugins/designer/formeditorw.cpp
+++ b/src/plugins/designer/formeditorw.cpp
@@ -292,7 +292,7 @@ void FormEditorW::fullInit()
settings->endGroup();
m_editorToolBar = createEditorToolBar();
- m_toolBar = EditorManager::createToolBar();
+ m_toolBar = new EditorToolBar;
m_toolBar->setToolbarCreationFlags(EditorToolBar::FlagsStandalone);
m_toolBar->setNavigationVisible(false);
m_toolBar->addCenterToolBar(m_editorToolBar);
diff --git a/src/plugins/designer/formtemplatewizardpage.cpp b/src/plugins/designer/formtemplatewizardpage.cpp
index 3264025085..1697a347cf 100644
--- a/src/plugins/designer/formtemplatewizardpage.cpp
+++ b/src/plugins/designer/formtemplatewizardpage.cpp
@@ -47,11 +47,7 @@
#include <QVBoxLayout>
#include <QMessageBox>
-#ifdef USE_XSLT
-# include <QXmlQuery>
-#else
-# include <QDomDocument>
-#endif
+#include <QDomDocument>
namespace Designer {
namespace Internal {
@@ -133,83 +129,6 @@ bool FormTemplateWizardPage::getUIXmlData(const QString &uiXml,
return false;
}
-#ifdef USE_XSLT
-
-// Change the UI class name in UI xml: This occurs several times, as contents
-// of the <class> element, as name of the first <widget> element, and possibly
-// in the signal/slot connections
-
-static const char *classNameChangingSheetFormatC =
-"<?xml version=\"1.0\"?>\n"
-"<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"2.0\">\n"
-"<xsl:output method=\"xml\" indent=\"yes\" encoding=\"UTF-8\" />\n"
-"\n"
-"<!-- Grab old class name to be replaced by evaluating <ui><class> -->\n"
-"<xsl:param name=\"oldClassName\"><xsl:value-of select=\"/ui/class\"/></xsl:param>\n"
-"\n"
-"<!-- heavy wizardry to copy nodes and attributes (emulating the default rules) -->\n"
-"<xsl:template match=\"@*|node()\">\n"
-" <xsl:copy>\n"
-" <xsl:apply-templates select=\"@*|node()\"/>\n"
-" </xsl:copy>\n"
-"</xsl:template>\n"
-"\n"
-"<!-- Change <ui><class> tag -->\n"
-"<xsl:template match=\"class\">\n"
-" <xsl:element name=\"class\">\n"
-" <xsl:text>%1</xsl:text>\n"
-" </xsl:element>\n"
-"</xsl:template>\n"
-"\n"
-"<!-- Change first <widget> tag -->\n"
-"<xsl:template match=\"/ui/widget/@name\">\n"
-"<xsl:attribute name=\"name\">\n"
-"<xsl:text>%1</xsl:text>\n"
-"</xsl:attribute>\n"
-"</xsl:template>\n"
-"\n"
-"<!-- Change <sender>/<receiver> elements (for pre-wired QDialog signals) -->\n"
-"<xsl:template match=\"receiver[.='Dialog']\">\n"
-" <xsl:element name=\"receiver\">\n"
-" <xsl:text>%1</xsl:text>\n"
-" </xsl:element>\n"
-"</xsl:template>\n"
-"<xsl:template match=\"sender[.='Dialog']\">\n"
-" <xsl:element name=\"sender\">\n"
-" <xsl:text>%1</xsl:text>\n"
-" </xsl:element>\n"
-"</xsl:template>\n"
-"</xsl:stylesheet>\n";
-
-QString FormTemplateWizardPage::changeUiClassName(const QString &uiXml, const QString &newUiClassName)
-{
- // Prepare I/O: Sheet
- const QString xsltSheet = QString::fromLatin1(classNameChangingSheetFormatC).arg(newUiClassName);
- QByteArray xsltSheetBA = xsltSheet.toUtf8();
- QBuffer xsltSheetBuffer(&xsltSheetBA);
- xsltSheetBuffer.open(QIODevice::ReadOnly);
- // Prepare I/O: Xml
- QByteArray xmlBA = uiXml.toUtf8();
- QBuffer xmlBuffer(&xmlBA);
- xmlBuffer.open(QIODevice::ReadOnly);
- // Prepare I/O: output
- QBuffer outputBuffer;
- outputBuffer.open(QIODevice::WriteOnly);
-
- // Run query
- QXmlQuery query(QXmlQuery::XSLT20);
- query.setFocus(&xmlBuffer);
- query.setQuery(&xsltSheetBuffer);
- if (!query.evaluateTo(&outputBuffer)) {
- qWarning("Unable to change the ui class name in a form template.\n%s\nUsing:\n%s\n",
- xmlBA.constData(), xsltSheetBA.constData());
- return uiXml;
- }
- outputBuffer.close();
- return QString::fromUtf8(outputBuffer.data());
-}
-#else
-
// Change the contents of a DOM element to a new value if it matches
// a predicate
template <class Predicate>
@@ -332,7 +251,6 @@ QString FormTemplateWizardPage::changeUiClassName(const QString &uiXml, const QS
qDebug() << '<' << Q_FUNC_INFO << newUiClassName << rc;
return rc;
}
-#endif // USE_XSLT
} // namespace Internal
} // namespace Designer
diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp
index 09a5607e53..cd2d547d65 100644
--- a/src/plugins/designer/formwindoweditor.cpp
+++ b/src/plugins/designer/formwindoweditor.cpp
@@ -51,10 +51,11 @@ struct FormWindowEditorPrivate
};
FormWindowEditor::FormWindowEditor(Internal::DesignerXmlEditorWidget *editor) :
- TextEditor::PlainTextEditor(editor),
+ TextEditor::BaseTextEditor(editor),
d(new FormWindowEditorPrivate)
{
d->m_widget = editor;
+ setDuplicateSupported(true);
setContext(Core::Context(Designer::Constants::K_DESIGNER_XML_EDITOR_ID,
Designer::Constants::C_DESIGNER_XML_EDITOR));
diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h
index 159717efa9..825ffb6ee4 100644
--- a/src/plugins/designer/formwindoweditor.h
+++ b/src/plugins/designer/formwindoweditor.h
@@ -32,27 +32,25 @@
#include "designer_export.h"
#include <coreplugin/editormanager/ieditor.h>
-#include <texteditor/plaintexteditor.h>
+#include <texteditor/basetexteditor.h>
QT_BEGIN_NAMESPACE
class QDesignerFormWindowInterface;
QT_END_NAMESPACE
-namespace TextEditor { class PlainTextEditor; }
-
namespace Designer {
namespace Internal { class DesignerXmlEditorWidget; }
struct FormWindowEditorPrivate;
// IEditor that is used for the QDesignerFormWindowInterface
-// It is a read-only PlainTextEditor that shows the XML of the form.
-// DesignerXmlEditorWidget is the corresponding PlainTextEditorWidget,
+// It is a read-only text editor that shows the XML of the form.
+// DesignerXmlEditorWidget is the corresponding BaseTextEditorWidget,
// FormWindowFile the corresponding BaseTextDocument.
// The content from the QDesignerFormWindowInterface is synced to the
// content of the XML editor.
-class DESIGNER_EXPORT FormWindowEditor : public TextEditor::PlainTextEditor
+class DESIGNER_EXPORT FormWindowEditor : public TextEditor::BaseTextEditor
{
Q_PROPERTY(QString contents READ contents)
Q_OBJECT
diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp
index 9915cbe32f..24d2da9b45 100644
--- a/src/plugins/designer/formwindowfile.cpp
+++ b/src/plugins/designer/formwindowfile.cpp
@@ -112,7 +112,7 @@ bool FormWindowFile::setContents(const QByteArray &contents)
if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << contents.size();
- document()->setPlainText(QString());
+ document()->clear();
QTC_ASSERT(m_formWindow, return false);
diff --git a/src/plugins/designer/formwindowfile.h b/src/plugins/designer/formwindowfile.h
index 939a0756e5..52060dd749 100644
--- a/src/plugins/designer/formwindowfile.h
+++ b/src/plugins/designer/formwindowfile.h
@@ -30,19 +30,18 @@
#ifndef FORMWINDOWFILE_H
#define FORMWINDOWFILE_H
-#include <texteditor/plaintexteditor.h>
+#include <texteditor/basetextdocument.h>
#include <QPointer>
QT_BEGIN_NAMESPACE
class QDesignerFormWindowInterface;
-class QFile;
QT_END_NAMESPACE
namespace Designer {
namespace Internal {
-class FormWindowFile : public TextEditor::PlainTextDocument
+class FormWindowFile : public TextEditor::BaseTextDocument
{
Q_OBJECT
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp
index 7d6809fb55..97c7b90402 100644
--- a/src/plugins/designer/qtcreatorintegration.cpp
+++ b/src/plugins/designer/qtcreatorintegration.cpp
@@ -276,9 +276,9 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
return Document::Ptr();
}
-static inline ITextEditor *editableAt(const QString &fileName, int line, int column)
+static inline BaseTextEditor *editorAt(const QString &fileName, int line, int column)
{
- return qobject_cast<ITextEditor *>(Core::EditorManager::openEditorAt(fileName, line, column,
+ return qobject_cast<BaseTextEditor *>(Core::EditorManager::openEditorAt(fileName, line, column,
Core::Id(),
Core::EditorManager::DoNotMakeVisible));
}
@@ -301,15 +301,15 @@ static void addDeclaration(const Snapshot &snapshot,
//! \todo change this to use the Refactoring changes.
//
- if (ITextEditor *editable = editableAt(fileName, loc.line(), loc.column() - 1)) {
- BaseTextEditorWidget *editor = qobject_cast<BaseTextEditorWidget *>(editable->widget());
- if (editor) {
- QTextCursor tc = editor->textCursor();
+ if (BaseTextEditor *editor = editorAt(fileName, loc.line(), loc.column() - 1)) {
+ BaseTextEditorWidget *widget = editor->editorWidget();
+ if (widget) {
+ QTextCursor tc = widget->textCursor();
int pos = tc.position();
tc.beginEditBlock();
tc.insertText(loc.prefix() + declaration + loc.suffix());
tc.setPosition(pos, QTextCursor::KeepAnchor);
- editor->baseTextDocument()->autoIndent(tc);
+ widget->textDocument()->autoIndent(tc);
tc.endEditBlock();
}
}
@@ -344,17 +344,17 @@ static Document::Ptr addDefinition(const Snapshot &docTable,
//! \todo change this to use the Refactoring changes.
//
- if (ITextEditor *editable = editableAt(doc->fileName(), 0, 0)) {
+ if (BaseTextEditor *editor = editorAt(doc->fileName(), 0, 0)) {
//
//! \todo use the InsertionPointLocator to insert at the correct place.
// (we'll have to extend that class first to do definition insertions)
- const QString contents = editable->textDocument()->plainText();
+ const QString contents = editor->textDocument()->plainText();
int column;
- editable->convertPosition(contents.length(), line, &column);
- editable->gotoLine(*line, column);
- editable->insert(definition);
+ editor->convertPosition(contents.length(), line, &column);
+ editor->gotoLine(*line, column);
+ editor->insert(definition);
*line += 1;
}
return doc;
diff --git a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp
index 6739eae60f..0b9ddf8dd8 100644
--- a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp
+++ b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp
@@ -34,6 +34,7 @@
#include <utils/codegeneration.h>
#include <coreplugin/icore.h>
#include <cpptools/abstracteditorsupport.h>
+#include <qtsupport/codegensettings.h>
#include <QTextStream>
#include <QSettings>
@@ -43,74 +44,22 @@
static const char uiMemberC[] = "ui";
static const char uiNamespaceC[] = "Ui";
-static const char formClassWizardPageGroupC[] = "FormClassWizardPage";
-static const char translationKeyC[] = "RetranslationSupport";
-static const char embeddingModeKeyC[] = "Embedding";
-
-// TODO: These 3 are general coding convention settings and
-// should go to CppTools...
-static const char includeQtModuleKeyC[] = "IncludeQtModule";
-static const char addQtVersionCheckKeyC[] = "AddQtVersionCheck";
-static const char indentNamespaceKeyC[] = "IndentNamespace";
-
-static const bool retranslationSupportDefault = false;
-
namespace Designer {
namespace Internal {
-FormClassWizardGenerationParameters::FormClassWizardGenerationParameters() :
- embedding(PointerAggregatedUiClass),
- retranslationSupport(retranslationSupportDefault),
- includeQtModule(false),
- addQtVersionCheck(false),
- indentNamespace(false)
-{
-}
-
-void FormClassWizardGenerationParameters::fromSettings(const QSettings *settings)
-{
- QString group = QLatin1String(formClassWizardPageGroupC) + QLatin1Char('/');
-
- retranslationSupport = settings->value(group + QLatin1String(translationKeyC), retranslationSupportDefault).toBool();
- embedding = static_cast<UiClassEmbedding>(settings->value(group + QLatin1String(embeddingModeKeyC), int(PointerAggregatedUiClass)).toInt());
- includeQtModule = settings->value(group + QLatin1String(includeQtModuleKeyC), false).toBool();
- addQtVersionCheck = settings->value(group + QLatin1String(addQtVersionCheckKeyC), false).toBool();
- indentNamespace = settings->value(group + QLatin1String(indentNamespaceKeyC), false).toBool();
-}
-
-void FormClassWizardGenerationParameters::toSettings(QSettings *settings) const
-{
- settings->beginGroup(QLatin1String(formClassWizardPageGroupC));
- settings->setValue(QLatin1String(translationKeyC), retranslationSupport);
- settings->setValue(QLatin1String(embeddingModeKeyC), embedding);
- settings->setValue(QLatin1String(includeQtModuleKeyC), includeQtModule);
- settings->setValue(QLatin1String(addQtVersionCheckKeyC), addQtVersionCheck);
- settings->setValue(QLatin1String(indentNamespaceKeyC), indentNamespace);
- settings->endGroup();
-}
-
-bool FormClassWizardGenerationParameters::equals(const FormClassWizardGenerationParameters &rhs) const
-{
- return embedding == rhs.embedding
- && retranslationSupport == rhs.retranslationSupport
- && includeQtModule == rhs.includeQtModule
- && addQtVersionCheck == rhs.addQtVersionCheck
- && indentNamespace == rhs.indentNamespace;
-}
-
// Generation code
// Write out how to access the Ui class in the source code.
-static inline void writeUiMemberAccess(const FormClassWizardGenerationParameters &fp, QTextStream &str)
+static inline void writeUiMemberAccess(const QtSupport::CodeGenSettings &fp, QTextStream &str)
{
switch (fp.embedding) {
- case PointerAggregatedUiClass:
+ case QtSupport::CodeGenSettings::PointerAggregatedUiClass:
str << uiMemberC << "->";
break;
- case AggregatedUiClass:
+ case QtSupport::CodeGenSettings::AggregatedUiClass:
str << uiMemberC << '.';
break;
- case InheritedUiClass:
+ case QtSupport::CodeGenSettings::InheritedUiClass:
break;
}
}
@@ -120,7 +69,7 @@ static inline void writeUiMemberAccess(const FormClassWizardGenerationParameters
bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParameters &parameters,
QString *header, QString *source, int indentation)
{
- Internal::FormClassWizardGenerationParameters generationParameters;
+ QtSupport::CodeGenSettings generationParameters;
generationParameters.fromSettings(Core::ICore::settings());
const QString indent = QString(indentation, QLatin1Char(' '));
@@ -163,7 +112,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
<< "\n#define " << guard << '\n' << '\n';
// Include 'ui_'
- if (generationParameters.embedding != Internal::PointerAggregatedUiClass) {
+ if (generationParameters.embedding != QtSupport::CodeGenSettings::PointerAggregatedUiClass) {
Utils::writeIncludeFileDirective(uiInclude, false, headerStr);
} else {
// Todo: Can we obtain the header from the code model for custom widgets?
@@ -185,12 +134,11 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
}
}
- const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList,
- generationParameters.indentNamespace ? indent : QString(),
+ const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, QString(),
headerStr);
// Forward-declare the UI class
- if (generationParameters.embedding == Internal::PointerAggregatedUiClass) {
+ if (generationParameters.embedding == QtSupport::CodeGenSettings::PointerAggregatedUiClass) {
headerStr << '\n'
<< namespaceIndent << "namespace " << uiNamespaceC << " {\n"
<< namespaceIndent << indent << "class " << Internal::FormTemplateWizardPage::stripNamespaces(uiClassName) << ";\n"
@@ -200,47 +148,47 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
// Class declaration
headerStr << '\n' << namespaceIndent << "class " << unqualifiedClassName
<< " : public " << formBaseClass;
- if (generationParameters.embedding == Internal::InheritedUiClass)
+ if (generationParameters.embedding == QtSupport::CodeGenSettings::InheritedUiClass)
headerStr << ", private " << uiClassName;
headerStr << "\n{\n" << namespaceIndent << indent << "Q_OBJECT\n\n"
<< namespaceIndent << "public:\n"
<< namespaceIndent << indent << "explicit " << unqualifiedClassName << "(QWidget *parent = 0);\n";
- if (generationParameters.embedding == Internal::PointerAggregatedUiClass)
+ if (generationParameters.embedding == QtSupport::CodeGenSettings::PointerAggregatedUiClass)
headerStr << namespaceIndent << indent << "~" << unqualifiedClassName << "();\n";
// retranslation
if (generationParameters.retranslationSupport)
headerStr << '\n' << namespaceIndent << "protected:\n"
<< namespaceIndent << indent << "void changeEvent(QEvent *e);\n";
// Member variable
- if (generationParameters.embedding != Internal::InheritedUiClass) {
+ if (generationParameters.embedding != QtSupport::CodeGenSettings::InheritedUiClass) {
headerStr << '\n' << namespaceIndent << "private:\n"
<< namespaceIndent << indent << uiClassName << ' ';
- if (generationParameters.embedding == Internal::PointerAggregatedUiClass)
+ if (generationParameters.embedding == QtSupport::CodeGenSettings::PointerAggregatedUiClass)
headerStr << '*';
headerStr << uiMemberC << ";\n";
}
headerStr << namespaceIndent << "};\n\n";
- Utils::writeClosingNameSpaces(namespaceList, generationParameters.indentNamespace ? indent : QString(), headerStr);
+ Utils::writeClosingNameSpaces(namespaceList, QString(), headerStr);
headerStr << "#endif // "<< guard << '\n';
// 2) Source file
QTextStream sourceStr(source);
sourceStr << sourceLicense;
Utils::writeIncludeFileDirective(parameters.headerFile, false, sourceStr);
- if (generationParameters.embedding == Internal::PointerAggregatedUiClass)
+ if (generationParameters.embedding == QtSupport::CodeGenSettings::PointerAggregatedUiClass)
Utils::writeIncludeFileDirective(uiInclude, false, sourceStr);
// NameSpaces(
- Utils::writeOpeningNameSpaces(namespaceList, generationParameters.indentNamespace ? indent : QString(), sourceStr);
+ Utils::writeOpeningNameSpaces(namespaceList, QString(), sourceStr);
// Constructor with setupUi
sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName << "(QWidget *parent) :\n"
<< namespaceIndent << indent << formBaseClass << "(parent)";
- if (generationParameters.embedding == Internal::PointerAggregatedUiClass)
+ if (generationParameters.embedding == QtSupport::CodeGenSettings::PointerAggregatedUiClass)
sourceStr << ",\n" << namespaceIndent << indent << uiMemberC << "(new " << uiClassName << ")";
sourceStr << '\n' << namespaceIndent << "{\n" << namespaceIndent << indent;
- writeUiMemberAccess(generationParameters, sourceStr);
+ Internal::writeUiMemberAccess(generationParameters, sourceStr);
sourceStr << "setupUi(this);\n" << namespaceIndent << "}\n";
// Deleting destructor for ptr
- if (generationParameters.embedding == Internal::PointerAggregatedUiClass) {
+ if (generationParameters.embedding == QtSupport::CodeGenSettings::PointerAggregatedUiClass) {
sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::~" << unqualifiedClassName
<< "()\n" << namespaceIndent << "{\n"
<< namespaceIndent << indent << "delete " << uiMemberC << ";\n"
@@ -253,7 +201,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
<< namespaceIndent << indent << formBaseClass << "::changeEvent(e);\n"
<< namespaceIndent << indent << "switch (e->type()) {\n" << namespaceIndent << indent << "case QEvent::LanguageChange:\n"
<< namespaceIndent << indent << indent;
- writeUiMemberAccess(generationParameters, sourceStr);
+ Internal::writeUiMemberAccess(generationParameters, sourceStr);
sourceStr << "retranslateUi(this);\n"
<< namespaceIndent << indent << indent << "break;\n"
<< namespaceIndent << indent << "default:\n"
@@ -261,7 +209,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
<< namespaceIndent << indent << "}\n"
<< namespaceIndent << "}\n";
}
- Utils::writeClosingNameSpaces(namespaceList, generationParameters.indentNamespace ? indent : QString(), sourceStr);
+ Utils::writeClosingNameSpaces(namespaceList, QString(), sourceStr);
return true;
}
diff --git a/src/plugins/designer/qtdesignerformclasscodegenerator.h b/src/plugins/designer/qtdesignerformclasscodegenerator.h
index abe527a72c..aa71301ac7 100644
--- a/src/plugins/designer/qtdesignerformclasscodegenerator.h
+++ b/src/plugins/designer/qtdesignerformclasscodegenerator.h
@@ -40,36 +40,6 @@ QT_END_NAMESPACE
namespace Designer {
class FormClassWizardParameters;
-namespace Internal {
-
-// How to embed the Ui::Form class.
-enum UiClassEmbedding
-{
- PointerAggregatedUiClass, // "Ui::Form *m_ui";
- AggregatedUiClass, // "Ui::Form m_ui";
- InheritedUiClass // "...private Ui::Form..."
-};
-
-// Parameters influencing the code generation to be used in settings page.
-struct FormClassWizardGenerationParameters
-{
- FormClassWizardGenerationParameters();
- bool equals(const FormClassWizardGenerationParameters &rhs) const;
-
- void fromSettings(const QSettings *);
- void toSettings(QSettings *) const;
-
- UiClassEmbedding embedding;
- bool retranslationSupport; // Add handling for language change events
- bool includeQtModule; // Include "<QtGui/[Class]>" or just "<[Class]>"
- bool addQtVersionCheck; // Include #ifdef when using "#include <QtGui/..."
- bool indentNamespace;
-};
-
-inline bool operator==(const FormClassWizardGenerationParameters &p1, const FormClassWizardGenerationParameters &p2) { return p1.equals(p2); }
-inline bool operator!=(const FormClassWizardGenerationParameters &p1, const FormClassWizardGenerationParameters &p2) { return !p1.equals(p2); }
-
-} // namespace Internal
// Publicly registered service to generate the code for a form class
// (See PluginManager::Invoke) to be accessed by Qt4ProjectManager.
diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp
index 34d75a2bbc..3f34e60beb 100644
--- a/src/plugins/diffeditor/diffeditor.cpp
+++ b/src/plugins/diffeditor/diffeditor.cpp
@@ -101,7 +101,7 @@ private:
};
DescriptionEditorWidget::DescriptionEditorWidget(QWidget *parent)
- : BaseTextEditorWidget(parent)
+ : BaseTextEditorWidget(new BaseTextDocument, parent)
{
DisplaySettings settings = displaySettings();
settings.m_textWrapping = false;
@@ -264,14 +264,14 @@ void DiffEditor::ctor()
SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
connect(TextEditorSettings::instance(),
SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
- m_descriptionWidget->baseTextDocument(),
+ m_descriptionWidget->textDocument(),
SLOT(setFontSettings(TextEditor::FontSettings)));
m_descriptionWidget->setDisplaySettings(
TextEditorSettings::displaySettings());
m_descriptionWidget->setCodeStyle(
TextEditorSettings::codeStyle());
- m_descriptionWidget->baseTextDocument()->setFontSettings(
+ m_descriptionWidget->textDocument()->setFontSettings(
TextEditorSettings::fontSettings());
m_controller = m_document->controller();
diff --git a/src/plugins/diffeditor/selectabletexteditorwidget.cpp b/src/plugins/diffeditor/selectabletexteditorwidget.cpp
index 91e31b0e8c..cc906cd154 100644
--- a/src/plugins/diffeditor/selectabletexteditorwidget.cpp
+++ b/src/plugins/diffeditor/selectabletexteditorwidget.cpp
@@ -28,6 +28,7 @@
****************************************************************************/
#include "selectabletexteditorwidget.h"
+#include <texteditor/basetextdocument.h>
#include <QPainter>
#include <QTextBlock>
@@ -35,7 +36,7 @@
namespace DiffEditor {
SelectableTextEditorWidget::SelectableTextEditorWidget(QWidget *parent)
- : BaseTextEditorWidget(parent)
+ : BaseTextEditorWidget(new TextEditor::BaseTextDocument, parent)
{
setFrameStyle(QFrame::NoFrame);
}
diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
index 935270719d..9e530f15c2 100644
--- a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
+++ b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
@@ -82,12 +82,12 @@ public:
: BaseTextEditor(editorWidget)
{
document()->setId("DiffEditor.SideDiffEditor");
- connect(this, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
- this, SLOT(slotTooltipRequested(TextEditor::ITextEditor*,QPoint,int)));
+ connect(this, SIGNAL(tooltipRequested(TextEditor::BaseTextEditor*,QPoint,int)),
+ this, SLOT(slotTooltipRequested(TextEditor::BaseTextEditor*,QPoint,int)));
}
private slots:
- void slotTooltipRequested(TextEditor::ITextEditor *editor,
+ void slotTooltipRequested(TextEditor::BaseTextEditor *editor,
const QPoint &globalPoint,
int position);
@@ -210,7 +210,7 @@ private:
////////////////////////
-void SideDiffEditor::slotTooltipRequested(TextEditor::ITextEditor *editor,
+void SideDiffEditor::slotTooltipRequested(TextEditor::BaseTextEditor *editor,
const QPoint &globalPoint,
int position)
{
@@ -348,7 +348,7 @@ void SideDiffEditorWidget::setDisplaySettings(const DisplaySettings &ds)
void SideDiffEditorWidget::applyFontSettings()
{
SelectableTextEditorWidget::applyFontSettings();
- const TextEditor::FontSettings &fs = baseTextDocument()->fontSettings();
+ const TextEditor::FontSettings &fs = textDocument()->fontSettings();
m_fileLineForeground = fs.formatFor(C_DIFF_FILE_LINE).foreground();
m_chunkLineForeground = fs.formatFor(C_DIFF_CONTEXT_LINE).foreground();
m_textForeground = fs.toTextCharFormat(C_TEXT).foreground().color();
@@ -1163,8 +1163,8 @@ void SideBySideDiffEditorWidget::showDiff()
void SideBySideDiffEditorWidget::setFontSettings(
const TextEditor::FontSettings &fontSettings)
{
- m_leftEditor->baseTextDocument()->setFontSettings(fontSettings);
- m_rightEditor->baseTextDocument()->setFontSettings(fontSettings);
+ m_leftEditor->textDocument()->setFontSettings(fontSettings);
+ m_rightEditor->textDocument()->setFontSettings(fontSettings);
m_spanLineFormat = fontSettings.toTextCharFormat(C_LINE_NUMBER);
m_fileLineFormat = fontSettings.toTextCharFormat(C_DIFF_FILE_LINE);
diff --git a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp
index 5858fe91ff..063160c854 100644
--- a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp
+++ b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp
@@ -172,7 +172,7 @@ void UnifiedDiffEditorWidget::setDisplaySettings(const DisplaySettings &ds)
void UnifiedDiffEditorWidget::setFontSettings(const FontSettings &fontSettings)
{
- baseTextDocument()->setFontSettings(fontSettings);
+ textDocument()->setFontSettings(fontSettings);
m_fileLineFormat = fontSettings.toTextCharFormat(C_DIFF_FILE_LINE);
m_chunkLineFormat = fontSettings.toTextCharFormat(C_DIFF_CONTEXT_LINE);
diff --git a/src/plugins/emacskeys/emacskeysplugin.cpp b/src/plugins/emacskeys/emacskeysplugin.cpp
index fa55ecbaac..66b80c006e 100644
--- a/src/plugins/emacskeys/emacskeysplugin.cpp
+++ b/src/plugins/emacskeys/emacskeysplugin.cpp
@@ -322,7 +322,7 @@ void EmacsKeysPlugin::insertLineAndIndent()
cursor.beginEditBlock();
cursor.insertBlock();
if (m_currentBaseTextEditorWidget != 0)
- m_currentBaseTextEditorWidget->baseTextDocument()->autoIndent(cursor);
+ m_currentBaseTextEditorWidget->textDocument()->autoIndent(cursor);
cursor.endEditBlock();
m_currentEditorWidget->setTextCursor(cursor);
m_currentState->endOwnAction(KeysActionOther);
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index a9457a9a33..eb42a734c8 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -57,7 +57,7 @@
#include <texteditor/basetextdocumentlayout.h>
#include <texteditor/basetexteditor.h>
-#include <texteditor/basetextmark.h>
+#include <texteditor/textmark.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/typingsettings.h>
#include <texteditor/tabsettings.h>
@@ -525,7 +525,7 @@ void FakeVimOptionPage::setPlainStyle()
m_ui.checkBoxAutoIndent->setChecked(false);
m_ui.checkBoxSmartIndent->setChecked(false);
m_ui.checkBoxIncSearch->setChecked(false);
- m_ui.lineEditBackspace->setText(QString());
+ m_ui.lineEditBackspace->clear();
m_ui.checkBoxPassKeys->setChecked(false);
}
@@ -791,13 +791,13 @@ public:
private:
FakeVimPluginPrivate *m_q;
- QPointer<QGroupBox> m_widget;
+ QPointer<QWidget> m_widget;
};
QWidget *FakeVimUserCommandsPage::widget()
{
if (!m_widget) {
- m_widget = new QGroupBox;
+ m_widget = new QWidget;
FakeVimUserCommandsModel *model = new FakeVimUserCommandsModel(m_q);
QTreeView *widget = new QTreeView;
@@ -1921,7 +1921,7 @@ void FakeVimPluginPrivate::checkForElectricCharacter(bool *result, QChar c)
if (!handler)
return;
if (BaseTextEditorWidget *bt = qobject_cast<BaseTextEditorWidget *>(handler->widget()))
- *result = bt->baseTextDocument()->indenter()->isElectricCharacter(c);
+ *result = bt->textDocument()->indenter()->isElectricCharacter(c);
}
void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
@@ -2117,7 +2117,7 @@ void FakeVimPluginPrivate::indentRegion(int beginBlock, int endBlock,
while (!cursor.atBlockEnd())
cursor.deleteChar();
} else {
- bt->baseTextDocument()->indenter()->indentBlock(doc, block, typedChar, tabSettings);
+ bt->textDocument()->indenter()->indentBlock(doc, block, typedChar, tabSettings);
}
block = block.next();
}
diff --git a/src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp b/src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp
new file mode 100644
index 0000000000..33621345b2
--- /dev/null
+++ b/src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "cppmodelmanagerhelper.h"
+
+#include <QCoreApplication>
+#include <QSignalSpy>
+#include <QTest>
+#include <QThread>
+
+using namespace CppTools;
+using namespace GenericProjectManager::Internal::Tests;
+
+CppModelManagerHelper::CppModelManagerHelper(QObject *parent) :
+ QObject(parent)
+{
+ connect(cppModelManager(), SIGNAL(sourceFilesRefreshed(const QStringList &)),
+ this, SLOT(onSourceFilesRefreshed(const QStringList &)));
+}
+
+
+CppModelManagerInterface *CppModelManagerHelper::cppModelManager()
+{
+ return CppModelManagerInterface::instance();
+}
+
+void CppModelManagerHelper::waitForSourceFilesRefreshed(const QString &file, int timeOut)
+{
+ waitForSourceFilesRefreshed(QStringList() << file, timeOut);
+}
+
+void CppModelManagerHelper::waitForSourceFilesRefreshed(const QStringList &files, int timeOut)
+{
+ QTime t;
+ t.start();
+ QSignalSpy spy(cppModelManager(), SIGNAL(sourceFilesRefreshed(const QStringList &)));
+
+ foreach (const QString &file, files) {
+ while (!m_refreshedSourceFiles.contains(file)) {
+#if QT_VERSION >= 0x050000
+ QVERIFY(spy.wait());
+#else // Qt 4.x
+ class MyThread: public QThread
+ {
+ public:
+ static void Zzzzz()
+ {
+ QThread::msleep(50);
+ }
+ };
+
+ MyThread::Zzzzz();
+ QCoreApplication::processEvents();
+#endif
+ }
+ QVERIFY(t.elapsed() <= timeOut);
+ }
+}
+
+void CppModelManagerHelper::onSourceFilesRefreshed(const QStringList &files)
+{
+ m_refreshedSourceFiles += files;
+}
diff --git a/src/plugins/genericprojectmanager/cppmodelmanagerhelper.h b/src/plugins/genericprojectmanager/cppmodelmanagerhelper.h
new file mode 100644
index 0000000000..e854c73c88
--- /dev/null
+++ b/src/plugins/genericprojectmanager/cppmodelmanagerhelper.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef CPPMODELMANAGERHELPER_H
+#define CPPMODELMANAGERHELPER_H
+
+#include <cpptools/cppmodelmanagerinterface.h>
+
+#include <QObject>
+
+namespace GenericProjectManager {
+namespace Internal {
+namespace Tests {
+
+class CppModelManagerHelper : public QObject
+{
+ Q_OBJECT
+public:
+ explicit CppModelManagerHelper(QObject *parent = 0);
+
+ static CppTools::CppModelManagerInterface *cppModelManager();
+
+ enum { defaultTimeOut = 30 * 1000 }; // 30 secs
+ void waitForSourceFilesRefreshed(const QString &file = QString(), int timeOut = defaultTimeOut);
+ void waitForSourceFilesRefreshed(const QStringList &files, int timeOut = defaultTimeOut);
+
+private slots:
+ void onSourceFilesRefreshed(const QStringList &files);
+
+private:
+ QStringList m_refreshedSourceFiles;
+};
+
+} // Tests namespace
+} // Internal namespace
+} // GenericProjectManager namespace
+
+#endif // CPPMODELMANAGERHELPER_H
diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
index 05f285e67c..143e2fa927 100644
--- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
@@ -64,9 +64,9 @@ ProjectFilesFactory::ProjectFilesFactory(Manager *manager)
Core::IEditor *ProjectFilesFactory::createEditor()
{
- ProjectFilesEditorWidget *ed = new ProjectFilesEditorWidget();
- TextEditorSettings::initializeEditor(ed);
- return ed->editor();
+ auto widget = new ProjectFilesEditorWidget(new BaseTextDocument, 0);
+ TextEditorSettings::initializeEditor(widget);
+ return widget->editor();
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -85,10 +85,9 @@ ProjectFilesEditor::ProjectFilesEditor(ProjectFilesEditorWidget *editor)
Core::IEditor *ProjectFilesEditor::duplicate()
{
- ProjectFilesEditorWidget *editor = new ProjectFilesEditorWidget(
- qobject_cast<ProjectFilesEditorWidget *>(editorWidget()));
- TextEditorSettings::initializeEditor(editor);
- return editor->editor();
+ auto widget = new ProjectFilesEditorWidget(editorWidget());
+ TextEditorSettings::initializeEditor(widget);
+ return widget->editor();
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -97,12 +96,12 @@ Core::IEditor *ProjectFilesEditor::duplicate()
//
////////////////////////////////////////////////////////////////////////////////////////
-ProjectFilesEditorWidget::ProjectFilesEditorWidget(QWidget *parent)
- : BaseTextEditorWidget(parent)
+ProjectFilesEditorWidget::ProjectFilesEditorWidget(BaseTextDocument *doc, QWidget *parent)
+ : BaseTextEditorWidget(doc, parent)
{
}
-ProjectFilesEditorWidget::ProjectFilesEditorWidget(ProjectFilesEditorWidget *other)
+ProjectFilesEditorWidget::ProjectFilesEditorWidget(BaseTextEditorWidget *other)
: BaseTextEditorWidget(other)
{
}
diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.h b/src/plugins/genericprojectmanager/genericprojectfileseditor.h
index 8c74f26dbc..755161abe0 100644
--- a/src/plugins/genericprojectmanager/genericprojectfileseditor.h
+++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.h
@@ -67,13 +67,10 @@ class ProjectFilesEditorWidget : public TextEditor::BaseTextEditorWidget
Q_OBJECT
public:
- ProjectFilesEditorWidget(QWidget *parent = 0);
- ProjectFilesEditorWidget(ProjectFilesEditorWidget *other);
+ ProjectFilesEditorWidget(TextEditor::BaseTextDocument *doc, QWidget *parent);
+ ProjectFilesEditorWidget(BaseTextEditorWidget *other);
TextEditor::BaseTextEditor *createEditor();
-
-private:
- ProjectFilesEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
};
} // namespace Internal
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.pro b/src/plugins/genericprojectmanager/genericprojectmanager.pro
index 3ccecd9f86..a822f5b240 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.pro
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.pro
@@ -23,3 +23,9 @@ SOURCES = genericproject.cpp \
filesselectionwizardpage.cpp
RESOURCES += genericproject.qrc
FORMS += genericmakestep.ui
+
+equals(TEST, 1) {
+ SOURCES += genericprojectplugin_test.cpp cppmodelmanagerhelper.cpp
+ HEADERS += cppmodelmanagerhelper.h
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.qbs b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
index 5e345dd8f8..f3d5ec50ae 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.qbs
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
@@ -1,4 +1,5 @@
import qbs 1.0
+import qbs.FileInfo
import QtcPlugin
@@ -39,4 +40,15 @@ QtcPlugin {
"pkgconfigtool.cpp",
"pkgconfigtool.h",
]
+
+ Group {
+ name: "Tests"
+ condition: project.testsEnabled
+ files: [
+ "cppmodelmanagerhelper.cpp", "cppmodelmanagerhelper.h",
+ "genericprojectplugin_test.cpp",
+ ]
+
+ cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
+ }
}
diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
index 3e214eb65d..eeb0be6d98 100644
--- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
@@ -54,7 +54,7 @@ namespace GenericProjectManager {
namespace Internal {
GenericProjectPlugin::GenericProjectPlugin()
- : m_projectFilesEditorFactory(0)
+ : m_projectFilesEditorFactory(0), m_editFilesAction(0), m_contextMenuProject(0)
{ }
GenericProjectPlugin::~GenericProjectPlugin()
diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.h b/src/plugins/genericprojectmanager/genericprojectplugin.h
index 0fe8790544..97279bc13b 100644
--- a/src/plugins/genericprojectmanager/genericprojectplugin.h
+++ b/src/plugins/genericprojectmanager/genericprojectplugin.h
@@ -61,6 +61,11 @@ private slots:
void updateContextMenu(ProjectExplorer::Project *, ProjectExplorer::Node *);
void editFiles();
+#ifdef WITH_TESTS
+private slots:
+ void test_simple();
+#endif // WITH_TESTS
+
private:
ProjectFilesFactory *m_projectFilesEditorFactory;
QAction *m_editFilesAction;
diff --git a/src/plugins/genericprojectmanager/genericprojectplugin_test.cpp b/src/plugins/genericprojectmanager/genericprojectplugin_test.cpp
new file mode 100644
index 0000000000..2f21b67364
--- /dev/null
+++ b/src/plugins/genericprojectmanager/genericprojectplugin_test.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "cppmodelmanagerhelper.h"
+#include "genericprojectplugin.h"
+
+#include <projectexplorer/project.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/session.h>
+
+#include <QFileInfo>
+#include <QTest>
+
+using namespace CppTools;
+using namespace GenericProjectManager;
+using namespace GenericProjectManager::Internal;
+using namespace GenericProjectManager::Internal::Tests;
+using namespace ProjectExplorer;
+
+inline static QString _(const QByteArray &ba) { return QString::fromLatin1(ba, ba.size()); }
+inline static QString projectFilePath(const QString &project)
+{
+ const QString fileName(_(SRCDIR "/../../../tests/genericprojectmanager/") + project);
+ return QFileInfo(fileName).absoluteFilePath();
+}
+
+namespace {
+class ProjectExplorerHelper
+{
+public:
+ static ProjectExplorerPlugin *getInstance()
+ { return ProjectExplorerPlugin::instance(); }
+
+ ProjectExplorerHelper()
+ {
+ QVERIFY(!SessionManager::hasProjects());
+ }
+
+ ~ProjectExplorerHelper()
+ {
+ foreach (Project *project, m_openProjects)
+ getInstance()->unloadProject(project);
+ }
+
+ Project *openProject(const QString &projectFile)
+ {
+ QString error;
+ Project *project = getInstance()->openProject(projectFile, &error);
+ if (!error.isEmpty())
+ qWarning() << error;
+ if (!project)
+ return 0;
+ m_openProjects.append(project);
+ return project;
+ }
+
+private:
+ QList<Project *> m_openProjects;
+};
+} // anonymous namespace
+
+void GenericProjectPlugin::test_simple()
+{
+ CppModelManagerHelper cppHelper;
+
+ QString projectFile = _("testdata_simpleproject/simpleproject.creator");
+ ProjectExplorerHelper pHelper;
+ Project *project = pHelper.openProject(projectFilePath(projectFile));
+ QVERIFY(project);
+
+ QString mainFile = projectFilePath(_("testdata_simpleproject/main.cpp"));
+ cppHelper.waitForSourceFilesRefreshed(mainFile);
+
+ CppModelManagerInterface *mm = cppHelper.cppModelManager();
+ CppModelManagerInterface::ProjectInfo pInfo = mm->projectInfo(project);
+
+ QCOMPARE(pInfo.projectParts().size(), 1);
+
+ ProjectPart::Ptr pPart = pInfo.projectParts().first();
+ QVERIFY(pPart);
+ QCOMPARE(pPart->files.size(), 1);
+ QCOMPARE(pPart->files.first().path, mainFile);
+ QCOMPARE(pPart->files.first().kind, ProjectFile::CXXSource);
+}
diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp
index f7e41a41f0..39c1c398ca 100644
--- a/src/plugins/git/changeselectiondialog.cpp
+++ b/src/plugins/git/changeselectiondialog.cpp
@@ -244,7 +244,7 @@ void ChangeSelectionDialog::recalculateDetails()
const QString ref = change();
if (ref.isEmpty()) {
- m_ui->detailsText->setPlainText(QString());
+ m_ui->detailsText->clear();
return;
}
@@ -257,7 +257,7 @@ void ChangeSelectionDialog::recalculateDetails()
connect(m_process, SIGNAL(finished(int)), this, SLOT(setDetails(int)));
- m_process->start(m_gitExecutable, args);
+ m_process->start(m_gitExecutable.toString(), args);
m_process->closeWriteChannel();
if (!m_process->waitForStarted())
m_ui->detailsText->setPlainText(tr("Error: Could not start Git."));
diff --git a/src/plugins/git/changeselectiondialog.h b/src/plugins/git/changeselectiondialog.h
index c5c20221a7..e6919464a1 100644
--- a/src/plugins/git/changeselectiondialog.h
+++ b/src/plugins/git/changeselectiondialog.h
@@ -32,6 +32,8 @@
#include <coreplugin/id.h>
+#include <utils/fileutils.h>
+
#include <QDialog>
#include <QProcessEnvironment>
@@ -87,7 +89,7 @@ private:
Ui::ChangeSelectionDialog *m_ui;
QProcess *m_process;
- QString m_gitExecutable;
+ Utils::FileName m_gitExecutable;
QProcessEnvironment m_gitEnvironment;
ChangeCommand m_command;
QStringListModel *m_changeModel;
diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp
index f811044044..05401283ed 100644
--- a/src/plugins/git/gerrit/gerritmodel.cpp
+++ b/src/plugins/git/gerrit/gerritmodel.cpp
@@ -314,8 +314,8 @@ void QueryContext::startQuery(const QString &query)
{
QStringList arguments = m_baseArguments;
arguments.push_back(query);
- VcsBase::VcsBaseOutputWindow::instance()
- ->appendCommand(m_process.workingDirectory(), m_binary, arguments);
+ VcsBase::VcsBaseOutputWindow::instance()->appendCommand(
+ m_process.workingDirectory(), Utils::FileName::fromString(m_binary), arguments);
m_timer.start();
m_process.start(m_binary, arguments);
m_process.closeWriteChannel();
diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp
index c8ef4a9471..ee1ba7bf4c 100644
--- a/src/plugins/git/gerrit/gerritplugin.cpp
+++ b/src/plugins/git/gerrit/gerritplugin.cpp
@@ -99,7 +99,7 @@ class FetchContext : public QObject
Q_OBJECT
public:
FetchContext(const QSharedPointer<GerritChange> &change,
- const QString &repository, const QString &git,
+ const QString &repository, const Utils::FileName &git,
const QSharedPointer<GerritParameters> &p,
FetchMode fm, QObject *parent = 0);
~FetchContext();
@@ -129,7 +129,7 @@ private:
const QSharedPointer<GerritChange> m_change;
const QString m_repository;
const FetchMode m_fetchMode;
- const QString m_git;
+ const Utils::FileName m_git;
const QSharedPointer<GerritParameters> m_parameters;
State m_state;
QProcess m_process;
@@ -137,7 +137,7 @@ private:
};
FetchContext::FetchContext(const QSharedPointer<GerritChange> &change,
- const QString &repository, const QString &git,
+ const QString &repository, const Utils::FileName &git,
const QSharedPointer<GerritParameters> &p,
FetchMode fm, QObject *parent)
: QObject(parent)
@@ -179,18 +179,18 @@ void FetchContext::start()
// Order: initialize future before starting the process in case error handling is invoked.
const QStringList args = m_change->gitFetchArguments(m_parameters);
VcsBase::VcsBaseOutputWindow::instance()->appendCommand(m_repository, m_git, args);
- m_process.start(m_git, args);
+ m_process.start(m_git.toString(), args);
m_process.closeWriteChannel();
}
void FetchContext::processFinished(int exitCode, QProcess::ExitStatus es)
{
if (es != QProcess::NormalExit) {
- handleError(tr("%1 crashed.").arg(m_git));
+ handleError(tr("%1 crashed.").arg(m_git.toUserOutput()));
return;
}
if (exitCode) {
- handleError(tr("%1 returned %2.").arg(m_git).arg(exitCode));
+ handleError(tr("%1 returned %2.").arg(m_git.toUserOutput()).arg(exitCode));
return;
}
if (m_state == FetchState) {
@@ -235,7 +235,7 @@ void FetchContext::handleError(const QString &e)
void FetchContext::processError(QProcess::ProcessError e)
{
- const QString msg = tr("Error running %1: %2").arg(m_git, m_process.errorString());
+ const QString msg = tr("Error running %1: %2").arg(m_git.toUserOutput(), m_process.errorString());
if (e == QProcess::FailedToStart)
handleError(msg);
else
@@ -266,6 +266,7 @@ void FetchContext::checkout()
GerritPlugin::GerritPlugin(QObject *parent)
: QObject(parent)
, m_parameters(new GerritParameters)
+ , m_gerritCommand(0), m_pushToGerritCommand(0)
{
}
@@ -388,13 +389,13 @@ void GerritPlugin::push()
push(GitPlugin::instance()->currentState().topLevel());
}
-QString GerritPlugin::gitBinary()
+Utils::FileName GerritPlugin::gitBinary()
{
bool ok;
- const QString git = gitClient()->gitExecutable(&ok);
+ const Utils::FileName git = gitClient()->gitExecutable(&ok);
if (!ok) {
VcsBase::VcsBaseOutputWindow::instance()->appendError(tr("Git is not available."));
- return QString();
+ return Utils::FileName();
}
return git;
}
@@ -428,7 +429,7 @@ void GerritPlugin::fetchCheckout(const QSharedPointer<GerritChange> &change)
void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
{
// Locate git.
- const QString git = gitBinary();
+ const Utils::FileName git = gitBinary();
if (git.isEmpty())
return;
diff --git a/src/plugins/git/gerrit/gerritplugin.h b/src/plugins/git/gerrit/gerritplugin.h
index 23ee4fe087..423f6a2390 100644
--- a/src/plugins/git/gerrit/gerritplugin.h
+++ b/src/plugins/git/gerrit/gerritplugin.h
@@ -63,7 +63,7 @@ public:
bool initialize(Core::ActionContainer *ac);
- static QString gitBinary();
+ static Utils::FileName gitBinary();
static Utils::FileName gitBinDirectory();
static QString branch(const QString &repository);
void addToLocator(Core::CommandLocator *locator);
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index fa195f2c79..e5576ed57e 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -133,7 +133,7 @@ private:
void addJob(VcsBase::Command *command, const QStringList &arguments);
int timeout() const;
QProcessEnvironment processEnvironment() const;
- QString gitPath() const;
+ Utils::FileName gitPath() const;
QPointer<DiffEditor::DiffEditorController> m_controller;
const QString m_workingDirectory;
@@ -303,7 +303,7 @@ QProcessEnvironment GitDiffHandler::processEnvironment() const
return m_gitClient->processEnvironment();
}
-QString GitDiffHandler::gitPath() const
+Utils::FileName GitDiffHandler::gitPath() const
{
return m_gitClient->gitExecutable();
}
@@ -2185,7 +2185,9 @@ VcsBase::Command *GitClient::executeGit(const QString &workingDirectory,
unsigned additionalFlags,
int editorLineNumber)
{
- outputWindow()->appendCommand(workingDirectory, settings()->stringValue(GitSettings::binaryPathKey), arguments);
+ outputWindow()->appendCommand(workingDirectory,
+ Utils::FileName::fromUserInput(settings()->stringValue(GitSettings::binaryPathKey)),
+ arguments);
VcsBase::Command *command = createCommand(workingDirectory, editor, useOutputToWindow, editorLineNumber);
command->addJob(arguments, settings()->intValue(GitSettings::timeoutKey));
command->addFlags(additionalFlags);
@@ -2544,7 +2546,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
void GitClient::launchGitK(const QString &workingDirectory, const QString &fileName)
{
- const QFileInfo binaryInfo(gitExecutable());
+ const QFileInfo binaryInfo = gitExecutable().toFileInfo();
QDir foundBinDir(binaryInfo.dir());
const bool foundBinDirIsCmdDir = foundBinDir.dirName() == QLatin1String("cmd");
QProcessEnvironment env = processEnvironment();
@@ -2565,10 +2567,10 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
}
Utils::Environment sysEnv = Utils::Environment::systemEnvironment();
- const QString exec = sysEnv.searchInPath(QLatin1String("gitk"));
+ const Utils::FileName exec = sysEnv.searchInPath(QLatin1String("gitk"));
if (!exec.isEmpty() && tryLauchingGitK(env, workingDirectory, fileName,
- QFileInfo(exec).absolutePath())) {
+ exec.parentDir().toString())) {
return;
}
@@ -2603,7 +2605,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
arguments.append(Utils::QtcProcess::splitArgs(gitkOpts, Utils::HostOsInfo::hostOs()));
if (!fileName.isEmpty())
arguments << QLatin1String("--") << fileName;
- outwin->appendCommand(workingDirectory, binary, arguments);
+ outwin->appendCommand(workingDirectory, Utils::FileName::fromString(binary), arguments);
// This should always use QProcess::startDetached (as not to kill
// the child), but that does not have an environment parameter.
bool success = false;
@@ -2626,10 +2628,11 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
bool GitClient::launchGitGui(const QString &workingDirectory) {
bool success;
- QString gitBinary = gitExecutable(&success);
- if (success)
- success = QProcess::startDetached(gitBinary, QStringList(QLatin1String("gui")),
+ Utils::FileName gitBinary = gitExecutable(&success);
+ if (success) {
+ success = QProcess::startDetached(gitBinary.toString(), QStringList(QLatin1String("gui")),
workingDirectory);
+ }
if (!success)
outputWindow()->appendError(msgCannotLaunch(QLatin1String("git gui")));
@@ -2639,7 +2642,7 @@ bool GitClient::launchGitGui(const QString &workingDirectory) {
Utils::FileName GitClient::gitBinDirectory()
{
- const QString git = gitExecutable();
+ const QString git = gitExecutable().toString();
if (git.isEmpty())
return Utils::FileName();
@@ -2655,7 +2658,7 @@ Utils::FileName GitClient::gitBinDirectory()
return Utils::FileName::fromString(path);
}
-QString GitClient::gitExecutable(bool *ok, QString *errorMessage) const
+Utils::FileName GitClient::gitExecutable(bool *ok, QString *errorMessage) const
{
return settings()->gitExecutable(ok, errorMessage);
}
@@ -3288,9 +3291,7 @@ void GitClient::asyncCommand(const QString &workingDirectory, const QStringList
// Git might request an editor, so this must be done asynchronously
// and without timeout
QString gitCommand = arguments.first();
- outputWindow()->appendCommand(workingDirectory,
- settings()->stringValue(GitSettings::binaryPathKey),
- arguments);
+ outputWindow()->appendCommand(workingDirectory, settings()->binaryPath(), arguments);
VcsBase::Command *command = createCommand(workingDirectory, 0, true);
new ConflictHandler(command, workingDirectory, gitCommand);
if (hasProgress)
@@ -3336,7 +3337,7 @@ void GitClient::interactiveRebase(const QString &workingDirectory, const QString
if (fixup)
arguments << QLatin1String("--autosquash");
arguments << commit + QLatin1Char('^');
- outputWindow()->appendCommand(workingDirectory, settings()->stringValue(GitSettings::binaryPathKey), arguments);
+ outputWindow()->appendCommand(workingDirectory, settings()->binaryPath(), arguments);
if (fixup)
m_disableEditor = true;
asyncCommand(workingDirectory, arguments, true);
@@ -3525,7 +3526,7 @@ GitSettings *GitClient::settings() const
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
unsigned GitClient::gitVersion(QString *errorMessage) const
{
- const QString newGitBinary = gitExecutable();
+ const Utils::FileName newGitBinary = gitExecutable();
if (m_gitVersionForBinary != newGitBinary && !newGitBinary.isEmpty()) {
// Do not execute repeatedly if that fails (due to git
// not being installed) until settings are changed.
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 31ff87171d..2c2cfb141e 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -136,7 +136,7 @@ public:
explicit GitClient(GitSettings *settings);
~GitClient();
- QString gitExecutable(bool *ok = 0, QString *errorMessage = 0) const;
+ Utils::FileName gitExecutable(bool *ok = 0, QString *errorMessage = 0) const;
unsigned gitVersion(QString *errorMessage = 0) const;
QString findRepositoryForDirectory(const QString &dir);
@@ -426,7 +426,7 @@ private:
QString msgBoxText, const QString &buttonName,
const QString &gitCommand, ContinueCommandMode continueMode);
- mutable QString m_gitVersionForBinary;
+ mutable Utils::FileName m_gitVersionForBinary;
mutable unsigned m_cachedGitVersion;
const QString m_msgWait;
diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp
index edde549c24..99e17b3a34 100644
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
@@ -58,9 +58,7 @@
namespace Git {
namespace Internal {
-// ------------ GitEditor
-GitEditor::GitEditor(const VcsBase::VcsBaseEditorParameters *type,
- QWidget *parent) :
+GitEditorWidget::GitEditorWidget(const VcsBase::VcsBaseEditorParameters *type, QWidget *parent) :
VcsBase::VcsBaseEditorWidget(type, parent),
m_changeNumberPattern(QLatin1String(CHANGE_PATTERN))
{
@@ -77,7 +75,7 @@ GitEditor::GitEditor(const VcsBase::VcsBaseEditorParameters *type,
setAnnotatePreviousRevisionTextFormat(tr("Blame Parent Revision %1"));
}
-QSet<QString> GitEditor::annotationChanges() const
+QSet<QString> GitEditorWidget::annotationChanges() const
{
QSet<QString> changes;
const QString txt = toPlainText();
@@ -99,7 +97,7 @@ QSet<QString> GitEditor::annotationChanges() const
return changes;
}
-QString GitEditor::changeUnderCursor(const QTextCursor &c) const
+QString GitEditorWidget::changeUnderCursor(const QTextCursor &c) const
{
QTextCursor cursor = c;
// Any number is regarded as change number.
@@ -112,7 +110,7 @@ QString GitEditor::changeUnderCursor(const QTextCursor &c) const
return QString();
}
-VcsBase::BaseAnnotationHighlighter *GitEditor::createAnnotationHighlighter(const QSet<QString> &changes) const
+VcsBase::BaseAnnotationHighlighter *GitEditorWidget::createAnnotationHighlighter(const QSet<QString> &changes) const
{
return new GitAnnotationHighlighter(changes);
}
@@ -174,7 +172,7 @@ static QString removeAnnotationDate(const QString &b)
return result;
}
-void GitEditor::setPlainTextFiltered(const QString &text)
+void GitEditorWidget::setPlainTextFiltered(const QString &text)
{
QString modText = text;
GitPlugin *plugin = GitPlugin::instance();
@@ -191,10 +189,10 @@ void GitEditor::setPlainTextFiltered(const QString &text)
break;
}
- baseTextDocument()->setPlainText(modText);
+ textDocument()->setPlainText(modText);
}
-void GitEditor::commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v)
+void GitEditorWidget::commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v)
{
reportCommandFinished(ok, exitCode, v);
if (ok && v.type() == QVariant::Int) {
@@ -204,13 +202,13 @@ void GitEditor::commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v
}
}
-void GitEditor::checkoutChange()
+void GitEditorWidget::checkoutChange()
{
GitPlugin::instance()->gitClient()->stashAndCheckout(
sourceWorkingDirectory(), m_currentChange);
}
-void GitEditor::resetChange()
+void GitEditorWidget::resetChange()
{
const QString workingDir = sourceWorkingDirectory();
@@ -228,19 +226,19 @@ void GitEditor::resetChange()
client->reset(workingDir, QLatin1String("--hard"), m_currentChange);
}
-void GitEditor::cherryPickChange()
+void GitEditorWidget::cherryPickChange()
{
GitPlugin::instance()->gitClient()->synchronousCherryPick(
sourceWorkingDirectory(), m_currentChange);
}
-void GitEditor::revertChange()
+void GitEditorWidget::revertChange()
{
GitPlugin::instance()->gitClient()->synchronousRevert(
sourceWorkingDirectory(), m_currentChange);
}
-void GitEditor::stageDiffChunk()
+void GitEditorWidget::stageDiffChunk()
{
const QAction *a = qobject_cast<QAction *>(sender());
QTC_ASSERT(a, return);
@@ -248,7 +246,7 @@ void GitEditor::stageDiffChunk()
return applyDiffChunk(chunk, false);
}
-void GitEditor::unstageDiffChunk()
+void GitEditorWidget::unstageDiffChunk()
{
const QAction *a = qobject_cast<QAction *>(sender());
QTC_ASSERT(a, return);
@@ -256,7 +254,7 @@ void GitEditor::unstageDiffChunk()
return applyDiffChunk(chunk, true);
}
-void GitEditor::applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert)
+void GitEditorWidget::applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert)
{
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
QTemporaryFile patchFile;
@@ -287,17 +285,17 @@ void GitEditor::applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert)
}
}
-void GitEditor::init()
+void GitEditorWidget::init()
{
VcsBase::VcsBaseEditorWidget::init();
Core::Id editorId = editor()->document()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
- new GitSubmitHighlighter(baseTextDocument());
+ new GitSubmitHighlighter(textDocument());
else if (editorId == Git::Constants::GIT_REBASE_EDITOR_ID)
- new GitRebaseHighlighter(baseTextDocument());
+ new GitRebaseHighlighter(textDocument());
}
-void GitEditor::addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chunk)
+void GitEditorWidget::addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chunk)
{
menu->addSeparator();
@@ -310,7 +308,7 @@ void GitEditor::addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chunk)
connect(unstageAction, SIGNAL(triggered()), this, SLOT(unstageDiffChunk()));
}
-bool GitEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
+bool GitEditorWidget::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
Core::Id editorId = editor()->document()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID
@@ -318,13 +316,13 @@ bool GitEditor::open(QString *errorString, const QString &fileName, const QStrin
QFileInfo fi(fileName);
const QString gitPath = fi.absolutePath();
setSource(gitPath);
- baseTextDocument()->setCodec(
+ textDocument()->setCodec(
GitPlugin::instance()->gitClient()->encoding(gitPath, "i18n.commitEncoding"));
}
return VcsBaseEditorWidget::open(errorString, fileName, realFileName);
}
-QString GitEditor::decorateVersion(const QString &revision) const
+QString GitEditorWidget::decorateVersion(const QString &revision) const
{
const QFileInfo fi(source());
const QString workingDirectory = fi.absolutePath();
@@ -333,7 +331,7 @@ QString GitEditor::decorateVersion(const QString &revision) const
return GitPlugin::instance()->gitClient()->synchronousShortDescription(workingDirectory, revision);
}
-QStringList GitEditor::annotationPreviousVersions(const QString &revision) const
+QStringList GitEditorWidget::annotationPreviousVersions(const QString &revision) const
{
QStringList revisions;
QString errorMessage;
@@ -349,12 +347,12 @@ QStringList GitEditor::annotationPreviousVersions(const QString &revision) const
return revisions;
}
-bool GitEditor::isValidRevision(const QString &revision) const
+bool GitEditorWidget::isValidRevision(const QString &revision) const
{
return GitPlugin::instance()->gitClient()->isValidRevision(revision);
}
-void GitEditor::addChangeActions(QMenu *menu, const QString &change)
+void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change)
{
m_currentChange = change;
if (contentType() != VcsBase::OtherContent) {
@@ -365,7 +363,7 @@ void GitEditor::addChangeActions(QMenu *menu, const QString &change)
}
}
-QString GitEditor::revisionSubject(const QTextBlock &inBlock) const
+QString GitEditorWidget::revisionSubject(const QTextBlock &inBlock) const
{
for (QTextBlock block = inBlock.next(); block.isValid(); block = block.next()) {
const QString line = block.text().trimmed();
@@ -377,14 +375,14 @@ QString GitEditor::revisionSubject(const QTextBlock &inBlock) const
return QString();
}
-bool GitEditor::supportChangeLinks() const
+bool GitEditorWidget::supportChangeLinks() const
{
return VcsBaseEditorWidget::supportChangeLinks()
|| (editor()->document()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
|| (editor()->document()->id() == Git::Constants::GIT_REBASE_EDITOR_ID);
}
-QString GitEditor::fileNameForLine(int line) const
+QString GitEditorWidget::fileNameForLine(int line) const
{
// 7971b6e7 share/qtcreator/dumper/dumper.py (hjk
QTextBlock block = document()->findBlockByLineNumber(line - 1);
@@ -398,7 +396,7 @@ QString GitEditor::fileNameForLine(int line) const
return source();
}
-QString GitEditor::sourceWorkingDirectory() const
+QString GitEditorWidget::sourceWorkingDirectory() const
{
const QFileInfo fi(source());
return fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
diff --git a/src/plugins/git/giteditor.h b/src/plugins/git/giteditor.h
index 9247d7f46f..f1604e3227 100644
--- a/src/plugins/git/giteditor.h
+++ b/src/plugins/git/giteditor.h
@@ -41,13 +41,13 @@ QT_END_NAMESPACE
namespace Git {
namespace Internal {
-class GitEditor : public VcsBase::VcsBaseEditorWidget
+class GitEditorWidget : public VcsBase::VcsBaseEditorWidget
{
Q_OBJECT
public:
- explicit GitEditor(const VcsBase::VcsBaseEditorParameters *type,
- QWidget *parent);
+ GitEditorWidget(const VcsBase::VcsBaseEditorParameters *type,
+ QWidget *parent);
public slots:
void setPlainTextFiltered(const QString &text);
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 9ee1fe321f..86eca7b04a 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -83,10 +83,24 @@
#include <QMessageBox>
#include <QScopedPointer>
-static const unsigned minimumRequiredVersion = 0x010702;
-static const char RC_GIT_MIME_XML[] = ":/git/Git.mimetypes.xml";
+#ifdef WITH_TESTS
+#include "clonewizardpage.h"
+#include <QTest>
+#endif
+
+Q_DECLARE_METATYPE(Git::Internal::FileStates)
+
+using namespace Core;
+using namespace Utils;
+using namespace VcsBase;
-static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
+namespace Git {
+namespace Internal {
+
+const unsigned minimumRequiredVersion = 0x010702;
+const char RC_GIT_MIME_XML[] = ":/git/Git.mimetypes.xml";
+
+const VcsBaseEditorParameters editorParameters[] = {
{
VcsBase::OtherContent,
Git::Constants::GIT_COMMAND_LOG_EDITOR_ID,
@@ -115,14 +129,10 @@ static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
"text/vnd.qtcreator.git.rebase"},
};
-Q_DECLARE_METATYPE(Git::Internal::GitClientMemberFunc)
-
-using namespace Git;
-using namespace Git::Internal;
// GitPlugin
-GitPlugin *GitPlugin::m_instance = 0;
+static GitPlugin *m_instance = 0;
GitPlugin::GitPlugin() :
m_commandLocator(0),
@@ -136,8 +146,6 @@ GitPlugin::GitPlugin() :
m_submitActionTriggered(false)
{
m_instance = this;
- const int mid = qRegisterMetaType<GitClientMemberFunc>();
- Q_UNUSED(mid)
m_fileActions.reserve(10);
m_projectActions.reserve(10);
m_repositoryActions.reserve(50);
@@ -168,123 +176,122 @@ GitPlugin *GitPlugin::instance()
return m_instance;
}
-static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = {
+const VcsBaseSubmitEditorParameters submitParameters = {
Git::Constants::SUBMIT_MIMETYPE,
Git::Constants::GITSUBMITEDITOR_ID,
Git::Constants::GITSUBMITEDITOR_DISPLAY_NAME,
Git::Constants::C_GITSUBMITEDITOR,
- VcsBase::VcsBaseSubmitEditorParameters::DiffRows
+ VcsBaseSubmitEditorParameters::DiffRows
};
// Create a parameter action
-ParameterActionCommandPair
- GitPlugin::createParameterAction(Core::ActionContainer *ac,
- const QString &defaultText, const QString &parameterText,
- Core::Id id, const Core::Context &context,
- bool addToLocator)
-{
- Utils::ParameterAction *action = new Utils::ParameterAction(defaultText, parameterText,
- Utils::ParameterAction::EnabledWithParameter,
- this);
- Core::Command *command = Core::ActionManager::registerAction(action, id, context);
+ParameterAction *GitPlugin::createParameterAction(ActionContainer *ac,
+ const QString &defaultText, const QString &parameterText,
+ Id id, const Context &context,
+ bool addToLocator, const QKeySequence &keys)
+{
+ auto action = new ParameterAction(defaultText, parameterText, ParameterAction::EnabledWithParameter, this);
+ Core::Command *command = ActionManager::registerAction(action, id, context);
+ if (!keys.isEmpty())
+ command->setDefaultKeySequence(keys);
command->setAttribute(Core::Command::CA_UpdateText);
ac->addAction(command);
if (addToLocator)
m_commandLocator->appendCommand(command);
- return ParameterActionCommandPair(action, command);
+ return action;
}
// Create an action to act on a file with a slot.
-ParameterActionCommandPair
- GitPlugin::createFileAction(Core::ActionContainer *ac,
- const QString &defaultText, const QString &parameterText,
- Core::Id id, const Core::Context &context, bool addToLocator,
- const char *pluginSlot)
+QAction *GitPlugin::createFileAction(ActionContainer *ac,
+ const QString &defaultText, const QString &parameterText,
+ Id id, const Context &context, bool addToLocator,
+ const char *pluginSlot, const QKeySequence &keys)
{
- const ParameterActionCommandPair rc = createParameterAction(ac, defaultText, parameterText, id, context, addToLocator);
- m_fileActions.push_back(rc.first);
- connect(rc.first, SIGNAL(triggered()), this, pluginSlot);
- return rc;
+ ParameterAction *action = createParameterAction(ac, defaultText, parameterText, id, context, addToLocator, keys);
+ m_fileActions.push_back(action);
+ connect(action, SIGNAL(triggered()), this, pluginSlot);
+ return action;
}
// Create an action to act on a project with slot.
-ParameterActionCommandPair
- GitPlugin::createProjectAction(Core::ActionContainer *ac,
- const QString &defaultText, const QString &parameterText,
- Core::Id id, const Core::Context &context, bool addToLocator,
- const char *pluginSlot)
+QAction *GitPlugin::createProjectAction(ActionContainer *ac,
+ const QString &defaultText, const QString &parameterText,
+ Id id, const Context &context, bool addToLocator,
+ const char *pluginSlot, const QKeySequence &keys)
{
- const ParameterActionCommandPair rc = createParameterAction(ac, defaultText, parameterText, id, context, addToLocator);
- m_projectActions.push_back(rc.first);
- connect(rc.first, SIGNAL(triggered()), this, pluginSlot);
- return rc;
+ ParameterAction *action = createParameterAction(ac, defaultText, parameterText, id, context, addToLocator, keys);
+ m_projectActions.push_back(action);
+ connect(action, SIGNAL(triggered()), this, pluginSlot);
+ return action;
}
// Create an action to act on the repository
-ActionCommandPair
- GitPlugin::createRepositoryAction(Core::ActionContainer *ac,
- const QString &text, Core::Id id,
- const Core::Context &context, bool addToLocator)
-{
- QAction *action = new QAction(text, this);
- Core::Command *command = Core::ActionManager::registerAction(action, id, context);
+QAction *GitPlugin::createRepositoryAction(ActionContainer *ac,
+ const QString &text, Id id,
+ const Context &context, bool addToLocator,
+ const QKeySequence &keys)
+{
+ QAction *action = new QAction(text, this);
+ Core::Command *command = ActionManager::registerAction(action, id, context);
+ if (!keys.isEmpty())
+ command->setDefaultKeySequence(keys);
if (ac)
ac->addAction(command);
m_repositoryActions.push_back(action);
if (addToLocator)
m_commandLocator->appendCommand(command);
- return ActionCommandPair(action, command);
+ return action;
}
// Create an action to act on the repository with slot
-ActionCommandPair
- GitPlugin::createRepositoryAction(Core::ActionContainer *ac,
- const QString &text, Core::Id id,
- const Core::Context &context, bool addToLocator,
- const char *pluginSlot)
+QAction *GitPlugin::createRepositoryAction(ActionContainer *ac,
+ const QString &text, Id id,
+ const Context &context, bool addToLocator,
+ const char *pluginSlot, const QKeySequence &keys)
{
- const ActionCommandPair rc = createRepositoryAction(ac, text, id, context, addToLocator);
- connect(rc.first, SIGNAL(triggered()), this, pluginSlot);
- rc.first->setData(id.uniqueIdentifier());
- return rc;
+ QAction *action = createRepositoryAction(ac, text, id, context, addToLocator, keys);
+ connect(action, SIGNAL(triggered()), this, pluginSlot);
+ action->setData(id.uniqueIdentifier());
+ return action;
}
// Action to act on the repository forwarded to a git client member function
-// taking the directory. Store the member function as data on the action.
-ActionCommandPair
- GitPlugin::createRepositoryAction(Core::ActionContainer *ac,
- const QString &text, Core::Id id,
- const Core::Context &context, bool addToLocator,
- GitClientMemberFunc func)
+// taking the directory.
+QAction *GitPlugin::createRepositoryAction(ActionContainer *ac,
+ const QString &text, Id id,
+ const Context &context, bool addToLocator,
+ GitClientMemberFunc func, const QKeySequence &keys)
{
// Set the member func as data and connect to generic slot
- const ActionCommandPair rc = createRepositoryAction(ac, text, id, context, addToLocator);
- rc.first->setData(qVariantFromValue(func));
- connect(rc.first, SIGNAL(triggered()), this, SLOT(gitClientMemberFuncRepositoryAction()));
- return rc;
+ QAction *action = createRepositoryAction(ac, text, id, context, addToLocator, keys);
+ connect(action, &QAction::triggered, [this, func]() -> void {
+ QTC_ASSERT(currentState().hasTopLevel(), return);
+ (m_gitClient->*func)(currentState().topLevel());
+ });
+ return action;
}
bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
- m_settings.readSettings(Core::ICore::settings());
+ m_settings.readSettings(ICore::settings());
m_gitClient = new GitClient(&m_settings);
- typedef VcsBase::VcsEditorFactory<GitEditor> GitEditorFactory;
- typedef VcsBase::VcsSubmitEditorFactory<GitSubmitEditor> GitSubmitEditorFactory;
+ typedef VcsEditorFactory<GitEditorWidget> GitEditorFactory;
+ typedef VcsSubmitEditorFactory<GitSubmitEditor> GitSubmitEditorFactory;
initializeVcs(new GitVersionControl(m_gitClient));
// Create the globalcontext list to register actions accordingly
- Core::Context globalcontext(Core::Constants::C_GLOBAL);
+ Context globalcontext(Core::Constants::C_GLOBAL);
// Create the settings Page
addAutoReleasedObject(new SettingsPage());
static const char *describeSlot = SLOT(show(QString,QString));
- const int editorCount = sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters);
+ const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new GitEditorFactory(editorParameters + i, m_gitClient, describeSlot));
@@ -293,137 +300,99 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
addAutoReleasedObject(new Gitorious::Internal::GitoriousCloneWizardFactory);
const QString prefix = QLatin1String("git");
- m_commandLocator = new Core::CommandLocator("Git", prefix, prefix);
+ m_commandLocator = new CommandLocator("Git", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
//register actions
- Core::ActionContainer *toolsContainer =
- Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
+ ActionContainer *toolsContainer = ActionManager::actionContainer(Core::Constants::M_TOOLS);
- Core::ActionContainer *gitContainer = Core::ActionManager::createMenu("Git");
+ ActionContainer *gitContainer = ActionManager::createMenu("Git");
gitContainer->menu()->setTitle(tr("&Git"));
toolsContainer->addMenu(gitContainer);
m_menuAction = gitContainer->menu()->menuAction();
+
/* "Current File" menu */
- Core::ActionContainer *currentFileMenu = Core::ActionManager::createMenu("Git.CurrentFileMenu");
+ ActionContainer *currentFileMenu = ActionManager::createMenu("Git.CurrentFileMenu");
currentFileMenu->menu()->setTitle(tr("Current &File"));
gitContainer->addMenu(currentFileMenu);
- ParameterActionCommandPair parameterActionCommand
- = createFileAction(currentFileMenu,
- tr("Diff Current File"), tr("Diff of \"%1\""),
- "Git.Diff", globalcontext, true,
- SLOT(diffCurrentFile()));
- parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+D") : tr("Alt+G,Alt+D")));
-
- parameterActionCommand
- = createFileAction(currentFileMenu,
- tr("Log Current File"), tr("Log of \"%1\""),
- "Git.Log", globalcontext, true, SLOT(logFile()));
- parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+L") : tr("Alt+G,Alt+L")));
-
- parameterActionCommand
- = createFileAction(currentFileMenu,
- tr("Blame Current File"), tr("Blame for \"%1\""),
- "Git.Blame",
- globalcontext, true, SLOT(blameFile()));
- parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+B") : tr("Alt+G,Alt+B")));
-
- // ------
- currentFileMenu->addSeparator(globalcontext);
+ createFileAction(currentFileMenu, tr("Diff Current File"), tr("Diff of \"%1\""),
+ "Git.Diff", globalcontext, true, SLOT(diffCurrentFile()),
+ QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+D") : tr("Alt+G,Alt+D")));
+
+ createFileAction(currentFileMenu, tr("Log Current File"), tr("Log of \"%1\""),
+ "Git.Log", globalcontext, true, SLOT(logFile()),
+ QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+L") : tr("Alt+G,Alt+L")));
- parameterActionCommand
- = createFileAction(currentFileMenu,
- tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"),
- "Git.Stage", globalcontext, true, SLOT(stageFile()));
- parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+A") : tr("Alt+G,Alt+A")));
+ createFileAction(currentFileMenu, tr("Blame Current File"), tr("Blame for \"%1\""),
+ "Git.Blame", globalcontext, true, SLOT(blameFile()),
+ QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+B") : tr("Alt+G,Alt+B")));
- parameterActionCommand
- = createFileAction(currentFileMenu,
- tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"),
- "Git.Unstage", globalcontext, true, SLOT(unstageFile()));
+ currentFileMenu->addSeparator(globalcontext);
- parameterActionCommand
- = createFileAction(currentFileMenu,
- tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
- "Git.UndoUnstaged", globalcontext,
- true, SLOT(undoUnstagedFileChanges()));
+ createFileAction(currentFileMenu, tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"),
+ "Git.Stage", globalcontext, true, SLOT(stageFile()),
+ QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+A") : tr("Alt+G,Alt+A")));
- parameterActionCommand
- = createFileAction(currentFileMenu,
- tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
- "Git.Undo", globalcontext,
- true, SLOT(undoFileChanges()));
- parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+U") : tr("Alt+G,Alt+U")));
+ createFileAction(currentFileMenu, tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"),
+ "Git.Unstage", globalcontext, true, SLOT(unstageFile()));
- /* \"Current File" menu */
+ createFileAction(currentFileMenu, tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
+ "Git.UndoUnstaged", globalcontext,
+ true, SLOT(undoUnstagedFileChanges()));
+
+ createFileAction(currentFileMenu, tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
+ "Git.Undo", globalcontext,
+ true, SLOT(undoFileChanges()),
+ QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+U") : tr("Alt+G,Alt+U")));
- // ------------
/* "Current Project" menu */
- Core::ActionContainer *currentProjectMenu = Core::ActionManager::createMenu("Git.CurrentProjectMenu");
+ ActionContainer *currentProjectMenu = ActionManager::createMenu("Git.CurrentProjectMenu");
currentProjectMenu->menu()->setTitle(tr("Current &Project"));
gitContainer->addMenu(currentProjectMenu);
- parameterActionCommand
- = createProjectAction(currentProjectMenu,
- tr("Diff Current Project"), tr("Diff Project \"%1\""),
- "Git.DiffProject", globalcontext, true,
- SLOT(diffCurrentProject()));
- parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+Shift+D") : tr("Alt+G,Alt+Shift+D")));
-
- parameterActionCommand
- = createProjectAction(currentProjectMenu,
- tr("Log Project"), tr("Log Project \"%1\""),
- "Git.LogProject", globalcontext, true,
- SLOT(logProject()));
- parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+K") : tr("Alt+G,Alt+K")));
+ createProjectAction(currentProjectMenu, tr("Diff Current Project"), tr("Diff Project \"%1\""),
+ "Git.DiffProject", globalcontext, true, SLOT(diffCurrentProject()),
+ QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+Shift+D") : tr("Alt+G,Alt+Shift+D")));
- parameterActionCommand
- = createProjectAction(currentProjectMenu,
- tr("Clean Project..."), tr("Clean Project \"%1\"..."),
- "Git.CleanProject", globalcontext,
- true, SLOT(cleanProject()));
+ createProjectAction(currentProjectMenu, tr("Log Project"), tr("Log Project \"%1\""),
+ "Git.LogProject", globalcontext, true, SLOT(logProject()),
+ QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+K") : tr("Alt+G,Alt+K")));
- /* \"Current Project" menu */
+ createProjectAction(currentProjectMenu, tr("Clean Project..."), tr("Clean Project \"%1\"..."),
+ "Git.CleanProject", globalcontext, true, SLOT(cleanProject()));
- // --------------
/* "Local Repository" menu */
- Core::ActionContainer *localRepositoryMenu = Core::ActionManager::createMenu("Git.LocalRepositoryMenu");
+ ActionContainer *localRepositoryMenu = ActionManager::createMenu("Git.LocalRepositoryMenu");
localRepositoryMenu->menu()->setTitle(tr("&Local Repository"));
gitContainer->addMenu(localRepositoryMenu);
- createRepositoryAction(localRepositoryMenu,
- tr("Diff"), "Git.DiffRepository",
+ createRepositoryAction(localRepositoryMenu, tr("Diff"), "Git.DiffRepository",
globalcontext, true, SLOT(diffRepository()));
- createRepositoryAction(localRepositoryMenu,
- tr("Log"), "Git.LogRepository",
+ createRepositoryAction(localRepositoryMenu, tr("Log"), "Git.LogRepository",
globalcontext, true,
SLOT(logRepository()));
- createRepositoryAction(localRepositoryMenu,
- tr("Reflog"), "Git.ReflogRepository",
+ createRepositoryAction(localRepositoryMenu, tr("Reflog"), "Git.ReflogRepository",
globalcontext, true,
SLOT(reflogRepository()));
- createRepositoryAction(localRepositoryMenu,
- tr("Clean..."), "Git.CleanRepository",
+ createRepositoryAction(localRepositoryMenu, tr("Clean..."), "Git.CleanRepository",
globalcontext, true, SLOT(cleanRepository()));
- createRepositoryAction(localRepositoryMenu,
- tr("Status"), "Git.StatusRepository",
+ createRepositoryAction(localRepositoryMenu, tr("Status"), "Git.StatusRepository",
globalcontext, true, &GitClient::status);
// --------------
localRepositoryMenu->addSeparator(globalcontext);
- ActionCommandPair actionCommand = createRepositoryAction(localRepositoryMenu,
- tr("Commit..."), "Git.Commit",
- globalcontext, true, SLOT(startCommit()));
- actionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+C") : tr("Alt+G,Alt+C")));
+ createRepositoryAction(localRepositoryMenu, tr("Commit..."), "Git.Commit",
+ globalcontext, true, SLOT(startCommit()));
+ QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+C") : tr("Alt+G,Alt+C"));
createRepositoryAction(localRepositoryMenu,
tr("Amend Last Commit..."), "Git.AmendCommit",
@@ -432,7 +401,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_fixupCommitAction =
createRepositoryAction(localRepositoryMenu,
tr("Fixup Previous Commit..."), "Git.FixupCommit",
- globalcontext, true, SLOT(startFixupCommit())).first;
+ globalcontext, true, SLOT(startFixupCommit()));
+
// --------------
localRepositoryMenu->addSeparator(globalcontext);
@@ -443,46 +413,46 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_interactiveRebaseAction =
createRepositoryAction(localRepositoryMenu,
tr("Interactive Rebase..."), "Git.InteractiveRebase",
- globalcontext, true, SLOT(startRebase())).first;
+ globalcontext, true, SLOT(startRebase()));
m_submoduleUpdateAction =
createRepositoryAction(localRepositoryMenu,
tr("Update Submodules"), "Git.SubmoduleUpdate",
- globalcontext, true, SLOT(updateSubmodules())).first;
+ globalcontext, true, SLOT(updateSubmodules()));
m_abortMergeAction =
createRepositoryAction(localRepositoryMenu,
tr("Abort Merge"), "Git.MergeAbort",
- globalcontext, true, SLOT(continueOrAbortCommand())).first;
+ globalcontext, true, SLOT(continueOrAbortCommand()));
m_abortRebaseAction =
createRepositoryAction(localRepositoryMenu,
tr("Abort Rebase"), "Git.RebaseAbort",
- globalcontext, true, SLOT(continueOrAbortCommand())).first;
+ globalcontext, true, SLOT(continueOrAbortCommand()));
m_abortCherryPickAction =
createRepositoryAction(localRepositoryMenu,
tr("Abort Cherry Pick"), "Git.CherryPickAbort",
- globalcontext, true, SLOT(continueOrAbortCommand())).first;
+ globalcontext, true, SLOT(continueOrAbortCommand()));
m_abortRevertAction =
createRepositoryAction(localRepositoryMenu,
tr("Abort Revert"), "Git.RevertAbort",
- globalcontext, true, SLOT(continueOrAbortCommand())).first;
+ globalcontext, true, SLOT(continueOrAbortCommand()));
m_continueRebaseAction =
createRepositoryAction(localRepositoryMenu,
tr("Continue Rebase"), "Git.RebaseContinue",
- globalcontext, true, SLOT(continueOrAbortCommand())).first;
+ globalcontext, true, SLOT(continueOrAbortCommand()));
m_continueCherryPickAction =
createRepositoryAction(localRepositoryMenu,
tr("Continue Cherry Pick"), "Git.CherryPickContinue",
- globalcontext, true, SLOT(continueOrAbortCommand())).first;
+ globalcontext, true, SLOT(continueOrAbortCommand()));
m_continueRevertAction =
createRepositoryAction(localRepositoryMenu,
tr("Continue Revert"), "Git.RevertContinue",
- globalcontext, true, SLOT(continueOrAbortCommand())).first;
+ globalcontext, true, SLOT(continueOrAbortCommand()));
// --------------
localRepositoryMenu->addSeparator(globalcontext);
@@ -495,17 +465,17 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
localRepositoryMenu->addSeparator(globalcontext);
// "Patch" menu
- Core::ActionContainer *patchMenu = Core::ActionManager::createMenu("Git.PatchMenu");
+ ActionContainer *patchMenu = ActionManager::createMenu("Git.PatchMenu");
patchMenu->menu()->setTitle(tr("&Patch"));
localRepositoryMenu->addMenu(patchMenu);
// Apply current file as patch is handled specially.
- parameterActionCommand =
+ m_applyCurrentFilePatchAction =
createParameterAction(patchMenu,
tr("Apply from Editor"), tr("Apply \"%1\""),
"Git.ApplyCurrentFilePatch",
globalcontext, true);
- m_applyCurrentFilePatchAction = parameterActionCommand.first;
+
connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this,
SLOT(applyCurrentFilePatch()));
@@ -514,7 +484,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
globalcontext, true, SLOT(promptApplyPatch()));
// "Stash" menu
- Core::ActionContainer *stashMenu = Core::ActionManager::createMenu("Git.StashMenu");
+ ActionContainer *stashMenu = ActionManager::createMenu("Git.StashMenu");
stashMenu->menu()->setTitle(tr("&Stash"));
localRepositoryMenu->addMenu(stashMenu);
@@ -524,22 +494,19 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
stashMenu->addSeparator(globalcontext);
- actionCommand = createRepositoryAction(stashMenu,
- tr("Stash"), "Git.Stash",
- globalcontext, true, SLOT(stash()));
- actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository."));
+ QAction *action = createRepositoryAction(stashMenu, tr("Stash"), "Git.Stash",
+ globalcontext, true, SLOT(stash()));
+ action->setToolTip(tr("Saves the current state of your work and resets the repository."));
- actionCommand = createRepositoryAction(stashMenu,
- tr("Take Snapshot..."), "Git.StashSnapshot",
- globalcontext, true, SLOT(stashSnapshot()));
- actionCommand.first->setToolTip(tr("Saves the current state of your work."));
+ action = createRepositoryAction(stashMenu, tr("Take Snapshot..."), "Git.StashSnapshot",
+ globalcontext, true, SLOT(stashSnapshot()));
+ action->setToolTip(tr("Saves the current state of your work."));
stashMenu->addSeparator(globalcontext);
- actionCommand = createRepositoryAction(stashMenu,
- tr("Stash Pop"), "Git.StashPop",
- globalcontext, true, &GitClient::stashPop);
- actionCommand.first->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
+ action = createRepositoryAction(stashMenu, tr("Stash Pop"), "Git.StashPop",
+ globalcontext, true, &GitClient::stashPop);
+ action->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
/* \"Local Repository" menu */
@@ -547,27 +514,24 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
// --------------
/* "Remote Repository" menu */
- Core::ActionContainer *remoteRepositoryMenu = Core::ActionManager::createMenu("Git.RemoteRepositoryMenu");
+ ActionContainer *remoteRepositoryMenu = ActionManager::createMenu("Git.RemoteRepositoryMenu");
remoteRepositoryMenu->menu()->setTitle(tr("&Remote Repository"));
gitContainer->addMenu(remoteRepositoryMenu);
- createRepositoryAction(remoteRepositoryMenu,
- tr("Fetch"), "Git.Fetch",
+ createRepositoryAction(remoteRepositoryMenu, tr("Fetch"), "Git.Fetch",
globalcontext, true, SLOT(fetch()));
- createRepositoryAction(remoteRepositoryMenu,
- tr("Pull"), "Git.Pull",
+ createRepositoryAction(remoteRepositoryMenu, tr("Pull"), "Git.Pull",
globalcontext, true, SLOT(pull()));
- actionCommand = createRepositoryAction(remoteRepositoryMenu,
- tr("Push"), "Git.Push",
- globalcontext, true, SLOT(push()));
+ createRepositoryAction(remoteRepositoryMenu, tr("Push"), "Git.Push",
+ globalcontext, true, SLOT(push()));
// --------------
remoteRepositoryMenu->addSeparator(globalcontext);
// "Subversion" menu
- Core::ActionContainer *subversionMenu = Core::ActionManager::createMenu("Git.Subversion");
+ ActionContainer *subversionMenu = ActionManager::createMenu("Git.Subversion");
subversionMenu->menu()->setTitle(tr("&Subversion"));
remoteRepositoryMenu->addMenu(subversionMenu);
@@ -614,7 +578,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
// --------------
/* "Git Tools" menu */
- Core::ActionContainer *gitToolsMenu = Core::ActionManager::createMenu("Git.GitToolsMenu");
+ ActionContainer *gitToolsMenu = ActionManager::createMenu("Git.GitToolsMenu");
gitToolsMenu->menu()->setTitle(tr("Git &Tools"));
gitContainer->addMenu(gitToolsMenu);
@@ -622,15 +586,11 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
tr("Gitk"), "Git.LaunchGitK",
globalcontext, true, &GitClient::launchGitK);
- parameterActionCommand
- = createFileAction(gitToolsMenu,
- tr("Gitk Current File"), tr("Gitk of \"%1\""),
- "Git.GitkFile", globalcontext, true, SLOT(gitkForCurrentFile()));
+ createFileAction(gitToolsMenu, tr("Gitk Current File"), tr("Gitk of \"%1\""),
+ "Git.GitkFile", globalcontext, true, SLOT(gitkForCurrentFile()));
- parameterActionCommand
- = createFileAction(gitToolsMenu,
- tr("Gitk for folder of Current File"), tr("Gitk for folder of \"%1\""),
- "Git.GitkFolder", globalcontext, true, SLOT(gitkForCurrentFolder()));
+ createFileAction(gitToolsMenu, tr("Gitk for folder of Current File"), tr("Gitk for folder of \"%1\""),
+ "Git.GitkFolder", globalcontext, true, SLOT(gitkForCurrentFolder()));
// --------------
gitToolsMenu->addSeparator(globalcontext);
@@ -641,15 +601,15 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
// --------------
gitToolsMenu->addSeparator(globalcontext);
- m_repositoryBrowserAction
- = createRepositoryAction(gitToolsMenu,
- tr("Repository Browser"), "Git.LaunchRepositoryBrowser",
- globalcontext, true, &GitClient::launchRepositoryBrowser).first;
+ m_repositoryBrowserAction =
+ createRepositoryAction(gitToolsMenu,
+ tr("Repository Browser"), "Git.LaunchRepositoryBrowser",
+ globalcontext, true, &GitClient::launchRepositoryBrowser);
m_mergeToolAction =
createRepositoryAction(gitToolsMenu,
tr("Merge Tool"), "Git.MergeTool",
- globalcontext, true, SLOT(startMergeTool())).first;
+ globalcontext, true, SLOT(startMergeTool()));
/* \"Git Tools" menu */
@@ -660,32 +620,32 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
globalcontext, false, SLOT(startChangeRelatedAction()));
QAction *repositoryAction = new QAction(tr("Create Repository..."), this);
- Core::Command *createRepositoryCommand = Core::ActionManager::registerAction(repositoryAction, "Git.CreateRepository", globalcontext);
+ Core::Command *createRepositoryCommand = ActionManager::registerAction(repositoryAction, "Git.CreateRepository", globalcontext);
connect(repositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
gitContainer->addAction(createRepositoryCommand);
// Submit editor
- Core::Context submitContext(Constants::C_GITSUBMITEDITOR);
- m_submitCurrentAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- Core::Command *command = Core::ActionManager::registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext);
+ Context submitContext(Constants::C_GITSUBMITEDITOR);
+ m_submitCurrentAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
+ Core::Command *command = ActionManager::registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_submitCurrentAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
- m_diffSelectedFilesAction = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- command = Core::ActionManager::registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext);
+ m_diffSelectedFilesAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
+ command = ActionManager::registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext);
m_undoAction = new QAction(tr("&Undo"), this);
- command = Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, submitContext);
+ command = ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, submitContext);
m_redoAction = new QAction(tr("&Redo"), this);
- command = Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, submitContext);
+ command = ActionManager::registerAction(m_redoAction, Core::Constants::REDO, submitContext);
- connect(Core::VcsManager::instance(), SIGNAL(repositoryChanged(QString)),
+ connect(VcsManager::instance(), SIGNAL(repositoryChanged(QString)),
this, SLOT(updateContinueAndAbortCommands()));
- connect(Core::VcsManager::instance(), SIGNAL(repositoryChanged(QString)),
+ connect(VcsManager::instance(), SIGNAL(repositoryChanged(QString)),
this, SLOT(updateBranches(QString)), Qt::QueuedConnection);
- if (!Core::MimeDatabase::addMimeTypes(QLatin1String(RC_GIT_MIME_XML), errorMessage))
+ if (!MimeDatabase::addMimeTypes(QLatin1String(RC_GIT_MIME_XML), errorMessage))
return false;
/* "Gerrit" */
@@ -714,14 +674,14 @@ void GitPlugin::submitEditorMerge(const QStringList &unmerged)
void GitPlugin::diffCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_gitClient->diff(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void GitPlugin::diffCurrentProject()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
const QString relativeProject = state.relativeCurrentProject();
m_gitClient->diff(state.currentProjectTopLevel(),
@@ -730,60 +690,60 @@ void GitPlugin::diffCurrentProject()
void GitPlugin::diffRepository()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->diff(state.topLevel(), QStringList());
}
void GitPlugin::logFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_gitClient->log(state.currentFileTopLevel(), state.relativeCurrentFile(), true);
}
void GitPlugin::blameFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
- const int lineNumber = VcsBase::VcsBaseEditorWidget::lineNumberOfCurrentEditor(state.currentFile());
+ const int lineNumber = VcsBaseEditorWidget::lineNumberOfCurrentEditor(state.currentFile());
m_gitClient->blame(state.currentFileTopLevel(), QStringList(), state.relativeCurrentFile(), QString(), lineNumber);
}
void GitPlugin::logProject()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
m_gitClient->log(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
void GitPlugin::logRepository()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->log(state.topLevel());
}
void GitPlugin::reflogRepository()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->reflog(state.topLevel());
}
void GitPlugin::undoFileChanges(bool revertStaging)
{
- if (!Core::DocumentManager::saveAllModifiedDocuments())
+ if (!DocumentManager::saveAllModifiedDocuments())
return;
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
- Core::FileChangeBlocker fcb(state.currentFile());
+ FileChangeBlocker fcb(state.currentFile());
m_gitClient->revert(QStringList(state.currentFile()), revertStaging);
}
void GitPlugin::undoUnstagedFileChanges()
{
- if (!Core::DocumentManager::saveAllModifiedDocuments())
+ if (!DocumentManager::saveAllModifiedDocuments())
return;
undoFileChanges(false);
}
@@ -817,13 +777,13 @@ protected:
void GitPlugin::resetRepository()
{
- if (!Core::DocumentManager::saveAllModifiedDocuments())
+ if (!DocumentManager::saveAllModifiedDocuments())
return;
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QString topLevel = state.topLevel();
- LogChangeDialog dialog(true, Core::ICore::mainWindow());
+ LogChangeDialog dialog(true, ICore::mainWindow());
ResetItemDelegate delegate(dialog.widget());
dialog.setWindowTitle(tr("Undo Changes to %1").arg(QDir::toNativeSeparators(topLevel)));
if (dialog.runDialog(topLevel, QString(), LogChangeWidget::IncludeRemotes))
@@ -832,14 +792,14 @@ void GitPlugin::resetRepository()
void GitPlugin::startRebase()
{
- if (!Core::DocumentManager::saveAllModifiedDocuments())
+ if (!DocumentManager::saveAllModifiedDocuments())
return;
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
const QString topLevel = state.topLevel();
if (topLevel.isEmpty() || !m_gitClient->canRebase(topLevel))
return;
- LogChangeDialog dialog(false, Core::ICore::mainWindow());
+ LogChangeDialog dialog(false, ICore::mainWindow());
RebaseItemDelegate delegate(dialog.widget());
dialog.setWindowTitle(tr("Interactive Rebase"));
if (!dialog.runDialog(topLevel))
@@ -850,13 +810,13 @@ void GitPlugin::startRebase()
void GitPlugin::startChangeRelatedAction()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
if (!state.hasTopLevel())
return;
QAction *action = qobject_cast<QAction *>(sender());
- Core::Id id = action ? Core::Id::fromUniqueIdentifier(action->data().toInt()) : Core::Id();
- ChangeSelectionDialog dialog(state.topLevel(), id, Core::ICore::mainWindow());
+ Id id = action ? Id::fromUniqueIdentifier(action->data().toInt()) : Id();
+ ChangeSelectionDialog dialog(state.topLevel(), id, ICore::mainWindow());
int result = dialog.exec();
@@ -874,7 +834,7 @@ void GitPlugin::startChangeRelatedAction()
return;
}
- if (!Core::DocumentManager::saveAllModifiedDocuments())
+ if (!DocumentManager::saveAllModifiedDocuments())
return;
switch (dialog.command()) {
@@ -894,28 +854,28 @@ void GitPlugin::startChangeRelatedAction()
void GitPlugin::stageFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_gitClient->addFile(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void GitPlugin::unstageFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_gitClient->synchronousReset(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void GitPlugin::gitkForCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_gitClient->launchGitK(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void GitPlugin::gitkForCurrentFolder()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
/*
@@ -945,7 +905,7 @@ void GitPlugin::gitkForCurrentFolder()
void GitPlugin::gitGui()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->launchGitGui(state.topLevel());
}
@@ -970,17 +930,17 @@ void GitPlugin::startCommit(CommitType commitType)
if (raiseSubmitEditor())
return;
if (isCommitEditorOpen()) {
- VcsBase::VcsBaseOutputWindow::instance()->appendWarning(tr("Another submit is currently being executed."));
+ VcsBaseOutputWindow::instance()->appendWarning(tr("Another submit is currently being executed."));
return;
}
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QString errorMessage, commitTemplate;
CommitData data(commitType);
if (!m_gitClient->getCommitData(state.topLevel(), &commitTemplate, data, &errorMessage)) {
- VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
+ VcsBaseOutputWindow::instance()->appendError(errorMessage);
return;
}
@@ -989,12 +949,12 @@ void GitPlugin::startCommit(CommitType commitType)
m_submitRepository = data.panelInfo.repository;
// Start new temp file with message template
- Utils::TempFileSaver saver;
+ TempFileSaver saver;
// Keep the file alive, else it removes self and forgets its name
saver.setAutoRemove(false);
saver.write(commitTemplate.toLocal8Bit());
if (!saver.finalize()) {
- VcsBase::VcsBaseOutputWindow::instance()->appendError(saver.errorString());
+ VcsBaseOutputWindow::instance()->appendError(saver.errorString());
return;
}
m_commitMessageFileName = saver.fileName();
@@ -1006,22 +966,22 @@ void GitPlugin::updateVersionWarning()
unsigned version = m_gitClient->gitVersion();
if (!version || version >= minimumRequiredVersion)
return;
- Core::IDocument *curDocument = Core::EditorManager::currentDocument();
+ IDocument *curDocument = EditorManager::currentDocument();
if (!curDocument)
return;
- Core::InfoBar *infoBar = curDocument->infoBar();
- Core::Id gitVersionWarning("GitVersionWarning");
+ InfoBar *infoBar = curDocument->infoBar();
+ Id gitVersionWarning("GitVersionWarning");
if (!infoBar->canInfoBeAdded(gitVersionWarning))
return;
- infoBar->addInfo(Core::InfoBarEntry(gitVersionWarning,
+ infoBar->addInfo(InfoBarEntry(gitVersionWarning,
tr("Unsupported version of Git found. Git %1 or later required.")
.arg(versionString(minimumRequiredVersion)),
- Core::InfoBarEntry::GlobalSuppressionEnabled));
+ InfoBarEntry::GlobalSuppressionEnabled));
}
-Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd)
+IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd)
{
- Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::GITSUBMITEDITOR_ID);
+ IEditor *editor = EditorManager::openEditor(fileName, Constants::GITSUBMITEDITOR_ID);
GitSubmitEditor *submitEditor = qobject_cast<GitSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return 0);
setSubmitEditor(submitEditor);
@@ -1041,7 +1001,7 @@ Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const Commit
default:
title = tr("Git Commit");
}
- Core::IDocument *document = submitEditor->document();
+ IDocument *document = submitEditor->document();
document->setDisplayName(title);
VcsBasePlugin::setSource(document, m_submitRepository);
connect(submitEditor, SIGNAL(diff(QStringList,QStringList)), this, SLOT(submitEditorDiff(QStringList,QStringList)));
@@ -1054,7 +1014,7 @@ void GitPlugin::submitCurrentLog()
{
// Close the submit editor
m_submitActionTriggered = true;
- Core::EditorManager::closeEditor();
+ EditorManager::closeEditor();
}
bool GitPlugin::submitEditorAboutToClose()
@@ -1063,7 +1023,7 @@ bool GitPlugin::submitEditorAboutToClose()
return true;
GitSubmitEditor *editor = qobject_cast<GitSubmitEditor *>(submitEditor());
QTC_ASSERT(editor, return true);
- Core::IDocument *editorDocument = editor->document();
+ IDocument *editorDocument = editor->document();
QTC_ASSERT(editorDocument, return true);
// Submit editor closing. Make it write out the commit message
// and retrieve files
@@ -1075,16 +1035,16 @@ bool GitPlugin::submitEditorAboutToClose()
// Prompt user. Force a prompt unless submit was actually invoked (that
// is, the editor was closed or shutdown).
bool promptData = false;
- const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult answer
+ const VcsBaseSubmitEditor::PromptSubmitResult answer
= editor->promptSubmit(tr("Closing Git Editor"),
tr("Do you want to commit the change?"),
tr("Git will not accept this commit. Do you want to continue to edit it?"),
&promptData, !m_submitActionTriggered, false);
m_submitActionTriggered = false;
switch (answer) {
- case VcsBase::VcsBaseSubmitEditor::SubmitCanceled:
+ case VcsBaseSubmitEditor::SubmitCanceled:
return false; // Keep editing and change file
- case VcsBase::VcsBaseSubmitEditor::SubmitDiscarded:
+ case VcsBaseSubmitEditor::SubmitDiscarded:
cleanCommitMessageFile();
return true; // Cancel all
default:
@@ -1093,13 +1053,13 @@ bool GitPlugin::submitEditorAboutToClose()
// Go ahead!
- VcsBase::SubmitFileModel *model = qobject_cast<VcsBase::SubmitFileModel *>(editor->fileModel());
+ SubmitFileModel *model = qobject_cast<SubmitFileModel *>(editor->fileModel());
bool closeEditor = true;
CommitType commitType = editor->commitType();
QString amendSHA1 = editor->amendSHA1();
if (model->hasCheckedFiles() || !amendSHA1.isEmpty()) {
// get message & commit
- if (!Core::DocumentManager::saveDocument(editorDocument))
+ if (!DocumentManager::saveDocument(editorDocument))
return false;
closeEditor = m_gitClient->addAndCommit(m_submitRepository, editor->panelData(),
@@ -1133,9 +1093,9 @@ void GitPlugin::fetch()
void GitPlugin::pull()
{
- if (!Core::DocumentManager::saveAllModifiedDocuments())
+ if (!DocumentManager::saveAllModifiedDocuments())
return;
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QString topLevel = state.topLevel();
bool rebase = m_settings.boolValue(GitSettings::pullRebaseKey);
@@ -1156,23 +1116,23 @@ void GitPlugin::pull()
void GitPlugin::push()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->push(state.topLevel());
}
void GitPlugin::startMergeTool()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->merge(state.topLevel());
}
void GitPlugin::continueOrAbortCommand()
{
- if (!Core::DocumentManager::saveAllModifiedDocuments())
+ if (!DocumentManager::saveAllModifiedDocuments())
return;
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QObject *action = QObject::sender();
@@ -1194,39 +1154,16 @@ void GitPlugin::continueOrAbortCommand()
updateContinueAndAbortCommands();
}
-// Retrieve member function of git client stored as user data of action
-static inline GitClientMemberFunc memberFunctionFromAction(const QObject *o)
-{
- if (o) {
- if (const QAction *action = qobject_cast<const QAction *>(o)) {
- const QVariant v = action->data();
- if (v.canConvert<GitClientMemberFunc>())
- return qvariant_cast<GitClientMemberFunc>(v);
- }
- }
- return 0;
-}
-
-void GitPlugin::gitClientMemberFuncRepositoryAction()
-{
- const VcsBase::VcsBasePluginState state = currentState();
- QTC_ASSERT(state.hasTopLevel(), return);
- // Retrieve member function and invoke on repository
- GitClientMemberFunc func = memberFunctionFromAction(sender());
- QTC_ASSERT(func, return);
- (m_gitClient->*func)(state.topLevel());
-}
-
void GitPlugin::cleanProject()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
cleanRepository(state.currentProjectPath());
}
void GitPlugin::cleanRepository()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
cleanRepository(state.topLevel());
}
@@ -1241,7 +1178,7 @@ void GitPlugin::cleanRepository(const QString &directory)
const bool gotFiles = m_gitClient->synchronousCleanList(directory, &files, &ignoredFiles, &errorMessage);
QApplication::restoreOverrideCursor();
- QWidget *parent = Core::ICore::mainWindow();
+ QWidget *parent = ICore::mainWindow();
if (!gotFiles) {
QMessageBox::warning(parent, tr("Unable to retrieve file list"), errorMessage);
return;
@@ -1253,14 +1190,14 @@ void GitPlugin::cleanRepository(const QString &directory)
}
// Show in dialog
- VcsBase::CleanDialog dialog(parent);
+ CleanDialog dialog(parent);
dialog.setFileList(directory, files, ignoredFiles);
dialog.exec();
}
void GitPlugin::updateSubmodules()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->updateSubmodulesIfNeeded(state.topLevel(), false);
}
@@ -1268,13 +1205,12 @@ void GitPlugin::updateSubmodules()
// If the file is modified in an editor, make sure it is saved.
static bool ensureFileSaved(const QString &fileName)
{
- Core::IDocument *document = Core::DocumentModel::documentForFilePath(fileName);
- return Core::DocumentManager::saveModifiedDocument(document);
+ return DocumentManager::saveModifiedDocument(DocumentModel::documentForFilePath(fileName));
}
void GitPlugin::applyCurrentFilePatch()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasPatchFile() && state.hasTopLevel(), return);
const QString patchFile = state.currentPatchFile();
if (!ensureFileSaved(patchFile))
@@ -1284,7 +1220,7 @@ void GitPlugin::applyCurrentFilePatch()
void GitPlugin::promptApplyPatch()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
applyPatch(state.topLevel(), QString());
}
@@ -1297,16 +1233,14 @@ void GitPlugin::applyPatch(const QString &workingDirectory, QString file)
// Prompt for file
if (file.isEmpty()) {
const QString filter = tr("Patches (*.patch *.diff)");
- file = QFileDialog::getOpenFileName(Core::ICore::mainWindow(),
- tr("Choose Patch"),
- QString(), filter);
+ file = QFileDialog::getOpenFileName(ICore::mainWindow(), tr("Choose Patch"), QString(), filter);
if (file.isEmpty()) {
m_gitClient->endStashScope(workingDirectory);
return;
}
}
// Run!
- VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
+ VcsBaseOutputWindow *outwin = VcsBaseOutputWindow::instance();
QString errorMessage;
if (m_gitClient->synchronousApplyPatch(workingDirectory, file, &errorMessage)) {
if (errorMessage.isEmpty())
@@ -1321,10 +1255,10 @@ void GitPlugin::applyPatch(const QString &workingDirectory, QString file)
void GitPlugin::stash()
{
- if (!Core::DocumentManager::saveAllModifiedDocuments())
+ if (!DocumentManager::saveAllModifiedDocuments())
return;
// Simple stash without prompt, reset repo.
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QString topLevel = state.topLevel();
@@ -1337,7 +1271,7 @@ void GitPlugin::stash()
void GitPlugin::stashSnapshot()
{
// Prompt for description, restore immediately and keep on working.
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
const QString id = m_gitClient->synchronousStash(state.topLevel(), QString(),
GitClient::StashImmediateRestore | GitClient::StashPromptDescription);
@@ -1354,7 +1288,7 @@ template <class NonModalDialog>
dialog->show();
dialog->raise();
} else {
- dialog = new NonModalDialog(Core::ICore::mainWindow());
+ dialog = new NonModalDialog(ICore::mainWindow());
dialog->refresh(topLevel, true);
dialog->show();
}
@@ -1375,7 +1309,7 @@ void GitPlugin::stashList()
showNonModalDialog(currentState().topLevel(), m_stashDialog);
}
-void GitPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
+void GitPlugin::updateActions(VcsBasePlugin::ActionState as)
{
const bool repositoryEnabled = currentState().hasTopLevel();
if (m_stashDialog)
@@ -1393,12 +1327,12 @@ void GitPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
// Note: This menu is visible if there is no repository. Only
// 'Create Repository'/'Show' actions should be available.
const QString fileName = currentState().currentFileName();
- foreach (Utils::ParameterAction *fileAction, m_fileActions)
+ foreach (ParameterAction *fileAction, m_fileActions)
fileAction->setParameter(fileName);
// If the current file looks like a patch, offer to apply
m_applyCurrentFilePatchAction->setParameter(currentState().currentPatchFileDisplayName());
const QString projectName = currentState().currentProjectName();
- foreach (Utils::ParameterAction *projectAction, m_projectActions)
+ foreach (ParameterAction *projectAction, m_projectActions)
projectAction->setParameter(projectName);
foreach (QAction *repositoryAction, m_repositoryActions)
@@ -1489,12 +1423,6 @@ Gerrit::Internal::GerritPlugin *GitPlugin::gerritPlugin() const
#ifdef WITH_TESTS
-#include "clonewizardpage.h"
-
-#include <QTest>
-
-Q_DECLARE_METATYPE(FileStates)
-
void GitPlugin::testStatusParsing_data()
{
QTest::addColumn<FileStates>("first");
@@ -1575,7 +1503,7 @@ void GitPlugin::testDiffFileResolving_data()
void GitPlugin::testDiffFileResolving()
{
- GitEditor editor(editorParameters + 3, 0);
+ GitEditorWidget editor(editorParameters + 3, 0);
editor.testDiffFileResolving();
}
@@ -1601,7 +1529,7 @@ void GitPlugin::testLogResolving()
" \n"
" Signed-off-by: Junio C Hamano <gitster@pobox.com>\n"
);
- GitEditor editor(editorParameters + 1, 0);
+ GitEditorWidget editor(editorParameters + 1, 0);
editor.testLogResolving(data,
"50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn",
"3587b513 - Update draft release notes to 1.8.2");
@@ -1629,4 +1557,7 @@ void GitPlugin::testCloneWizard_directoryFromRepository_data()
}
#endif
+} // namespace Internal
+} // namespace Git
+
Q_EXPORT_PLUGIN(GitPlugin)
diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h
index dda50d4835..3f15e15051 100644
--- a/src/plugins/git/gitplugin.h
+++ b/src/plugins/git/gitplugin.h
@@ -36,7 +36,7 @@
#include <QStringList>
#include <QPointer>
-#include <QPair>
+#include <QKeySequence>
#include <QVector>
QT_BEGIN_NAMESPACE
@@ -47,11 +47,9 @@ QT_END_NAMESPACE
namespace Core {
class IEditor;
-class IEditorFactory;
class Command;
class CommandLocator;
class Context;
-class ActionManager;
class ActionContainer;
}
namespace Utils { class ParameterAction; }
@@ -71,9 +69,6 @@ class RemoteDialog;
typedef void (GitClient::*GitClientMemberFunc)(const QString &);
-typedef QPair<QAction *, Core::Command* > ActionCommandPair;
-typedef QPair<Utils::ParameterAction *, Core::Command* > ParameterActionCommandPair;
-
class GitPlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
@@ -126,7 +121,6 @@ private slots:
void updateSubmodules();
void applyCurrentFilePatch();
void promptApplyPatch();
- void gitClientMemberFuncRepositoryAction();
void startAmendCommit();
void startFixupCommit();
@@ -157,40 +151,42 @@ protected:
bool submitEditorAboutToClose();
private:
- inline ParameterActionCommandPair
- createParameterAction(Core::ActionContainer *ac,
- const QString &defaultText, const QString &parameterText,
- Core::Id id, const Core::Context &context, bool addToLocator);
-
- inline ParameterActionCommandPair
- createFileAction(Core::ActionContainer *ac,
- const QString &defaultText, const QString &parameterText,
- Core::Id id, const Core::Context &context, bool addToLocator,
- const char *pluginSlot);
-
- inline ParameterActionCommandPair
- createProjectAction(Core::ActionContainer *ac,
- const QString &defaultText, const QString &parameterText,
- Core::Id id, const Core::Context &context, bool addToLocator);
-
- inline ParameterActionCommandPair
- createProjectAction(Core::ActionContainer *ac,
- const QString &defaultText, const QString &parameterText,
- Core::Id id, const Core::Context &context, bool addToLocator,
- const char *pluginSlot);
-
-
- inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
- const QString &text, Core::Id id,
- const Core::Context &context, bool addToLocator);
- inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
- const QString &text, Core::Id id,
- const Core::Context &context,
- bool addToLocator, const char *pluginSlot);
- inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
- const QString &text, Core::Id id,
- const Core::Context &context,
- bool addToLocator, GitClientMemberFunc);
+ Utils::ParameterAction *createParameterAction(Core::ActionContainer *ac,
+ const QString &defaultText, const QString &parameterText,
+ Core::Id id, const Core::Context &context, bool addToLocator,
+ const QKeySequence &keys = QKeySequence());
+
+ QAction *createFileAction(Core::ActionContainer *ac,
+ const QString &defaultText, const QString &parameterText,
+ Core::Id id, const Core::Context &context, bool addToLocator,
+ const char *pluginSlot,
+ const QKeySequence &keys = QKeySequence());
+
+ QAction *createProjectAction(Core::ActionContainer *ac,
+ const QString &defaultText, const QString &parameterText,
+ Core::Id id, const Core::Context &context, bool addToLocator,
+ const QKeySequence &keys = QKeySequence());
+
+ QAction *createProjectAction(Core::ActionContainer *ac,
+ const QString &defaultText, const QString &parameterText,
+ Core::Id id, const Core::Context &context, bool addToLocator,
+ const char *pluginSlot, const QKeySequence &keys = QKeySequence());
+
+
+ QAction *createRepositoryAction(Core::ActionContainer *ac,
+ const QString &text, Core::Id id,
+ const Core::Context &context, bool addToLocator,
+ const QKeySequence &keys = QKeySequence());
+ QAction *createRepositoryAction(Core::ActionContainer *ac,
+ const QString &text, Core::Id id,
+ const Core::Context &context,
+ bool addToLocator, const char *pluginSlot,
+ const QKeySequence &keys = QKeySequence());
+ QAction *createRepositoryAction(Core::ActionContainer *ac,
+ const QString &text, Core::Id id,
+ const Core::Context &context,
+ bool addToLocator, GitClientMemberFunc,
+ const QKeySequence &keys = QKeySequence());
void updateRepositoryBrowserAction();
bool isCommitEditorOpen() const;
@@ -201,7 +197,6 @@ private:
void startCommit(CommitType commitType);
void updateVersionWarning();
- static GitPlugin *m_instance;
Core::CommandLocator *m_commandLocator;
QAction *m_submitCurrentAction;
diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp
index f04eb78e66..de2909e387 100644
--- a/src/plugins/git/gitsettings.cpp
+++ b/src/plugins/git/gitsettings.cpp
@@ -70,7 +70,7 @@ GitSettings::GitSettings()
declareKey(lastResetIndexKey, 0);
}
-QString GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
+Utils::FileName GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
{
// Locate binary in path if one is specified, otherwise default
// to pathless binary
@@ -79,7 +79,7 @@ QString GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
if (errorMessage)
errorMessage->clear();
- QString binPath = binaryPath();
+ Utils::FileName binPath = binaryPath();
if (binPath.isEmpty()) {
if (ok)
*ok = false;
diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h
index 935312c33e..02171621f9 100644
--- a/src/plugins/git/gitsettings.h
+++ b/src/plugins/git/gitsettings.h
@@ -62,7 +62,7 @@ public:
static const QLatin1String graphLogKey;
static const QLatin1String lastResetIndexKey;
- QString gitExecutable(bool *ok = 0, QString *errorMessage = 0) const;
+ Utils::FileName gitExecutable(bool *ok = 0, QString *errorMessage = 0) const;
GitSettings &operator = (const GitSettings &s);
};
diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp
index aefb1a687c..2883f79fd6 100644
--- a/src/plugins/git/mergetool.cpp
+++ b/src/plugins/git/mergetool.cpp
@@ -75,7 +75,11 @@ private:
MergeTool::MergeTool(QObject *parent) :
QObject(parent),
m_process(0),
- m_gitClient(GitPlugin::instance()->gitClient())
+ m_mergeType(NormalMerge),
+ m_localState(UnknownState),
+ m_remoteState(UnknownState),
+ m_gitClient(GitPlugin::instance()->gitClient()),
+ m_merging(false)
{
}
@@ -98,9 +102,9 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
}
m_process = new MergeToolProcess(this);
m_process->setWorkingDirectory(workingDirectory);
- const QString binary = m_gitClient->gitExecutable();
+ const Utils::FileName binary = m_gitClient->gitExecutable();
VcsBase::VcsBaseOutputWindow::instance()->appendCommand(workingDirectory, binary, arguments);
- m_process->start(binary, arguments);
+ m_process->start(binary.toString(), arguments);
if (m_process->waitForStarted()) {
connect(m_process, SIGNAL(finished(int)), this, SLOT(done()));
connect(m_process, SIGNAL(readyRead()), this, SLOT(readData()));
diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp
index 66a24c06d8..c9aa3d5a11 100644
--- a/src/plugins/git/remotedialog.cpp
+++ b/src/plugins/git/remotedialog.cpp
@@ -73,8 +73,8 @@ QString RemoteAdditionDialog::remoteUrl() const
void RemoteAdditionDialog::clear()
{
- m_ui->nameEdit->setText(QString());
- m_ui->urlEdit->setText(QString());
+ m_ui->nameEdit->clear();
+ m_ui->urlEdit->clear();
}
// --------------------------------------------------------------------------
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index 68ba232dce..844adcfb02 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -33,8 +33,8 @@
#include "glsleditorplugin.h"
#include "glslhighlighter.h"
#include "glslautocompleter.h"
-#include "glslindenter.h"
#include "glslcompletionassist.h"
+#include "glslindenter.h"
#include <glsl/glsllexer.h>
#include <glsl/glslparser.h>
@@ -140,27 +140,24 @@ void Document::addRange(const QTextCursor &cursor, GLSL::Scope *scope)
_cursors.append(c);
}
-GLSLTextEditorWidget::GLSLTextEditorWidget(QWidget *parent)
- : TextEditor::BaseTextEditorWidget(parent)
+GlslEditorWidget::GlslEditorWidget(TextEditor::BaseTextDocument *doc, QWidget *parent)
+ : TextEditor::BaseTextEditorWidget(doc, parent)
{
- baseTextDocument()->setId(GLSLEditor::Constants::C_GLSLEDITOR_ID);
- baseTextDocument()->setIndenter(new GLSLIndenter());
ctor();
}
-GLSLTextEditorWidget::GLSLTextEditorWidget(GLSLTextEditorWidget *other)
+GlslEditorWidget::GlslEditorWidget(GlslEditorWidget *other)
: TextEditor::BaseTextEditorWidget(other)
{
ctor();
}
-void GLSLTextEditorWidget::ctor()
+void GlslEditorWidget::ctor()
{
m_outlineCombo = 0;
setParenthesesMatchingEnabled(true);
setMarksVisible(true);
setCodeFoldingSupported(true);
- setAutoCompleter(new GLSLCompleter());
m_updateDocumentTimer = new QTimer(this);
m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
@@ -169,7 +166,28 @@ void GLSLTextEditorWidget::ctor()
connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument()));
- new Highlighter(baseTextDocument());
+ new Highlighter(textDocument());
+
+ m_outlineCombo = new QComboBox;
+ m_outlineCombo->setMinimumContentsLength(22);
+
+ // ### m_outlineCombo->setModel(m_outlineModel);
+
+ QTreeView *treeView = new QTreeView;
+ treeView->header()->hide();
+ treeView->setItemsExpandable(false);
+ treeView->setRootIsDecorated(false);
+ m_outlineCombo->setView(treeView);
+ treeView->expandAll();
+
+ //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
+ // Make the combo box prefer to expand
+ QSizePolicy policy = m_outlineCombo->sizePolicy();
+ policy.setHorizontalPolicy(QSizePolicy::Expanding);
+ m_outlineCombo->setSizePolicy(policy);
+
+ insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, m_outlineCombo);
// if (m_modelManager) {
// m_semanticHighlighter->setModelManager(m_modelManager);
@@ -181,17 +199,13 @@ void GLSLTextEditorWidget::ctor()
// }
}
-GLSLTextEditorWidget::~GLSLTextEditorWidget()
-{
-}
-
-int GLSLTextEditorWidget::editorRevision() const
+int GlslEditorWidget::editorRevision() const
{
//return document()->revision();
return 0;
}
-bool GLSLTextEditorWidget::isOutdated() const
+bool GlslEditorWidget::isOutdated() const
{
// if (m_semanticInfo.revision() != editorRevision())
// return true;
@@ -199,27 +213,22 @@ bool GLSLTextEditorWidget::isOutdated() const
return false;
}
-Core::IEditor *GLSLEditorEditable::duplicate()
+Core::IEditor *GlslEditor::duplicate()
{
- GLSLTextEditorWidget *newEditor = new GLSLTextEditorWidget(
- qobject_cast<GLSLTextEditorWidget *>(editorWidget()));
+ GlslEditorWidget *newEditor = new GlslEditorWidget(
+ qobject_cast<GlslEditorWidget *>(editorWidget()));
TextEditor::TextEditorSettings::initializeEditor(newEditor);
return newEditor->editor();
}
-bool GLSLEditorEditable::open(QString *errorString, const QString &fileName, const QString &realFileName)
+bool GlslEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
- baseTextDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
+ textDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
bool b = TextEditor::BaseTextEditor::open(errorString, fileName, realFileName);
return b;
}
-TextEditor::CompletionAssistProvider *GLSLEditorEditable::completionAssistProvider()
-{
- return ExtensionSystem::PluginManager::getObject<GLSLCompletionAssistProvider>();
-}
-
-QString GLSLTextEditorWidget::wordUnderCursor() const
+QString GlslEditorWidget::wordUnderCursor() const
{
QTextCursor tc = textCursor();
const QChar ch = document()->characterAt(tc.position() - 1);
@@ -232,52 +241,21 @@ QString GLSLTextEditorWidget::wordUnderCursor() const
return word;
}
-TextEditor::BaseTextEditor *GLSLTextEditorWidget::createEditor()
-{
- GLSLEditorEditable *editable = new GLSLEditorEditable(this);
- createToolBar(editable);
- return editable;
-}
-
-void GLSLTextEditorWidget::createToolBar(GLSLEditorEditable *editor)
-{
- m_outlineCombo = new QComboBox;
- m_outlineCombo->setMinimumContentsLength(22);
-
- // ### m_outlineCombo->setModel(m_outlineModel);
-
- QTreeView *treeView = new QTreeView;
- treeView->header()->hide();
- treeView->setItemsExpandable(false);
- treeView->setRootIsDecorated(false);
- m_outlineCombo->setView(treeView);
- treeView->expandAll();
-
- //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
-
- // Make the combo box prefer to expand
- QSizePolicy policy = m_outlineCombo->sizePolicy();
- policy.setHorizontalPolicy(QSizePolicy::Expanding);
- m_outlineCombo->setSizePolicy(policy);
-
- editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo);
-}
-
-void GLSLTextEditorWidget::unCommentSelection()
+TextEditor::BaseTextEditor *GlslEditorWidget::createEditor()
{
- Utils::unCommentSelection(this);
+ return new GlslEditor(this);
}
-void GLSLTextEditorWidget::updateDocument()
+void GlslEditorWidget::updateDocument()
{
m_updateDocumentTimer->start();
}
-void GLSLTextEditorWidget::updateDocumentNow()
+void GlslEditorWidget::updateDocumentNow()
{
m_updateDocumentTimer->stop();
- int variant = languageVariant(baseTextDocument()->mimeType());
+ int variant = languageVariant(textDocument()->mimeType());
const QString contents = toPlainText(); // get the code from the editor
const QByteArray preprocessedCode = contents.toLatin1(); // ### use the QtCreator C++ preprocessor.
@@ -339,7 +317,7 @@ void GLSLTextEditorWidget::updateDocumentNow()
}
}
-int GLSLTextEditorWidget::languageVariant(const QString &type)
+int GlslEditorWidget::languageVariant(const QString &type)
{
int variant = 0;
bool isVertex = false;
@@ -376,7 +354,7 @@ int GLSLTextEditorWidget::languageVariant(const QString &type)
return variant;
}
-TextEditor::IAssistInterface *GLSLTextEditorWidget::createAssistInterface(
+TextEditor::IAssistInterface *GlslEditorWidget::createAssistInterface(
TextEditor::AssistKind kind,
TextEditor::AssistReason reason) const
{
@@ -385,7 +363,7 @@ TextEditor::IAssistInterface *GLSLTextEditorWidget::createAssistInterface(
position(),
editor()->document()->filePath(),
reason,
- baseTextDocument()->mimeType(),
+ textDocument()->mimeType(),
m_glslDocument);
return BaseTextEditorWidget::createAssistInterface(kind, reason);
}
diff --git a/src/plugins/glsleditor/glsleditor.h b/src/plugins/glsleditor/glsleditor.h
index 831b6e7d04..380a7be537 100644
--- a/src/plugins/glsleditor/glsleditor.h
+++ b/src/plugins/glsleditor/glsleditor.h
@@ -49,8 +49,8 @@ class Scope;
namespace GLSLEditor {
namespace Internal {
-class GLSLEditorEditable;
-class GLSLTextEditorWidget;
+class GlslEditor;
+class GlslEditorWidget;
class Document
{
@@ -78,19 +78,16 @@ private:
GLSL::Scope *_globalScope;
QList<Range> _cursors;
- friend class GLSLTextEditorWidget;
+ friend class GlslEditorWidget;
};
-class GLSLTextEditorWidget : public TextEditor::BaseTextEditorWidget
+class GlslEditorWidget : public TextEditor::BaseTextEditorWidget
{
Q_OBJECT
public:
- GLSLTextEditorWidget(QWidget *parent = 0);
- GLSLTextEditorWidget(GLSLTextEditorWidget *other);
- ~GLSLTextEditorWidget();
-
- virtual void unCommentSelection();
+ GlslEditorWidget(TextEditor::BaseTextDocument *doc, QWidget *parent);
+ GlslEditorWidget(GlslEditorWidget *other);
int editorRevision() const;
bool isOutdated() const;
@@ -108,10 +105,9 @@ private slots:
protected:
TextEditor::BaseTextEditor *createEditor();
- void createToolBar(Internal::GLSLEditorEditable *editable);
private:
- GLSLTextEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
+ GlslEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
void ctor();
void setSelectedElements();
QString wordUnderCursor() const;
diff --git a/src/plugins/glsleditor/glsleditoreditable.cpp b/src/plugins/glsleditor/glsleditoreditable.cpp
index f1e34ec463..857af69cc8 100644
--- a/src/plugins/glsleditor/glsleditoreditable.cpp
+++ b/src/plugins/glsleditor/glsleditoreditable.cpp
@@ -28,27 +28,28 @@
****************************************************************************/
#include "glsleditoreditable.h"
-#include "glsleditor.h"
#include "glsleditorconstants.h"
+#include "glslcompletionassist.h"
+#include "glslautocompleter.h"
#include <texteditor/texteditorconstants.h>
-#include <qmldesigner/qmldesignerconstants.h>
-#include <coreplugin/mimedatabase.h>
#include <coreplugin/icore.h>
-#include <coreplugin/designmode.h>
-#include <coreplugin/modemanager.h>
-#include <coreplugin/coreconstants.h>
+
+#include <extensionsystem/pluginmanager.h>
namespace GLSLEditor {
namespace Internal {
-GLSLEditorEditable::GLSLEditorEditable(GLSLTextEditorWidget *editor)
+GlslEditor::GlslEditor(GlslEditorWidget *editor)
: BaseTextEditor(editor)
{
setContext(Core::Context(GLSLEditor::Constants::C_GLSLEDITOR_ID,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
+ setCommentStyle(Utils::CommentDefinition::CppStyle);
+ setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<GLSLCompletionAssistProvider>());
+ setAutoCompleter(new GLSLCompleter);
}
} // namespace Internal
diff --git a/src/plugins/glsleditor/glsleditoreditable.h b/src/plugins/glsleditor/glsleditoreditable.h
index b54177ce74..9fdb0e87c3 100644
--- a/src/plugins/glsleditor/glsleditoreditable.h
+++ b/src/plugins/glsleditor/glsleditoreditable.h
@@ -35,18 +35,17 @@
namespace GLSLEditor {
namespace Internal {
-class GLSLTextEditorWidget;
+class GlslEditorWidget;
-class GLSLEditorEditable : public TextEditor::BaseTextEditor
+class GlslEditor : public TextEditor::BaseTextEditor
{
Q_OBJECT
public:
- explicit GLSLEditorEditable(GLSLTextEditorWidget *);
+ explicit GlslEditor(GlslEditorWidget *);
Core::IEditor *duplicate();
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
- TextEditor::CompletionAssistProvider *completionAssistProvider();
};
} // namespace Internal
diff --git a/src/plugins/glsleditor/glsleditorfactory.cpp b/src/plugins/glsleditor/glsleditorfactory.cpp
index 47283799e8..5393d1834e 100644
--- a/src/plugins/glsleditor/glsleditorfactory.cpp
+++ b/src/plugins/glsleditor/glsleditorfactory.cpp
@@ -32,6 +32,7 @@
#include "glsleditor.h"
#include "glsleditorconstants.h"
#include "glsleditorplugin.h"
+#include "glslindenter.h"
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
@@ -65,7 +66,10 @@ GLSLEditorFactory::GLSLEditorFactory(QObject *parent)
Core::IEditor *GLSLEditorFactory::createEditor()
{
- GLSLTextEditorWidget *rc = new GLSLTextEditorWidget();
+ auto doc = new TextEditor::BaseTextDocument;
+ doc->setId(C_GLSLEDITOR_ID);
+ doc->setIndenter(new GLSLIndenter);
+ GlslEditorWidget *rc = new GlslEditorWidget(doc, 0);
TextEditor::TextEditorSettings::initializeEditor(rc);
return rc->editor();
}
diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp
index a8ecc37659..8dbcf99044 100644
--- a/src/plugins/glsleditor/glsleditorplugin.cpp
+++ b/src/plugins/glsleditor/glsleditorplugin.cpp
@@ -95,7 +95,7 @@ public:
}
GLSLEditorFactory *m_editor;
- QPointer<TextEditor::ITextEditor> m_currentTextEditable;
+ QPointer<TextEditor::BaseTextEditor> m_currentTextEditable;
GLSLEditorPlugin::InitFile *m_glsl_120_frag;
GLSLEditorPlugin::InitFile *m_glsl_120_vert;
diff --git a/src/plugins/glsleditor/glsleditorplugin.h b/src/plugins/glsleditor/glsleditorplugin.h
index d4fae86c25..a29ade5670 100644
--- a/src/plugins/glsleditor/glsleditorplugin.h
+++ b/src/plugins/glsleditor/glsleditorplugin.h
@@ -36,7 +36,7 @@
namespace GLSLEditor {
namespace Internal {
-class GLSLTextEditorWidget;
+class GlslEditorWidget;
class GLSLEditorPlugin : public ExtensionSystem::IPlugin
{
diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp
index 2443e65660..e54527240d 100644
--- a/src/plugins/glsleditor/glslhighlighter.cpp
+++ b/src/plugins/glsleditor/glslhighlighter.cpp
@@ -92,7 +92,7 @@ void Highlighter::highlightBlock(const QString &text)
lex.setState(state);
lex.setScanKeywords(false);
lex.setScanComments(true);
- const int variant = GLSLTextEditorWidget::languageVariant(parent()
+ const int variant = GlslEditorWidget::languageVariant(parent()
? static_cast<BaseTextDocument*>(parent())->mimeType()
: QString());
lex.setVariant(variant);
diff --git a/src/plugins/glsleditor/glslhighlighter.h b/src/plugins/glsleditor/glslhighlighter.h
index 3e703e5898..5e85c50e1b 100644
--- a/src/plugins/glsleditor/glslhighlighter.h
+++ b/src/plugins/glsleditor/glslhighlighter.h
@@ -34,7 +34,7 @@
namespace GLSLEditor {
namespace Internal {
-class GLSLTextEditorWidget;
+class GlslEditorWidget;
class Highlighter : public TextEditor::SyntaxHighlighter
{
diff --git a/src/plugins/glsleditor/glslhoverhandler.cpp b/src/plugins/glsleditor/glslhoverhandler.cpp
index 6731568b3f..fc672467e9 100644
--- a/src/plugins/glsleditor/glslhoverhandler.cpp
+++ b/src/plugins/glsleditor/glslhoverhandler.cpp
@@ -35,7 +35,6 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/helpmanager.h>
#include <extensionsystem/pluginmanager.h>
-#include <texteditor/itexteditor.h>
#include <texteditor/basetexteditor.h>
#include <QTextCursor>
@@ -53,14 +52,14 @@ GLSLHoverHandler::~GLSLHoverHandler()
bool GLSLHoverHandler::acceptEditor(IEditor *editor)
{
- if (qobject_cast<GLSLEditorEditable *>(editor) != 0)
+ if (qobject_cast<GlslEditor *>(editor) != 0)
return true;
return false;
}
-void GLSLHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
+void GLSLHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos)
{
- if (GLSLTextEditorWidget *glslEditor = qobject_cast<GLSLTextEditorWidget *>(editor->widget())) {
+ if (GlslEditorWidget *glslEditor = qobject_cast<GlslEditorWidget *>(editor->widget())) {
if (! glslEditor->extraSelectionTooltip(pos).isEmpty())
setToolTip(glslEditor->extraSelectionTooltip(pos));
}
diff --git a/src/plugins/glsleditor/glslhoverhandler.h b/src/plugins/glsleditor/glslhoverhandler.h
index 843d2417c3..dc65a6e147 100644
--- a/src/plugins/glsleditor/glslhoverhandler.h
+++ b/src/plugins/glsleditor/glslhoverhandler.h
@@ -36,7 +36,7 @@
namespace Core { class IEditor; }
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace GLSLEditor {
namespace Internal {
@@ -50,7 +50,7 @@ public:
private:
virtual bool acceptEditor(Core::IEditor *editor);
- virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos);
+ virtual void identifyMatch(TextEditor::BaseTextEditor *editor, int pos);
virtual void decorateToolTip();
};
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index fbbfe74eaa..3203e2c69e 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -841,7 +841,7 @@ Utils::StyledBar *HelpPlugin::createWidgetToolBar()
SLOT(updateSideBarSource()));
m_closeButton = new QToolButton();
- m_closeButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_CLOSE_DOCUMENT)));
+ m_closeButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_BUTTON_CLOSE)));
m_closeButton->setToolTip(tr("Close current page"));
connect(m_closeButton, SIGNAL(clicked()), &OpenPagesManager::instance(),
SLOT(closeCurrentPage()));
diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp
index 46d9a2ceef..98f235a3ab 100644
--- a/src/plugins/help/helpwidget.cpp
+++ b/src/plugins/help/helpwidget.cpp
@@ -152,7 +152,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
}
if (style == SideBarWidget) {
- QAction *close = new QAction(QIcon(QLatin1String(Core::Constants::ICON_CLOSE_DOCUMENT)),
+ QAction *close = new QAction(QIcon(QLatin1String(Core::Constants::ICON_BUTTON_CLOSE)),
QString(), toolBar);
connect(close, SIGNAL(triggered()), this, SIGNAL(closeButtonClicked()));
layout->addWidget(toolButton(close));
diff --git a/src/plugins/help/openpageswidget.cpp b/src/plugins/help/openpageswidget.cpp
index 2a03ad710e..a73c48e1ba 100644
--- a/src/plugins/help/openpageswidget.cpp
+++ b/src/plugins/help/openpageswidget.cpp
@@ -69,7 +69,7 @@ void OpenPagesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
if (index.column() == 1 && index.model()->rowCount() > 1
&& option.state & QStyle::State_MouseOver) {
const QIcon icon(QLatin1String((option.state & QStyle::State_Selected) ?
- Core::Constants::ICON_CLOSE : Core::Constants::ICON_CLOSE_DARK));
+ Core::Constants::ICON_CLOSE_BUTTON : Core::Constants::ICON_DARK_CLOSE_BUTTON));
const QRect iconRect(option.rect.right() - option.rect.height(),
option.rect.top(), option.rect.height(), option.rect.height());
diff --git a/src/plugins/imageviewer/imageview.cpp b/src/plugins/imageviewer/imageview.cpp
index 0767a68eb3..8659344133 100644
--- a/src/plugins/imageviewer/imageview.cpp
+++ b/src/plugins/imageviewer/imageview.cpp
@@ -69,7 +69,8 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
- painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
+ const bool smoothTransform = painter->worldTransform().m11() < 1;
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, smoothTransform);
painter->drawPixmap(offset(), m_movie->currentPixmap());
}
@@ -257,6 +258,9 @@ void ImageView::doScale(qreal factor)
scale(actualFactor, actualFactor);
emitScaleFactor();
+ if (QGraphicsPixmapItem *pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(d->imageItem))
+ pixmapItem->setTransformationMode(
+ transform().m11() < 1 ? Qt::SmoothTransformation : Qt::FastTransformation);
}
void ImageView::updatePixmap(const QRect &rect)
diff --git a/src/plugins/ios/iosconfigurations.cpp b/src/plugins/ios/iosconfigurations.cpp
index 87da1bdc8a..ec08acd01d 100644
--- a/src/plugins/ios/iosconfigurations.cpp
+++ b/src/plugins/ios/iosconfigurations.cpp
@@ -170,7 +170,7 @@ void IosConfigurations::updateAutomaticKitList()
toolchain->setDisplayName(displayName);
toolchain->setPlatformCodeGenFlags(p.backendFlags);
toolchain->setPlatformLinkerFlags(p.backendFlags);
- toolchain->setCompilerCommand(p.compilerPath);
+ toolchain->resetToolChain(p.compilerPath);
if (p.architecture == QLatin1String("i386")) {
qCDebug(kitSetupLog) << "setting toolchain Abi for " << toolchain->displayName();
toolchain->setTargetAbi(Abi(Abi::X86Architecture,Abi::MacOS, Abi::GenericMacFlavor,
diff --git a/src/plugins/macros/texteditormacrohandler.cpp b/src/plugins/macros/texteditormacrohandler.cpp
index fbbf8eb87f..54b4134df1 100644
--- a/src/plugins/macros/texteditormacrohandler.cpp
+++ b/src/plugins/macros/texteditormacrohandler.cpp
@@ -31,7 +31,7 @@
#include "macroevent.h"
#include "macro.h"
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <texteditor/texteditorconstants.h>
#include <coreplugin/icore.h>
@@ -135,7 +135,7 @@ void TextEditorMacroHandler::changeEditor(Core::IEditor *editor)
if (isRecording() && m_currentEditor && m_currentEditor->widget())
m_currentEditor->widget()->removeEventFilter(this);
- m_currentEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
+ m_currentEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
if (isRecording() && m_currentEditor && m_currentEditor->widget())
m_currentEditor->widget()->installEventFilter(this);
}
diff --git a/src/plugins/macros/texteditormacrohandler.h b/src/plugins/macros/texteditormacrohandler.h
index ec37106a56..e7014fdb1a 100644
--- a/src/plugins/macros/texteditormacrohandler.h
+++ b/src/plugins/macros/texteditormacrohandler.h
@@ -34,7 +34,7 @@
namespace Core { class IEditor; }
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace Macros {
namespace Internal {
@@ -59,7 +59,7 @@ public slots:
void closeEditor(Core::IEditor *editor);
private:
- TextEditor::ITextEditor *m_currentEditor;
+ TextEditor::BaseTextEditor *m_currentEditor;
};
} // namespace Internal
diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp
index 98a3c8abb4..bd29ee0940 100644
--- a/src/plugins/mercurial/mercurialclient.cpp
+++ b/src/plugins/mercurial/mercurialclient.cpp
@@ -140,7 +140,7 @@ bool MercurialClient::synchronousPull(const QString &workingDir, const QString &
VcsBase::VcsBasePlugin::SshPasswordPrompt
| VcsBase::VcsBasePlugin::ShowStdOutInLogWindow
| VcsBase::VcsBasePlugin::ShowSuccessMessage;
- const QString binary = settings()->binaryPath();
+ const Utils::FileName binary = settings()->binaryPath();
const int timeoutSec = settings()->value(settings()->timeoutKey).toInt();
// cause mercurial doesn`t understand LANG
diff --git a/src/plugins/mercurial/mercurialcontrol.cpp b/src/plugins/mercurial/mercurialcontrol.cpp
index 0b763952ad..c5090e2229 100644
--- a/src/plugins/mercurial/mercurialcontrol.cpp
+++ b/src/plugins/mercurial/mercurialcontrol.cpp
@@ -94,10 +94,10 @@ bool MercurialControl::managesFile(const QString &workingDirectory, const QStrin
bool MercurialControl::isConfigured() const
{
- const QString binary = mercurialClient->settings()->binaryPath();
+ const Utils::FileName binary = mercurialClient->settings()->binaryPath();
if (binary.isEmpty())
return false;
- QFileInfo fi(binary);
+ QFileInfo fi = binary.toFileInfo();
return fi.exists() && fi.isFile() && fi.isExecutable();
}
diff --git a/src/plugins/perforce/perforceconstants.h b/src/plugins/perforce/perforceconstants.h
index 4d9bbef105..3735033e0c 100644
--- a/src/plugins/perforce/perforceconstants.h
+++ b/src/plugins/perforce/perforceconstants.h
@@ -35,26 +35,6 @@
namespace Perforce {
namespace Constants {
-const char PERFORCE_SUBMIT_EDITOR_ID[] = "Perforce.SubmitEditor";
-const char PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce.SubmitEditor");
-const char PERFORCESUBMITEDITOR_CONTEXT[] = "Perforce Submit Editor";
-
-const char PERFORCE_LOG_EDITOR_ID[] = "Perforce.LogEditor";
-const char PERFORCE_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Log Editor");
-const char PERFORCE_LOG_EDITOR_CONTEXT[] = "Perforce Log Editor";
-
-const char PERFORCE_DIFF_EDITOR_ID[] = "Perforce.DiffEditor";
-const char PERFORCE_DIFF_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Diff Editor");
-const char PERFORCE_DIFF_EDITOR_CONTEXT[] = "Perforce Diff Editor";
-
-const char PERFORCE_ANNOTATION_EDITOR_ID[] = "Perforce.AnnotationEditor";
-const char PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Annotation Editor");
-const char PERFORCE_ANNOTATION_EDITOR_CONTEXT[] = "Perforce Annotation Editor";
-
-const char SUBMIT_CURRENT[] = "Perforce.SubmitCurrentLog";
-const char DIFF_SELECTED[] = "Perforce.DiffSelectedFilesInLog";
-const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.p4.submit";
-
enum { debug = 0 };
} // Constants
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index 76d4f86d2f..eee131f369 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -59,43 +59,69 @@
#include <vcsbase/vcsbaseoutputwindow.h>
#include <vcsbase/vcsbaseeditorparameterwidget.h>
-#include <QtPlugin>
+#include <QAction>
#include <QDebug>
#include <QDir>
-#include <QFileInfo>
-#include <QSettings>
-#include <QTextCodec>
-
-#include <QAction>
#include <QFileDialog>
+#include <QFileInfo>
#include <QMainWindow>
#include <QMenu>
#include <QMessageBox>
+#include <QSettings>
+#include <QTextCodec>
+#include <QtPlugin>
+
+using namespace Core;
+using namespace Utils;
+using namespace VcsBase;
-static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
+namespace Perforce {
+namespace Internal {
+
+const char SUBMIT_CURRENT[] = "Perforce.SubmitCurrentLog";
+const char DIFF_SELECTED[] = "Perforce.DiffSelectedFilesInLog";
+const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.p4.submit";
+
+const char PERFORCE_SUBMIT_EDITOR_ID[] = "Perforce.SubmitEditor";
+const char PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce.SubmitEditor");
+const char PERFORCESUBMITEDITOR_CONTEXT[] = "Perforce Submit Editor";
+
+const char PERFORCE_LOG_EDITOR_ID[] = "Perforce.LogEditor";
+const char PERFORCE_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Log Editor");
+const char PERFORCE_LOG_EDITOR_CONTEXT[] = "Perforce Log Editor";
+
+const char PERFORCE_DIFF_EDITOR_ID[] = "Perforce.DiffEditor";
+const char PERFORCE_DIFF_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Diff Editor");
+const char PERFORCE_DIFF_EDITOR_CONTEXT[] = "Perforce Diff Editor";
+
+const char PERFORCE_ANNOTATION_EDITOR_ID[] = "Perforce.AnnotationEditor";
+const char PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Annotation Editor");
+const char PERFORCE_ANNOTATION_EDITOR_CONTEXT[] = "Perforce Annotation Editor";
+
+const VcsBaseEditorParameters editorParameters[] = {
{
VcsBase::LogOutput,
- Perforce::Constants::PERFORCE_LOG_EDITOR_ID,
- Perforce::Constants::PERFORCE_LOG_EDITOR_DISPLAY_NAME,
- Perforce::Constants::PERFORCE_LOG_EDITOR_CONTEXT,
+ PERFORCE_LOG_EDITOR_ID,
+ PERFORCE_LOG_EDITOR_DISPLAY_NAME,
+ PERFORCE_LOG_EDITOR_CONTEXT,
"text/vnd.qtcreator.p4.log"},
{ VcsBase::AnnotateOutput,
- Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_ID,
- Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME,
- Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_CONTEXT,
+ PERFORCE_ANNOTATION_EDITOR_ID,
+ PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME,
+ PERFORCE_ANNOTATION_EDITOR_CONTEXT,
"text/vnd.qtcreator.p4.annotation"},
{ VcsBase::DiffOutput,
- Perforce::Constants::PERFORCE_DIFF_EDITOR_ID,
- Perforce::Constants::PERFORCE_DIFF_EDITOR_DISPLAY_NAME,
- Perforce::Constants::PERFORCE_DIFF_EDITOR_CONTEXT,
+ PERFORCE_DIFF_EDITOR_ID,
+ PERFORCE_DIFF_EDITOR_DISPLAY_NAME,
+ PERFORCE_DIFF_EDITOR_CONTEXT,
"text/x-patch"}
};
// Utility to find a parameter set by type
-static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
+static inline const VcsBaseEditorParameters *findType(int ie)
{
- const VcsBase::EditorContentType et = static_cast<VcsBase::EditorContentType>(ie);
- return VcsBase::VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters), et);
+ const EditorContentType et = static_cast<EditorContentType>(ie);
+ return VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(editorParameters[0]), et);
}
static inline QString debugCodec(const QTextCodec *c)
@@ -112,7 +138,7 @@ static inline QString perforceRelativeFileArguments(const QString &args)
return args + QLatin1String("/...");
}
-static inline QStringList perforceRelativeProjectDirectory(const VcsBase::VcsBasePluginState &s)
+static inline QStringList perforceRelativeProjectDirectory(const VcsBasePluginState &s)
{
return QStringList(perforceRelativeFileArguments(s.relativeCurrentProject()));
}
@@ -125,36 +151,33 @@ static inline QProcessEnvironment overrideDiffEnvironmentVariable()
return rc;
}
-static const char CMD_ID_PERFORCE_MENU[] = "Perforce.Menu";
-static const char CMD_ID_EDIT[] = "Perforce.Edit";
-static const char CMD_ID_ADD[] = "Perforce.Add";
-static const char CMD_ID_DELETE_FILE[] = "Perforce.Delete";
-static const char CMD_ID_OPENED[] = "Perforce.Opened";
-static const char CMD_ID_PROJECTLOG[] = "Perforce.ProjectLog";
-static const char CMD_ID_REPOSITORYLOG[] = "Perforce.RepositoryLog";
-static const char CMD_ID_REVERT[] = "Perforce.Revert";
-static const char CMD_ID_DIFF_CURRENT[] = "Perforce.DiffCurrent";
-static const char CMD_ID_DIFF_PROJECT[] = "Perforce.DiffProject";
-static const char CMD_ID_UPDATE_PROJECT[] = "Perforce.UpdateProject";
-static const char CMD_ID_REVERT_PROJECT[] = "Perforce.RevertProject";
-static const char CMD_ID_REVERT_UNCHANGED_PROJECT[] = "Perforce.RevertUnchangedProject";
-static const char CMD_ID_DIFF_ALL[] = "Perforce.DiffAll";
-static const char CMD_ID_SUBMIT[] = "Perforce.Submit";
-static const char CMD_ID_PENDING_CHANGES[] = "Perforce.PendingChanges";
-static const char CMD_ID_DESCRIBE[] = "Perforce.Describe";
-static const char CMD_ID_ANNOTATE_CURRENT[] = "Perforce.AnnotateCurrent";
-static const char CMD_ID_ANNOTATE[] = "Perforce.Annotate";
-static const char CMD_ID_FILELOG_CURRENT[] = "Perforce.FilelogCurrent";
-static const char CMD_ID_FILELOG[] = "Perforce.Filelog";
-static const char CMD_ID_UPDATEALL[] = "Perforce.UpdateAll";
+const char CMD_ID_PERFORCE_MENU[] = "Perforce.Menu";
+const char CMD_ID_EDIT[] = "Perforce.Edit";
+const char CMD_ID_ADD[] = "Perforce.Add";
+const char CMD_ID_DELETE_FILE[] = "Perforce.Delete";
+const char CMD_ID_OPENED[] = "Perforce.Opened";
+const char CMD_ID_PROJECTLOG[] = "Perforce.ProjectLog";
+const char CMD_ID_REPOSITORYLOG[] = "Perforce.RepositoryLog";
+const char CMD_ID_REVERT[] = "Perforce.Revert";
+const char CMD_ID_DIFF_CURRENT[] = "Perforce.DiffCurrent";
+const char CMD_ID_DIFF_PROJECT[] = "Perforce.DiffProject";
+const char CMD_ID_UPDATE_PROJECT[] = "Perforce.UpdateProject";
+const char CMD_ID_REVERT_PROJECT[] = "Perforce.RevertProject";
+const char CMD_ID_REVERT_UNCHANGED_PROJECT[] = "Perforce.RevertUnchangedProject";
+const char CMD_ID_DIFF_ALL[] = "Perforce.DiffAll";
+const char CMD_ID_SUBMIT[] = "Perforce.Submit";
+const char CMD_ID_PENDING_CHANGES[] = "Perforce.PendingChanges";
+const char CMD_ID_DESCRIBE[] = "Perforce.Describe";
+const char CMD_ID_ANNOTATE_CURRENT[] = "Perforce.AnnotateCurrent";
+const char CMD_ID_ANNOTATE[] = "Perforce.Annotate";
+const char CMD_ID_FILELOG_CURRENT[] = "Perforce.FilelogCurrent";
+const char CMD_ID_FILELOG[] = "Perforce.Filelog";
+const char CMD_ID_UPDATEALL[] = "Perforce.UpdateAll";
////
// PerforcePlugin
////
-namespace Perforce {
-namespace Internal {
-
PerforceResponse::PerforceResponse() :
error(true),
exitCode(-1)
@@ -194,26 +217,26 @@ PerforcePlugin::PerforcePlugin() :
{
}
-static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = {
- Perforce::Constants::SUBMIT_MIMETYPE,
- Perforce::Constants::PERFORCE_SUBMIT_EDITOR_ID,
- Perforce::Constants::PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME,
- Perforce::Constants::PERFORCESUBMITEDITOR_CONTEXT,
- VcsBase::VcsBaseSubmitEditorParameters::DiffFiles
+static const VcsBaseSubmitEditorParameters submitParameters = {
+ SUBMIT_MIMETYPE,
+ PERFORCE_SUBMIT_EDITOR_ID,
+ PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME,
+ PERFORCESUBMITEDITOR_CONTEXT,
+ VcsBaseSubmitEditorParameters::DiffFiles
};
bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage)
{
- typedef VcsBase::VcsEditorFactory<PerforceEditor> PerforceEditorFactory;
- typedef VcsBase::VcsSubmitEditorFactory<PerforceSubmitEditor> PerforceSubmitEditorFactory;
+ typedef VcsEditorFactory<PerforceEditor> PerforceEditorFactory;
+ typedef VcsSubmitEditorFactory<PerforceSubmitEditor> PerforceSubmitEditorFactory;
initializeVcs(new PerforceVersionControl(this));
- if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage))
+ if (!MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage))
return false;
m_instance = this;
- m_settings.fromSettings(Core::ICore::settings());
+ m_settings.fromSettings(ICore::settings());
addAutoReleasedObject(new SettingsPage);
@@ -221,48 +244,46 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
addAutoReleasedObject(new PerforceSubmitEditorFactory(&submitParameters));
static const char *describeSlot = SLOT(describe(QString,QString));
- const int editorCount = sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters);
+ const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new PerforceEditorFactory(editorParameters + i, this, describeSlot));
const QString prefix = QLatin1String("p4");
- m_commandLocator = new Core::CommandLocator("Perforce", prefix, prefix);
+ m_commandLocator = new CommandLocator("Perforce", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
- Core::ActionContainer *mtools =
- Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
+ ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
- Core::ActionContainer *mperforce =
- Core::ActionManager::createMenu(Core::Id(CMD_ID_PERFORCE_MENU));
+ ActionContainer *mperforce = ActionManager::createMenu(CMD_ID_PERFORCE_MENU);
mperforce->menu()->setTitle(tr("&Perforce"));
mtools->addMenu(mperforce);
m_menuAction = mperforce->menu()->menuAction();
- Core::Context globalcontext(Core::Constants::C_GLOBAL);
- Core::Context perforcesubmitcontext(Constants::PERFORCESUBMITEDITOR_CONTEXT);
+ Context globalcontext(Core::Constants::C_GLOBAL);
+ Context perforcesubmitcontext(PERFORCESUBMITEDITOR_CONTEXT);
Core::Command *command;
- m_diffFileAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, globalcontext);
+ m_diffFileAction = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Diff Current File"));
connect(m_diffFileAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext);
+ m_annotateCurrentAction = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Annotate Current File"));
connect(m_annotateCurrentAction, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext);
+ m_filelogCurrentAction = new ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+F") : tr("Alt+P,Alt+F")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+F") : tr("Alt+P,Alt+F")));
command->setDescription(tr("Filelog Current File"));
connect(m_filelogCurrentAction, SIGNAL(triggered()), this, SLOT(filelogCurrentFile()));
mperforce->addAction(command);
@@ -270,36 +291,36 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
mperforce->addSeparator(globalcontext);
- m_editAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_editAction, CMD_ID_EDIT, globalcontext);
+ m_editAction = new ParameterAction(tr("Edit"), tr("Edit \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_editAction, CMD_ID_EDIT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+E") : tr("Alt+P,Alt+E")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+E") : tr("Alt+P,Alt+E")));
command->setDescription(tr("Edit File"));
connect(m_editAction, SIGNAL(triggered()), this, SLOT(openCurrentFile()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_addAction, CMD_ID_ADD, globalcontext);
+ m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_addAction, CMD_ID_ADD, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+A") : tr("Alt+P,Alt+A")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+A") : tr("Alt+P,Alt+A")));
command->setDescription(tr("Add File"));
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext);
+ m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Delete File"));
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_revertFileAction = new Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_revertFileAction, CMD_ID_REVERT, globalcontext);
+ m_revertFileAction = new ParameterAction(tr("Revert"), tr("Revert \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_revertFileAction, CMD_ID_REVERT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+R") : tr("Alt+P,Alt+R")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+R") : tr("Alt+P,Alt+R")));
command->setDescription(tr("Revert File"));
connect(m_revertFileAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
mperforce->addAction(command);
@@ -308,48 +329,48 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
mperforce->addSeparator(globalcontext);
const QString diffProjectDefaultText = tr("Diff Current Project/Session");
- m_diffProjectAction = new Utils::ParameterAction(diffProjectDefaultText, tr("Diff Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
- command = Core::ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext);
+ m_diffProjectAction = new ParameterAction(diffProjectDefaultText, tr("Diff Project \"%1\""), ParameterAction::AlwaysEnabled, this);
+ command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+D") : tr("Alt+P,Alt+D")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+D") : tr("Alt+P,Alt+D")));
command->setDescription(diffProjectDefaultText);
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffCurrentProject()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
+ m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_submitProjectAction = new Utils::ParameterAction(tr("Submit Project"), tr("Submit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_submitProjectAction, CMD_ID_SUBMIT, globalcontext);
+ m_submitProjectAction = new ParameterAction(tr("Submit Project"), tr("Submit Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_submitProjectAction, CMD_ID_SUBMIT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+S") : tr("Alt+P,Alt+S")));
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+S") : tr("Alt+P,Alt+S")));
connect(m_submitProjectAction, SIGNAL(triggered()), this, SLOT(startSubmitProject()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
const QString updateProjectDefaultText = tr("Update Current Project");
- m_updateProjectAction = new Utils::ParameterAction(updateProjectDefaultText, tr("Update Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
- command = Core::ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, globalcontext);
+ m_updateProjectAction = new ParameterAction(updateProjectDefaultText, tr("Update Project \"%1\""), ParameterAction::AlwaysEnabled, this);
+ command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, globalcontext);
command->setDescription(updateProjectDefaultText);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateCurrentProject()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_revertUnchangedAction = new Utils::ParameterAction(tr("Revert Unchanged"), tr("Revert Unchanged Files of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, globalcontext);
+ m_revertUnchangedAction = new ParameterAction(tr("Revert Unchanged"), tr("Revert Unchanged Files of Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertUnchangedAction, SIGNAL(triggered()), this, SLOT(revertUnchangedCurrentProject()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
- m_revertProjectAction = new Utils::ParameterAction(tr("Revert Project"), tr("Revert Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
- command = Core::ActionManager::registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, globalcontext);
+ m_revertProjectAction = new ParameterAction(tr("Revert Project"), tr("Revert Project \"%1\""), ParameterAction::EnabledWithParameter, this);
+ command = ActionManager::registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertProjectAction, SIGNAL(triggered()), this, SLOT(revertCurrentProject()));
mperforce->addAction(command);
@@ -358,32 +379,32 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
mperforce->addSeparator(globalcontext);
m_diffAllAction = new QAction(tr("Diff Opened Files"), this);
- command = Core::ActionManager::registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, globalcontext);
+ command = ActionManager::registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, globalcontext);
connect(m_diffAllAction, SIGNAL(triggered()), this, SLOT(diffAllOpened()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
m_openedAction = new QAction(tr("Opened"), this);
- command = Core::ActionManager::registerAction(m_openedAction, CMD_ID_OPENED, globalcontext);
- command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+O") : tr("Alt+P,Alt+O")));
+ command = ActionManager::registerAction(m_openedAction, CMD_ID_OPENED, globalcontext);
+ command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+O") : tr("Alt+P,Alt+O")));
connect(m_openedAction, SIGNAL(triggered()), this, SLOT(printOpenedFileList()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
m_logRepositoryAction = new QAction(tr("Repository Log"), this);
- command = Core::ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
+ command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
m_pendingAction = new QAction(tr("Pending Changes..."), this);
- command = Core::ActionManager::registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, globalcontext);
+ command = ActionManager::registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, globalcontext);
connect(m_pendingAction, SIGNAL(triggered()), this, SLOT(printPendingChanges()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
m_updateAllAction = new QAction(tr("Update All"), this);
- command = Core::ActionManager::registerAction(m_updateAllAction, CMD_ID_UPDATEALL, globalcontext);
+ command = ActionManager::registerAction(m_updateAllAction, CMD_ID_UPDATEALL, globalcontext);
connect(m_updateAllAction, SIGNAL(triggered()), this, SLOT(updateAll()));
mperforce->addAction(command);
m_commandLocator->appendCommand(command);
@@ -391,63 +412,63 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
mperforce->addSeparator(globalcontext);
m_describeAction = new QAction(tr("Describe..."), this);
- command = Core::ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext);
+ command = ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext);
connect(m_describeAction, SIGNAL(triggered()), this, SLOT(describeChange()));
mperforce->addAction(command);
m_annotateAction = new QAction(tr("Annotate..."), this);
- command = Core::ActionManager::registerAction(m_annotateAction, CMD_ID_ANNOTATE, globalcontext);
+ command = ActionManager::registerAction(m_annotateAction, CMD_ID_ANNOTATE, globalcontext);
connect(m_annotateAction, SIGNAL(triggered()), this, SLOT(annotate()));
mperforce->addAction(command);
m_filelogAction = new QAction(tr("Filelog..."), this);
- command = Core::ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, globalcontext);
+ command = ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, globalcontext);
connect(m_filelogAction, SIGNAL(triggered()), this, SLOT(filelog()));
mperforce->addAction(command);
- m_submitCurrentLogAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Submit"), this);
- command = Core::ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, perforcesubmitcontext);
+ m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Submit"), this);
+ command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, perforcesubmitcontext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
- m_diffSelectedFiles = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- command = Core::ActionManager::registerAction(m_diffSelectedFiles, Constants::DIFF_SELECTED, perforcesubmitcontext);
+ m_diffSelectedFiles = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
+ command = ActionManager::registerAction(m_diffSelectedFiles, DIFF_SELECTED, perforcesubmitcontext);
m_undoAction = new QAction(tr("&Undo"), this);
- command = Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, perforcesubmitcontext);
+ command = ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, perforcesubmitcontext);
m_redoAction = new QAction(tr("&Redo"), this);
- command = Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext);
+ command = ActionManager::registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext);
return true;
}
void PerforcePlugin::extensionsInitialized()
{
- VcsBase::VcsBasePlugin::extensionsInitialized();
+ VcsBasePlugin::extensionsInitialized();
getTopLevel();
}
void PerforcePlugin::openCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
vcsOpen(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void PerforcePlugin::addCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
vcsAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void PerforcePlugin::revertCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
- QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(state.currentFile());
+ QTextCodec *codec = VcsBaseEditorWidget::getCodec(state.currentFile());
QStringList args;
args << QLatin1String("diff") << QLatin1String("-sa") << state.relativeCurrentFile();
PerforceResponse result = runP4Cmd(state.currentFileTopLevel(), args,
@@ -462,13 +483,13 @@ void PerforcePlugin::revertCurrentFile()
bool doNotRevert = false;
if (!result.stdOut.isEmpty())
- doNotRevert = (QMessageBox::warning(Core::ICore::dialogParent(), tr("p4 revert"),
+ doNotRevert = (QMessageBox::warning(ICore::dialogParent(), tr("p4 revert"),
tr("The file has been changed. Do you want to revert it?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No);
if (doNotRevert)
return;
- Core::FileChangeBlocker fcb(state.currentFile());
+ FileChangeBlocker fcb(state.currentFile());
args.clear();
args << QLatin1String("revert") << state.relativeCurrentFile();
PerforceResponse result2 = runP4Cmd(state.currentFileTopLevel(), args,
@@ -479,14 +500,14 @@ void PerforcePlugin::revertCurrentFile()
void PerforcePlugin::diffCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
p4Diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void PerforcePlugin::diffCurrentProject()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
p4Diff(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state));
}
@@ -498,7 +519,7 @@ void PerforcePlugin::diffAllOpened()
void PerforcePlugin::updateCurrentProject()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
updateCheckout(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state));
}
@@ -510,11 +531,11 @@ void PerforcePlugin::updateAll()
void PerforcePlugin::revertCurrentProject()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
const QString msg = tr("Do you want to revert all changes to the project \"%1\"?").arg(state.currentProjectName());
- if (QMessageBox::warning(Core::ICore::dialogParent(), tr("p4 revert"), msg, QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
+ if (QMessageBox::warning(ICore::dialogParent(), tr("p4 revert"), msg, QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return;
revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), false);
}
@@ -522,7 +543,7 @@ void PerforcePlugin::revertCurrentProject()
void PerforcePlugin::revertUnchangedCurrentProject()
{
// revert -a.
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), true);
}
@@ -563,7 +584,7 @@ void PerforcePlugin::printOpenedFileList()
return;
// reformat "//depot/file.cpp#1 - description" into "file.cpp # - description"
// for context menu opening to work. This produces absolute paths, then.
- VcsBase::VcsBaseOutputWindow *outWin = VcsBase::VcsBaseOutputWindow::instance();
+ VcsBaseOutputWindow *outWin = VcsBaseOutputWindow::instance();
QString errorMessage;
QString mapped;
const QChar delimiter = QLatin1Char('#');
@@ -577,7 +598,7 @@ void PerforcePlugin::printOpenedFileList()
else
outWin->appendSilently(mapped + QLatin1Char(' ') + line.mid(delimiterPos));
}
- outWin->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus);
+ outWin->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
}
void PerforcePlugin::startSubmitProject()
@@ -587,11 +608,11 @@ void PerforcePlugin::startSubmitProject()
return;
if (isCommitEditorOpen()) {
- VcsBase::VcsBaseOutputWindow::instance()->appendWarning(tr("Another submit is currently executed."));
+ VcsBaseOutputWindow::instance()->appendWarning(tr("Another submit is currently executed."));
return;
}
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
// Revert all unchanged files.
@@ -608,11 +629,11 @@ void PerforcePlugin::startSubmitProject()
return;
}
- Utils::TempFileSaver saver;
+ TempFileSaver saver;
saver.setAutoRemove(false);
saver.write(result.stdOut.toLatin1());
if (!saver.finalize()) {
- VcsBase::VcsBaseOutputWindow::instance()->appendError(saver.errorString());
+ VcsBaseOutputWindow::instance()->appendError(saver.errorString());
cleanCommitMessageFile();
return;
}
@@ -635,7 +656,7 @@ void PerforcePlugin::startSubmitProject()
depotFileNames.append(line.mid(14));
}
if (depotFileNames.isEmpty()) {
- VcsBase::VcsBaseOutputWindow::instance()->appendWarning(tr("Project has no files"));
+ VcsBaseOutputWindow::instance()->appendWarning(tr("Project has no files"));
cleanCommitMessageFile();
return;
}
@@ -643,9 +664,9 @@ void PerforcePlugin::startSubmitProject()
openPerforceSubmitEditor(m_commitMessageFileName, depotFileNames);
}
-Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames)
+IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames)
{
- Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::PERFORCE_SUBMIT_EDITOR_ID);
+ IEditor *editor = EditorManager::openEditor(fileName, PERFORCE_SUBMIT_EDITOR_ID);
PerforceSubmitEditor *submitEditor = static_cast<PerforceSubmitEditor*>(editor);
setSubmitEditor(submitEditor);
submitEditor->restrictToProjectFiles(depotFileNames);
@@ -658,7 +679,7 @@ Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName,
void PerforcePlugin::printPendingChanges()
{
qApp->setOverrideCursor(Qt::WaitCursor);
- PendingChangesDialog dia(pendingChangesData(), Core::ICore::mainWindow());
+ PendingChangesDialog dia(pendingChangesData(), ICore::mainWindow());
qApp->restoreOverrideCursor();
if (dia.exec() == QDialog::Accepted) {
const int i = dia.changeNumber();
@@ -678,14 +699,14 @@ void PerforcePlugin::describeChange()
void PerforcePlugin::annotateCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void PerforcePlugin::annotate()
{
- const QString file = QFileDialog::getOpenFileName(Core::ICore::dialogParent(), tr("p4 annotate"));
+ const QString file = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("p4 annotate"));
if (!file.isEmpty()) {
const QFileInfo fi(file);
annotate(fi.absolutePath(), fi.fileName());
@@ -704,9 +725,9 @@ void PerforcePlugin::annotate(const QString &workingDir,
int lineNumber /* = -1 */)
{
const QStringList files = QStringList(fileName);
- QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(workingDir, files);
- const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDir, files, changeList);
- const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files);
+ QTextCodec *codec = VcsBaseEditorWidget::getCodec(workingDir, files);
+ const QString id = VcsBaseEditorWidget::getTitleId(workingDir, files, changeList);
+ const QString source = VcsBaseEditorWidget::getSource(workingDir, files);
QStringList args;
args << QLatin1String("annotate") << QLatin1String("-cqi");
if (changeList.isEmpty())
@@ -718,24 +739,24 @@ void PerforcePlugin::annotate(const QString &workingDir,
QStringList(), QByteArray(), codec);
if (!result.error) {
if (lineNumber < 1)
- lineNumber = VcsBase::VcsBaseEditorWidget::lineNumberOfCurrentEditor();
- Core::IEditor *ed = showOutputInEditor(tr("p4 annotate %1").arg(id),
- result.stdOut, VcsBase::AnnotateOutput,
- source, codec);
- VcsBase::VcsBaseEditorWidget::gotoLineOfEditor(ed, lineNumber);
+ lineNumber = VcsBaseEditorWidget::lineNumberOfCurrentEditor();
+ IEditor *ed = showOutputInEditor(tr("p4 annotate %1").arg(id),
+ result.stdOut, VcsBase::AnnotateOutput,
+ source, codec);
+ VcsBaseEditorWidget::gotoLineOfEditor(ed, lineNumber);
}
}
void PerforcePlugin::filelogCurrentFile()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
filelog(state.currentFileTopLevel(), state.relativeCurrentFile(), true);
}
void PerforcePlugin::filelog()
{
- const QString file = QFileDialog::getOpenFileName(Core::ICore::dialogParent(), tr("p4 filelog"));
+ const QString file = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("p4 filelog"));
if (!file.isEmpty()) {
const QFileInfo fi(file);
filelog(fi.absolutePath(), fi.fileName());
@@ -744,14 +765,14 @@ void PerforcePlugin::filelog()
void PerforcePlugin::logProject()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
filelog(state.currentProjectTopLevel(), perforceRelativeFileArguments(state.relativeCurrentProject()));
}
void PerforcePlugin::logRepository()
{
- const VcsBase::VcsBasePluginState state = currentState();
+ const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
filelog(state.topLevel(), perforceRelativeFileArguments(QString()));
}
@@ -759,8 +780,8 @@ void PerforcePlugin::logRepository()
void PerforcePlugin::filelog(const QString &workingDir, const QString &fileName,
bool enableAnnotationContextMenu)
{
- const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(workingDir, QStringList(fileName));
- QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(workingDir, QStringList(fileName));
+ const QString id = VcsBaseEditorWidget::getTitleId(workingDir, QStringList(fileName));
+ QTextCodec *codec = VcsBaseEditorWidget::getCodec(workingDir, QStringList(fileName));
QStringList args;
args << QLatin1String("filelog") << QLatin1String("-li");
if (m_settings.logCount() > 0)
@@ -771,15 +792,15 @@ void PerforcePlugin::filelog(const QString &workingDir, const QString &fileName,
CommandToWindow|StdErrToWindow|ErrorToWindow,
QStringList(), QByteArray(), codec);
if (!result.error) {
- const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, fileName);
- Core::IEditor *editor = showOutputInEditor(tr("p4 filelog %1").arg(id), result.stdOut,
+ const QString source = VcsBaseEditorWidget::getSource(workingDir, fileName);
+ IEditor *editor = showOutputInEditor(tr("p4 filelog %1").arg(id), result.stdOut,
VcsBase::LogOutput, source, codec);
if (enableAnnotationContextMenu)
- VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(editor)->setFileLogAnnotateEnabled(true);
+ VcsBaseEditorWidget::getVcsBaseEditor(editor)->setFileLogAnnotateEnabled(true);
}
}
-void PerforcePlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
+void PerforcePlugin::updateActions(VcsBasePlugin::ActionState as)
{
if (!enableMenuAction(as, m_menuAction)) {
m_commandLocator->setEnabled(false);
@@ -927,12 +948,12 @@ bool PerforcePlugin::vcsMove(const QString &workingDir, const QString &from, con
}
// Write extra args to temporary file
-QSharedPointer<Utils::TempFileSaver>
+QSharedPointer<TempFileSaver>
PerforcePlugin::createTemporaryArgumentFile(const QStringList &extraArgs,
QString *errorString)
{
if (extraArgs.isEmpty())
- return QSharedPointer<Utils::TempFileSaver>();
+ return QSharedPointer<TempFileSaver>();
// create pattern
QString pattern = m_instance->m_tempFilePattern;
if (pattern.isEmpty()) {
@@ -942,7 +963,7 @@ PerforcePlugin::createTemporaryArgumentFile(const QStringList &extraArgs,
pattern += QLatin1String("qtc_p4_XXXXXX.args");
m_instance->m_tempFilePattern = pattern;
}
- QSharedPointer<Utils::TempFileSaver> rc(new Utils::TempFileSaver(pattern));
+ QSharedPointer<TempFileSaver> rc(new TempFileSaver(pattern));
rc->setAutoRemove(true);
const int last = extraArgs.size() - 1;
for (int i = 0; i <= last; i++) {
@@ -951,7 +972,7 @@ PerforcePlugin::createTemporaryArgumentFile(const QStringList &extraArgs,
rc->write("\n", 1);
}
if (!rc->finalize(errorString))
- return QSharedPointer<Utils::TempFileSaver>();
+ return QSharedPointer<TempFileSaver>();
return rc;
}
@@ -986,9 +1007,9 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
{
QTC_ASSERT(stdInput.isEmpty(), return PerforceResponse()); // Not supported here
- VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
+ VcsBaseOutputWindow *outputWindow = VcsBaseOutputWindow::instance();
// Run, connect stderr to the output window
- Utils::SynchronousProcess process;
+ SynchronousProcess process;
const int timeOut = (flags & LongTimeOut) ? settings().longTimeOutMS() : settings().timeOutMS();
process.setTimeout(timeOut);
process.setCodec(outputCodec);
@@ -1016,7 +1037,7 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
if (Perforce::Constants::debug)
qDebug() << "PerforcePlugin::run syncp actual args [" << process.workingDirectory() << ']' << args;
process.setTimeOutMessageBoxEnabled(true);
- const Utils::SynchronousProcessResponse sp_resp = process.run(settings().p4BinaryPath(), args);
+ const SynchronousProcessResponse sp_resp = process.run(settings().p4BinaryPath(), args);
if (Perforce::Constants::debug)
qDebug() << sp_resp;
@@ -1026,20 +1047,20 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
response.stdErr = sp_resp.stdErr;
response.stdOut = sp_resp.stdOut;
switch (sp_resp.result) {
- case Utils::SynchronousProcessResponse::Finished:
+ case SynchronousProcessResponse::Finished:
response.error = false;
break;
- case Utils::SynchronousProcessResponse::FinishedError:
+ case SynchronousProcessResponse::FinishedError:
response.message = msgExitCode(sp_resp.exitCode);
response.error = !(flags & IgnoreExitCode);
break;
- case Utils::SynchronousProcessResponse::TerminatedAbnormally:
+ case SynchronousProcessResponse::TerminatedAbnormally:
response.message = msgCrash();
break;
- case Utils::SynchronousProcessResponse::StartFailed:
+ case SynchronousProcessResponse::StartFailed:
response.message = msgNotStarted(settings().p4BinaryPath());
break;
- case Utils::SynchronousProcessResponse::Hang:
+ case SynchronousProcessResponse::Hang:
response.message = msgCrash();
break;
}
@@ -1075,7 +1096,7 @@ PerforceResponse PerforcePlugin::fullySynchronousProcess(const QString &workingD
}
if (!stdInput.isEmpty()) {
if (process.write(stdInput) == -1) {
- Utils::SynchronousProcess::stopProcess(process);
+ SynchronousProcess::stopProcess(process);
response.error = true;
response.message = tr("Unable to write input data to process %1: %2").
arg(QDir::toNativeSeparators(settings().p4BinaryPath()),
@@ -1088,8 +1109,8 @@ PerforceResponse PerforcePlugin::fullySynchronousProcess(const QString &workingD
QByteArray stdOut;
QByteArray stdErr;
const int timeOut = (flags & LongTimeOut) ? settings().longTimeOutMS() : settings().timeOutMS();
- if (!Utils::SynchronousProcess::readDataFromProcess(process, timeOut, &stdOut, &stdErr, true)) {
- Utils::SynchronousProcess::stopProcess(process);
+ if (!SynchronousProcess::readDataFromProcess(process, timeOut, &stdOut, &stdErr, true)) {
+ SynchronousProcess::stopProcess(process);
response.error = true;
response.message = msgTimeout(timeOut);
return response;
@@ -1108,11 +1129,11 @@ PerforceResponse PerforcePlugin::fullySynchronousProcess(const QString &workingD
response.stdErr.remove(cr);
response.stdOut.remove(cr);
// Logging
- VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
+ VcsBaseOutputWindow *outputWindow = VcsBaseOutputWindow::instance();
if ((flags & StdErrToWindow) && !response.stdErr.isEmpty())
outputWindow->appendError(response.stdErr);
if ((flags & StdOutToWindow) && !response.stdOut.isEmpty())
- outputWindow->append(response.stdOut, VcsBase::VcsBaseOutputWindow::None, flags & SilentStdOut);
+ outputWindow->append(response.stdOut, VcsBaseOutputWindow::None, flags & SilentStdOut);
return response;
}
@@ -1126,7 +1147,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir,
if (Perforce::Constants::debug)
qDebug() << "PerforcePlugin::runP4Cmd [" << workingDir << ']' << args << extraArgs << stdInput << debugCodec(outputCodec);
- VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
+ VcsBaseOutputWindow *outputWindow = VcsBaseOutputWindow::instance();
if (!settings().isValid()) {
PerforceResponse invalidConfigResponse;
invalidConfigResponse.error = true;
@@ -1136,7 +1157,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir,
}
QStringList actualArgs = settings().commonP4Arguments(workingDir);
QString errorMessage;
- QSharedPointer<Utils::TempFileSaver> tempFile = createTemporaryArgumentFile(extraArgs, &errorMessage);
+ QSharedPointer<TempFileSaver> tempFile = createTemporaryArgumentFile(extraArgs, &errorMessage);
if (!tempFile.isNull()) {
actualArgs << QLatin1String("-x") << tempFile->fileName();
} else if (!errorMessage.isEmpty()) {
@@ -1148,7 +1169,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir,
actualArgs.append(args);
if (flags & CommandToWindow)
- outputWindow->appendCommand(workingDir, settings().p4BinaryPath(), actualArgs);
+ outputWindow->appendCommand(workingDir, FileName::fromString(settings().p4BinaryPath()), actualArgs);
if (flags & ShowBusyCursor)
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
@@ -1169,20 +1190,20 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir,
return response;
}
-Core::IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
- const QString &output,
- int editorType,
- const QString &source,
- QTextCodec *codec)
+IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
+ const QString &output,
+ int editorType,
+ const QString &source,
+ QTextCodec *codec)
{
- const VcsBase::VcsBaseEditorParameters *params = findType(editorType);
+ const VcsBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0);
- const Core::Id id = params->id;
+ const Id id = params->id;
if (Perforce::Constants::debug)
qDebug() << "PerforcePlugin::showOutputInEditor" << title << id.name()
<< "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
QString s = title;
- Core::IEditor *editor = Core::EditorManager::openEditorWithContents(id, &s, output.toUtf8());
+ IEditor *editor = EditorManager::openEditorWithContents(id, &s, output.toUtf8());
connect(editor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
this, SLOT(vcsAnnotate(QString,QString,QString,int)));
PerforceEditor *e = qobject_cast<PerforceEditor*>(editor->widget());
@@ -1191,7 +1212,7 @@ Core::IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
e->setForceReadOnly(true);
e->setSource(source);
s.replace(QLatin1Char(' '), QLatin1Char('_'));
- e->baseTextDocument()->setSuggestedFileName(s);
+ e->textDocument()->setSuggestedFileName(s);
if (codec)
e->setCodec(codec);
return editor;
@@ -1210,7 +1231,7 @@ struct PerforceDiffParameters
};
// Parameter widget controlling whitespace diff mode, associated with a parameter
-class PerforceDiffParameterWidget : public VcsBase::VcsBaseEditorParameterWidget
+class PerforceDiffParameterWidget : public VcsBaseEditorParameterWidget
{
Q_OBJECT
public:
@@ -1227,7 +1248,7 @@ private:
};
PerforceDiffParameterWidget::PerforceDiffParameterWidget(const PerforceDiffParameters &p, QWidget *parent) :
- VcsBase::VcsBaseEditorParameterWidget(parent), m_parameters(p)
+ VcsBaseEditorParameterWidget(parent), m_parameters(p)
{
setBaseArguments(p.diffArguments);
addToggleButton(QLatin1String("w"), tr("Ignore Whitespace"));
@@ -1252,11 +1273,11 @@ void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files)
void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
{
- QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(p.workingDir, p.files);
- const QString id = VcsBase::VcsBaseEditorWidget::getTitleId(p.workingDir, p.files);
+ QTextCodec *codec = VcsBaseEditorWidget::getCodec(p.workingDir, p.files);
+ const QString id = VcsBaseEditorWidget::getTitleId(p.workingDir, p.files);
// Reuse existing editors for that id
- const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, p.workingDir, p.files);
- Core::IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag);
+ const QString tag = VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, p.workingDir, p.files);
+ IEditor *existingEditor = VcsBaseEditorWidget::locateEditorByTag(tag);
// Split arguments according to size
QStringList args;
args << QLatin1String("diff");
@@ -1275,15 +1296,15 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
if (existingEditor) {
existingEditor->document()->setContents(result.stdOut.toUtf8());
- Core::EditorManager::activateEditor(existingEditor);
+ EditorManager::activateEditor(existingEditor);
return;
}
// Create new editor
- Core::IEditor *editor = showOutputInEditor(tr("p4 diff %1").arg(id), result.stdOut, VcsBase::DiffOutput,
- VcsBase::VcsBaseEditorWidget::getSource(p.workingDir, p.files),
- codec);
- VcsBase::VcsBaseEditorWidget::tagEditor(editor, tag);
- VcsBase::VcsBaseEditorWidget *diffEditorWidget = qobject_cast<VcsBase::VcsBaseEditorWidget *>(editor->widget());
+ IEditor *editor = showOutputInEditor(tr("p4 diff %1").arg(id), result.stdOut, VcsBase::DiffOutput,
+ VcsBaseEditorWidget::getSource(p.workingDir, p.files),
+ codec);
+ VcsBaseEditorWidget::tagEditor(editor, tag);
+ VcsBaseEditorWidget *diffEditorWidget = qobject_cast<VcsBaseEditorWidget *>(editor->widget());
// Wire up the parameter widget to trigger a re-run on
// parameter change and 'revert' from inside the diff editor.
PerforceDiffParameterWidget *pw = new PerforceDiffParameterWidget(p);
@@ -1296,7 +1317,7 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
void PerforcePlugin::describe(const QString & source, const QString &n)
{
- QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBase::VcsBaseEditorWidget::getCodec(source);
+ QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditorWidget::getCodec(source);
QStringList args;
args << QLatin1String("describe") << QLatin1String("-du") << n;
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
@@ -1308,7 +1329,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
void PerforcePlugin::submitCurrentLog()
{
m_submitActionTriggered = true;
- Core::EditorManager::closeEditor(Core::EditorManager::currentEditor());
+ EditorManager::closeEditor(EditorManager::currentEditor());
}
void PerforcePlugin::cleanCommitMessageFile()
@@ -1331,36 +1352,36 @@ bool PerforcePlugin::submitEditorAboutToClose()
return true;
PerforceSubmitEditor *perforceEditor = qobject_cast<PerforceSubmitEditor *>(submitEditor());
QTC_ASSERT(perforceEditor, return true);
- Core::IDocument *editorDocument = perforceEditor->document();
+ IDocument *editorDocument = perforceEditor->document();
QTC_ASSERT(editorDocument, return true);
// Prompt the user. Force a prompt unless submit was actually invoked (that
// is, the editor was closed or shutdown).
bool wantsPrompt = m_settings.promptToSubmit();
- const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult answer =
+ const VcsBaseSubmitEditor::PromptSubmitResult answer =
perforceEditor->promptSubmit(tr("Closing p4 Editor"),
tr("Do you want to submit this change list?"),
tr("The commit message check failed. Do you want to submit this change list?"),
&wantsPrompt, !m_submitActionTriggered);
m_submitActionTriggered = false;
- if (answer == VcsBase::VcsBaseSubmitEditor::SubmitCanceled)
+ if (answer == VcsBaseSubmitEditor::SubmitCanceled)
return false;
// Set without triggering the checking mechanism
if (wantsPrompt != m_settings.promptToSubmit()) {
m_settings.setPromptToSubmit(wantsPrompt);
- m_settings.toSettings(Core::ICore::settings());
+ m_settings.toSettings(ICore::settings());
}
- if (!Core::DocumentManager::saveDocument(editorDocument))
+ if (!DocumentManager::saveDocument(editorDocument))
return false;
- if (answer == VcsBase::VcsBaseSubmitEditor::SubmitDiscarded) {
+ if (answer == VcsBaseSubmitEditor::SubmitDiscarded) {
cleanCommitMessageFile();
return true;
}
// Pipe file into p4 submit -i
- Utils::FileReader reader;
+ FileReader reader;
if (!reader.fetch(m_commitMessageFileName, QIODevice::Text)) {
- VcsBase::VcsBaseOutputWindow::instance()->appendError(reader.errorString());
+ VcsBaseOutputWindow::instance()->appendError(reader.errorString());
return false;
}
@@ -1370,10 +1391,10 @@ bool PerforcePlugin::submitEditorAboutToClose()
LongTimeOut|RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow|ShowBusyCursor,
QStringList(), reader.data());
if (submitResponse.error) {
- VcsBase::VcsBaseOutputWindow::instance()->appendError(tr("p4 submit failed: %1").arg(submitResponse.message));
+ VcsBaseOutputWindow::instance()->appendError(tr("p4 submit failed: %1").arg(submitResponse.message));
return false;
}
- VcsBase::VcsBaseOutputWindow::instance()->append(submitResponse.stdOut);
+ VcsBaseOutputWindow::instance()->append(submitResponse.stdOut);
if (submitResponse.stdOut.contains(QLatin1String("Out of date files must be resolved or reverted)")))
QMessageBox::warning(perforceEditor->widget(), tr("Pending change"), tr("Could not submit the change, because your workspace was out of date. Created a pending submit instead."));
@@ -1437,7 +1458,7 @@ void PerforcePlugin::setSettings(const Settings &newSettings)
if (newSettings != m_instance->m_settings.settings()) {
m_instance->m_settings.setSettings(newSettings);
m_instance->m_managedDirectoryCache.clear();
- m_instance->m_settings.toSettings(Core::ICore::settings());
+ m_instance->m_settings.toSettings(ICore::settings());
getTopLevel();
perforceVersionControl()->emitConfigurationChanged();
}
@@ -1499,14 +1520,14 @@ void PerforcePlugin::slotTopLevelFound(const QString &t)
m_settings.setTopLevel(t);
const QString msg = tr("Perforce repository: %1").
arg(QDir::toNativeSeparators(t));
- VcsBase::VcsBaseOutputWindow::instance()->appendSilently(msg);
+ VcsBaseOutputWindow::instance()->appendSilently(msg);
if (Perforce::Constants::debug)
qDebug() << "P4: " << t;
}
void PerforcePlugin::slotTopLevelFailed(const QString &errorMessage)
{
- VcsBase::VcsBaseOutputWindow::instance()->appendSilently(tr("Perforce: Unable to determine the repository: %1").arg(errorMessage));
+ VcsBaseOutputWindow::instance()->appendSilently(tr("Perforce: Unable to determine the repository: %1").arg(errorMessage));
if (Perforce::Constants::debug)
qDebug() << errorMessage;
}
diff --git a/src/plugins/perforce/perforcesettings.cpp b/src/plugins/perforce/perforcesettings.cpp
index 9a9f301795..98ac16feff 100644
--- a/src/plugins/perforce/perforcesettings.cpp
+++ b/src/plugins/perforce/perforcesettings.cpp
@@ -109,7 +109,8 @@ void PerforceSettings::fromSettings(QSettings *settings)
{
settings->beginGroup(QLatin1String(groupC));
m_settings.p4Command = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
- m_settings.p4BinaryPath = Utils::Environment::systemEnvironment().searchInPath(m_settings.p4Command);
+ m_settings.p4BinaryPath =
+ Utils::Environment::systemEnvironment().searchInPath(m_settings.p4Command).toString();
m_settings.defaultEnv = settings->value(QLatin1String(defaultKeyC), true).toBool();
m_settings.p4Port = settings->value(QLatin1String(portKeyC), QString()).toString();
m_settings.p4Client = settings->value(QLatin1String(clientKeyC), QString()).toString();
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 38173f736a..b38bbe7645 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -48,7 +48,8 @@ SUBDIRS = \
clearcase \
baremetal \
ios \
- beautifier
+ beautifier \
+ qmakeandroidsupport
minQtVersion(5, 0, 0) {
SUBDIRS += winrt
diff --git a/src/plugins/plugins.qbs b/src/plugins/plugins.qbs
index 6bb73380df..b323d9c827 100644
--- a/src/plugins/plugins.qbs
+++ b/src/plugins/plugins.qbs
@@ -41,6 +41,7 @@ Project {
"perforce/perforce.qbs",
"projectexplorer/projectexplorer.qbs",
"qbsprojectmanager/qbsprojectmanager.qbs",
+ "qmakeandroidsupport",
"pythoneditor/pythoneditor.qbs",
// "qmldesigner/qmldesigner.qbs",
"qmljseditor/qmljseditor.qbs",
diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
index 3964f8f8e0..ed2ce6b874 100644
--- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
+++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
@@ -185,17 +185,17 @@ QString AbstractMsvcToolChain::makeCommand(const Utils::Environment &environment
bool useJom = ProjectExplorerPlugin::projectExplorerSettings().useJom;
const QString jom = QLatin1String("jom.exe");
const QString nmake = QLatin1String("nmake.exe");
- QString tmp;
+ Utils::FileName tmp;
if (useJom) {
tmp = environment.searchInPath(jom, QStringList()
<< QCoreApplication::applicationDirPath());
if (!tmp.isEmpty())
- return tmp;
+ return tmp.toString();
}
tmp = environment.searchInPath(nmake);
if (!tmp.isEmpty())
- return tmp;
+ return tmp.toString();
// Nothing found :(
return useJom ? jom : nmake;
@@ -205,7 +205,7 @@ Utils::FileName AbstractMsvcToolChain::compilerCommand() const
{
Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env);
- return Utils::FileName::fromString(env.searchInPath(QLatin1String("cl.exe")));
+ return env.searchInPath(QLatin1String("cl.exe"));
}
IOutputParser *AbstractMsvcToolChain::outputParser() const
@@ -273,14 +273,14 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env,
// if Creator is launched within a session set up by setenv.cmd.
env.unset(QLatin1String("ORIGINALPATH"));
run.setEnvironment(env);
- QString cmdPath = QString::fromLocal8Bit(qgetenv("COMSPEC"));
+ Utils::FileName cmdPath = Utils::FileName::fromUserInput(QString::fromLocal8Bit(qgetenv("COMSPEC")));
if (cmdPath.isEmpty())
cmdPath = env.searchInPath(QLatin1String("cmd.exe"));
// Windows SDK setup scripts require command line switches for environment expansion.
QString cmdArguments = QLatin1String(" /E:ON /V:ON /c \"");
cmdArguments += QDir::toNativeSeparators(saver.fileName());
cmdArguments += QLatin1Char('"');
- run.setCommand(cmdPath, cmdArguments);
+ run.setCommand(cmdPath.toString(), cmdArguments);
if (debug)
qDebug() << "readEnvironmentSetting: " << call << cmdPath << cmdArguments
<< " Env: " << env.size();
diff --git a/src/plugins/projectexplorer/allprojectsfind.cpp b/src/plugins/projectexplorer/allprojectsfind.cpp
index f3483e6719..7762783303 100644
--- a/src/plugins/projectexplorer/allprojectsfind.cpp
+++ b/src/plugins/projectexplorer/allprojectsfind.cpp
@@ -34,7 +34,7 @@
#include "projectexplorer.h"
#include "editorconfiguration.h"
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <utils/filesearch.h>
#include <utils/algorithm.h>
@@ -83,8 +83,7 @@ Utils::FileIterator *AllProjectsFind::filesForProjects(const QStringList &nameFi
foreach (const QString &filter, nameFilters) {
filterRegs << QRegExp(filter, Qt::CaseInsensitive, QRegExp::Wildcard);
}
- QMap<QString, QTextCodec *> openEditorEncodings
- = TextEditor::ITextEditorDocument::openedTextDocumentEncodings();
+ QMap<QString, QTextCodec *> openEditorEncodings = BaseTextDocument::openedTextDocumentEncodings();
QMap<QString, QTextCodec *> encodings;
foreach (const Project *project, projects) {
QStringList projectFiles = project->files(Project::AllFiles);
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index 9c4522e187..99b841b891 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -55,7 +55,8 @@ static const char BUILDDIRECTORY_KEY[] = "ProjectExplorer.BuildConfiguration.Bui
namespace ProjectExplorer {
namespace Internal {
-class BuildConfigMacroExpander : public Utils::AbstractQtcMacroExpander {
+class BuildConfigMacroExpander : public Utils::AbstractMacroExpander
+{
public:
explicit BuildConfigMacroExpander(const BuildConfiguration *bc) : m_bc(bc) {}
virtual bool resolveMacro(const QString &name, QString *ret);
@@ -155,17 +156,12 @@ Utils::AbstractMacroExpander *BuildConfiguration::macroExpander()
QList<Core::Id> BuildConfiguration::knownStepLists() const
{
- return Utils::transform(m_stepLists, [](BuildStepList *list) {
- return list->id();
- });
+ return Utils::transform(m_stepLists, &BuildStepList::id);
}
BuildStepList *BuildConfiguration::stepList(Core::Id id) const
{
- foreach (BuildStepList *list, m_stepLists)
- if (id == list->id())
- return list;
- return 0;
+ return Utils::findOrDefault(m_stepLists, Utils::equal(&BuildStepList::id, id));
}
QVariantMap BuildConfiguration::toMap() const
diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h
index 94894bb230..5cb9aec5ce 100644
--- a/src/plugins/projectexplorer/buildconfiguration.h
+++ b/src/plugins/projectexplorer/buildconfiguration.h
@@ -95,6 +95,7 @@ signals:
void environmentChanged();
void buildDirectoryChanged();
void enabledChanged();
+ void buildTypeChanged();
protected:
BuildConfiguration(Target *target, Core::Id id);
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
index 976f748240..eba28dacb7 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
@@ -54,45 +54,6 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
///
-// BuildSettingsPanelFactory
-///
-
-QString BuildSettingsPanelFactory::id() const
-{
- return QLatin1String(BUILDSETTINGS_PANEL_ID);
-}
-
-QString BuildSettingsPanelFactory::displayName() const
-{
- return QCoreApplication::translate("BuildSettingsPanelFactory", "Build Settings");
-}
-
-int BuildSettingsPanelFactory::priority() const
-{
- return 10;
-}
-
-bool BuildSettingsPanelFactory::supports(Target *target)
-{
- return IBuildConfigurationFactory::find(target);
-}
-
-PropertiesPanel *BuildSettingsPanelFactory::createPanel(Target *target)
-{
- PropertiesPanel *panel = new PropertiesPanel;
- QWidget *w = new QWidget();
- QVBoxLayout *l = new QVBoxLayout(w);
- QWidget *b = new BuildSettingsWidget(target);
- l->addWidget(b);
- l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
- l->setContentsMargins(QMargins());
- panel->setWidget(w);
- panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/BuildSettings.png")));
- panel->setDisplayName(QCoreApplication::translate("BuildSettingsPanel", "Build Settings"));
- return panel;
-}
-
-///
// BuildSettingsWidget
///
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h
index 35333f8a4d..d285c4a7b9 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h
@@ -30,8 +30,6 @@
#ifndef BUILDSETTINGSPROPERTIESPAGE_H
#define BUILDSETTINGSPROPERTIESPAGE_H
-#include "iprojectproperties.h"
-
#include <QWidget>
QT_BEGIN_NAMESPACE
@@ -45,26 +43,11 @@ namespace ProjectExplorer {
class BuildConfiguration;
class BuildInfo;
-class IBuildStepFactory;
class NamedWidget;
+class Target;
namespace Internal {
-const char BUILDSETTINGS_PANEL_ID[] = "ProjectExplorer.BuildSettingsPanel";
-
-class BuildSettingsPanelFactory : public ITargetPanelFactory
-{
-public:
- QString id() const;
- QString displayName() const;
- int priority() const;
-
- bool supports(Target *target);
- PropertiesPanel *createPanel(Target *target);
-};
-
-class BuildConfigurationsWidget;
-
class BuildSettingsWidget : public QWidget
{
Q_OBJECT
diff --git a/src/plugins/projectexplorer/buildsteplist.cpp b/src/plugins/projectexplorer/buildsteplist.cpp
index 3b48de0c75..e900602164 100644
--- a/src/plugins/projectexplorer/buildsteplist.cpp
+++ b/src/plugins/projectexplorer/buildsteplist.cpp
@@ -37,6 +37,7 @@
#include "target.h"
#include <extensionsystem/pluginmanager.h>
+#include <utils/algorithm.h>
using namespace ProjectExplorer;
@@ -121,11 +122,9 @@ bool BuildStepList::isEmpty() const
bool BuildStepList::contains(Core::Id id) const
{
- foreach (BuildStep *bs, steps()) {
- if (bs->id() == id)
- return true;
- }
- return false;
+ return Utils::anyOf(steps(), [id](BuildStep *bs){
+ return bs->id() == id;
+ });
}
void BuildStepList::cloneSteps(BuildStepList *source)
diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp
index e013a54dbd..b243d87435 100644
--- a/src/plugins/projectexplorer/buildstepspage.cpp
+++ b/src/plugins/projectexplorer/buildstepspage.cpp
@@ -34,6 +34,7 @@
#include "projectexplorerconstants.h"
#include <coreplugin/icore.h>
+#include <coreplugin/coreconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <utils/detailswidget.h>
@@ -102,7 +103,7 @@ ToolWidget::ToolWidget(QWidget *parent)
m_removeButton->setAutoRaise(true);
m_removeButton->setToolTip(BuildStepListWidget::tr("Remove Item"));
m_removeButton->setFixedSize(buttonSize);
- m_removeButton->setIcon(QIcon(QLatin1String(":/core/images/darkclose.png")));
+ m_removeButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_DARK_CLOSE)));
hbox->addWidget(m_removeButton);
layout->addWidget(m_secondWidget);
@@ -285,12 +286,6 @@ void BuildStepListWidget::init(BuildStepList *bsl)
m_addButton->setText(tr("Add %1 Step").arg(m_buildStepList->displayName()));
updateBuildStepButtonsState();
-
- static QLatin1String buttonStyle(
- "QToolButton{ border-width: 2;}"
- "QToolButton:hover{border-image: url(:/welcome/images/btn_26_hover.png) 4;}"
- "QToolButton:pressed{ border-image: url(:/welcome/images/btn_26_pressed.png) 4;}");
- setStyleSheet(buttonStyle);
}
void BuildStepListWidget::updateAddBuildStepMenu()
diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
index fede40f9ea..10c90f7950 100644
--- a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
@@ -38,36 +38,6 @@ using namespace TextEditor;
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
-QString CodeStyleSettingsPanelFactory::id() const
-{
- return QLatin1String(CODESTYLESETTINGS_PANEL_ID);
-}
-
-QString CodeStyleSettingsPanelFactory::displayName() const
-{
- return QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style");
-}
-
-int CodeStyleSettingsPanelFactory::priority() const
-{
- return 40;
-}
-
-bool CodeStyleSettingsPanelFactory::supports(Project *project)
-{
- Q_UNUSED(project);
- return true;
-}
-
-PropertiesPanel *CodeStyleSettingsPanelFactory::createPanel(Project *project)
-{
- PropertiesPanel *panel = new PropertiesPanel;
- panel->setWidget(new CodeStyleSettingsWidget(project));
- panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/CodeStyleSettings.png")));
- panel->setDisplayName(QCoreApplication::translate("CodeStyleSettingsPanel", "Code Style"));
- return panel;
-}
-
CodeStyleSettingsWidget::CodeStyleSettingsWidget(Project *project) : QWidget(), m_project(project)
{
m_ui.setupUi(this);
diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.h b/src/plugins/projectexplorer/codestylesettingspropertiespage.h
index e2cb64a1fc..7a1c881a1b 100644
--- a/src/plugins/projectexplorer/codestylesettingspropertiespage.h
+++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.h
@@ -30,29 +30,14 @@
#ifndef CODESTYLESETTINGSPROPERTIESPAGE_H
#define CODESTYLESETTINGSPROPERTIESPAGE_H
-#include "iprojectproperties.h"
#include "ui_codestylesettingspropertiespage.h"
namespace ProjectExplorer {
-
class EditorConfiguration;
+class Project;
namespace Internal {
-const char CODESTYLESETTINGS_PANEL_ID[] = "ProjectExplorer.CodeStyleSettingsPanel";
-
-class CodeStyleSettingsPanelFactory : public IProjectPanelFactory
-{
-public:
- QString id() const;
- QString displayName() const;
- int priority() const;
- PropertiesPanel *createPanel(Project *project);
- bool supports(Project *project);
-};
-
-class CodeStyleSettingsWidget;
-
class CodeStyleSettingsWidget : public QWidget
{
Q_OBJECT
diff --git a/src/plugins/projectexplorer/customtoolchain.cpp b/src/plugins/projectexplorer/customtoolchain.cpp
index 033dffa2e4..7384bf7175 100644
--- a/src/plugins/projectexplorer/customtoolchain.cpp
+++ b/src/plugins/projectexplorer/customtoolchain.cpp
@@ -38,6 +38,7 @@
#include "projectexplorerconstants.h"
#include "toolchainmanager.h"
+#include <utils/algorithm.h>
#include <utils/detailswidget.h>
#include <utils/environment.h>
#include <utils/pathchooser.h>
@@ -218,17 +219,14 @@ IOutputParser *CustomToolChain::outputParser() const
QStringList CustomToolChain::headerPathsList() const
{
- QStringList list;
- foreach (const HeaderPath &headerPath, m_systemHeaderPaths)
- list << headerPath.path();
- return list;
+ return Utils::transform(m_systemHeaderPaths, &HeaderPath::path);
}
void CustomToolChain::setHeaderPaths(const QStringList &list)
{
- m_systemHeaderPaths.clear();
- foreach (const QString &headerPath, list)
- m_systemHeaderPaths << HeaderPath(headerPath.trimmed(), HeaderPath::GlobalHeaderPath);
+ m_systemHeaderPaths = Utils::transform(list, [](const QString &headerPath) {
+ return HeaderPath(headerPath.trimmed(), HeaderPath::GlobalHeaderPath);
+ });
}
void CustomToolChain::setCompilerCommand(const FileName &path)
@@ -272,9 +270,7 @@ const QStringList &CustomToolChain::cxx11Flags() const
void CustomToolChain::setMkspecs(const QString &specs)
{
- m_mkspecs.clear();
- foreach (const QString &spec, specs.split(QLatin1Char(',')))
- m_mkspecs << FileName::fromString(spec);
+ m_mkspecs = Utils::transform(specs.split(QLatin1Char(',')), &FileName::fromString);
}
QString CustomToolChain::mkspecs() const
diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
index 9836a5893c..44287c76d5 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
@@ -32,6 +32,8 @@
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
+#include <utils/textfieldcheckbox.h>
+#include <utils/textfieldcombobox.h>
#include <QRegExp>
#include <QDebug>
@@ -51,97 +53,11 @@
enum { debug = 0 };
+using namespace Utils;
+
namespace ProjectExplorer {
namespace Internal {
-// ----------- TextFieldComboBox
-
-/*!
- \class ProjectExplorer::Internal::TextFieldComboBox
- \brief The TextFieldComboBox class is a non-editable combo box for text
- editing purposes that plays with \c QWizard::registerField (providing a
- settable 'text' property).
-
- Allows for a separation of values to be used for wizard fields replacement
- and display texts.
-
- \sa ProjectExplorer::Internal::CustomWizardFieldPage, ProjectExplorer::CustomWizard
-*/
-
-TextFieldComboBox::TextFieldComboBox(QWidget *parent) :
- QComboBox(parent)
-{
- setEditable(false);
- connect(this, SIGNAL(currentIndexChanged(int)),
- this, SLOT(slotCurrentIndexChanged(int)));
-}
-
-QString TextFieldComboBox::text() const
-{
- return valueAt(currentIndex());
-}
-
-void TextFieldComboBox::setText(const QString &s)
-{
- const int index = findData(QVariant(s), Qt::UserRole);
- if (index != -1 && index != currentIndex())
- setCurrentIndex(index);
-}
-
-void TextFieldComboBox::slotCurrentIndexChanged(int i)
-{
- emit text4Changed(valueAt(i));
-}
-
-void TextFieldComboBox::setItems(const QStringList &displayTexts,
- const QStringList &values)
-{
- QTC_ASSERT(displayTexts.size() == values.size(), return);
- clear();
- addItems(displayTexts);
- const int count = values.count();
- for (int i = 0; i < count; i++)
- setItemData(i, QVariant(values.at(i)), Qt::UserRole);
-}
-
-QString TextFieldComboBox::valueAt(int i) const
-{
- return i >= 0 && i < count() ? itemData(i, Qt::UserRole).toString() : QString();
-}
-
-/*!
- \class ProjectExplorer::Internal::TextFieldCheckBox
- \brief The TextFieldCheckBox class is a aheckbox that plays with
- \c QWizard::registerField.
-
- Provides a settable 'text' property containing predefined strings for
- \c true and \c false.
-
- \sa ProjectExplorer::Internal::CustomWizardFieldPage, ProjectExplorer::CustomWizard
-*/
-
-TextFieldCheckBox::TextFieldCheckBox(const QString &text, QWidget *parent) :
- QCheckBox(text, parent),
- m_trueText(QLatin1String("true")), m_falseText(QLatin1String("false"))
-{
- connect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
-}
-
-QString TextFieldCheckBox::text() const
-{
- return isChecked() ? m_trueText : m_falseText;
-}
-
-void TextFieldCheckBox::setText(const QString &s)
-{
- setChecked(s == m_trueText);
-}
-
-void TextFieldCheckBox::slotStateChanged(int cs)
-{
- emit textChanged(cs == Qt::Checked ? m_trueText : m_falseText);
-}
-
/*!
\class ProjectExplorer::Internal::CustomWizardFieldPage
\brief The CustomWizardFieldPage class is a simple custom wizard page
@@ -167,7 +83,7 @@ CustomWizardFieldPage::TextEditData::TextEditData(QTextEdit* le, const QString &
{
}
-CustomWizardFieldPage::PathChooserData::PathChooserData(Utils::PathChooser* pe, const QString &defText) :
+CustomWizardFieldPage::PathChooserData::PathChooserData(PathChooser* pe, const QString &defText) :
pathChooser(pe), defaultText(defText)
{
}
@@ -214,7 +130,7 @@ void CustomWizardFieldPage::showError(const QString &m)
void CustomWizardFieldPage::clearError()
{
- m_errorLabel->setText(QString());
+ m_errorLabel->clear();
m_errorLabel->setVisible(false);
}
@@ -324,20 +240,20 @@ QWidget *CustomWizardFieldPage::registerTextEdit(const QString &fieldName,
QWidget *CustomWizardFieldPage::registerPathChooser(const QString &fieldName,
const CustomWizardField &field)
{
- Utils::PathChooser *pathChooser = new Utils::PathChooser;
+ PathChooser *pathChooser = new PathChooser;
const QString expectedKind = field.controlAttributes.value(QLatin1String("expectedkind")).toLower();
if (expectedKind == QLatin1String("existingdirectory"))
- pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ pathChooser->setExpectedKind(PathChooser::ExistingDirectory);
else if (expectedKind == QLatin1String("directory"))
- pathChooser->setExpectedKind(Utils::PathChooser::Directory);
+ pathChooser->setExpectedKind(PathChooser::Directory);
else if (expectedKind == QLatin1String("file"))
- pathChooser->setExpectedKind(Utils::PathChooser::File);
+ pathChooser->setExpectedKind(PathChooser::File);
else if (expectedKind == QLatin1String("existingcommand"))
- pathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ pathChooser->setExpectedKind(PathChooser::ExistingCommand);
else if (expectedKind == QLatin1String("command"))
- pathChooser->setExpectedKind(Utils::PathChooser::Command);
+ pathChooser->setExpectedKind(PathChooser::Command);
else if (expectedKind == QLatin1String("any"))
- pathChooser->setExpectedKind(Utils::PathChooser::Any);
+ pathChooser->setExpectedKind(PathChooser::Any);
pathChooser->setHistoryCompleter(QString::fromLatin1("PE.Custom.") + m_parameters->id + QLatin1Char('.') + field.name);
registerField(fieldName, pathChooser, "path", SIGNAL(changed(QString)));
@@ -518,7 +434,7 @@ CustomWizardPage::CustomWizardPage(const QSharedPointer<CustomWizardContext> &ct
const QSharedPointer<CustomWizardParameters> &parameters,
QWidget *parent) :
CustomWizardFieldPage(ctx, parameters, parent),
- m_pathChooser(new Utils::PathChooser)
+ m_pathChooser(new PathChooser)
{
m_pathChooser->setHistoryCompleter(QLatin1String("PE.ProjectDir.History"));
addRow(tr("Path:"), m_pathChooser);
diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.h b/src/plugins/projectexplorer/customwizard/customwizardpage.h
index a48b5afee8..1c7ad4d312 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardpage.h
+++ b/src/plugins/projectexplorer/customwizard/customwizardpage.h
@@ -52,56 +52,6 @@ class CustomWizardParameters;
class CustomWizardContext;
// Documentation inside.
-class TextFieldComboBox : public QComboBox {
- Q_PROPERTY(QString text READ text WRITE setText)
- Q_OBJECT
-public:
- explicit TextFieldComboBox(QWidget *parent = 0);
-
- QString text() const;
- void setText(const QString &s);
-
- void setItems(const QStringList &displayTexts, const QStringList &values);
-
-signals:
- void text4Changed(const QString &); // Do not conflict with Qt 3 compat signal.
-
-private slots:
- void slotCurrentIndexChanged(int);
-
-private:
- inline QString valueAt(int) const;
-};
-
-// Documentation inside.
-class TextFieldCheckBox : public QCheckBox {
- Q_PROPERTY(QString text READ text WRITE setText)
- Q_PROPERTY(QString trueText READ trueText WRITE setTrueText)
- Q_PROPERTY(QString falseText READ falseText WRITE setFalseText)
- Q_OBJECT
-public:
- explicit TextFieldCheckBox(const QString &text, QWidget *parent = 0);
-
- QString text() const;
- void setText(const QString &s);
-
- void setTrueText(const QString &t) { m_trueText = t; }
- QString trueText() const { return m_trueText; }
- void setFalseText(const QString &t) { m_falseText = t; }
- QString falseText() const { return m_falseText; }
-
-signals:
- void textChanged(const QString &);
-
-private slots:
- void slotStateChanged(int);
-
-private:
- QString m_trueText;
- QString m_falseText;
-};
-
-// Documentation inside.
class CustomWizardFieldPage : public QWizardPage {
Q_OBJECT
public:
diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp
index d07807706f..5fcf24725e 100644
--- a/src/plugins/projectexplorer/dependenciespanel.cpp
+++ b/src/plugins/projectexplorer/dependenciespanel.cpp
@@ -231,39 +231,5 @@ DependenciesWidget::DependenciesWidget(Project *project, QWidget *parent)
layout->addSpacerItem(new QSpacerItem(0, 0 , QSizePolicy::Expanding, QSizePolicy::Fixed));
}
-//
-// DependenciesPanelFactory
-//
-
-QString DependenciesPanelFactory::id() const
-{
- return QLatin1String("ProjectExplorer.DependenciesPanel");
-}
-
-QString DependenciesPanelFactory::displayName() const
-{
- return QCoreApplication::translate("DependenciesPanelFactory", "Dependencies");
-}
-
-int DependenciesPanelFactory::priority() const
-{
- return 50;
-}
-
-bool DependenciesPanelFactory::supports(Project *project)
-{
- Q_UNUSED(project);
- return true;
-}
-
-PropertiesPanel *DependenciesPanelFactory::createPanel(Project *project)
-{
- PropertiesPanel *panel = new PropertiesPanel;
- panel->setWidget(new DependenciesWidget(project));
- panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/ProjectDependencies.png")));
- panel->setDisplayName(QCoreApplication::translate("DependenciesPanel", "Dependencies"));
- return panel;
-}
-
} // namespace Internal
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h
index 7dcea402c4..8c67de81cd 100644
--- a/src/plugins/projectexplorer/dependenciespanel.h
+++ b/src/plugins/projectexplorer/dependenciespanel.h
@@ -30,8 +30,6 @@
#ifndef DEPENDENCIESPANEL_H
#define DEPENDENCIESPANEL_H
-#include "iprojectproperties.h"
-
#include <QAbstractListModel>
#include <QTreeView>
@@ -44,19 +42,6 @@ class Project;
namespace Internal {
-class DependenciesPanelFactory : public IProjectPanelFactory
-{
-public:
- DependenciesPanelFactory() {}
-
- QString id() const;
- QString displayName() const;
- int priority() const;
- bool supports(Project *project);
- PropertiesPanel *createPanel(Project *project);
-};
-
-
//
// DependenciesModel
//
diff --git a/src/plugins/projectexplorer/deploymentdata.h b/src/plugins/projectexplorer/deploymentdata.h
index d70daafb1b..ae606f5682 100644
--- a/src/plugins/projectexplorer/deploymentdata.h
+++ b/src/plugins/projectexplorer/deploymentdata.h
@@ -32,6 +32,8 @@
#include "deployablefile.h"
#include "projectexplorer_export.h"
+#include <utils/algorithm.h>
+
#include <QList>
#include <QSet>
@@ -60,11 +62,9 @@ public:
DeployableFile deployableForLocalFile(const QString &localFilePath) const
{
- foreach (const DeployableFile &d, m_files) {
- if (d.localFilePath().toString() == localFilePath)
- return d;
- }
- return DeployableFile();
+ return Utils::findOrDefault(m_files, [&localFilePath](const DeployableFile &d) {
+ return d.localFilePath().toString() == localFilePath;
+ });
}
bool operator==(const DeploymentData &other) const
diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
index 3229e2dafb..01033a5415 100644
--- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
@@ -39,6 +39,7 @@
#include <utils/persistentsettings.h>
#include <utils/qtcassert.h>
#include <utils/portlist.h>
+#include <utils/algorithm.h>
#include <QFileInfo>
#include <QHash>
@@ -368,11 +369,9 @@ IDevice::Ptr DeviceManager::mutableDevice(Core::Id id) const
bool DeviceManager::hasDevice(const QString &name) const
{
- foreach (const IDevice::Ptr &device, d->devices) {
- if (device->displayName() == name)
- return true;
- }
- return false;
+ return Utils::anyOf(d->devices, [&name](const IDevice::Ptr &device) {
+ return device->displayName() == name;
+ });
}
IDevice::ConstPtr DeviceManager::find(Core::Id id) const
diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp
index aec30a2290..fbde811507 100644
--- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp
@@ -119,9 +119,7 @@ void DeviceSettingsWidget::initGui()
const QList<IDeviceFactory *> &factories
= ExtensionSystem::PluginManager::getObjects<IDeviceFactory>();
- bool hasDeviceFactories = Utils::anyOf(factories, [](IDeviceFactory *factory) {
- return factory->canCreate();
- });
+ bool hasDeviceFactories = Utils::anyOf(factories, &IDeviceFactory::canCreate);
m_ui->addConfigButton->setEnabled(hasDeviceFactories);
diff --git a/src/plugins/projectexplorer/doubletabwidget.cpp b/src/plugins/projectexplorer/doubletabwidget.cpp
index 6e3a65b4a0..51facf8e19 100644
--- a/src/plugins/projectexplorer/doubletabwidget.cpp
+++ b/src/plugins/projectexplorer/doubletabwidget.cpp
@@ -122,6 +122,25 @@ int DoubleTabWidget::currentSubIndex() const
return -1;
}
+QStringList DoubleTabWidget::subTabs(int index) const
+{
+ if (index >= 0 && index < m_tabs.size())
+ return m_tabs.at(index).subTabs;
+ return QStringList();
+}
+
+void DoubleTabWidget::setCurrentIndex(int index, int subIndex)
+{
+ Q_ASSERT(index < m_tabs.size());
+ if (index == m_currentIndex
+ && m_tabs.at(m_currentIndex).currentSubTab == subIndex)
+ return;
+ m_currentIndex = index;
+ m_tabs[m_currentIndex].currentSubTab = subIndex;
+ emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab);
+ update();
+}
+
void DoubleTabWidget::setTitle(const QString &title)
{
m_title = title;
diff --git a/src/plugins/projectexplorer/doubletabwidget.h b/src/plugins/projectexplorer/doubletabwidget.h
index 1c88b8d255..73f12161e5 100644
--- a/src/plugins/projectexplorer/doubletabwidget.h
+++ b/src/plugins/projectexplorer/doubletabwidget.h
@@ -56,9 +56,12 @@ public:
int currentIndex() const;
void setCurrentIndex(int index);
+ void setCurrentIndex(int index, int subIndex);
int currentSubIndex() const;
+ QStringList subTabs(int index) const;
+
signals:
void currentIndexChanged(int index, int subIndex);
diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp
index eea1b04b19..2358920a2c 100644
--- a/src/plugins/projectexplorer/editorconfiguration.cpp
+++ b/src/plugins/projectexplorer/editorconfiguration.cpp
@@ -246,23 +246,23 @@ void EditorConfiguration::fromMap(const QVariantMap &map)
d->m_marginSettings.fromMap(kPrefix, map);
}
-void EditorConfiguration::configureEditor(ITextEditor *textEditor) const
+void EditorConfiguration::configureEditor(BaseTextEditor *textEditor) const
{
- BaseTextEditorWidget *baseTextEditor = qobject_cast<BaseTextEditorWidget *>(textEditor->widget());
- if (baseTextEditor)
- baseTextEditor->setCodeStyle(codeStyle(baseTextEditor->languageSettingsId()));
+ BaseTextEditorWidget *widget = textEditor->editorWidget();
+ if (widget)
+ widget->setCodeStyle(codeStyle(widget->languageSettingsId()));
if (!d->m_useGlobal) {
textEditor->textDocument()->setCodec(d->m_textCodec);
- if (baseTextEditor)
- switchSettings(baseTextEditor);
+ if (widget)
+ switchSettings(widget);
}
}
-void EditorConfiguration::deconfigureEditor(ITextEditor *textEditor) const
+void EditorConfiguration::deconfigureEditor(BaseTextEditor *textEditor) const
{
- BaseTextEditorWidget *baseTextEditor = qobject_cast<BaseTextEditorWidget *>(textEditor->widget());
- if (baseTextEditor)
- baseTextEditor->setCodeStyle(TextEditorSettings::codeStyle(baseTextEditor->languageSettingsId()));
+ BaseTextEditorWidget *widget = textEditor->editorWidget();
+ if (widget)
+ widget->setCodeStyle(TextEditorSettings::codeStyle(widget->languageSettingsId()));
// TODO: what about text codec and switching settings?
}
@@ -273,56 +273,56 @@ void EditorConfiguration::setUseGlobalSettings(bool use)
d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal
? TextEditorSettings::codeStyle() : 0);
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) {
- if (BaseTextEditorWidget *baseTextEditor = qobject_cast<BaseTextEditorWidget *>(editor->widget())) {
+ if (BaseTextEditorWidget *widget = qobject_cast<BaseTextEditorWidget *>(editor->widget())) {
Project *project = SessionManager::projectForFile(editor->document()->filePath());
if (project && project->editorConfiguration() == this)
- switchSettings(baseTextEditor);
+ switchSettings(widget);
}
}
}
static void switchSettings_helper(const QObject *newSender, const QObject *oldSender,
- BaseTextEditorWidget *baseTextEditor)
+ BaseTextEditorWidget *widget)
{
QObject::disconnect(oldSender, SIGNAL(marginSettingsChanged(TextEditor::MarginSettings)),
- baseTextEditor, SLOT(setMarginSettings(TextEditor::MarginSettings)));
+ widget, SLOT(setMarginSettings(TextEditor::MarginSettings)));
QObject::disconnect(oldSender, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
- baseTextEditor, SLOT(setTypingSettings(TextEditor::TypingSettings)));
+ widget, SLOT(setTypingSettings(TextEditor::TypingSettings)));
QObject::disconnect(oldSender, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
- baseTextEditor, SLOT(setStorageSettings(TextEditor::StorageSettings)));
+ widget, SLOT(setStorageSettings(TextEditor::StorageSettings)));
QObject::disconnect(oldSender, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
- baseTextEditor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings)));
+ widget, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings)));
QObject::disconnect(oldSender, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)),
- baseTextEditor, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings)));
+ widget, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings)));
QObject::connect(newSender, SIGNAL(marginSettingsChanged(TextEditor::MarginSettings)),
- baseTextEditor, SLOT(setMarginSettings(TextEditor::MarginSettings)));
+ widget, SLOT(setMarginSettings(TextEditor::MarginSettings)));
QObject::connect(newSender, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
- baseTextEditor, SLOT(setTypingSettings(TextEditor::TypingSettings)));
+ widget, SLOT(setTypingSettings(TextEditor::TypingSettings)));
QObject::connect(newSender, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
- baseTextEditor, SLOT(setStorageSettings(TextEditor::StorageSettings)));
+ widget, SLOT(setStorageSettings(TextEditor::StorageSettings)));
QObject::connect(newSender, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
- baseTextEditor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings)));
+ widget, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings)));
QObject::connect(newSender, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)),
- baseTextEditor, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings)));
+ widget, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings)));
}
-void EditorConfiguration::switchSettings(BaseTextEditorWidget *baseTextEditor) const
+void EditorConfiguration::switchSettings(BaseTextEditorWidget *widget) const
{
if (d->m_useGlobal) {
- baseTextEditor->setMarginSettings(TextEditorSettings::marginSettings());
- baseTextEditor->setTypingSettings(TextEditorSettings::typingSettings());
- baseTextEditor->setStorageSettings(TextEditorSettings::storageSettings());
- baseTextEditor->setBehaviorSettings(TextEditorSettings::behaviorSettings());
- baseTextEditor->setExtraEncodingSettings(TextEditorSettings::extraEncodingSettings());
- switchSettings_helper(TextEditorSettings::instance(), this, baseTextEditor);
+ widget->setMarginSettings(TextEditorSettings::marginSettings());
+ widget->setTypingSettings(TextEditorSettings::typingSettings());
+ widget->setStorageSettings(TextEditorSettings::storageSettings());
+ widget->setBehaviorSettings(TextEditorSettings::behaviorSettings());
+ widget->setExtraEncodingSettings(TextEditorSettings::extraEncodingSettings());
+ switchSettings_helper(TextEditorSettings::instance(), this, widget);
} else {
- baseTextEditor->setMarginSettings(marginSettings());
- baseTextEditor->setTypingSettings(typingSettings());
- baseTextEditor->setStorageSettings(storageSettings());
- baseTextEditor->setBehaviorSettings(behaviorSettings());
- baseTextEditor->setExtraEncodingSettings(extraEncodingSettings());
- switchSettings_helper(this, TextEditorSettings::instance(), baseTextEditor);
+ widget->setMarginSettings(marginSettings());
+ widget->setTypingSettings(typingSettings());
+ widget->setStorageSettings(storageSettings());
+ widget->setBehaviorSettings(behaviorSettings());
+ widget->setExtraEncodingSettings(extraEncodingSettings());
+ switchSettings_helper(this, TextEditorSettings::instance(), widget);
}
}
@@ -385,7 +385,7 @@ void EditorConfiguration::slotAboutToRemoveProject(ProjectExplorer::Project *pro
return;
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) {
- if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor)) {
+ if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) {
Core::IDocument *document = editor->document();
if (document) {
Project *editorProject = SessionManager::projectForFile(document->filePath());
diff --git a/src/plugins/projectexplorer/editorconfiguration.h b/src/plugins/projectexplorer/editorconfiguration.h
index ef8b61c272..71e825df16 100644
--- a/src/plugins/projectexplorer/editorconfiguration.h
+++ b/src/plugins/projectexplorer/editorconfiguration.h
@@ -38,7 +38,7 @@
namespace Core { class Id; }
namespace TextEditor {
-class ITextEditor;
+class BaseTextEditor;
class BaseTextEditorWidget;
class BaseTextDocument;
class TabSettings;
@@ -80,8 +80,8 @@ public:
TextEditor::ICodeStylePreferences *codeStyle(Core::Id languageId) const;
QMap<Core::Id, TextEditor::ICodeStylePreferences *> codeStyles() const;
- void configureEditor(TextEditor::ITextEditor *textEditor) const;
- void deconfigureEditor(TextEditor::ITextEditor *textEditor) const;
+ void configureEditor(TextEditor::BaseTextEditor *textEditor) const;
+ void deconfigureEditor(TextEditor::BaseTextEditor *textEditor) const;
QVariantMap toMap() const;
void fromMap(const QVariantMap &map);
diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp
index 3382b83ab3..5bb1065ca1 100644
--- a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp
@@ -37,36 +37,6 @@
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
-QString EditorSettingsPanelFactory::id() const
-{
- return QLatin1String(EDITORSETTINGS_PANEL_ID);
-}
-
-QString EditorSettingsPanelFactory::displayName() const
-{
- return QCoreApplication::translate("EditorSettingsPanelFactory", "Editor");
-}
-
-int EditorSettingsPanelFactory::priority() const
-{
- return 30;
-}
-
-bool EditorSettingsPanelFactory::supports(Project *project)
-{
- Q_UNUSED(project);
- return true;
-}
-
-PropertiesPanel *EditorSettingsPanelFactory::createPanel(Project *project)
-{
- PropertiesPanel *panel = new PropertiesPanel;
- panel->setDisplayName(QCoreApplication::translate("EditorSettingsPanel", "Editor"));
- panel->setWidget(new EditorSettingsWidget(project)),
- panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/EditorSettings.png")));
- return panel;
-}
-
EditorSettingsWidget::EditorSettingsWidget(Project *project) : QWidget(), m_project(project)
{
m_ui.setupUi(this);
diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.h b/src/plugins/projectexplorer/editorsettingspropertiespage.h
index 4e06469c68..6a37e6a1f3 100644
--- a/src/plugins/projectexplorer/editorsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/editorsettingspropertiespage.h
@@ -30,27 +30,14 @@
#ifndef EDITORSETTINGSPROPERTIESPAGE_H
#define EDITORSETTINGSPROPERTIESPAGE_H
-#include "iprojectproperties.h"
#include "ui_editorsettingspropertiespage.h"
namespace ProjectExplorer {
-
class EditorConfiguration;
+class Project;
namespace Internal {
-const char EDITORSETTINGS_PANEL_ID[] = "ProjectExplorer.EditorSettingsPanel";
-
-class EditorSettingsPanelFactory : public IProjectPanelFactory
-{
-public:
- QString id() const;
- QString displayName() const;
- int priority() const;
- PropertiesPanel *createPanel(Project *project);
- bool supports(Project *project);
-};
-
class EditorSettingsWidget : public QWidget
{
Q_OBJECT
diff --git a/src/plugins/projectexplorer/environmentitemswidget.cpp b/src/plugins/projectexplorer/environmentitemswidget.cpp
index 9c89858984..f0f90d9462 100644
--- a/src/plugins/projectexplorer/environmentitemswidget.cpp
+++ b/src/plugins/projectexplorer/environmentitemswidget.cpp
@@ -71,7 +71,7 @@ EnvironmentItemsWidget::EnvironmentItemsWidget(QWidget *parent) :
QWidget(parent), d(new EnvironmentItemsWidgetPrivate)
{
d->m_editor = new TextEditor::SnippetEditorWidget(this);
- d->m_editor->baseTextDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
+ d->m_editor->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(d->m_editor);
}
diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp
index 07340cd8c1..a68a83b963 100644
--- a/src/plugins/projectexplorer/foldernavigationwidget.cpp
+++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp
@@ -415,30 +415,10 @@ void FolderNavigationWidget::ensureCurrentIndex()
// --------------------FolderNavigationWidgetFactory
FolderNavigationWidgetFactory::FolderNavigationWidgetFactory()
{
-}
-
-FolderNavigationWidgetFactory::~FolderNavigationWidgetFactory()
-{
-}
-
-QString FolderNavigationWidgetFactory::displayName() const
-{
- return tr("File System");
-}
-
-int FolderNavigationWidgetFactory::priority() const
-{
- return 400;
-}
-
-Core::Id FolderNavigationWidgetFactory::id() const
-{
- return "File System";
-}
-
-QKeySequence FolderNavigationWidgetFactory::activationSequence() const
-{
- return QKeySequence(Core::UseMacShortcuts ? tr("Meta+Y") : tr("Alt+Y"));
+ setDisplayName(tr("File System"));
+ setPriority(400);
+ setId("File System");
+ setActivationSequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Y") : tr("Alt+Y")));
}
Core::NavigationView FolderNavigationWidgetFactory::createWidget()
diff --git a/src/plugins/projectexplorer/foldernavigationwidget.h b/src/plugins/projectexplorer/foldernavigationwidget.h
index ee465bb75c..a417cce371 100644
--- a/src/plugins/projectexplorer/foldernavigationwidget.h
+++ b/src/plugins/projectexplorer/foldernavigationwidget.h
@@ -99,12 +99,7 @@ class FolderNavigationWidgetFactory : public Core::INavigationWidgetFactory
Q_OBJECT
public:
FolderNavigationWidgetFactory();
- ~FolderNavigationWidgetFactory();
- QString displayName() const;
- int priority() const;
- Core::Id id() const;
- QKeySequence activationSequence() const;
Core::NavigationView createWidget();
void saveSettings(int position, QWidget *widget);
void restoreSettings(int position, QWidget *widget);
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index afd6952e23..25f319392a 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -35,6 +35,7 @@
#include "projectexplorerconstants.h"
#include "toolchainmanager.h"
+#include <utils/algorithm.h>
#include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h>
@@ -258,6 +259,19 @@ GccToolChain::GccToolChain(const GccToolChain &tc) :
m_version(tc.m_version)
{ }
+void GccToolChain::setCompilerCommand(const FileName &path)
+{
+ if (path == m_compilerCommand)
+ return;
+
+ m_compilerCommand = path;
+}
+
+void GccToolChain::setSupportedAbis(const QList<Abi> &m_abis)
+{
+ m_supportedAbis = m_abis;
+}
+
void GccToolChain::setMacroCache(const QStringList &allCxxflags, const QByteArray &macros) const
{
if (macros.isNull())
@@ -596,8 +610,8 @@ QList<FileName> GccToolChain::suggestedMkspecList() const
QString GccToolChain::makeCommand(const Utils::Environment &environment) const
{
QString make = QLatin1String("make");
- QString tmp = environment.searchInPath(make);
- return tmp.isEmpty() ? make : tmp;
+ FileName tmp = environment.searchInPath(make);
+ return tmp.isEmpty() ? make : tmp.toString();
}
IOutputParser *GccToolChain::outputParser() const
@@ -605,14 +619,14 @@ IOutputParser *GccToolChain::outputParser() const
return new GccParser;
}
-void GccToolChain::setCompilerCommand(const FileName &path)
+void GccToolChain::resetToolChain(const FileName &path)
{
if (path == m_compilerCommand)
return;
bool resetDisplayName = displayName() == defaultDisplayName();
- m_compilerCommand = path;
+ setCompilerCommand(path);
Abi currentAbi = m_targetAbi;
m_supportedAbis = detectSupportedAbis();
@@ -682,9 +696,7 @@ QVariantMap GccToolChain::toMap() const
data.insert(QLatin1String(compilerPlatformCodeGenFlagsKeyC), m_platformCodeGenFlags);
data.insert(QLatin1String(compilerPlatformLinkerFlagsKeyC), m_platformLinkerFlags);
data.insert(QLatin1String(targetAbiKeyC), m_targetAbi.toString());
- QStringList abiList;
- foreach (const Abi &a, m_supportedAbis)
- abiList.append(a.toString());
+ QStringList abiList = Utils::transform(m_supportedAbis, &Abi::toString);
data.insert(QLatin1String(supportedAbisKeyC), abiList);
return data;
}
@@ -809,7 +821,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp
QList<ToolChain *> result;
Environment systemEnvironment = Environment::systemEnvironment();
- const FileName compilerPath = FileName::fromString(systemEnvironment.searchInPath(compiler));
+ const FileName compilerPath = systemEnvironment.searchInPath(compiler);
if (compilerPath.isEmpty())
return result;
@@ -831,6 +843,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp
return result;
tc->setCompilerCommand(compilerPath);
+ tc->setSupportedAbis(abiList);
tc->setTargetAbi(abi);
tc->setDisplayName(tc->defaultDisplayName()); // reset displayname
@@ -869,7 +882,6 @@ GccToolChainConfigWidget::GccToolChainConfigWidget(GccToolChain *tc) :
addErrorLabel();
setFromToolchain();
- handleCompilerCommandChange();
connect(m_compilerCommand, SIGNAL(changed(QString)), this, SLOT(handleCompilerCommandChange()));
connect(m_platformCodeGenFlagsLineEdit, SIGNAL(editingFinished()), this, SLOT(handlePlatformCodeGenFlagsChange()));
@@ -886,6 +898,7 @@ void GccToolChainConfigWidget::applyImpl()
Q_ASSERT(tc);
QString displayName = tc->displayName();
tc->setCompilerCommand(m_compilerCommand->fileName());
+ tc->setSupportedAbis(m_abiWidget->supportedAbis());
tc->setTargetAbi(m_abiWidget->currentAbi());
tc->setDisplayName(displayName); // reset display name
tc->setPlatformCodeGenFlags(splitString(m_platformCodeGenFlagsLineEdit->text()));
@@ -1023,11 +1036,11 @@ QString ClangToolChain::makeCommand(const Utils::Environment &environment) const
makes << QLatin1String("make");
}
- QString tmp;
+ FileName tmp;
foreach (const QString &make, makes) {
tmp = environment.searchInPath(make);
if (!tmp.isEmpty())
- return tmp;
+ return tmp.toString();
}
return makes.first();
}
@@ -1188,11 +1201,11 @@ QString MingwToolChain::makeCommand(const Utils::Environment &environment) const
makes << QLatin1String("make");
}
- QString tmp;
+ FileName tmp;
foreach (const QString &make, makes) {
tmp = environment.searchInPath(make);
if (!tmp.isEmpty())
- return tmp;
+ return tmp.toString();
}
return makes.first();
}
diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h
index 5d5e7f6055..57d7523e34 100644
--- a/src/plugins/projectexplorer/gcctoolchain.h
+++ b/src/plugins/projectexplorer/gcctoolchain.h
@@ -83,7 +83,7 @@ public:
bool operator ==(const ToolChain &) const;
- void setCompilerCommand(const Utils::FileName &);
+ void resetToolChain(const Utils::FileName &);
Utils::FileName compilerCommand() const;
void setPlatformCodeGenFlags(const QStringList &);
QStringList platformCodeGenFlags() const;
@@ -101,6 +101,8 @@ protected:
typedef QPair<QStringList, QByteArray> CacheItem;
+ void setCompilerCommand(const Utils::FileName &path);
+ void setSupportedAbis(const QList<Abi> &m_abis);
void setMacroCache(const QStringList &allCxxflags, const QByteArray &macroCache) const;
QByteArray macroCache(const QStringList &allCxxflags) const;
diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp
index 763f81aa9c..aa52ea586d 100644
--- a/src/plugins/projectexplorer/kit.cpp
+++ b/src/plugins/projectexplorer/kit.cpp
@@ -582,6 +582,45 @@ bool Kit::isMutable(Id id) const
return d->m_mutable.contains(id);
}
+QSet<QString> Kit::availablePlatforms() const
+{
+ QSet<QString> platforms;
+ foreach (const KitInformation *ki, KitManager::kitInformation())
+ platforms.unite(ki->availablePlatforms(this));
+ return platforms;
+}
+
+bool Kit::hasPlatform(const QString &platform) const
+{
+ if (platform.isEmpty())
+ return true;
+ return availablePlatforms().contains(platform);
+}
+
+QString Kit::displayNameForPlatform(const QString &platform) const
+{
+ foreach (const KitInformation *ki, KitManager::kitInformation()) {
+ const QString displayName = ki->displayNameForPlatform(this, platform);
+ if (!displayName.isEmpty())
+ return displayName;
+ }
+ return QString();
+
+}
+
+FeatureSet Kit::availableFeatures() const
+{
+ Core::FeatureSet features;
+ foreach (const KitInformation *ki, KitManager::kitInformation())
+ features |= ki->availableFeatures(this);
+ return features;
+}
+
+bool Kit::hasFeatures(const FeatureSet &features) const
+{
+ return availableFeatures().contains(features);
+}
+
void Kit::kitUpdated()
{
if (d->m_nestedBlockingLevel > 0 && !d->m_mustNotifyAboutDisplayName) {
diff --git a/src/plugins/projectexplorer/kit.h b/src/plugins/projectexplorer/kit.h
index 8092f445e6..7ee9609749 100644
--- a/src/plugins/projectexplorer/kit.h
+++ b/src/plugins/projectexplorer/kit.h
@@ -33,6 +33,9 @@
#include "projectexplorer_export.h"
#include "task.h"
+#include <coreplugin/featureprovider.h>
+
+#include <QSet>
#include <QVariant>
namespace Utils { class Environment; }
@@ -113,6 +116,12 @@ public:
void setMutable(Core::Id id, bool b);
bool isMutable(Core::Id id) const;
+ QSet<QString> availablePlatforms() const;
+ bool hasPlatform(const QString &platform) const;
+ QString displayNameForPlatform(const QString &platform) const;
+ Core::FeatureSet availableFeatures() const;
+ bool hasFeatures(const Core::FeatureSet &features) const;
+
private:
void setSdkProvided(bool sdkProvided);
diff --git a/src/plugins/qtsupport/qtfeatureprovider.h b/src/plugins/projectexplorer/kitfeatureprovider.h
index 818292f835..788ddedcfa 100644
--- a/src/plugins/qtsupport/qtfeatureprovider.h
+++ b/src/plugins/projectexplorer/kitfeatureprovider.h
@@ -27,26 +27,24 @@
**
****************************************************************************/
-#ifndef QTFEATUREPROVIDER_H
-#define QTFEATUREPROVIDER_H
+#ifndef KITFEATUREPROVIDER_H
+#define KITFEATUREPROVIDER_H
+#include <coreplugin/id.h>
#include <coreplugin/featureprovider.h>
-namespace QtSupport {
+namespace ProjectExplorer {
namespace Internal {
-class QtFeatureProvider : public Core::IFeatureProvider
+class KitFeatureProvider : public Core::IFeatureProvider
{
- Q_OBJECT
-
public:
- QtFeatureProvider() {}
- Core::FeatureSet availableFeatures(const QString &platformName) const;
+ Core::FeatureSet availableFeatures(const QString &platform) const;
QStringList availablePlatforms() const;
QString displayNameForPlatform(const QString &string) const;
};
} // namespace Internal
-} // namespace QtSupport
+} // namespace ProjectExplorer
-#endif // QTFEATUREPROVIDER_H
+#endif // KITFEATUREPROVIDER_H
diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp
index c2062daed9..11b3f4e435 100644
--- a/src/plugins/projectexplorer/kitinformation.cpp
+++ b/src/plugins/projectexplorer/kitinformation.cpp
@@ -39,6 +39,7 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/abi.h>
+#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
@@ -46,7 +47,7 @@
namespace ProjectExplorer {
// --------------------------------------------------------------------------
-// SysRootInformation:
+// SysRootKitInformation:
// --------------------------------------------------------------------------
SysRootKitInformation::SysRootKitInformation()
@@ -108,7 +109,7 @@ void SysRootKitInformation::setSysRoot(Kit *k, const Utils::FileName &v)
}
// --------------------------------------------------------------------------
-// ToolChainInformation:
+// ToolChainKitInformation:
// --------------------------------------------------------------------------
ToolChainKitInformation::ToolChainKitInformation()
@@ -130,12 +131,10 @@ QVariant ToolChainKitInformation::defaultValue(Kit *k) const
Abi abi = Abi::hostAbi();
- foreach (ToolChain *tc, tcList) {
- if (tc->targetAbi() == abi)
- return tc->id();
- }
+ ToolChain *tc = Utils::findOr(tcList, tcList.first(),
+ Utils::equal(&ToolChain::targetAbi, abi));
- return tcList.at(0)->id();
+ return tc->id();
}
QList<Task> ToolChainKitInformation::validate(const Kit *k) const
@@ -249,7 +248,8 @@ void ToolChainKitInformation::kitsWereLoaded()
void ToolChainKitInformation::toolChainUpdated(ToolChain *tc)
{
- foreach (Kit *k, KitManager::matchingKits(ToolChainMatcher(tc)))
+ auto matcher = KitMatcher([tc, this](const Kit *k) { return toolChain(k) == tc; });
+ foreach (Kit *k, KitManager::matchingKits(matcher))
notifyAboutUpdate(k);
}
@@ -261,7 +261,7 @@ void ToolChainKitInformation::toolChainRemoved(ToolChain *tc)
}
// --------------------------------------------------------------------------
-// DeviceTypeInformation:
+// DeviceTypeKitInformation:
// --------------------------------------------------------------------------
DeviceTypeKitInformation::DeviceTypeKitInformation()
@@ -319,8 +319,24 @@ void DeviceTypeKitInformation::setDeviceTypeId(Kit *k, Core::Id type)
k->setValue(DeviceTypeKitInformation::id(), type.toSetting());
}
+KitMatcher DeviceTypeKitInformation::deviceTypeMatcher(Core::Id type)
+{
+ return std::function<bool(const Kit *)>([type](const Kit *kit) {
+ return type.isValid() && deviceTypeId(kit) == type;
+ });
+}
+
+Core::FeatureSet DeviceTypeKitInformation::availableFeatures(const Kit *k) const
+{
+ Core::Id id = DeviceTypeKitInformation::deviceTypeId(k);
+ Core::FeatureSet result;
+ if (id.isValid())
+ result |= Core::Feature(Core::Id::fromString(QString::fromLatin1("DeviceType.") + id.toString()));
+ return result;
+}
+
// --------------------------------------------------------------------------
-// DeviceInformation:
+// DeviceKitInformation:
// --------------------------------------------------------------------------
DeviceKitInformation::DeviceKitInformation()
diff --git a/src/plugins/projectexplorer/kitinformation.h b/src/plugins/projectexplorer/kitinformation.h
index 54d978b9f3..79c09484d0 100644
--- a/src/plugins/projectexplorer/kitinformation.h
+++ b/src/plugins/projectexplorer/kitinformation.h
@@ -67,21 +67,6 @@ public:
static void setSysRoot(Kit *k, const Utils::FileName &v);
};
-class PROJECTEXPLORER_EXPORT SysRootMatcher : public KitMatcher
-{
-public:
- SysRootMatcher(const Utils::FileName &fn) : m_sysroot(fn)
- { }
-
- bool matches(const Kit *k) const
- {
- return SysRootKitInformation::sysRoot(k) == m_sysroot;
- }
-
-private:
- Utils::FileName m_sysroot;
-};
-
// --------------------------------------------------------------------------
// ToolChainInformation:
// --------------------------------------------------------------------------
@@ -120,21 +105,6 @@ private slots:
void toolChainRemoved(ProjectExplorer::ToolChain *tc);
};
-class PROJECTEXPLORER_EXPORT ToolChainMatcher : public KitMatcher
-{
-public:
- ToolChainMatcher(const ToolChain *tc) : m_tc(tc)
- { }
-
- bool matches(const Kit *k) const
- {
- return ToolChainKitInformation::toolChain(k) == m_tc;
- }
-
-private:
- const ToolChain *m_tc;
-};
-
// --------------------------------------------------------------------------
// DeviceTypeInformation:
// --------------------------------------------------------------------------
@@ -157,24 +127,10 @@ public:
static const Core::Id id();
static const Core::Id deviceTypeId(const Kit *k);
static void setDeviceTypeId(Kit *k, Core::Id type);
-};
-class PROJECTEXPLORER_EXPORT DeviceTypeMatcher : public KitMatcher
-{
-public:
- DeviceTypeMatcher(Core::Id t) : m_type(t)
- { }
-
- bool matches(const Kit *k) const
- {
- Core::Id deviceType = DeviceTypeKitInformation::deviceTypeId(k);
- if (!deviceType.isValid())
- return false;
- return deviceType == m_type;
- }
-
-private:
- const Core::Id m_type;
+ static KitMatcher deviceTypeMatcher(Core::Id type);
+
+ Core::FeatureSet availableFeatures(const Kit *k) const;
};
// --------------------------------------------------------------------------
@@ -213,23 +169,6 @@ private slots:
void kitUpdated(ProjectExplorer::Kit *k);
};
-class PROJECTEXPLORER_EXPORT DeviceMatcher : public KitMatcher
-{
-public:
- DeviceMatcher(Core::Id id) : m_devId(id)
- { }
-
- DeviceMatcher() { }
-
- bool matches(const Kit *k) const
- {
- return DeviceKitInformation::deviceId(k) == m_devId;
- }
-
-private:
- Core::Id m_devId;
-};
-
} // namespace ProjectExplorer
#endif // KITINFORMATION_H
diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp
index d9e93655ce..891ed458c1 100644
--- a/src/plugins/projectexplorer/kitmanager.cpp
+++ b/src/plugins/projectexplorer/kitmanager.cpp
@@ -30,9 +30,10 @@
#include "kitmanager.h"
#include "kit.h"
-#include "task.h"
+#include "kitfeatureprovider.h"
#include "kitmanagerconfigwidget.h"
#include "project.h"
+#include "task.h"
#include <coreplugin/icore.h>
@@ -41,6 +42,7 @@
#include <utils/persistentsettings.h>
#include <utils/qtcassert.h>
#include <utils/environment.h>
+#include <utils/algorithm.h>
#include <QSettings>
@@ -249,11 +251,19 @@ void KitManager::restoreKits()
defaultKit->setup();
addKit(defaultKit);
+ setDefaultKit(defaultKit);
}
Kit *k = find(userKits.defaultKit);
- if (k)
+ if (k) {
setDefaultKit(k);
+ } else if (!defaultKit()) {
+ k = Utils::findOr(kitsToRegister, 0, [](Kit *k) {
+ return k->isValid();
+ });
+ if (k)
+ setDefaultKit(k);
+ }
d->m_writer = new Utils::PersistentSettingsWriter(settingsFileName(), QLatin1String("QtCreatorProfiles"));
d->m_initialized = true;
@@ -332,6 +342,35 @@ void KitManager::deregisterKitInformation(KitInformation *ki)
delete ki;
}
+QSet<QString> KitManager::availablePlatforms()
+{
+ QSet<QString> platforms;
+ foreach (const Kit *k, kits())
+ platforms.unite(k->availablePlatforms());
+ return platforms;
+}
+
+QString KitManager::displayNameForPlatform(const QString &platform)
+{
+ foreach (const Kit *k, kits()) {
+ const QString displayName = k->displayNameForPlatform(platform);
+ if (!displayName.isEmpty())
+ return displayName;
+ }
+ return QString();
+}
+
+Core::FeatureSet KitManager::availableFeatures(const QString &platform)
+{
+ Core::FeatureSet features;
+ foreach (const Kit *k, kits()) {
+ QSet<QString> kitPlatforms = k->availablePlatforms();
+ if (kitPlatforms.isEmpty() || kitPlatforms.contains(platform))
+ features |= k->availableFeatures();
+ }
+ return features;
+}
+
KitManager::KitList KitManager::restoreKits(const Utils::FileName &fileName)
{
KitList result;
@@ -400,19 +439,14 @@ Kit *KitManager::find(Core::Id id)
if (!id.isValid())
return 0;
- foreach (Kit *k, kits()) {
- if (k->id() == id)
- return k;
- }
- return 0;
+ return Utils::findOrDefault(kits(), Utils::equal(&Kit::id, id));
}
Kit *KitManager::find(const KitMatcher &matcher)
{
- foreach (Kit *k, d->m_kitList)
- if (matcher.matches(k))
- return k;
- return 0;
+ return Utils::findOrDefault(d->m_kitList, [&matcher](Kit *k) {
+ return matcher.matches(k);
+ });
}
Kit *KitManager::defaultKit()
@@ -500,15 +534,18 @@ bool KitManager::registerKit(ProjectExplorer::Kit *k)
QTC_ASSERT(k->id().isValid(), return false);
- foreach (Kit *current, kits()) {
- if (k == current)
- return false;
- }
+ if (kits().contains(k))
+ return false;
k->setDisplayName(uniqueKitName(k, k->displayName(), kits()));
// make sure we have all the information in our kits:
m_instance->addKit(k);
+
+ if (!d->m_defaultKit ||
+ (!d->m_defaultKit->isValid() && k->isValid()))
+ setDefaultKit(k);
+
emit m_instance->kitAdded(k);
return true;
}
@@ -559,13 +596,8 @@ void KitManager::addKit(Kit *k)
}
d->insertKit(k);
-
- if (!d->m_defaultKit ||
- (!d->m_defaultKit->isValid() && k->isValid()))
- setDefaultKit(k);
}
-
void KitInformation::addToEnvironment(const Kit *k, Utils::Environment &env) const
{
Q_UNUSED(k);
@@ -584,9 +616,47 @@ QString KitInformation::displayNamePostfix(const Kit *k) const
return QString();
}
+QSet<QString> KitInformation::availablePlatforms(const Kit *k) const
+{
+ Q_UNUSED(k);
+ return QSet<QString>();
+}
+
+QString KitInformation::displayNameForPlatform(const Kit *k, const QString &platform) const
+{
+ Q_UNUSED(k);
+ Q_UNUSED(platform);
+ return QString();
+}
+
+Core::FeatureSet KitInformation::availableFeatures(const Kit *k) const
+{
+ Q_UNUSED(k);
+ return Core::FeatureSet();
+}
+
void KitInformation::notifyAboutUpdate(Kit *k)
{
KitManager::notifyAboutUpdate(k);
}
+// --------------------------------------------------------------------
+// KitFeatureProvider:
+// --------------------------------------------------------------------
+
+Core::FeatureSet Internal::KitFeatureProvider::availableFeatures(const QString &platform) const
+{
+ return KitManager::availableFeatures(platform);
+}
+
+QStringList Internal::KitFeatureProvider::availablePlatforms() const
+{
+ return KitManager::availablePlatforms().toList();
+}
+
+QString Internal::KitFeatureProvider::displayNameForPlatform(const QString &string) const
+{
+ return KitManager::displayNameForPlatform(string);
+}
+
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/kitmanager.h b/src/plugins/projectexplorer/kitmanager.h
index fafc20d79b..fa163472ec 100644
--- a/src/plugins/projectexplorer/kitmanager.h
+++ b/src/plugins/projectexplorer/kitmanager.h
@@ -33,10 +33,13 @@
#include "projectexplorer_export.h"
#include <coreplugin/id.h>
+#include <coreplugin/featureprovider.h>
#include <QObject>
#include <QPair>
+#include <functional>
+
namespace Utils {
class FileName;
class Environment;
@@ -90,6 +93,10 @@ public:
virtual QString displayNamePostfix(const Kit *k) const;
+ virtual QSet<QString> availablePlatforms(const Kit *k) const;
+ virtual QString displayNameForPlatform(const ProjectExplorer::Kit *k, const QString &platform) const;
+ virtual Core::FeatureSet availableFeatures(const Kit *k) const;
+
protected:
void setId(Core::Id id) { m_id = id; }
void setPriority(int priority) { m_priority = priority; }
@@ -103,8 +110,14 @@ private:
class PROJECTEXPLORER_EXPORT KitMatcher
{
public:
- virtual ~KitMatcher() { }
- virtual bool matches(const Kit *k) const = 0;
+ typedef std::function<bool(const Kit *)> Matcher;
+ KitMatcher() : m_matcher([](const Kit *k) -> bool { Q_UNUSED(k); return true; }) {}
+ KitMatcher(const Matcher &m) : m_matcher(m) {}
+
+ bool matches(const Kit *kit) const { return m_matcher(kit); }
+
+private:
+ Matcher m_matcher;
};
class PROJECTEXPLORER_EXPORT KitManager : public QObject
@@ -136,6 +149,10 @@ public:
static void registerKitInformation(ProjectExplorer::KitInformation *ki);
static void deregisterKitInformation(ProjectExplorer::KitInformation *ki);
+ static QSet<QString> availablePlatforms();
+ static QString displayNameForPlatform(const QString &platform);
+ static Core::FeatureSet availableFeatures(const QString &platform);
+
public slots:
void saveKits();
diff --git a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp
index 9006309255..d3267fb3f2 100644
--- a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp
+++ b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp
@@ -140,7 +140,7 @@ void KitManagerConfigWidget::apply()
mustRegister = true;
m_kit = new Kit;
}
- m_kit->copyFrom(m_modifiedKit);//m_isDefaultKit is reset in discard() here.
+ m_kit->copyFrom(m_modifiedKit); //m_isDefaultKit is reset in discard() here.
if (mustRegister)
KitManager::registerKit(m_kit);
diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp
index e0920fb8ac..cecaf86ef7 100644
--- a/src/plugins/projectexplorer/kitmodel.cpp
+++ b/src/plugins/projectexplorer/kitmodel.cpp
@@ -34,6 +34,7 @@
#include "kitmanager.h"
#include <coreplugin/coreconstants.h>
+#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QApplication>
@@ -253,11 +254,9 @@ KitManagerConfigWidget *KitModel::widget(const QModelIndex &index)
bool KitModel::isDirty() const
{
- foreach (KitNode *n, m_manualRoot->childNodes) {
- if (n->widget->isDirty())
- return true;
- }
- return false;
+ return Utils::anyOf(m_manualRoot->childNodes, [](KitNode *n) {
+ return n->widget->isDirty();
+ });
}
bool KitModel::isDirty(Kit *k) const
@@ -371,15 +370,12 @@ QModelIndex KitModel::index(KitNode *node, int column) const
KitNode *KitModel::findWorkingCopy(Kit *k) const
{
- foreach (KitNode *n, m_autoRoot->childNodes) {
- if (n->widget->workingCopy() == k)
- return n;
- }
- foreach (KitNode *n, m_manualRoot->childNodes) {
- if (n->widget->workingCopy() == k)
- return n;
- }
- return 0;
+ auto compareWorkingCopy = [&k](KitNode *n){ return n->widget->workingCopy() == k; };
+
+ KitNode *n = Utils::findOrDefault(m_autoRoot->childNodes, compareWorkingCopy);
+ if (!n)
+ n = Utils::findOrDefault(m_manualRoot->childNodes, compareWorkingCopy);
+ return n;
}
KitNode *KitModel::createNode(KitNode *parent, Kit *k)
diff --git a/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp b/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp
index 2cc4ae4d62..be6d020641 100644
--- a/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp
+++ b/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp
@@ -41,7 +41,9 @@
namespace ProjectExplorer {
namespace Internal {
-class FallBackMacroExpander : public Utils::AbstractQtcMacroExpander {
+
+class FallBackMacroExpander : public Utils::AbstractMacroExpander
+{
public:
explicit FallBackMacroExpander(const Target *target) : m_target(target) {}
virtual bool resolveMacro(const QString &name, QString *ret);
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
index 65f40ff94e..2f37a953f8 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
@@ -228,7 +228,9 @@ void ListWidget::setOptimalWidth(int width)
int ListWidget::padding()
{
// there needs to be enough extra pixels to show a scrollbar
- return 30;
+ return 2 * style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, this)
+ + style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, this)
+ + 10;
}
////////
@@ -780,9 +782,15 @@ QVector<int> MiniProjectTargetSelector::listWidgetWidths(int minSize, int maxSiz
if (result[i] != -1)
indexes.append(i);
- Utils::sort(indexes, [&](int i, int j) -> bool {
- return (result[i] > result[j]) ^ tooSmall;
- });
+ if (tooSmall) {
+ Utils::sort(indexes, [&result](int i, int j) {
+ return result[i] < result[j];
+ });
+ } else {
+ Utils::sort(indexes, [&result](int i, int j) {
+ return result[i] > result[j];
+ });
+ }
int i = 0;
int first = result[indexes.first()]; // biggest or smallest
@@ -856,12 +864,8 @@ void MiniProjectTargetSelector::doLayout(bool keepSize)
onlySummary = true;
} else {
if (visibleLineCount < 3) {
- foreach (Project *p, SessionManager::projects()) {
- if (p->needsConfiguration()) {
- visibleLineCount = 3;
- break;
- }
- }
+ if (Utils::anyOf(SessionManager::projects(), &Project::needsConfiguration))
+ visibleLineCount = 3;
}
if (visibleLineCount)
summaryLabelHeight = visibleLineCount * QFontMetrics(m_summaryLabel->font()).height()
diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp
index 265532887a..1b2f92dc90 100644
--- a/src/plugins/projectexplorer/msvctoolchain.cpp
+++ b/src/plugins/projectexplorer/msvctoolchain.cpp
@@ -238,27 +238,27 @@ QByteArray MsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags,
cpp.setEnvironment(env.toStringList());
cpp.setWorkingDirectory(QDir::tempPath());
QStringList arguments;
- const QString binary = env.searchInPath(QLatin1String("cl.exe"));
+ const Utils::FileName binary = env.searchInPath(QLatin1String("cl.exe"));
if (binary.isEmpty()) {
qWarning("%s: The compiler binary cl.exe could not be found in the path.", Q_FUNC_INFO);
return predefinedMacros;
}
arguments << toProcess << QLatin1String("/EP") << QDir::toNativeSeparators(saver.fileName());
- cpp.start(binary, arguments);
+ cpp.start(binary.toString(), arguments);
if (!cpp.waitForStarted()) {
- qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(binary),
+ qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(binary.toUserOutput()),
qPrintable(cpp.errorString()));
return predefinedMacros;
}
cpp.closeWriteChannel();
if (!cpp.waitForFinished()) {
Utils::SynchronousProcess::stopProcess(cpp);
- qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(binary));
+ qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(binary.toUserOutput()));
return predefinedMacros;
}
if (cpp.exitStatus() != QProcess::NormalExit) {
- qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(binary));
+ qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(binary.toUserOutput()));
return predefinedMacros;
}
diff --git a/src/plugins/projectexplorer/panelswidget.cpp b/src/plugins/projectexplorer/panelswidget.cpp
new file mode 100644
index 0000000000..e4111167d8
--- /dev/null
+++ b/src/plugins/projectexplorer/panelswidget.cpp
@@ -0,0 +1,210 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+#include "panelswidget.h"
+
+#include "propertiespanel.h"
+
+#include <QPainter>
+#include <QVBoxLayout>
+#include <QLabel>
+
+#include <utils/stylehelper.h>
+#include <utils/qtcassert.h>
+
+namespace {
+const int ICON_SIZE(64);
+
+const int ABOVE_HEADING_MARGIN(10);
+const int ABOVE_CONTENTS_MARGIN(4);
+const int BELOW_CONTENTS_MARGIN(16);
+const int PANEL_LEFT_MARGIN = 70;
+
+} // anonymous namespace
+///
+// OnePixelBlackLine
+///
+/// \brief The OnePixelBlackLine class
+
+using namespace ProjectExplorer;
+
+namespace {
+class OnePixelBlackLine : public QWidget
+{
+public:
+ OnePixelBlackLine(QWidget *parent)
+ : QWidget(parent)
+ {
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ setMinimumHeight(1);
+ setMaximumHeight(1);
+ }
+ void paintEvent(QPaintEvent *e)
+ {
+ Q_UNUSED(e);
+ QPainter p(this);
+ QColor fillColor = Utils::StyleHelper::mergedColors(
+ palette().button().color(), Qt::black, 80);
+ p.fillRect(contentsRect(), fillColor);
+ }
+};
+
+class RootWidget : public QWidget
+{
+public:
+ RootWidget(QWidget *parent) : QWidget(parent) {
+ setFocusPolicy(Qt::NoFocus);
+ }
+ void paintEvent(QPaintEvent *);
+};
+
+void RootWidget::paintEvent(QPaintEvent *e)
+{
+ QWidget::paintEvent(e);
+
+ QPainter painter(this);
+ QColor light = Utils::StyleHelper::mergedColors(
+ palette().button().color(), Qt::white, 30);
+ QColor dark = Utils::StyleHelper::mergedColors(
+ palette().button().color(), Qt::black, 85);
+
+ painter.setPen(light);
+ painter.drawLine(rect().topRight(), rect().bottomRight());
+ painter.setPen(dark);
+ painter.drawLine(rect().topRight() - QPoint(1,0), rect().bottomRight() - QPoint(1,0));
+}
+}
+
+///
+// PanelsWidget
+///
+
+PanelsWidget::PanelsWidget(QWidget *parent) :
+ QScrollArea(parent),
+ m_root(new RootWidget(this))
+{
+ // We want a 900px wide widget with and the scrollbar at the
+ // side of the screen.
+ m_root->setMaximumWidth(900);
+ m_root->setContentsMargins(0, 0, 40, 0);
+
+ QPalette pal;
+ QColor background = Utils::StyleHelper::mergedColors(
+ palette().window().color(), Qt::white, 85);
+ pal.setColor(QPalette::All, QPalette::Window, background.darker(102));
+ setPalette(pal);
+ pal.setColor(QPalette::All, QPalette::Window, background);
+ m_root->setPalette(pal);
+
+ // The layout holding the individual panels:
+ QVBoxLayout *topLayout = new QVBoxLayout(m_root);
+ topLayout->setMargin(0);
+ topLayout->setSpacing(0);
+
+ m_layout = new QGridLayout;
+ m_layout->setColumnMinimumWidth(0, ICON_SIZE + 4);
+ m_layout->setSpacing(0);
+ topLayout->addLayout(m_layout);
+ topLayout->addStretch(100);
+
+ setWidget(m_root);
+ setFrameStyle(QFrame::NoFrame);
+ setWidgetResizable(true);
+ setFocusPolicy(Qt::NoFocus);
+}
+
+PanelsWidget::~PanelsWidget()
+{
+ qDeleteAll(m_panels);
+}
+
+/*
+ * Add a widget with heading information into the grid
+ * layout of the PanelsWidget.
+ *
+ * ...
+ * +--------+-------------------------------------------+ ABOVE_HEADING_MARGIN
+ * | icon | name |
+ * + +-------------------------------------------+
+ * | | line |
+ * + +-------------------------------------------+ ABOVE_CONTENTS_MARGIN
+ * | | widget (with contentsmargins adjusted!) |
+ * +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
+ */
+void PanelsWidget::addPropertiesPanel(PropertiesPanel *panel)
+{
+ QTC_ASSERT(panel, return);
+
+ const int headerRow = m_layout->rowCount();
+
+ // icon:
+ if (!panel->icon().isNull()) {
+ QLabel *iconLabel = new QLabel(m_root);
+ iconLabel->setPixmap(panel->icon().pixmap(ICON_SIZE, ICON_SIZE));
+ iconLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
+ m_layout->addWidget(iconLabel, headerRow, 0, 3, 1, Qt::AlignTop | Qt::AlignHCenter);
+ }
+
+ // name:
+ QLabel *nameLabel = new QLabel(m_root);
+ nameLabel->setText(panel->displayName());
+ QPalette palette = nameLabel->palette();
+ for (int i = QPalette::Active; i < QPalette::NColorGroups; ++i ) {
+ QColor foregroundColor = palette.color(QPalette::ColorGroup(i), QPalette::Foreground);
+ foregroundColor.setAlpha(110);
+ palette.setBrush(QPalette::ColorGroup(i), QPalette::Foreground, foregroundColor);
+ }
+ nameLabel->setPalette(palette);
+ nameLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
+ QFont f = nameLabel->font();
+ f.setBold(true);
+ f.setPointSizeF(f.pointSizeF() * 1.6);
+ nameLabel->setFont(f);
+ m_layout->addWidget(nameLabel, headerRow, 1, 1, 1, Qt::AlignVCenter | Qt::AlignLeft);
+
+ // line:
+ const int lineRow(headerRow + 1);
+ QWidget *line = new OnePixelBlackLine(m_root);
+ m_layout->addWidget(line, lineRow, 1, 1, -1, Qt::AlignTop);
+
+ // add the widget:
+ const int widgetRow(lineRow + 1);
+ addPanelWidget(panel, widgetRow);
+}
+
+void PanelsWidget::addPanelWidget(PropertiesPanel *panel, int row)
+{
+ QWidget *widget = panel->widget();
+ widget->setContentsMargins(PANEL_LEFT_MARGIN,
+ ABOVE_CONTENTS_MARGIN, 0,
+ BELOW_CONTENTS_MARGIN);
+ widget->setParent(m_root);
+ m_layout->addWidget(widget, row, 0, 1, 2);
+
+ m_panels.append(panel);
+}
diff --git a/src/plugins/projectexplorer/panelswidget.h b/src/plugins/projectexplorer/panelswidget.h
new file mode 100644
index 0000000000..25b73a014d
--- /dev/null
+++ b/src/plugins/projectexplorer/panelswidget.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+#ifndef PANELSWIDGET_H
+#define PANELSWIDGET_H
+
+#include "projectexplorer_export.h"
+
+#include <QScrollArea>
+
+QT_BEGIN_NAMESPACE
+class QGridLayout;
+QT_END_NAMESPACE
+
+namespace ProjectExplorer {
+class PropertiesPanel;
+
+class PROJECTEXPLORER_EXPORT PanelsWidget : public QScrollArea
+{
+ Q_OBJECT
+public:
+ explicit PanelsWidget(QWidget *parent = 0);
+ ~PanelsWidget();
+ // Adds a widget
+ void addPropertiesPanel(PropertiesPanel *panel);
+
+private:
+ void addPanelWidget(PropertiesPanel *panel, int row);
+
+ QList<PropertiesPanel *> m_panels;
+ QGridLayout *m_layout;
+ QWidget *m_root;
+};
+
+} // end namespace
+#endif // PANELSWIDGET_H
diff --git a/src/plugins/projectexplorer/processparameters.cpp b/src/plugins/projectexplorer/processparameters.cpp
index 711209b872..c50f76edcc 100644
--- a/src/plugins/projectexplorer/processparameters.cpp
+++ b/src/plugins/projectexplorer/processparameters.cpp
@@ -128,8 +128,8 @@ QString ProcessParameters::effectiveCommand() const
QString cmd = m_command;
if (m_macroExpander)
Utils::expandMacros(&cmd, m_macroExpander);
- m_effectiveCommand = QDir::cleanPath(m_environment.searchInPath(
- cmd, QStringList() << effectiveWorkingDirectory()));
+ m_effectiveCommand =
+ m_environment.searchInPath(cmd, QStringList(effectiveWorkingDirectory())).toString();
m_commandMissing = m_effectiveCommand.isEmpty();
if (m_commandMissing)
m_effectiveCommand = cmd;
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index f0c27eb80a..afad2283b1 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -94,6 +94,9 @@ public:
Core::Context m_projectLanguages;
QVariantMap m_pluginSettings;
Internal::UserFileAccessor *m_accessor;
+
+ KitMatcher m_requiredKitMatcher;
+ KitMatcher m_preferredKitMatcher;
};
ProjectPrivate::ProjectPrivate() :
@@ -227,16 +230,12 @@ void Project::setActiveTarget(Target *target)
Target *Project::target(Core::Id id) const
{
- return Utils::findOr(d->m_targets, 0, [&id](Target *target) {
- return target->id() == id;
- });
+ return Utils::findOrDefault(d->m_targets, Utils::equal(&Target::id, id));
}
Target *Project::target(Kit *k) const
{
- return Utils::findOr(d->m_targets, 0, [&k](Target *target) {
- return target->kit() == k;
- });
+ return Utils::findOrDefault(d->m_targets, Utils::equal(&Target::kit, k));
}
bool Project::supportsKit(Kit *k, QString *errorMessage) const
@@ -480,9 +479,9 @@ void Project::configureAsExampleProject(const QStringList &platforms)
Q_UNUSED(platforms);
}
-bool Project::supportsNoTargetPanel() const
+bool Project::requiresTargetPanel() const
{
- return false;
+ return true;
}
bool Project::needsSpecialDeployment() const
@@ -499,9 +498,7 @@ void Project::setup(QList<const BuildInfo *> infoList)
continue;
Target *t = target(k);
if (!t) {
- t = Utils::findOr(toRegister, 0, [&k](Target *i){
- return i->kit() == k;
- });
+ t = Utils::findOrDefault(toRegister, Utils::equal(&Target::kit, k));
}
if (!t) {
t = new Target(this, k);
@@ -525,6 +522,26 @@ ProjectImporter *Project::createProjectImporter() const
return 0;
}
+KitMatcher Project::requiredKitMatcher() const
+{
+ return d->m_requiredKitMatcher;
+}
+
+void Project::setRequiredKitMatcher(const KitMatcher &matcher)
+{
+ d->m_requiredKitMatcher = matcher;
+}
+
+KitMatcher Project::preferredKitMatcher() const
+{
+ return d->m_preferredKitMatcher;
+}
+
+void Project::setPreferredKitMatcher(const KitMatcher &matcher)
+{
+ d->m_preferredKitMatcher = matcher;
+}
+
void Project::onBuildDirectoryChanged()
{
Target *target = qobject_cast<Target *>(sender());
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index 6f8f896335..62274d2965 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -128,10 +128,14 @@ public:
virtual bool needsConfiguration() const;
virtual void configureAsExampleProject(const QStringList &platforms);
- virtual bool supportsNoTargetPanel() const;
+ virtual bool requiresTargetPanel() const;
virtual ProjectImporter *createProjectImporter() const;
- virtual KitMatcher *createRequiredKitMatcher() const { return 0; }
- virtual KitMatcher *createPreferredKitMatcher() const { return 0; }
+
+ KitMatcher requiredKitMatcher() const;
+ void setRequiredKitMatcher(const KitMatcher &matcher);
+
+ KitMatcher preferredKitMatcher() const;
+ void setPreferredKitMatcher(const KitMatcher &matcher);
virtual bool needsSpecialDeployment() const;
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 2c4d8eb102..4d643e219f 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -40,6 +40,7 @@
#include "projectmacroexpander.h"
#include "removetaskhandler.h"
#include "unconfiguredprojectpanel.h"
+#include "kitfeatureprovider.h"
#include "kitmanager.h"
#include "kitoptionspage.h"
#include "target.h"
@@ -83,6 +84,8 @@
#include "devicesupport/desktopdevicefactory.h"
#include "devicesupport/devicemanager.h"
#include "devicesupport/devicesettingspage.h"
+#include "targetsettingspanel.h"
+#include "projectpanelfactory.h"
#ifdef Q_OS_WIN
# include "windebuginterface.h"
@@ -239,7 +242,6 @@ struct ProjectExplorerPluginPrivate {
Context m_lastProjectContext;
Node *m_currentNode;
- QList<IDocumentFactory *> m_fileFactories;
QStringList m_profileMimeTypes;
Internal::AppOutputPane *m_outputPane;
@@ -321,6 +323,7 @@ ProjectExplorerPlugin::~ProjectExplorerPlugin()
// Force sequence of deletion:
delete d->m_kitManager; // remove all the profile informations
delete d->m_toolChainManager;
+ ProjectPanelFactory::destroyFactories();
delete d;
}
@@ -387,6 +390,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_kitManager = new KitManager; // register before ToolChainManager
d->m_toolChainManager = new ToolChainManager;
+ Core::IWizardFactory::registerFeatureProvider(new Internal::KitFeatureProvider);
+
// Register KitInformation:
KitManager::registerKitInformation(new DeviceTypeKitInformation);
KitManager::registerKitInformation(new DeviceKitInformation);
@@ -469,14 +474,55 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new AllProjectsFilter);
addAutoReleasedObject(new CurrentProjectFilter);
- addAutoReleasedObject(new BuildSettingsPanelFactory);
- addAutoReleasedObject(new RunSettingsPanelFactory);
- addAutoReleasedObject(new EditorSettingsPanelFactory);
- addAutoReleasedObject(new CodeStyleSettingsPanelFactory);
- addAutoReleasedObject(new DependenciesPanelFactory);
+ // ProjectPanelFactories
+ auto editorSettingsPanelFactory = new ProjectPanelFactory;
+ editorSettingsPanelFactory->setPriority(30);
+ QString displayName = QCoreApplication::translate("EditorSettingsPanelFactory", "Editor");
+ editorSettingsPanelFactory->setDisplayName(displayName);
+ QIcon icon = QIcon(QLatin1String(":/projectexplorer/images/EditorSettings.png"));
+ editorSettingsPanelFactory->setSimpleCreateWidgetFunction<EditorSettingsWidget>(icon);
+ ProjectPanelFactory::registerFactory(editorSettingsPanelFactory);
+
+ auto codeStyleSettingsPanelFactory = new ProjectPanelFactory;
+ codeStyleSettingsPanelFactory->setPriority(40);
+ displayName = QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style");
+ codeStyleSettingsPanelFactory->setDisplayName(displayName);
+ icon = QIcon(QLatin1String(":/projectexplorer/images/CodeStyleSettings.png"));
+ codeStyleSettingsPanelFactory->setSimpleCreateWidgetFunction<CodeStyleSettingsWidget>(icon);
+ ProjectPanelFactory::registerFactory(codeStyleSettingsPanelFactory);
+
+ auto dependenciesPanelFactory = new ProjectPanelFactory;
+ dependenciesPanelFactory->setPriority(50);
+ displayName = QCoreApplication::translate("DependenciesPanelFactory", "Dependencies");
+ dependenciesPanelFactory->setDisplayName(displayName);
+ icon = QIcon(QLatin1String(":/projectexplorer/images/ProjectDependencies.png"));
+ dependenciesPanelFactory->setSimpleCreateWidgetFunction<DependenciesWidget>(icon);
+ ProjectPanelFactory::registerFactory(dependenciesPanelFactory);
+
+ auto unconfiguredProjectPanel = new ProjectPanelFactory;
+ unconfiguredProjectPanel->setPriority(-10);
+ unconfiguredProjectPanel->setDisplayName(tr("Configure Project"));
+ unconfiguredProjectPanel->setSupportsFunction([](Project *project){
+ return project->targets().isEmpty() && !project->requiresTargetPanel();
+ });
+ icon = QIcon(QLatin1String(":/projectexplorer/images/unconfigured.png"));
+ unconfiguredProjectPanel->setSimpleCreateWidgetFunction<TargetSetupPageWrapper>(icon);
+ ProjectPanelFactory::registerFactory(unconfiguredProjectPanel);
+
+ auto targetSettingsPanelFactory = new ProjectPanelFactory;
+ targetSettingsPanelFactory->setPriority(-10);
+ displayName = QCoreApplication::translate("TargetSettingsPanelFactory", "Build & Run");
+ targetSettingsPanelFactory->setDisplayName(displayName);
+ targetSettingsPanelFactory->setSupportsFunction([](Project *project) {
+ return !project->targets().isEmpty()
+ || project->requiresTargetPanel();
+ });
+ targetSettingsPanelFactory->setCreateWidgetFunction([](Project *project) {
+ return new TargetSettingsPanelWidget(project);
+ });
+ ProjectPanelFactory::registerFactory(targetSettingsPanelFactory);
addAutoReleasedObject(new ProcessStepFactory);
- addAutoReleasedObject(new UnconfiguredProjectPanel);
addAutoReleasedObject(new AllProjectsFind);
addAutoReleasedObject(new CurrentProjectFind);
@@ -1212,8 +1258,6 @@ void ProjectExplorerPlugin::closeAllProjects()
void ProjectExplorerPlugin::extensionsInitialized()
{
- d->m_proWindow->extensionsInitialized();
-
// Register factories for all project managers
QList<IProjectManager*> projectManagers =
ExtensionSystem::PluginManager::getObjects<IProjectManager>();
@@ -1222,30 +1266,29 @@ void ProjectExplorerPlugin::extensionsInitialized()
const QString filterSeparator = QLatin1String(";;");
QStringList filterStrings;
+
+ auto factory = new IDocumentFactory;
+ factory->setOpener([this](const QString &fileName) -> IDocument* {
+ QString errorMessage;
+ ProjectExplorerPlugin::instance()->openProject(fileName, &errorMessage);
+ if (!errorMessage.isEmpty())
+ QMessageBox::critical(Core::ICore::mainWindow(),
+ tr("Failed to open project"), errorMessage);
+ return 0;
+ });
+
foreach (IProjectManager *manager, projectManagers) {
- auto factory = new IDocumentFactory;
- factory->setId(Constants::FILE_FACTORY_ID);
- factory->setDisplayName(tr("Project File Factory",
- "ProjectExplorer::ProjectFileFactory display name."));
- factory->addMimeType(manager->mimeType());
- factory->setOpener([this](const QString &fileName) -> IDocument* {
- QString errorMessage;
- ProjectExplorerPlugin::instance()->openProject(fileName, &errorMessage);
- if (!errorMessage.isEmpty())
- QMessageBox::critical(Core::ICore::mainWindow(),
- tr("Failed to open project"), errorMessage);
- return 0;
- });
- d->m_fileFactories.push_back(factory);
const QString mimeType = manager->mimeType();
+ factory->addMimeType(mimeType);
MimeType mime = MimeDatabase::findByType(mimeType);
allGlobPatterns.append(mime.globPatterns());
filterStrings.append(mime.filterString());
- d->m_profileMimeTypes += factory->mimeTypes();
- addAutoReleasedObject(factory);
+ d->m_profileMimeTypes += mimeType;
}
+ addAutoReleasedObject(factory);
+
filterStrings.prepend(MimeType::formatFilterString(
tr("All Projects"), allGlobPatterns));
d->m_projectFilterString = filterStrings.join(filterSeparator);
@@ -1491,13 +1534,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
}
updateActions();
- bool switchToProjectsMode = false;
- foreach (Project *p, openedPro) {
- if (p->needsConfiguration()) {
- switchToProjectsMode = true;
- break;
- }
- }
+ bool switchToProjectsMode = Utils::anyOf(openedPro, &Project::needsConfiguration);
if (!openedPro.isEmpty()) {
if (switchToProjectsMode)
@@ -1914,7 +1951,7 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
if (node)
filePath = pathFor(node);
else
- node = SessionManager::nodeForFile(filePath, project);
+ node = ProjectTreeWidget::nodeForFile(filePath, project);
bool projectChanged = false;
if (d->m_currentProject != project) {
@@ -2288,12 +2325,11 @@ void ProjectExplorerPlugin::runProjectContextMenu()
bool ProjectExplorerPlugin::hasBuildSettings(Project *pro)
{
- foreach (Project *project, SessionManager::projectOrder(pro))
- if (project
+ return Utils::anyOf(SessionManager::projectOrder(pro), [](Project *project) {
+ return project
&& project->activeTarget()
- && project->activeTarget()->activeBuildConfiguration())
- return true;
- return false;
+ && project->activeTarget()->activeBuildConfiguration();
+ });
}
QPair<bool, QString> ProjectExplorerPlugin::buildSettingsEnabled(Project *pro)
@@ -2380,12 +2416,11 @@ bool ProjectExplorerPlugin::coreAboutToClose()
bool ProjectExplorerPlugin::hasDeploySettings(Project *pro)
{
- foreach (Project *project, SessionManager::projectOrder(pro))
- if (project->activeTarget()
+ return Utils::anyOf(SessionManager::projectOrder(pro), [](Project *project) {
+ return project->activeTarget()
&& project->activeTarget()->activeDeployConfiguration()
- && !project->activeTarget()->activeDeployConfiguration()->stepList()->isEmpty())
- return true;
- return false;
+ && !project->activeTarget()->activeDeployConfiguration()->stepList()->isEmpty();
+ });
}
void ProjectExplorerPlugin::runProject(Project *pro, RunMode mode, const bool forceSkipDeploy)
@@ -2567,15 +2602,14 @@ void ProjectExplorerPlugin::updateDeployActions()
bool enableDeploySessionAction = true;
if (d->m_projectExplorerSettings.buildBeforeDeploy) {
- foreach (Project *project, SessionManager::projectOrder(0)) {
- if (project
- && project->activeTarget()
+ auto hasDisabledBuildConfiguration = [](Project *project) {
+ return project && project->activeTarget()
&& project->activeTarget()->activeBuildConfiguration()
- && !project->activeTarget()->activeBuildConfiguration()->isEnabled()) {
- enableDeploySessionAction = false;
- break;
- }
- }
+ && !project->activeTarget()->activeBuildConfiguration()->isEnabled();
+ };
+
+ if (Utils::anyOf(SessionManager::projectOrder(0), hasDisabledBuildConfiguration))
+ enableDeploySessionAction = false;
}
if (!hasProjects || !hasDeploySettings(0) || BuildManager::isBuilding())
enableDeploySessionAction = false;
@@ -2918,9 +2952,7 @@ void ProjectExplorerPlugin::addNewFile()
QVariantMap map;
map.insert(QLatin1String(Constants::PREFERRED_PROJECT_NODE), QVariant::fromValue(d->m_currentNode));
if (d->m_currentProject) {
- QList<Id> profileIds;
- foreach (Target *target, d->m_currentProject->targets())
- profileIds << target->id();
+ QList<Id> profileIds = Utils::transform(d->m_currentProject->targets(), &Target::id);
map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), QVariant::fromValue(profileIds));
}
ICore::showNewItemDialog(tr("New File", "Title of dialog"),
@@ -2940,9 +2972,7 @@ void ProjectExplorerPlugin::addNewSubproject()
QVariantMap map;
map.insert(QLatin1String(Constants::PREFERRED_PROJECT_NODE), QVariant::fromValue(d->m_currentNode));
if (d->m_currentProject) {
- QList<Id> profileIds;
- foreach (Target *target, d->m_currentProject->targets())
- profileIds << target->id();
+ QList<Id> profileIds = Utils::transform(d->m_currentProject->targets(), &Target::id);
map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), QVariant::fromValue(profileIds));
}
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index 94173369c3..7319546449 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -28,6 +28,7 @@ HEADERS += projectexplorer.h \
kitconfigwidget.h \
kitinformation.h \
kitinformationconfigwidget.h \
+ kitfeatureprovider.h \
kitmanager.h \
kitmanagerconfigwidget.h \
kitmodel.h \
@@ -64,7 +65,6 @@ HEADERS += projectexplorer.h \
allprojectsfind.h \
buildstep.h \
buildconfiguration.h \
- iprojectproperties.h \
buildsettingspropertiespage.h \
environmentwidget.h \
processstep.h \
@@ -147,7 +147,10 @@ HEADERS += projectexplorer.h \
ipotentialkit.h \
selectablefilesmodel.h \
addnewmodel.h \
- xcodebuildparser.h
+ xcodebuildparser.h \
+ propertiespanel.h \
+ panelswidget.h \
+ projectpanelfactory.h
SOURCES += projectexplorer.cpp \
abi.cpp \
@@ -281,7 +284,10 @@ SOURCES += projectexplorer.cpp \
ipotentialkit.cpp \
selectablefilesmodel.cpp \
addnewmodel.cpp \
- xcodebuildparser.cpp
+ xcodebuildparser.cpp \
+ propertiespanel.cpp \
+ panelswidget.cpp \
+ projectpanelfactory.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs
index e1e148ad10..93030dc0c1 100644
--- a/src/plugins/projectexplorer/projectexplorer.qbs
+++ b/src/plugins/projectexplorer/projectexplorer.qbs
@@ -85,11 +85,11 @@ QtcPlugin {
"ipotentialkit.cpp",
"ipotentialkit.h",
"iprojectmanager.h",
- "iprojectproperties.h",
"itaskhandler.h",
"kit.cpp", "kit.h",
"kitchooser.cpp", "kitchooser.h",
"kitconfigwidget.cpp", "kitconfigwidget.h",
+ "kitfeatureprovider.h",
"kitinformation.cpp", "kitinformation.h",
"kitinformationconfigwidget.cpp", "kitinformationconfigwidget.h",
"kitmanager.cpp", "kitmanager.h",
@@ -106,6 +106,7 @@ QtcPlugin {
"namedwidget.cpp", "namedwidget.h",
"nodesvisitor.cpp", "nodesvisitor.h",
"osparser.cpp", "osparser.h",
+ "panelswidget.cpp", "panelswidget.h",
"processparameters.cpp", "processparameters.h",
"processstep.cpp", "processstep.h", "processstep.ui",
"project.cpp", "project.h",
@@ -121,9 +122,11 @@ QtcPlugin {
"projectmacroexpander.cpp", "projectmacroexpander.h",
"projectmodels.cpp", "projectmodels.h",
"projectnodes.cpp", "projectnodes.h",
+ "projectpanelfactory.cpp", "projectpanelfactory.h",
"projecttreewidget.cpp", "projecttreewidget.h",
"projectwindow.cpp", "projectwindow.h",
"projectwizardpage.cpp", "projectwizardpage.h", "projectwizardpage.ui",
+ "propertiespanel.cpp", "propertiespanel.h",
"removetaskhandler.cpp", "removetaskhandler.h",
"runconfiguration.cpp", "runconfiguration.h",
"runconfigurationmodel.cpp", "runconfigurationmodel.h",
diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h
index 180e7a5741..54fb8c9457 100644
--- a/src/plugins/projectexplorer/projectexplorerconstants.h
+++ b/src/plugins/projectexplorer/projectexplorerconstants.h
@@ -258,9 +258,6 @@ const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.lo; *.la; *.obj; *~;
const char SHOW_FILE_FILTER_SETTING[] = "GenericProject/ShowFileFilter";
const char SHOW_FILE_FILTER_DEFAULT[] = "*.c; *.cc; *.cpp; *.cp; *.cxx; *.c++; *.h; *.hh; *.hpp; *.hxx;";
-// Unconfigured Panel
-const char UNCONFIGURED_PANEL_PAGE_ID[] = "UnconfiguredPanel";
-
} // namespace Constants
// Run modes
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp
index 5a9e3e03c1..f95f1c9b37 100644
--- a/src/plugins/projectexplorer/projectfilewizardextension.cpp
+++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp
@@ -31,19 +31,14 @@
#include "projectexplorer.h"
#include "session.h"
#include "projectnodes.h"
-#include "nodesvisitor.h"
#include "projectwizardpage.h"
-#include "addnewmodel.h"
+#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
-#include <coreplugin/basefilewizardfactory.h>
#include <coreplugin/icore.h>
-#include <coreplugin/iversioncontrol.h>
-#include <coreplugin/vcsmanager.h>
#include <coreplugin/mimedatabase.h>
-#include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/icodestylepreferences.h>
#include <texteditor/icodestylepreferencesfactory.h>
@@ -56,8 +51,6 @@
#include <QPointer>
#include <QDebug>
#include <QFileInfo>
-#include <QMultiMap>
-#include <QDir>
#include <QTextDocument>
#include <QTextCursor>
#include <QMessageBox>
@@ -87,194 +80,27 @@ namespace ProjectExplorer {
namespace Internal {
-class BestNodeSelector
-{
-public:
- BestNodeSelector(const QString &commonDirectory, const QStringList &files);
- void inspect(AddNewTree *tree);
- AddNewTree *bestChoice() const;
- QString deployingProjects() const;
-private:
- QString m_commonDirectory;
- QStringList m_files;
- bool m_deploys;
- QString m_deployText;
- AddNewTree *m_bestChoice;
- int m_bestMatchLength;
- int m_bestMatchPriority;
-};
-
-BestNodeSelector::BestNodeSelector(const QString &commonDirectory, const QStringList &files)
- : m_commonDirectory(commonDirectory),
- m_files(files),
- m_deploys(false),
- m_deployText(QCoreApplication::translate("ProjectWizard", "The files are implicitly added to the projects:") + QLatin1Char('\n')),
- m_bestChoice(0),
- m_bestMatchLength(-1),
- m_bestMatchPriority(-1)
-{
-
-}
-
-// Find the project the new files should be added
-// If any node deploys the files, then we don't want to add the files.
-// Otherwise consider their common path. Either a direct match on the directory
-// or the directory with the longest matching path (list containing"/project/subproject1"
-// matching common path "/project/subproject1/newuserpath").
-void BestNodeSelector::inspect(AddNewTree *tree)
-{
- FolderNode *node = tree->node();
- if (node->nodeType() == ProjectNodeType) {
- if (static_cast<ProjectNode *>(node)->deploysFolder(m_commonDirectory)) {
- m_deploys = true;
- m_deployText += tree->displayName() + QLatin1Char('\n');
- }
- }
- if (m_deploys)
- return;
- const QString projectDirectory = ProjectExplorerPlugin::directoryFor(node);
- const int projectDirectorySize = projectDirectory.size();
- if (!m_commonDirectory.startsWith(projectDirectory))
- return;
- bool betterMatch = projectDirectorySize > m_bestMatchLength
- || (projectDirectorySize == m_bestMatchLength && tree->priority() > m_bestMatchPriority);
- if (betterMatch) {
- m_bestMatchPriority = tree->priority();
- m_bestMatchLength = projectDirectorySize;
- m_bestChoice = tree;
- }
-}
-
-AddNewTree *BestNodeSelector::bestChoice() const
-{
- if (m_deploys)
- return 0;
- return m_bestChoice;
-}
-
-QString BestNodeSelector::deployingProjects() const
-{
- if (m_deploys)
- return m_deployText;
- return QString();
-}
-
-static inline AddNewTree *createNoneNode(BestNodeSelector *selector)
-{
- QString displayName = QCoreApplication::translate("ProjectWizard", "<Implicitly Add>");
- if (selector->bestChoice())
- displayName = QCoreApplication::translate("ProjectWizard", "<None>");
- return new AddNewTree(displayName);
-}
-
-static inline AddNewTree *buildAddProjectTree(ProjectNode *root, const QString &projectPath, Node *contextNode, BestNodeSelector *selector)
-{
- QList<AddNewTree *> children;
- foreach (ProjectNode *pn, root->subProjectNodes()) {
- AddNewTree *child = buildAddProjectTree(pn, projectPath, contextNode, selector);
- if (child)
- children.append(child);
- }
-
- const QList<ProjectExplorer::ProjectAction> &list = root->supportedActions(root);
- if (list.contains(ProjectExplorer::AddSubProject) && !list.contains(ProjectExplorer::InheritedFromParent)) {
- if (projectPath.isEmpty() || root->canAddSubProject(projectPath)) {
- FolderNode::AddNewInformation info = root->addNewInformation(QStringList() << projectPath, contextNode);
- AddNewTree *item = new AddNewTree(root, children, info);
- selector->inspect(item);
- return item;
- }
- }
-
- if (children.isEmpty())
- return 0;
- return new AddNewTree(root, children, root->displayName());
-}
-
-static inline AddNewTree *buildAddProjectTree(SessionNode *root, const QString &projectPath, Node *contextNode, BestNodeSelector *selector)
-{
- QList<AddNewTree *> children;
- foreach (ProjectNode *pn, root->projectNodes()) {
- AddNewTree *child = buildAddProjectTree(pn, projectPath, contextNode, selector);
- if (child)
- children.append(child);
- }
- children.prepend(createNoneNode(selector));
- return new AddNewTree(root, children, root->displayName());
-}
-
-static inline AddNewTree *buildAddFilesTree(FolderNode *root, const QStringList &files, Node *contextNode, BestNodeSelector *selector)
-{
- QList<AddNewTree *> children;
- foreach (FolderNode *fn, root->subFolderNodes()) {
- AddNewTree *child = buildAddFilesTree(fn, files, contextNode, selector);
- if (child)
- children.append(child);
- }
-
- const QList<ProjectExplorer::ProjectAction> &list = root->supportedActions(root);
- if (list.contains(ProjectExplorer::AddNewFile) && !list.contains(ProjectExplorer::InheritedFromParent)) {
- FolderNode::AddNewInformation info = root->addNewInformation(files, contextNode);
- AddNewTree *item = new AddNewTree(root, children, info);
- selector->inspect(item);
- return item;
- }
- if (children.isEmpty())
- return 0;
- return new AddNewTree(root, children, root->displayName());
-}
-
-static inline AddNewTree *buildAddFilesTree(SessionNode *root, const QStringList &files, Node *contextNode, BestNodeSelector *selector)
-{
- QList<AddNewTree *> children;
- foreach (ProjectNode *pn, root->projectNodes()) {
- AddNewTree *child = buildAddFilesTree(pn, files, contextNode, selector);
- if (child)
- children.append(child);
- }
- children.prepend(createNoneNode(selector));
- return new AddNewTree(root, children, root->displayName());
-}
-
-static inline AddNewTree *getChoices(const QStringList &generatedFiles,
- IWizardFactory::WizardKind wizardKind,
- Node *contextNode,
- BestNodeSelector *selector)
-{
- if (wizardKind == IWizardFactory::ProjectWizard)
- return buildAddProjectTree(SessionManager::sessionNode(), generatedFiles.first(), contextNode, selector);
- else
- return buildAddFilesTree(SessionManager::sessionNode(), generatedFiles, contextNode, selector);
-}
-
// --------- ProjectWizardContext
+
class ProjectWizardContext
{
public:
ProjectWizardContext();
void clear();
- QList<IVersionControl*> versionControls;
- QList<IVersionControl*> activeVersionControls;
QPointer<ProjectWizardPage> page; // this is managed by the wizard!
- bool repositoryExists; // Is VCS 'add' sufficient, or should a repository be created?
- QString commonDirectory;
const IWizardFactory *wizard;
};
ProjectWizardContext::ProjectWizardContext() :
page(0),
- repositoryExists(false),
wizard(0)
{
}
void ProjectWizardContext::clear()
{
- activeVersionControls.clear();
- commonDirectory.clear();
page = 0;
- repositoryExists = false;
wizard = 0;
}
@@ -304,11 +130,8 @@ void ProjectFileWizardExtension::firstExtensionPageShown(
if (debugExtension)
qDebug() << Q_FUNC_INFO << files.size();
- QStringList fileNames;
- foreach (const GeneratedFile &f, files)
- fileNames.push_back(f.path());
- m_context->commonDirectory = Utils::commonPath(fileNames);
- m_context->page->setFilesDisplay(m_context->commonDirectory, fileNames);
+ QStringList fileNames = Utils::transform(files, &GeneratedFile::path);
+ m_context->page->setFiles(fileNames);
QStringList filePaths;
ProjectExplorer::ProjectAction projectAction;
@@ -317,79 +140,14 @@ void ProjectFileWizardExtension::firstExtensionPageShown(
filePaths << generatedProjectFilePath(files);
} else {
projectAction = ProjectExplorer::AddNewFile;
- foreach (const GeneratedFile &gf, files)
- filePaths << gf.path();
+ filePaths = Utils::transform(files, &GeneratedFile::path);
}
-
Node *contextNode = extraValues.value(QLatin1String(Constants::PREFERRED_PROJECT_NODE)).value<Node *>();
- BestNodeSelector selector(m_context->commonDirectory, filePaths);
- AddNewTree *tree = getChoices(filePaths, m_context->wizard->kind(), contextNode, &selector);
-
- m_context->page->setAdditionalInfo(selector.deployingProjects());
-
- AddNewModel *model = new AddNewModel(tree);
- m_context->page->setModel(model);
- m_context->page->setBestNode(selector.bestChoice());
- m_context->page->setAddingSubProject(projectAction == ProjectExplorer::AddSubProject);
- // Store all version controls for later use:
- if (m_context->versionControls.isEmpty()) {
- foreach (IVersionControl *vc, ExtensionSystem::PluginManager::getObjects<IVersionControl>()) {
- m_context->versionControls.append(vc);
- connect(vc, SIGNAL(configurationChanged()), this, SLOT(initializeVersionControlChoices()));
- }
- }
-
- initializeVersionControlChoices();
-}
-
-void ProjectFileWizardExtension::initializeVersionControlChoices()
-{
- if (m_context->page.isNull())
- return;
-
- // Figure out version control situation:
- // 1) Directory is managed and VCS supports "Add" -> List it
- // 2) Directory is managed and VCS does not support "Add" -> None available
- // 3) Directory is not managed -> Offer all VCS that support "CreateRepository"
-
- IVersionControl *currentSelection = 0;
- int currentIdx = m_context->page->versionControlIndex() - 1;
- if (currentIdx >= 0 && currentIdx <= m_context->activeVersionControls.size() - 1)
- currentSelection = m_context->activeVersionControls.at(currentIdx);
-
- m_context->activeVersionControls.clear();
-
- QStringList versionControlChoices = QStringList(tr("<None>"));
- if (!m_context->commonDirectory.isEmpty()) {
- IVersionControl *managingControl = VcsManager::findVersionControlForDirectory(m_context->commonDirectory);
- if (managingControl) {
- // Under VCS
- if (managingControl->supportsOperation(IVersionControl::AddOperation)) {
- versionControlChoices.append(managingControl->displayName());
- m_context->activeVersionControls.push_back(managingControl);
- m_context->repositoryExists = true;
- }
- } else {
- // Create
- foreach (IVersionControl *vc, m_context->versionControls)
- if (vc->supportsOperation(IVersionControl::CreateRepositoryOperation)) {
- versionControlChoices.append(vc->displayName());
- m_context->activeVersionControls.append(vc);
- }
- m_context->repositoryExists = false;
- }
- } // has a common root.
-
- m_context->page->setVersionControls(versionControlChoices);
- // Enable adding to version control by default.
- if (m_context->repositoryExists && versionControlChoices.size() >= 2)
- m_context->page->setVersionControlIndex(1);
- if (!m_context->repositoryExists) {
- int newIdx = m_context->activeVersionControls.indexOf(currentSelection) + 1;
- m_context->page->setVersionControlIndex(newIdx);
- }
+ m_context->page->initializeProjectTree(contextNode, filePaths, m_context->wizard->kind(),
+ projectAction);
+ m_context->page->initializeVersionControls();
}
QList<QWizardPage *> ProjectFileWizardExtension::extensionPages(const IWizardFactory *wizard)
@@ -410,7 +168,7 @@ bool ProjectFileWizardExtension::processFiles(
{
if (!processProject(files, removeOpenProjectAttribute, errorMessage))
return false;
- if (!processVersionControl(files, errorMessage)) {
+ if (!m_context->page->runVersionControl(files, errorMessage)) {
QString message;
if (errorMessage) {
message = *errorMessage;
@@ -445,9 +203,7 @@ bool ProjectFileWizardExtension::processProject(
}
*removeOpenProjectAttribute = true;
} else {
- QStringList filePaths;
- foreach (const GeneratedFile &generatedFile, files)
- filePaths << generatedFile.path();
+ QStringList filePaths = Utils::transform(files, &GeneratedFile::path);
if (!folder->addFiles(filePaths)) {
*errorMessage = tr("Failed to add one or more files to project\n\"%1\" (%2).").
arg(folder->path(), filePaths.join(QString(QLatin1Char(','))));
@@ -457,34 +213,6 @@ bool ProjectFileWizardExtension::processProject(
return true;
}
-bool ProjectFileWizardExtension::processVersionControl(const QList<GeneratedFile> &files, QString *errorMessage)
-{
- // Add files to version control (Entry at 0 is 'None').
- const int vcsIndex = m_context->page->versionControlIndex() - 1;
- if (vcsIndex < 0 || vcsIndex >= m_context->activeVersionControls.size())
- return true;
- QTC_ASSERT(!m_context->commonDirectory.isEmpty(), return false);
- IVersionControl *versionControl = m_context->activeVersionControls.at(vcsIndex);
- // Create repository?
- if (!m_context->repositoryExists) {
- QTC_ASSERT(versionControl->supportsOperation(IVersionControl::CreateRepositoryOperation), return false);
- if (!versionControl->vcsCreateRepository(m_context->commonDirectory)) {
- *errorMessage = tr("A version control system repository could not be created in \"%1\".").arg(m_context->commonDirectory);
- return false;
- }
- }
- // Add files if supported.
- if (versionControl->supportsOperation(IVersionControl::AddOperation)) {
- foreach (const GeneratedFile &generatedFile, files) {
- if (!versionControl->vcsAdd(generatedFile.path())) {
- *errorMessage = tr("Failed to add \"%1\" to the version control system.").arg(generatedFile.path());
- return false;
- }
- }
- }
- return true;
-}
-
static ICodeStylePreferences *codeStylePreferences(Project *project, Id languageId)
{
if (!languageId.isValid())
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.h b/src/plugins/projectexplorer/projectfilewizardextension.h
index a12f8dc0ff..0afbf31e18 100644
--- a/src/plugins/projectexplorer/projectfilewizardextension.h
+++ b/src/plugins/projectexplorer/projectfilewizardextension.h
@@ -55,12 +55,10 @@ public:
public slots:
void firstExtensionPageShown(const QList<Core::GeneratedFile> &files, const QVariantMap &extraValues);
- void initializeVersionControlChoices();
private:
bool processProject(const QList<Core::GeneratedFile> &files,
bool *removeOpenProjectAttribute, QString *errorMessage);
- bool processVersionControl(const QList<Core::GeneratedFile> &files, QString *errorMessage);
ProjectWizardContext *m_context;
};
diff --git a/src/plugins/projectexplorer/projectmacroexpander.h b/src/plugins/projectexplorer/projectmacroexpander.h
index f54f920189..cec78e9316 100644
--- a/src/plugins/projectexplorer/projectmacroexpander.h
+++ b/src/plugins/projectexplorer/projectmacroexpander.h
@@ -37,7 +37,7 @@
namespace ProjectExplorer {
class Kit;
-class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::AbstractQtcMacroExpander
+class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::AbstractMacroExpander
{
public:
ProjectMacroExpander(const QString &projectFilePath, const QString &projectName, const Kit *k, const QString &bcName);
diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp
index 9cd9dc5e57..c0a8a8e14e 100644
--- a/src/plugins/projectexplorer/projectnodes.cpp
+++ b/src/plugins/projectexplorer/projectnodes.cpp
@@ -811,6 +811,14 @@ bool SessionNode::showInSimpleTree() const
return true;
}
+void SessionNode::projectDisplayNameChanged(Node *node)
+{
+ foreach (NodesWatcher *watcher, m_watchers)
+ emit watcher->nodeSortKeyAboutToChange(node);
+ foreach (NodesWatcher *watcher, m_watchers)
+ emit watcher->nodeSortKeyChanged();
+}
+
QList<ProjectNode*> SessionNode::projectNodes() const
{
return m_projectNodes;
diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h
index fbf6909b5e..8212e7134a 100644
--- a/src/plugins/projectexplorer/projectnodes.h
+++ b/src/plugins/projectexplorer/projectnodes.h
@@ -301,6 +301,7 @@ public:
bool isEnabled() const { return true; }
bool showInSimpleTree() const;
+ void projectDisplayNameChanged(Node *node);
protected:
void addProjectNodes(const QList<ProjectNode*> &projectNodes);
void removeProjectNodes(const QList<ProjectNode*> &projectNodes);
diff --git a/src/plugins/projectexplorer/projectpanelfactory.cpp b/src/plugins/projectexplorer/projectpanelfactory.cpp
new file mode 100644
index 0000000000..f3bb78091d
--- /dev/null
+++ b/src/plugins/projectexplorer/projectpanelfactory.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "projectpanelfactory.h"
+
+namespace ProjectExplorer {
+
+static QList<ProjectPanelFactory *> s_factories;
+
+ProjectPanelFactory::ProjectPanelFactory()
+ : m_priority(0),
+ m_supportsFunction([] (Project *) { return true; })
+{}
+
+int ProjectPanelFactory::priority() const
+{
+ return m_priority;
+}
+
+void ProjectPanelFactory::setPriority(int priority)
+{
+ m_priority = priority;
+}
+
+QString ProjectPanelFactory::displayName() const
+{
+ return m_displayName;
+}
+
+void ProjectPanelFactory::setDisplayName(const QString &name)
+{
+ m_displayName = name;
+}
+
+void ProjectPanelFactory::registerFactory(ProjectPanelFactory *factory)
+{
+ auto it = std::lower_bound(s_factories.begin(), s_factories.end(), factory,
+ [](ProjectPanelFactory *a, ProjectPanelFactory *b) {
+ return (a->priority() == b->priority() && a < b) || a->priority() < b->priority();
+ });
+
+ s_factories.insert(it, factory);
+}
+
+QList<ProjectPanelFactory *> ProjectPanelFactory::factories()
+{
+ return s_factories;
+}
+
+void ProjectPanelFactory::destroyFactories()
+{
+ qDeleteAll(s_factories);
+ s_factories.clear();
+}
+
+bool ProjectPanelFactory::supports(Project *project)
+{
+ return m_supportsFunction(project);
+}
+
+void ProjectPanelFactory::setSupportsFunction(std::function<bool (Project *)> function)
+{
+ m_supportsFunction = function;
+}
+
+QWidget *ProjectPanelFactory::createWidget(Project *project)
+{
+ return m_createWidgetFunction(project);
+}
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/projectpanelfactory.h b/src/plugins/projectexplorer/projectpanelfactory.h
new file mode 100644
index 0000000000..d6f6b4d641
--- /dev/null
+++ b/src/plugins/projectexplorer/projectpanelfactory.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef PROJECTPANELFACTORY_H
+#define PROJECTPANELFACTORY_H
+
+#include "projectexplorer_export.h"
+#include "propertiespanel.h"
+#include "panelswidget.h"
+
+#include <functional>
+
+namespace ProjectExplorer {
+
+class Project;
+class ProjectExplorerPlugin;
+
+class PROJECTEXPLORER_EXPORT ProjectPanelFactory
+{
+public:
+ ProjectPanelFactory();
+
+ // simple properties
+ QString displayName() const;
+ void setDisplayName(const QString &name);
+ int priority() const;
+ void setPriority(int priority);
+
+ // interface for users of ProjectPanelFactory
+ bool supports(Project *project);
+ QWidget *createWidget(Project *project);
+
+ // interface for "implementations" of ProjectPanelFactory
+ // by default all projects are supported, only set a custom supports function
+ // if you need something different
+ void setSupportsFunction(std::function<bool (Project *)> function);
+
+ // the simpleCreatePanelFunction creates new instance of T
+ // wraps that into a PropertiesPanel
+ // sets the passed in icon on it
+ // and uses displayName() for the displayname
+ // Note: call setDisplayName before calling this
+ template<typename T>
+ void setSimpleCreateWidgetFunction(const QIcon &icon)
+ {
+ m_createWidgetFunction = [icon, this](Project *project) -> QWidget * {
+ PropertiesPanel *panel = new PropertiesPanel;
+ panel->setDisplayName(this->displayName());
+ panel->setWidget(new T(project)),
+ panel->setIcon(icon);
+ PanelsWidget *panelsWidget = new PanelsWidget();
+ panelsWidget->addPropertiesPanel(panel);
+ return panelsWidget;
+ };
+ }
+
+ void setCreateWidgetFunction(std::function<QWidget *(Project *)> function)
+ {
+ m_createWidgetFunction = function;
+ }
+
+ // This takes ownership.
+ static void registerFactory(ProjectPanelFactory *factory);
+
+ static QList<ProjectPanelFactory *> factories();
+
+private:
+ friend class ProjectExplorerPlugin;
+ static void destroyFactories();
+
+ int m_priority;
+ QString m_displayName;
+ std::function<bool (Project *)> m_supportsFunction;
+ std::function<QWidget *(Project *)> m_createWidgetFunction;
+};
+
+} // namespace ProjectExplorer
+
+#endif // PROJECTPANELFACTORY_H
diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp
index 8600fd9fef..ee10347456 100644
--- a/src/plugins/projectexplorer/projecttreewidget.cpp
+++ b/src/plugins/projectexplorer/projecttreewidget.cpp
@@ -43,6 +43,7 @@
#include <coreplugin/find/treeviewfind.h>
#include <utils/navigationtreeview.h>
+#include <utils/algorithm.h>
#include <QDebug>
#include <QSettings>
@@ -57,6 +58,8 @@ using namespace Core;
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
+QList<ProjectTreeWidget *> ProjectTreeWidget::m_projectTreeWidgets;
+
namespace {
class ProjectTreeItemDelegate : public QStyledItemDelegate
@@ -178,6 +181,59 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
connect(m_toggleSync, SIGNAL(clicked(bool)), this, SLOT(toggleAutoSynchronization()));
setAutoSynchronization(true);
+
+ m_projectTreeWidgets << this;
+}
+
+ProjectTreeWidget::~ProjectTreeWidget()
+{
+ m_projectTreeWidgets.removeOne(this);
+}
+
+// returns how many nodes need to be expanded to make node visible
+int ProjectTreeWidget::expandedCount(Node *node)
+{
+ if (m_projectTreeWidgets.isEmpty())
+ return 0;
+ FlatModel *model = m_projectTreeWidgets.first()->m_model;
+ QModelIndex index = model->indexForNode(node);
+ if (!index.isValid())
+ return 0;
+
+ int count = 0;
+ foreach (ProjectTreeWidget *tree, m_projectTreeWidgets) {
+ QModelIndex idx = index;
+ while (idx.isValid() && idx != tree->m_view->rootIndex()) {
+ if (!tree->m_view->isExpanded(idx))
+ ++count;
+ idx = model->parent(idx);
+ }
+ }
+ return count;
+}
+
+Node *ProjectTreeWidget::nodeForFile(const QString &fileName, Project *project)
+{
+ Node *bestNode = 0;
+ int bestNodeExpandCount = INT_MAX;
+
+ foreach (Node *node, SessionManager::nodesForFile(fileName, project)) {
+ if (!bestNode) {
+ bestNode = node;
+ bestNodeExpandCount = ProjectTreeWidget::expandedCount(node->parentFolderNode());
+ } else if (node->nodeType() < bestNode->nodeType()) {
+ bestNode = node;
+ bestNodeExpandCount = ProjectTreeWidget::expandedCount(node->parentFolderNode());
+ } else if (node->nodeType() == bestNode->nodeType()) {
+ int nodeExpandCount = ProjectTreeWidget::expandedCount(node->parentFolderNode());
+ if (nodeExpandCount < bestNodeExpandCount) {
+ bestNode = node;
+ bestNodeExpandCount = ProjectTreeWidget::expandedCount(node->parentFolderNode());
+ }
+ }
+ }
+
+ return bestNode;
}
void ProjectTreeWidget::disableAutoExpand()
@@ -406,30 +462,10 @@ bool ProjectTreeWidget::projectFilter()
ProjectTreeWidgetFactory::ProjectTreeWidgetFactory()
{
-}
-
-ProjectTreeWidgetFactory::~ProjectTreeWidgetFactory()
-{
-}
-
-QString ProjectTreeWidgetFactory::displayName() const
-{
- return tr("Projects");
-}
-
-int ProjectTreeWidgetFactory::priority() const
-{
- return 100;
-}
-
-Id ProjectTreeWidgetFactory::id() const
-{
- return "Projects";
-}
-
-QKeySequence ProjectTreeWidgetFactory::activationSequence() const
-{
- return QKeySequence(UseMacShortcuts ? tr("Meta+X") : tr("Alt+X"));
+ setDisplayName(tr("Projects"));
+ setPriority(100);
+ setId("Projects");
+ setActivationSequence(QKeySequence(UseMacShortcuts ? tr("Meta+X") : tr("Alt+X")));
}
NavigationView ProjectTreeWidgetFactory::createWidget()
diff --git a/src/plugins/projectexplorer/projecttreewidget.h b/src/plugins/projectexplorer/projecttreewidget.h
index 703660cb81..70c9d12cd2 100644
--- a/src/plugins/projectexplorer/projecttreewidget.h
+++ b/src/plugins/projectexplorer/projecttreewidget.h
@@ -54,6 +54,7 @@ class ProjectTreeWidget : public QWidget
Q_OBJECT
public:
explicit ProjectTreeWidget(QWidget *parent = 0);
+ ~ProjectTreeWidget();
bool autoSynchronization() const;
void setAutoSynchronization(bool sync, bool syncNow = true);
@@ -61,6 +62,8 @@ public:
bool generatedFilesFilter();
QToolButton *toggleSync();
+ static Node *nodeForFile(const QString &fileName, Project *project);
+
public slots:
void toggleAutoSynchronization();
void editCurrentItem();
@@ -88,6 +91,7 @@ private slots:
private:
void recursiveLoadExpandData(const QModelIndex &index, const QSet<QString> &data);
void recursiveSaveExpandData(const QModelIndex &index, QStringList *data);
+ static int expandedCount(Node *node);
ProjectExplorerPlugin *m_explorer;
QTreeView *m_view;
FlatModel *m_model;
@@ -99,6 +103,8 @@ private:
QString m_modelId;
bool m_autoSync;
bool m_autoExpand;
+
+ static QList<ProjectTreeWidget *> m_projectTreeWidgets;
friend class ProjectTreeWidgetFactory;
};
@@ -107,11 +113,7 @@ class ProjectTreeWidgetFactory : public Core::INavigationWidgetFactory
Q_OBJECT
public:
ProjectTreeWidgetFactory();
- ~ProjectTreeWidgetFactory();
- QString displayName() const;
- int priority() const;
- Core::Id id() const;
- QKeySequence activationSequence() const;
+
Core::NavigationView createWidget();
void restoreSettings(int position, QWidget *widget);
void saveSettings(int position, QWidget *widget);
diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp
index f71e25f948..7bb245deea 100644
--- a/src/plugins/projectexplorer/projectwelcomepage.cpp
+++ b/src/plugins/projectexplorer/projectwelcomepage.cpp
@@ -42,6 +42,7 @@
#include <utils/fileutils.h>
#include <utils/stringutils.h>
+#include <utils/algorithm.h>
namespace ProjectExplorer {
namespace Internal {
@@ -67,20 +68,18 @@ int SessionModel::rowCount(const QModelIndex &) const
QStringList pathsToBaseNames(const QStringList &paths)
{
- QStringList stringList;
- foreach (const QString &path, paths)
- stringList.append(QFileInfo(path).completeBaseName());
- return stringList;
+ return Utils::transform(paths, [](const QString &path) {
+ return QFileInfo(path).completeBaseName();
+ });
}
QStringList pathsWithTildeHomePath(const QStringList &paths)
{
- QStringList stringList;
- foreach (const QString &path, paths)
- stringList.append(Utils::withTildeHomePath(QDir::toNativeSeparators(path)));
- return stringList;
+ return Utils::transform(paths, [](const QString &path) {
+ return Utils::withTildeHomePath(QDir::toNativeSeparators(path));
+ });
}
QVariant SessionModel::data(const QModelIndex &index, int role) const
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index b784e8a8eb..ec110091b2 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -30,204 +30,32 @@
#include "projectwindow.h"
#include "doubletabwidget.h"
-
+#include "panelswidget.h"
#include "kitmanager.h"
#include "project.h"
#include "projectexplorer.h"
+#include "projectpanelfactory.h"
#include "session.h"
-#include "iprojectproperties.h"
-#include "targetsettingspanel.h"
#include "target.h"
#include <coreplugin/idocument.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
-#include <utils/stylehelper.h>
-#include <QGridLayout>
-#include <QLabel>
-#include <QPainter>
#include <QStackedWidget>
+#include <QVBoxLayout>
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
-
-namespace {
-const int ICON_SIZE(64);
-
-const int ABOVE_HEADING_MARGIN(10);
-const int ABOVE_CONTENTS_MARGIN(4);
-const int BELOW_CONTENTS_MARGIN(16);
-
-} // anonymous namespace
-
-///
-// OnePixelBlackLine
-///
-
-class OnePixelBlackLine : public QWidget
-{
-public:
- OnePixelBlackLine(QWidget *parent)
- : QWidget(parent)
- {
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- setMinimumHeight(1);
- setMaximumHeight(1);
- }
- void paintEvent(QPaintEvent *e)
- {
- Q_UNUSED(e);
- QPainter p(this);
- QColor fillColor = Utils::StyleHelper::mergedColors(
- palette().button().color(), Qt::black, 80);
- p.fillRect(contentsRect(), fillColor);
- }
-};
-
-class RootWidget : public QWidget
-{
-public:
- RootWidget(QWidget *parent) : QWidget(parent) {
- setFocusPolicy(Qt::NoFocus);
- }
- void paintEvent(QPaintEvent *);
-};
-
-void RootWidget::paintEvent(QPaintEvent *e)
-{
- QWidget::paintEvent(e);
-
- QPainter painter(this);
- QColor light = Utils::StyleHelper::mergedColors(
- palette().button().color(), Qt::white, 30);
- QColor dark = Utils::StyleHelper::mergedColors(
- palette().button().color(), Qt::black, 85);
-
- painter.setPen(light);
- painter.drawLine(rect().topRight(), rect().bottomRight());
- painter.setPen(dark);
- painter.drawLine(rect().topRight() - QPoint(1,0), rect().bottomRight() - QPoint(1,0));
-}
-
-///
-// PanelsWidget
-///
-
-PanelsWidget::PanelsWidget(QWidget *parent) :
- QScrollArea(parent),
- m_root(new RootWidget(this))
-{
- // We want a 900px wide widget with and the scrollbar at the
- // side of the screen.
- m_root->setMaximumWidth(900);
- m_root->setContentsMargins(0, 0, 40, 0);
-
- QPalette pal;
- QColor background = Utils::StyleHelper::mergedColors(
- palette().window().color(), Qt::white, 85);
- pal.setColor(QPalette::All, QPalette::Window, background.darker(102));
- setPalette(pal);
- pal.setColor(QPalette::All, QPalette::Window, background);
- m_root->setPalette(pal);
-
- // The layout holding the individual panels:
- QVBoxLayout *topLayout = new QVBoxLayout(m_root);
- topLayout->setMargin(0);
- topLayout->setSpacing(0);
-
- m_layout = new QGridLayout;
- m_layout->setColumnMinimumWidth(0, ICON_SIZE + 4);
- m_layout->setSpacing(0);
- topLayout->addLayout(m_layout);
- topLayout->addStretch(100);
-
- setWidget(m_root);
- setFrameStyle(QFrame::NoFrame);
- setWidgetResizable(true);
- setFocusPolicy(Qt::NoFocus);
-}
-
-PanelsWidget::~PanelsWidget()
-{
- qDeleteAll(m_panels);
-}
-
-/*
- * Add a widget with heading information into the grid
- * layout of the PanelsWidget.
- *
- * ...
- * +--------+-------------------------------------------+ ABOVE_HEADING_MARGIN
- * | icon | name |
- * + +-------------------------------------------+
- * | | line |
- * + +-------------------------------------------+ ABOVE_CONTENTS_MARGIN
- * | | widget (with contentsmargins adjusted!) |
- * +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
- */
-void PanelsWidget::addPropertiesPanel(PropertiesPanel *panel)
-{
- QTC_ASSERT(panel, return);
-
- const int headerRow = m_layout->rowCount();
-
- // icon:
- if (!panel->icon().isNull()) {
- QLabel *iconLabel = new QLabel(m_root);
- iconLabel->setPixmap(panel->icon().pixmap(ICON_SIZE, ICON_SIZE));
- iconLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
- m_layout->addWidget(iconLabel, headerRow, 0, 3, 1, Qt::AlignTop | Qt::AlignHCenter);
- }
-
- // name:
- QLabel *nameLabel = new QLabel(m_root);
- nameLabel->setText(panel->displayName());
- QPalette palette = nameLabel->palette();
- for (int i = QPalette::Active; i < QPalette::NColorGroups; ++i ) {
- QColor foregroundColor = palette.color(QPalette::ColorGroup(i), QPalette::Foreground);
- foregroundColor.setAlpha(110);
- palette.setBrush(QPalette::ColorGroup(i), QPalette::Foreground, foregroundColor);
- }
- nameLabel->setPalette(palette);
- nameLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
- QFont f = nameLabel->font();
- f.setBold(true);
- f.setPointSizeF(f.pointSizeF() * 1.6);
- nameLabel->setFont(f);
- m_layout->addWidget(nameLabel, headerRow, 1, 1, 1, Qt::AlignVCenter | Qt::AlignLeft);
-
- // line:
- const int lineRow(headerRow + 1);
- QWidget *line = new OnePixelBlackLine(m_root);
- m_layout->addWidget(line, lineRow, 1, 1, -1, Qt::AlignTop);
-
- // add the widget:
- const int widgetRow(lineRow + 1);
- addPanelWidget(panel, widgetRow);
-}
-
-void PanelsWidget::addPanelWidget(PropertiesPanel *panel, int row)
-{
- QWidget *widget = panel->widget();
- widget->setContentsMargins(Constants::PANEL_LEFT_MARGIN,
- ABOVE_CONTENTS_MARGIN, 0,
- BELOW_CONTENTS_MARGIN);
- widget->setParent(m_root);
- m_layout->addWidget(widget, row, 0, 1, 2);
-
- m_panels.append(panel);
-}
-
///
// ProjectWindow
///
ProjectWindow::ProjectWindow(QWidget *parent)
: QWidget(parent),
- m_currentWidget(0),
- m_previousTargetSubIndex(-1)
+ m_ignoreChange(false),
+ m_currentWidget(0)
{
// Setup overall layout:
QVBoxLayout *viewLayout = new QVBoxLayout(this);
@@ -255,7 +83,7 @@ ProjectWindow::ProjectWindow(QWidget *parent)
this, SLOT(startupProjectChanged(ProjectExplorer::Project*)));
connect(sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
- this, SLOT(projectUpdated(ProjectExplorer::Project*)));
+ this, SLOT(projectDisplayNameChanged(ProjectExplorer::Project*)));
// Update properties to empty project for now:
showProperties(-1, -1);
@@ -265,11 +93,6 @@ ProjectWindow::~ProjectWindow()
{
}
-void ProjectWindow::extensionsInitialized()
-{
- connect(KitManager::instance(), SIGNAL(kitsChanged()), this, SLOT(handleKitChanges()));
-}
-
void ProjectWindow::aboutToShutdown()
{
showProperties(-1, -1); // that's a bit stupid, but otherwise stuff is still
@@ -295,58 +118,61 @@ void ProjectWindow::projectUpdated(Project *p)
m_tabWidget->setCurrentIndex(index);
}
-void ProjectWindow::handleKitChanges()
+QStringList ProjectWindow::tabDisplayNamesFor(Project *project)
{
- bool changed = false;
- int index = m_tabWidget->currentIndex();
- QList<Project *> projects = m_tabIndexToProject;
- foreach (ProjectExplorer::Project *project, projects) {
- if (m_hasTarget.value(project) != hasTarget(project)) {
- changed = true;
- if (deregisterProject(project))
- registerProject(project);
- }
+ QStringList subTabs;
+ foreach (ProjectPanelFactory *panelFactory, ProjectPanelFactory::factories()) {
+ if (panelFactory->supports(project))
+ subTabs << panelFactory->displayName();
}
- if (changed)
- m_tabWidget->setCurrentIndex(index);
+ return subTabs;
}
-bool ProjectWindow::hasTarget(ProjectExplorer::Project *project)
-{
- return !project->targets().isEmpty();
-}
-
-void ProjectWindow::registerProject(ProjectExplorer::Project *project)
+int ProjectWindow::insertPosFor(Project *project)
{
- if (!project || m_tabIndexToProject.contains(project))
- return;
-
- // find index to insert:
- int index = -1;
+ int newIndex = -1;
for (int i = 0; i <= m_tabIndexToProject.count(); ++i) {
if (i == m_tabIndexToProject.count() ||
m_tabIndexToProject.at(i)->displayName() > project->displayName()) {
- index = i;
+ newIndex = i;
break;
}
}
+ return newIndex;
+}
- QStringList subtabs;
+void ProjectWindow::projectDisplayNameChanged(Project *project)
+{
+ int index = m_tabIndexToProject.indexOf(project);
+ if (index < 0)
+ return;
- bool projectHasTarget = hasTarget(project);
- m_hasTarget.insert(project, projectHasTarget);
+ m_ignoreChange = true;
+ bool isCurrentIndex = m_tabWidget->currentIndex() == index;
+ int subIndex = m_tabWidget->currentSubIndex();
+ QStringList subTabs = m_tabWidget->subTabs(index);
+ m_tabIndexToProject.removeAt(index);
+ m_tabWidget->removeTab(index);
- if (projectHasTarget) // Use the Targets page
- subtabs << QCoreApplication::translate("TargetSettingsPanelFactory", "Build & Run");
+ int newIndex = insertPosFor(project);
+ m_tabIndexToProject.insert(newIndex, project);
+ m_tabWidget->insertTab(newIndex, project->displayName(), project->projectFilePath().toString(), subTabs);
- // Add the project specific pages
- QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
- Utils::sort(factories, &IPanelFactory::prioritySort);
- foreach (IProjectPanelFactory *panelFactory, factories) {
- if (panelFactory->supports(project))
- subtabs << panelFactory->displayName();
- }
+ if (isCurrentIndex)
+ m_tabWidget->setCurrentIndex(newIndex, subIndex);
+ m_ignoreChange = false;
+}
+
+void ProjectWindow::registerProject(ProjectExplorer::Project *project)
+{
+ if (!project || m_tabIndexToProject.contains(project))
+ return;
+ // find index to insert:
+ int index = insertPosFor(project);
+
+ // Add the project specific pages
+ QStringList subtabs = tabDisplayNamesFor(project);
m_tabIndexToProject.insert(index, project);
m_tabWidget->insertTab(index, project->displayName(), project->projectFilePath().toString(), subtabs);
@@ -376,6 +202,9 @@ void ProjectWindow::startupProjectChanged(ProjectExplorer::Project *p)
void ProjectWindow::showProperties(int index, int subIndex)
{
+ if (m_ignoreChange)
+ return;
+
if (index < 0 || index >= m_tabIndexToProject.count()) {
removeCurrentWidget();
return;
@@ -385,30 +214,9 @@ void ProjectWindow::showProperties(int index, int subIndex)
// Set up custom panels again:
int pos = 0;
- IPanelFactory *fac = 0;
- // remember previous sub index state of target settings page
- if (TargetSettingsPanelWidget *previousPanelWidget
- = qobject_cast<TargetSettingsPanelWidget*>(m_currentWidget)) {
- m_previousTargetSubIndex = previousPanelWidget->currentSubIndex();
- }
-
- if (m_hasTarget.value(project) || !project->supportsNoTargetPanel()) {
- if (subIndex == 0) {
- // Targets page
- removeCurrentWidget();
- TargetSettingsPanelWidget *panelWidget = new TargetSettingsPanelWidget(project);
- if (m_previousTargetSubIndex >= 0)
- panelWidget->setCurrentSubIndex(m_previousTargetSubIndex);
- m_currentWidget = panelWidget;
- m_centralWidget->addWidget(m_currentWidget);
- m_centralWidget->setCurrentWidget(m_currentWidget);
- }
- ++pos;
- }
+ ProjectPanelFactory *fac = 0;
- QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
- Utils::sort(factories, &IPanelFactory::prioritySort);
- foreach (IProjectPanelFactory *panelFactory, factories) {
+ foreach (ProjectPanelFactory *panelFactory, ProjectPanelFactory::factories()) {
if (panelFactory->supports(project)) {
if (subIndex == pos) {
fac = panelFactory;
@@ -421,16 +229,10 @@ void ProjectWindow::showProperties(int index, int subIndex)
if (fac) {
removeCurrentWidget();
- PropertiesPanel *panel = 0;
- if (ITargetPanelFactory *ipf = qobject_cast<ITargetPanelFactory *>(fac))
- panel = ipf->createPanel(project->activeTarget());
- else if (IProjectPanelFactory *ipf = qobject_cast<IProjectPanelFactory *>(fac))
- panel = ipf->createPanel(project);
- Q_ASSERT(panel);
+ QWidget *widget = fac->createWidget(project);
+ Q_ASSERT(widget);
- PanelsWidget *panelsWidget = new PanelsWidget(m_centralWidget);
- panelsWidget->addPropertiesPanel(panel);
- m_currentWidget = panelsWidget;
+ m_currentWidget = widget;
m_centralWidget->addWidget(m_currentWidget);
m_centralWidget->setCurrentWidget(m_currentWidget);
diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h
index 1bb580f072..f276226ee9 100644
--- a/src/plugins/projectexplorer/projectwindow.h
+++ b/src/plugins/projectexplorer/projectwindow.h
@@ -33,39 +33,15 @@
#include "projectexplorer_export.h"
#include <QMap>
-#include <QScrollArea>
+#include <QWidget>
QT_BEGIN_NAMESPACE
-class QLabel;
-class QGridLayout;
-class QMenu;
class QStackedWidget;
QT_END_NAMESPACE
namespace ProjectExplorer {
-
-class PropertiesPanel;
class Project;
class Target;
-class BuildConfiguration;
-class RunConfiguration;
-
-class PROJECTEXPLORER_EXPORT PanelsWidget : public QScrollArea
-{
- Q_OBJECT
-public:
- explicit PanelsWidget(QWidget *parent);
- ~PanelsWidget();
- // Adds a widget
- void addPropertiesPanel(PropertiesPanel *panel);
-
-private:
- void addPanelWidget(PropertiesPanel *panel, int row);
-
- QList<PropertiesPanel *> m_panels;
- QGridLayout *m_layout;
- QWidget *m_root;
-};
namespace Internal {
@@ -80,13 +56,12 @@ public:
~ProjectWindow();
void aboutToShutdown();
- void extensionsInitialized();
public slots:
void projectUpdated(ProjectExplorer::Project *p);
private slots:
- void handleKitChanges();
+ void projectDisplayNameChanged(ProjectExplorer::Project *p);
void showProperties(int index, int subIndex);
void registerProject(ProjectExplorer::Project*);
bool deregisterProject(ProjectExplorer::Project*);
@@ -94,15 +69,15 @@ private slots:
void removedTarget(ProjectExplorer::Target*);
private:
- bool hasTarget(ProjectExplorer::Project *project);
void removeCurrentWidget();
+ static QStringList tabDisplayNamesFor(Project *project);
+ int insertPosFor(Project *project);
+ bool m_ignoreChange;
DoubleTabWidget *m_tabWidget;
QStackedWidget *m_centralWidget;
QWidget *m_currentWidget;
QList<ProjectExplorer::Project *> m_tabIndexToProject;
- QMap<ProjectExplorer::Project *, bool> m_hasTarget;
- int m_previousTargetSubIndex;
};
} // namespace Internal
diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp
index f73a843773..3a37bdd500 100644
--- a/src/plugins/projectexplorer/projectwizardpage.cpp
+++ b/src/plugins/projectexplorer/projectwizardpage.cpp
@@ -27,13 +27,22 @@
**
****************************************************************************/
-#include "addnewmodel.h"
#include "projectwizardpage.h"
#include "ui_projectwizardpage.h"
+#include "addnewmodel.h"
+#include "projectexplorer.h"
+#include "session.h"
+
#include <coreplugin/icore.h>
+#include <coreplugin/iversioncontrol.h>
+#include <coreplugin/iwizardfactory.h>
+#include <coreplugin/vcsmanager.h>
+#include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
+#include <utils/qtcassert.h>
+#include <utils/stringutils.h>
#include <utils/wizard.h>
#include <vcsbase/vcsbaseconstants.h>
@@ -50,13 +59,186 @@
\sa ProjectExplorer::Internal::ProjectFileWizardExtension
*/
-using namespace ProjectExplorer;
-using namespace Internal;
+using namespace Core;
+
+namespace ProjectExplorer {
+namespace Internal {
+
+// --------------------------------------------------------------------
+// BestNodeSelector:
+// --------------------------------------------------------------------
+
+class BestNodeSelector
+{
+public:
+ BestNodeSelector(const QString &commonDirectory, const QStringList &files);
+ void inspect(AddNewTree *tree);
+ AddNewTree *bestChoice() const;
+ QString deployingProjects() const;
+private:
+ QString m_commonDirectory;
+ QStringList m_files;
+ bool m_deploys;
+ QString m_deployText;
+ AddNewTree *m_bestChoice;
+ int m_bestMatchLength;
+ int m_bestMatchPriority;
+};
+
+BestNodeSelector::BestNodeSelector(const QString &commonDirectory, const QStringList &files)
+ : m_commonDirectory(commonDirectory),
+ m_files(files),
+ m_deploys(false),
+ m_deployText(QCoreApplication::translate("ProjectWizard", "The files are implicitly added to the projects:") + QLatin1Char('\n')),
+ m_bestChoice(0),
+ m_bestMatchLength(-1),
+ m_bestMatchPriority(-1)
+{ }
+
+// Find the project the new files should be added
+// If any node deploys the files, then we don't want to add the files.
+// Otherwise consider their common path. Either a direct match on the directory
+// or the directory with the longest matching path (list containing"/project/subproject1"
+// matching common path "/project/subproject1/newuserpath").
+void BestNodeSelector::inspect(AddNewTree *tree)
+{
+ FolderNode *node = tree->node();
+ if (node->nodeType() == ProjectNodeType) {
+ if (static_cast<ProjectNode *>(node)->deploysFolder(m_commonDirectory)) {
+ m_deploys = true;
+ m_deployText += tree->displayName() + QLatin1Char('\n');
+ }
+ }
+ if (m_deploys)
+ return;
+ const QString projectDirectory = ProjectExplorerPlugin::directoryFor(node);
+ const int projectDirectorySize = projectDirectory.size();
+ if (!m_commonDirectory.startsWith(projectDirectory))
+ return;
+ bool betterMatch = projectDirectorySize > m_bestMatchLength
+ || (projectDirectorySize == m_bestMatchLength && tree->priority() > m_bestMatchPriority);
+ if (betterMatch) {
+ m_bestMatchPriority = tree->priority();
+ m_bestMatchLength = projectDirectorySize;
+ m_bestChoice = tree;
+ }
+}
+
+AddNewTree *BestNodeSelector::bestChoice() const
+{
+ if (m_deploys)
+ return 0;
+ return m_bestChoice;
+}
+
+QString BestNodeSelector::deployingProjects() const
+{
+ if (m_deploys)
+ return m_deployText;
+ return QString();
+}
+
+// --------------------------------------------------------------------
+// Helper:
+// --------------------------------------------------------------------
+
+static inline AddNewTree *createNoneNode(BestNodeSelector *selector)
+{
+ QString displayName = QCoreApplication::translate("ProjectWizard", "<Implicitly Add>");
+ if (selector->bestChoice())
+ displayName = QCoreApplication::translate("ProjectWizard", "<None>");
+ return new AddNewTree(displayName);
+}
+
+static inline AddNewTree *buildAddProjectTree(ProjectNode *root, const QString &projectPath, Node *contextNode, BestNodeSelector *selector)
+{
+ QList<AddNewTree *> children;
+ foreach (ProjectNode *pn, root->subProjectNodes()) {
+ AddNewTree *child = buildAddProjectTree(pn, projectPath, contextNode, selector);
+ if (child)
+ children.append(child);
+ }
+
+ const QList<ProjectExplorer::ProjectAction> &list = root->supportedActions(root);
+ if (list.contains(ProjectExplorer::AddSubProject) && !list.contains(ProjectExplorer::InheritedFromParent)) {
+ if (projectPath.isEmpty() || root->canAddSubProject(projectPath)) {
+ FolderNode::AddNewInformation info = root->addNewInformation(QStringList() << projectPath, contextNode);
+ AddNewTree *item = new AddNewTree(root, children, info);
+ selector->inspect(item);
+ return item;
+ }
+ }
+
+ if (children.isEmpty())
+ return 0;
+ return new AddNewTree(root, children, root->displayName());
+}
+
+static inline AddNewTree *buildAddProjectTree(SessionNode *root, const QString &projectPath, Node *contextNode, BestNodeSelector *selector)
+{
+ QList<AddNewTree *> children;
+ foreach (ProjectNode *pn, root->projectNodes()) {
+ AddNewTree *child = buildAddProjectTree(pn, projectPath, contextNode, selector);
+ if (child)
+ children.append(child);
+ }
+ children.prepend(createNoneNode(selector));
+ return new AddNewTree(root, children, root->displayName());
+}
+
+static inline AddNewTree *buildAddFilesTree(FolderNode *root, const QStringList &files, Node *contextNode, BestNodeSelector *selector)
+{
+ QList<AddNewTree *> children;
+ foreach (FolderNode *fn, root->subFolderNodes()) {
+ AddNewTree *child = buildAddFilesTree(fn, files, contextNode, selector);
+ if (child)
+ children.append(child);
+ }
+
+ const QList<ProjectExplorer::ProjectAction> &list = root->supportedActions(root);
+ if (list.contains(ProjectExplorer::AddNewFile) && !list.contains(ProjectExplorer::InheritedFromParent)) {
+ FolderNode::AddNewInformation info = root->addNewInformation(files, contextNode);
+ AddNewTree *item = new AddNewTree(root, children, info);
+ selector->inspect(item);
+ return item;
+ }
+ if (children.isEmpty())
+ return 0;
+ return new AddNewTree(root, children, root->displayName());
+}
+
+static inline AddNewTree *buildAddFilesTree(SessionNode *root, const QStringList &files, Node *contextNode, BestNodeSelector *selector)
+{
+ QList<AddNewTree *> children;
+ foreach (ProjectNode *pn, root->projectNodes()) {
+ AddNewTree *child = buildAddFilesTree(pn, files, contextNode, selector);
+ if (child)
+ children.append(child);
+ }
+ children.prepend(createNoneNode(selector));
+ return new AddNewTree(root, children, root->displayName());
+}
+
+static inline AddNewTree *getChoices(const QStringList &generatedFiles,
+ IWizardFactory::WizardKind wizardKind,
+ Node *contextNode,
+ BestNodeSelector *selector)
+{
+ if (wizardKind == IWizardFactory::ProjectWizard)
+ return buildAddProjectTree(SessionManager::sessionNode(), generatedFiles.first(), contextNode, selector);
+ else
+ return buildAddFilesTree(SessionManager::sessionNode(), generatedFiles, contextNode, selector);
+}
+
+// --------------------------------------------------------------------
+// ProjectWizardPage:
+// --------------------------------------------------------------------
ProjectWizardPage::ProjectWizardPage(QWidget *parent) :
QWizardPage(parent),
m_ui(new Ui::WizardPage),
- m_model(0)
+ m_model(0),
+ m_repositoryExists(false)
{
m_ui->setupUi(this);
m_ui->vcsManageButton->setText(Core::ICore::msgShowOptionsDialog());
@@ -64,6 +246,9 @@ ProjectWizardPage::ProjectWizardPage(QWidget *parent) :
this, SLOT(slotProjectChanged(int)));
connect(m_ui->vcsManageButton, SIGNAL(clicked()), this, SLOT(slotManageVcs()));
setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Summary"));
+
+ connect(Core::VcsManager::instance(), SIGNAL(configurationChanged(const IVersionControl*)),
+ this, SLOT(initializeVersionControls()));
}
ProjectWizardPage::~ProjectWizardPage()
@@ -136,6 +321,96 @@ void ProjectWizardPage::setAddingSubProject(bool addingSubProject)
: tr("Add to &project:"));
}
+void ProjectWizardPage::initializeVersionControls()
+{
+ // Figure out version control situation:
+ // 1) Directory is managed and VCS supports "Add" -> List it
+ // 2) Directory is managed and VCS does not support "Add" -> None available
+ // 3) Directory is not managed -> Offer all VCS that support "CreateRepository"
+
+ IVersionControl *currentSelection = 0;
+ int currentIdx = versionControlIndex() - 1;
+ if (currentIdx >= 0 && currentIdx <= m_activeVersionControls.size() - 1)
+ currentSelection = m_activeVersionControls.at(currentIdx);
+
+ m_activeVersionControls.clear();
+
+ QStringList versionControlChoices = QStringList(tr("<None>"));
+ if (!m_commonDirectory.isEmpty()) {
+ IVersionControl *managingControl = VcsManager::findVersionControlForDirectory(m_commonDirectory);
+ if (managingControl) {
+ // Under VCS
+ if (managingControl->supportsOperation(IVersionControl::AddOperation)) {
+ versionControlChoices.append(managingControl->displayName());
+ m_activeVersionControls.push_back(managingControl);
+ m_repositoryExists = true;
+ }
+ } else {
+ // Create
+ foreach (IVersionControl *vc, ExtensionSystem::PluginManager::getObjects<IVersionControl>()) {
+ if (vc->supportsOperation(IVersionControl::CreateRepositoryOperation)) {
+ versionControlChoices.append(vc->displayName());
+ m_activeVersionControls.append(vc);
+ }
+ }
+ m_repositoryExists = false;
+ }
+ } // has a common root.
+
+ setVersionControls(versionControlChoices);
+ // Enable adding to version control by default.
+ if (m_repositoryExists && versionControlChoices.size() >= 2)
+ setVersionControlIndex(1);
+ if (!m_repositoryExists) {
+ int newIdx = m_activeVersionControls.indexOf(currentSelection) + 1;
+ setVersionControlIndex(newIdx);
+ }
+}
+
+bool ProjectWizardPage::runVersionControl(const QList<GeneratedFile> &files, QString *errorMessage)
+{
+ // Add files to version control (Entry at 0 is 'None').
+ const int vcsIndex = versionControlIndex() - 1;
+ if (vcsIndex < 0 || vcsIndex >= m_activeVersionControls.size())
+ return true;
+ QTC_ASSERT(!m_commonDirectory.isEmpty(), return false);
+
+ IVersionControl *versionControl = m_activeVersionControls.at(vcsIndex);
+ // Create repository?
+ if (!m_repositoryExists) {
+ QTC_ASSERT(versionControl->supportsOperation(IVersionControl::CreateRepositoryOperation), return false);
+ if (!versionControl->vcsCreateRepository(m_commonDirectory)) {
+ *errorMessage = tr("A version control system repository could not be created in \"%1\".").arg(m_commonDirectory);
+ return false;
+ }
+ }
+ // Add files if supported.
+ if (versionControl->supportsOperation(IVersionControl::AddOperation)) {
+ foreach (const GeneratedFile &generatedFile, files) {
+ if (!versionControl->vcsAdd(generatedFile.path())) {
+ *errorMessage = tr("Failed to add \"%1\" to the version control system.").arg(generatedFile.path());
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+void ProjectWizardPage::initializeProjectTree(Node *context, const QStringList &paths,
+ IWizardFactory::WizardKind kind,
+ ProjectAction action)
+{
+ BestNodeSelector selector(m_commonDirectory, paths);
+ AddNewTree *tree = getChoices(paths, kind, context, &selector);
+
+ setAdditionalInfo(selector.deployingProjects());
+
+ AddNewModel *model = new AddNewModel(tree);
+ setModel(model);
+ setBestNode(selector.bestChoice());
+ setAddingSubProject(action == ProjectExplorer::AddSubProject);
+}
+
void ProjectWizardPage::setNoneLabel(const QString &label)
{
m_ui->projectComboBox->setItemText(0, label);
@@ -163,23 +438,24 @@ void ProjectWizardPage::setVersionControlIndex(int idx)
m_ui->addToVersionControlComboBox->setCurrentIndex(idx);
}
-void ProjectWizardPage::setFilesDisplay(const QString &commonPath, const QStringList &files)
+void ProjectWizardPage::setFiles(const QStringList &fileNames)
{
+ m_commonDirectory = Utils::commonPath(fileNames);
QString fileMessage;
{
QTextStream str(&fileMessage);
str << "<qt>"
- << (commonPath.isEmpty() ? tr("Files to be added:") : tr("Files to be added in"))
+ << (m_commonDirectory.isEmpty() ? tr("Files to be added:") : tr("Files to be added in"))
<< "<pre>";
QStringList formattedFiles;
- if (commonPath.isEmpty()) {
- formattedFiles = files;
+ if (m_commonDirectory.isEmpty()) {
+ formattedFiles = fileNames;
} else {
- str << QDir::toNativeSeparators(commonPath) << ":\n\n";
- const int prefixSize = commonPath.size() + 1;
- foreach (const QString &f, files)
- formattedFiles.append(f.right(f.size() - prefixSize));
+ str << QDir::toNativeSeparators(m_commonDirectory) << ":\n\n";
+ const int prefixSize = m_commonDirectory.size() + 1;
+ formattedFiles = Utils::transform(fileNames, [prefixSize](const QString &f)
+ { return f.mid(prefixSize); });
}
// Alphabetically, and files in sub-directories first
Utils::sort(formattedFiles, [](const QString &filePath1, const QString &filePath2) -> bool {
@@ -218,3 +494,6 @@ void ProjectWizardPage::slotManageVcs()
VcsBase::Constants::VCS_COMMON_SETTINGS_ID,
this);
}
+
+} // namespace Internal
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/projectwizardpage.h b/src/plugins/projectexplorer/projectwizardpage.h
index 5618d39cc4..aa37dbbab2 100644
--- a/src/plugins/projectexplorer/projectwizardpage.h
+++ b/src/plugins/projectexplorer/projectwizardpage.h
@@ -30,6 +30,11 @@
#ifndef PROJECTWIZARDPAGE_H
#define PROJECTWIZARDPAGE_H
+#include "projectnodes.h"
+
+#include <coreplugin/generatedfile.h>
+#include <coreplugin/iwizardfactory.h>
+
#include <QWizardPage>
QT_BEGIN_NAMESPACE
@@ -37,8 +42,9 @@ class QTreeView;
class QModelIndex;
QT_END_NAMESPACE
+namespace Core { class IVersionControl; }
+
namespace ProjectExplorer {
-class FolderNode;
namespace Internal {
class AddNewModel;
class AddNewTree;
@@ -54,34 +60,45 @@ public:
explicit ProjectWizardPage(QWidget *parent = 0);
virtual ~ProjectWizardPage();
- void setModel(AddNewModel *model);
- void setBestNode(ProjectExplorer::Internal::AddNewTree *tree);
FolderNode *currentNode() const;
void setNoneLabel(const QString &label);
- void setAdditionalInfo(const QString &text);
-
- void setVersionControls(const QStringList &);
int versionControlIndex() const;
void setVersionControlIndex(int);
// Returns the common path
- void setFilesDisplay(const QString &commonPath, const QStringList &files);
+ void setFiles(const QStringList &files);
- void setAddingSubProject(bool addingSubProject);
+ bool runVersionControl(const QList<Core::GeneratedFile> &files, QString *errorMessage);
+
+ void initializeProjectTree(ProjectExplorer::Node *context, const QStringList &paths,
+ Core::IWizardFactory::WizardKind kind,
+ ProjectExplorer::ProjectAction action);
+
+public slots:
+ void initializeVersionControls();
private slots:
void slotProjectChanged(int);
void slotManageVcs();
private:
+ void setAdditionalInfo(const QString &text);
+ void setAddingSubProject(bool addingSubProject);
+ void setModel(AddNewModel *model);
+ void setBestNode(ProjectExplorer::Internal::AddNewTree *tree);
+ void setVersionControls(const QStringList &);
void setProjectToolTip(const QString &);
bool expandTree(const QModelIndex &root);
Ui::WizardPage *m_ui;
QStringList m_projectToolTips;
AddNewModel *m_model;
+
+ QList<Core::IVersionControl*> m_activeVersionControls;
+ QString m_commonDirectory;
+ bool m_repositoryExists;
};
} // namespace Internal
diff --git a/src/plugins/projectexplorer/propertiespanel.cpp b/src/plugins/projectexplorer/propertiespanel.cpp
new file mode 100644
index 0000000000..1a59911154
--- /dev/null
+++ b/src/plugins/projectexplorer/propertiespanel.cpp
@@ -0,0 +1,2 @@
+#include "propertiespanel.h"
+
diff --git a/src/plugins/projectexplorer/iprojectproperties.h b/src/plugins/projectexplorer/propertiespanel.h
index 173a9b27e2..f5a6053069 100644
--- a/src/plugins/projectexplorer/iprojectproperties.h
+++ b/src/plugins/projectexplorer/propertiespanel.h
@@ -26,24 +26,15 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
-
-#ifndef IPROJECTPROPERTIES_H
-#define IPROJECTPROPERTIES_H
+#ifndef PROPERTIESPANEL_H
+#define PROPERTIESPANEL_H
#include "projectexplorer_export.h"
-#include <QObject>
#include <QIcon>
#include <QWidget>
namespace ProjectExplorer {
-class Project;
-class Target;
-
-namespace Constants {
- const int PANEL_LEFT_MARGIN = 70;
-}
-
class PROJECTEXPLORER_EXPORT PropertiesPanel
{
Q_DISABLE_COPY(PropertiesPanel)
@@ -65,35 +56,5 @@ private:
QWidget *m_widget;
QIcon m_icon;
};
-
-class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject
-{
- Q_OBJECT
-public:
- virtual QString id() const = 0;
- virtual QString displayName() const = 0;
- virtual int priority() const = 0;
- static bool prioritySort(IPanelFactory *a, IPanelFactory *b)
- { return (a->priority() == b->priority() && a->id() < b->id())
- || a->priority() < b->priority(); }
-};
-
-class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public IPanelFactory
-{
- Q_OBJECT
-public:
- virtual bool supports(Project *project) = 0;
- virtual PropertiesPanel *createPanel(Project *project) = 0;
-};
-
-class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public IPanelFactory
-{
- Q_OBJECT
-public:
- virtual bool supports(Target *target) = 0;
- virtual PropertiesPanel *createPanel(Target *target) = 0;
-};
-
-} // namespace ProjectExplorer
-
-#endif // IPROJECTPROPERTIES_H
+}
+#endif // PROPERTIESPANEL_H
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
index 6e4c1dd7e5..cfa3068418 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
@@ -83,46 +83,6 @@ using namespace ProjectExplorer::Internal;
using ExtensionSystem::PluginManager;
///
-/// RunSettingsPanelFactory
-///
-
-QString RunSettingsPanelFactory::id() const
-{
- return QLatin1String(RUNSETTINGS_PANEL_ID);
-}
-
-QString RunSettingsPanelFactory::displayName() const
-{
- return RunSettingsWidget::tr("Run Settings");
-}
-
-int RunSettingsPanelFactory::priority() const
-{
- return 20;
-}
-
-bool RunSettingsPanelFactory::supports(Target *target)
-{
- Q_UNUSED(target);
- return true;
-}
-
-PropertiesPanel *RunSettingsPanelFactory::createPanel(Target *target)
-{
- PropertiesPanel *panel = new PropertiesPanel;
- QWidget *w = new QWidget();
- QVBoxLayout *l = new QVBoxLayout(w);
- QWidget *b = new RunSettingsWidget(target);
- l->addWidget(b);
- l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
- l->setContentsMargins(QMargins());
- panel->setWidget(w);
- panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/RunSettings.png")));
- panel->setDisplayName(RunSettingsWidget::tr("Run Settings"));
- return panel;
-}
-
-///
/// RunSettingsWidget
///
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h
index f1cad07038..3c33eb7cbe 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.h
@@ -30,8 +30,6 @@
#ifndef RUNSETTINGSPROPERTIESPAGE_H
#define RUNSETTINGSPROPERTIESPAGE_H
-#include "iprojectproperties.h"
-
#include <QWidget>
QT_BEGIN_NAMESPACE
@@ -51,6 +49,7 @@ class NamedWidget;
class RunConfiguration;
class RunConfigurationModel;
class RunConfigWidget;
+class Target;
namespace Internal {
@@ -58,16 +57,6 @@ const char RUNSETTINGS_PANEL_ID[] = "ProjectExplorer.RunSettingsPanel";
class BuildStepListWidget;
-class RunSettingsPanelFactory : public ITargetPanelFactory
-{
-public:
- QString id() const;
- QString displayName() const;
- int priority() const;
- bool supports(Target *target);
- PropertiesPanel *createPanel(Target *target);
-};
-
class RunSettingsWidget : public QWidget
{
Q_OBJECT
diff --git a/src/plugins/projectexplorer/selectablefilesmodel.cpp b/src/plugins/projectexplorer/selectablefilesmodel.cpp
index 3c09616492..4d267e6810 100644
--- a/src/plugins/projectexplorer/selectablefilesmodel.cpp
+++ b/src/plugins/projectexplorer/selectablefilesmodel.cpp
@@ -34,6 +34,7 @@
#include <coreplugin/icore.h>
#include <utils/QtConcurrentTools>
+#include <utils/algorithm.h>
#include <QDialogButtonBox>
#include <QHBoxLayout>
@@ -111,27 +112,15 @@ bool SelectableFilesModel::filter(Tree *t)
if (m_files.contains(t->fullPath))
return false;
- bool showFilterMatch = false;
-
- //First loop through show file filters and
- //if any of them match, cotinue checking.
- foreach (const Glob &g, m_showFilesFilter) {
- if (g.isMatch(t->name)) {
- showFilterMatch = true;
- break;
- }
- }
+ auto matchesTreeName = [t](const Glob &g) {
+ return g.isMatch(t->name);
+ };
//If none of the "show file" filters match just return
- if (!showFilterMatch)
+ if (!Utils::anyOf(m_showFilesFilter, matchesTreeName))
return true;
- foreach (const Glob &g, m_hideFilesFilter) {
- if (g.isMatch(t->name))
- return true;
- }
-
- return false;
+ return Utils::anyOf(m_hideFilesFilter, matchesTreeName);
}
void SelectableFilesModel::buildTree(const QString &baseDir, Tree *tree, QFutureInterface<void> &fi, int symlinkDepth)
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index b882f1779c..c69d8cc054 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -42,9 +42,11 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/modemanager.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
+#include <utils/algorithm.h>
#include <utils/stylehelper.h>
+#include <utils/algorithm.h>
#include <QDebug>
#include <QDir>
@@ -511,30 +513,33 @@ Project *SessionManager::projectForNode(Node *node)
Q_ASSERT(rootProjectNode);
- foreach (Project *p, d->m_projects)
- if (p->rootProjectNode() == rootProjectNode)
- return p;
-
- return 0;
+ return Utils::findOrDefault(d->m_projects, Utils::equal(&Project::rootProjectNode, rootProjectNode));
}
-Node *SessionManager::nodeForFile(const QString &fileName, Project *project)
+QList<Node *> SessionManager::nodesForFile(const QString &fileName, Project *project)
{
- Node *node = 0;
if (!project)
project = projectForFile(fileName);
if (project) {
FindNodesForFileVisitor findNodes(fileName);
project->rootProjectNode()->accept(&findNodes);
-
- foreach (Node *n, findNodes.nodes()) {
- // prefer file nodes
- if (!node || (node->nodeType() != FileNodeType && n->nodeType() == FileNodeType))
- node = n;
- }
+ return findNodes.nodes();
}
+ return QList<Node *>();
+}
+
+// node for file returns a randomly selected node if there are multiple
+// prefer to use nodesForFile and figure out which node you want
+Node *SessionManager::nodeForFile(const QString &fileName, Project *project)
+{
+ Node *node = 0;
+ foreach (Node *n, nodesForFile(fileName, project)) {
+ // prefer file nodes
+ if (!node || (node->nodeType() != FileNodeType && n->nodeType() == FileNodeType))
+ node = n;
+ }
return node;
}
@@ -567,7 +572,7 @@ bool SessionManagerPrivate::projectContainsFile(Project *p, const QString &fileN
void SessionManager::configureEditor(Core::IEditor *editor, const QString &fileName)
{
- if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor)) {
+ if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) {
Project *project = projectForFile(fileName);
// Global settings are the default.
if (project)
@@ -987,11 +992,7 @@ void SessionManager::projectDisplayNameChanged()
if (ProjectExplorerPlugin::currentProject() == pro)
currentNode = ProjectExplorerPlugin::instance()->currentNode();
- // Fix node sorting
- QList<ProjectNode *> nodes;
- nodes << pro->rootProjectNode();
- d->m_sessionNode->removeProjectNodes(nodes);
- d->m_sessionNode->addProjectNodes(nodes);
+ d->m_sessionNode->projectDisplayNameChanged(pro->rootProjectNode());
if (currentNode)
ProjectExplorerPlugin::instance()->setCurrentNode(currentNode);
diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h
index 08a770d9cf..cca7e65df1 100644
--- a/src/plugins/projectexplorer/session.h
+++ b/src/plugins/projectexplorer/session.h
@@ -116,6 +116,7 @@ public:
static SessionNode *sessionNode();
static Project *projectForNode(ProjectExplorer::Node *node);
+ static QList<Node *> nodesForFile(const QString &fileName, Project *project = 0);
static Node *nodeForFile(const QString &fileName, Project *project = 0);
static Project *projectForFile(const QString &fileName);
diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp
index ca373f3f11..42ae2a179e 100644
--- a/src/plugins/projectexplorer/settingsaccessor.cpp
+++ b/src/plugins/projectexplorer/settingsaccessor.cpp
@@ -321,6 +321,37 @@ public:
QString backupExtension() const { return QLatin1String("3.2-pre1"); }
QVariantMap upgrade(const QVariantMap &map);
};
+
+// Version 16 Changed android deployment
+class UserFileVersion16Upgrader : public VersionUpgrader
+{
+public:
+ int version() const { return 16; }
+ QString backupExtension() const { return QLatin1String("3.3-pre1"); }
+ QVariantMap upgrade(const QVariantMap &data);
+private:
+ class OldStepMaps
+ {
+ public:
+ QString defaultDisplayName;
+ QString displayName;
+ QVariantMap androidPackageInstall;
+ QVariantMap androidDeployQt;
+ bool isEmpty()
+ {
+ return androidPackageInstall.isEmpty() || androidDeployQt.isEmpty();
+ }
+ };
+
+
+ QVariantMap removeAndroidPackageStep(QVariantMap deployMap);
+ OldStepMaps extractStepMaps(const QVariantMap &deployMap);
+ enum NamePolicy { KeepName, RenameBuildConfiguration };
+ QVariantMap insertSteps(QVariantMap buildConfigurationMap,
+ const OldStepMaps &oldStepMap,
+ NamePolicy policy);
+};
+
} // namespace
//
@@ -403,6 +434,7 @@ UserFileAccessor::UserFileAccessor(Project *project)
addVersionUpgrader(new UserFileVersion13Upgrader);
addVersionUpgrader(new UserFileVersion14Upgrader);
addVersionUpgrader(new UserFileVersion15Upgrader);
+ addVersionUpgrader(new UserFileVersion16Upgrader);
}
QVariantMap UserFileAccessor::prepareSettings(const QVariantMap &data) const
@@ -419,6 +451,15 @@ QVariantMap UserFileAccessor::prepareSettings(const QVariantMap &data) const
return result;
}
+QVariantMap UserFileAccessor::prepareToSaveSettings(const QVariantMap &data) const
+{
+ QVariantMap tmp = SettingsAccessor::prepareToSaveSettings(data);
+
+ // for compatibility with QtC 3.1 and older:
+ tmp.insert(QLatin1String(OBSOLETE_VERSION_KEY), currentVersion());
+ return tmp;
+}
+
namespace ProjectExplorer {
// --------------------------------------------------------------------
// SettingsAccessorPrivate:
@@ -823,6 +864,19 @@ QVariantMap SettingsAccessor::restoreSettings(QWidget *parent) const
return mergeSettings(userSettings, sharedSettings);
}
+QVariantMap SettingsAccessor::prepareToSaveSettings(const QVariantMap &data) const
+{
+ QVariantMap tmp = data;
+ const QVariant &shared = m_project->property(SHARED_SETTINGS);
+ if (shared.isValid())
+ trackUserStickySettings(tmp, shared.toMap());
+
+ tmp.insert(QLatin1String(VERSION_KEY), d->currentVersion());
+ tmp.insert(QLatin1String(ENVIRONMENT_ID_KEY), SettingsAccessor::creatorId());
+
+ return tmp;
+}
+
bool SettingsAccessor::saveSettings(const QVariantMap &map, QWidget *parent) const
{
if (map.isEmpty())
@@ -830,22 +884,14 @@ bool SettingsAccessor::saveSettings(const QVariantMap &map, QWidget *parent) con
backupUserFile();
- QVariantMap data = map;
+ QVariantMap data = prepareToSaveSettings(map);
Utils::FileName path = FileName::fromString(defaultFileName(m_userSuffix));
- const QVariant &shared = m_project->property(SHARED_SETTINGS);
- if (shared.isValid())
- trackUserStickySettings(data, shared.toMap());
-
if (!d->m_writer || d->m_writer->fileName() != path) {
delete d->m_writer;
d->m_writer = new PersistentSettingsWriter(path, QLatin1String("QtCreatorProject"));
}
- data.insert(QLatin1String(VERSION_KEY), d->currentVersion());
- // for compatibility with QtC 3.1 and older:
- data.insert(QLatin1String(OBSOLETE_VERSION_KEY), d->currentVersion()); // TODO: Move into UserfileAccessor!
- data.insert(QLatin1String(ENVIRONMENT_ID_KEY), SettingsAccessor::creatorId());
return d->m_writer->save(data, parent);
}
@@ -2054,7 +2100,7 @@ QVariantMap UserFileVersion11Upgrader::upgrade(const QVariantMap &map)
if (m_toolChainExtras.contains(origTcId)) {
debuggerPath = m_toolChainExtras.value(origTcId).m_debugger;
if (!debuggerPath.isEmpty() && !QFileInfo(debuggerPath).isAbsolute())
- debuggerPath = Environment::systemEnvironment().searchInPath(debuggerPath);
+ debuggerPath = Environment::systemEnvironment().searchInPath(debuggerPath).toString();
if (debuggerPath.contains(QLatin1String("cdb")))
debuggerEngine = 4; // CDB
mkspec = m_toolChainExtras.value(origTcId).m_mkspec;
@@ -2387,3 +2433,221 @@ QVariantMap UserFileVersion15Upgrader::upgrade(const QVariantMap &map)
return renameKeys(changes, QVariantMap(map));
}
+
+// --------------------------------------------------------------------
+// UserFileVersion16Upgrader:
+// --------------------------------------------------------------------
+
+UserFileVersion16Upgrader::OldStepMaps UserFileVersion16Upgrader::extractStepMaps(const QVariantMap &deployMap)
+{
+ OldStepMaps result;
+ result.defaultDisplayName = deployMap.value(QLatin1String("ProjectExplorer.ProjectConfiguration.DefaultDisplayName")).toString();
+ result.displayName = deployMap.value(QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName")).toString();
+ const QString stepListKey = QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepList.0");
+ QVariantMap stepListMap = deployMap.value(stepListKey).toMap();
+ int stepCount = stepListMap.value(QLatin1String("ProjectExplorer.BuildStepList.StepsCount"), 0).toInt();
+ QString stepKey = QLatin1String("ProjectExplorer.BuildStepList.Step.");
+ for (int i = 0; i < stepCount; ++i) {
+ QVariantMap stepMap = stepListMap.value(stepKey + QString::number(i)).toMap();
+ const QString id = stepMap.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString();
+ if (id == QLatin1String("Qt4ProjectManager.AndroidDeployQtStep"))
+ result.androidDeployQt = stepMap;
+ else if (id == QLatin1String("Qt4ProjectManager.AndroidPackageInstallationStep"))
+ result.androidPackageInstall = stepMap;
+ if (!result.isEmpty())
+ return result;
+
+ }
+ return result;
+}
+
+QVariantMap UserFileVersion16Upgrader::removeAndroidPackageStep(QVariantMap deployMap)
+{
+ const QString stepListKey = QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepList.0");
+ QVariantMap stepListMap = deployMap.value(stepListKey).toMap();
+ const QString stepCountKey = QLatin1String("ProjectExplorer.BuildStepList.StepsCount");
+ int stepCount = stepListMap.value(stepCountKey, 0).toInt();
+ QString stepKey = QLatin1String("ProjectExplorer.BuildStepList.Step.");
+ int targetPosition = 0;
+ for (int sourcePosition = 0; sourcePosition < stepCount; ++sourcePosition) {
+ QVariantMap stepMap = stepListMap.value(stepKey + QString::number(sourcePosition)).toMap();
+ if (stepMap.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString()
+ != QLatin1String("Qt4ProjectManager.AndroidPackageInstallationStep")) {
+ stepListMap.insert(stepKey + QString::number(targetPosition), stepMap);
+ ++targetPosition;
+ }
+ }
+
+ stepListMap.insert(stepCountKey, targetPosition);
+
+ for (int i = targetPosition; i < stepCount; ++i)
+ stepListMap.remove(stepKey + QString::number(i));
+
+ deployMap.insert(stepListKey, stepListMap);
+ return deployMap;
+}
+
+QVariantMap UserFileVersion16Upgrader::insertSteps(QVariantMap buildConfigurationMap,
+ const OldStepMaps &oldStepMap,
+ NamePolicy policy)
+{
+ const QString bslCountKey = QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepListCount");
+ int stepListCount = buildConfigurationMap.value(bslCountKey).toInt();
+
+ const QString bslKey = QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepList.");
+ const QString bslTypeKey = QLatin1String("ProjectExplorer.ProjectConfiguration.Id");
+ for (int bslNumber = 0; bslNumber < stepListCount; ++bslNumber) {
+ QVariantMap buildStepListMap = buildConfigurationMap.value(bslKey + QString::number(bslNumber)).toMap();
+ if (buildStepListMap.value(bslTypeKey) != QLatin1String("ProjectExplorer.BuildSteps.Build"))
+ continue;
+
+ const QString bslStepCountKey = QLatin1String("ProjectExplorer.BuildStepList.StepsCount");
+
+ int stepCount = buildStepListMap.value(bslStepCountKey).toInt();
+ buildStepListMap.insert(bslStepCountKey, stepCount + 2);
+
+ QVariantMap androidPackageInstallStep;
+ QVariantMap androidBuildApkStep;
+
+ // common settings of all buildsteps
+ const QString enabledKey = QLatin1String("ProjectExplorer.BuildStep.Enabled");
+ const QString idKey = QLatin1String("ProjectExplorer.ProjectConfiguration.Id");
+ const QString displayNameKey = QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName");
+ const QString defaultDisplayNameKey = QLatin1String("ProjectExplorer.ProjectConfiguration.DefaultDisplayName");
+
+ QString displayName = oldStepMap.androidPackageInstall.value(displayNameKey).toString();
+ QString defaultDisplayName = oldStepMap.androidPackageInstall.value(defaultDisplayNameKey).toString();
+ bool enabled = oldStepMap.androidPackageInstall.value(enabledKey).toBool();
+
+ androidPackageInstallStep.insert(idKey, Core::Id("Qt4ProjectManager.AndroidPackageInstallationStep").toSetting());
+ androidPackageInstallStep.insert(displayNameKey, displayName);
+ androidPackageInstallStep.insert(defaultDisplayNameKey, defaultDisplayName);
+ androidPackageInstallStep.insert(enabledKey, enabled);
+
+ displayName = oldStepMap.androidDeployQt.value(displayName).toString();
+ defaultDisplayName = oldStepMap.androidDeployQt.value(defaultDisplayNameKey).toString();
+ enabled = oldStepMap.androidDeployQt.value(enabledKey).toBool();
+
+ androidBuildApkStep.insert(idKey, Core::Id("QmakeProjectManager.AndroidBuildApkStep").toSetting());
+ androidBuildApkStep.insert(displayNameKey, displayName);
+ androidBuildApkStep.insert(defaultDisplayNameKey, defaultDisplayName);
+ androidBuildApkStep.insert(enabledKey, enabled);
+
+ // settings transferred from AndroidDeployQtStep to QmakeBuildApkStep
+ const QString ProFilePathForInputFile = QLatin1String("ProFilePathForInputFile");
+ const QString DeployActionKey = QLatin1String("Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction");
+ const QString KeystoreLocationKey = QLatin1String("KeystoreLocation");
+ const QString BuildTargetSdkKey = QLatin1String("BuildTargetSdk");
+ const QString VerboseOutputKey = QLatin1String("VerboseOutput");
+
+ QString inputFile = oldStepMap.androidDeployQt.value(ProFilePathForInputFile).toString();
+ int oldDeployAction = oldStepMap.androidDeployQt.value(DeployActionKey).toInt();
+ QString keyStorePath = oldStepMap.androidDeployQt.value(KeystoreLocationKey).toString();
+ QString buildTargetSdk = oldStepMap.androidDeployQt.value(BuildTargetSdkKey).toString();
+ bool verbose = oldStepMap.androidDeployQt.value(VerboseOutputKey).toBool();
+ androidBuildApkStep.insert(ProFilePathForInputFile, inputFile);
+ androidBuildApkStep.insert(DeployActionKey, oldDeployAction);
+ androidBuildApkStep.insert(KeystoreLocationKey, keyStorePath);
+ androidBuildApkStep.insert(BuildTargetSdkKey, buildTargetSdk);
+ androidBuildApkStep.insert(VerboseOutputKey, verbose);
+
+ const QString buildStepKey = QLatin1String("ProjectExplorer.BuildStepList.Step.");
+ buildStepListMap.insert(buildStepKey + QString::number(stepCount), androidPackageInstallStep);
+ buildStepListMap.insert(buildStepKey + QString::number(stepCount + 1), androidBuildApkStep);
+
+ buildConfigurationMap.insert(bslKey + QString::number(bslNumber), buildStepListMap);
+ }
+
+ if (policy == RenameBuildConfiguration) {
+ const QString displayNameKey = QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName");
+ const QString defaultDisplayNameKey = QLatin1String("ProjectExplorer.ProjectConfiguration.DefaultDisplayName");
+
+ QString defaultDisplayName = buildConfigurationMap.value(defaultDisplayNameKey).toString();
+ QString displayName = buildConfigurationMap.value(displayNameKey).toString();
+ if (displayName.isEmpty())
+ displayName = defaultDisplayName;
+ QString oldDisplayname = oldStepMap.displayName;
+ if (oldDisplayname.isEmpty())
+ oldDisplayname = oldStepMap.defaultDisplayName;
+
+ displayName.append(QLatin1String(" - "));
+ displayName.append(oldDisplayname);
+ buildConfigurationMap.insert(displayNameKey, displayName);
+
+ defaultDisplayName.append(QLatin1String(" - "));
+ defaultDisplayName.append(oldStepMap.defaultDisplayName);
+ buildConfigurationMap.insert(defaultDisplayNameKey, defaultDisplayName);
+ }
+
+ return buildConfigurationMap;
+}
+
+QVariantMap UserFileVersion16Upgrader::upgrade(const QVariantMap &data)
+{
+ int targetCount = data.value(QLatin1String("ProjectExplorer.Project.TargetCount"), 0).toInt();
+ if (!targetCount)
+ return data;
+
+ QVariantMap result = data;
+
+ for (int i = 0; i < targetCount; ++i) {
+ QString targetKey = QLatin1String("ProjectExplorer.Project.Target.") + QString::number(i);
+ QVariantMap targetMap = data.value(targetKey).toMap();
+
+ const QString dcCountKey = QLatin1String("ProjectExplorer.Target.DeployConfigurationCount");
+ int deployconfigurationCount = targetMap.value(dcCountKey).toInt();
+ if (!deployconfigurationCount) // should never happen
+ continue;
+
+ QList<OldStepMaps> oldSteps;
+ QList<QVariantMap> oldBuildConfigurations;
+
+ QString deployKey = QLatin1String("ProjectExplorer.Target.DeployConfiguration.");
+ for (int j = 0; j < deployconfigurationCount; ++j) {
+ QVariantMap deployConfigurationMap
+ = targetMap.value(deployKey + QString::number(j)).toMap();
+ OldStepMaps oldStep = extractStepMaps(deployConfigurationMap);
+ if (!oldStep.isEmpty()) {
+ oldSteps.append(oldStep);
+ deployConfigurationMap = removeAndroidPackageStep(deployConfigurationMap);
+ targetMap.insert(deployKey + QString::number(j), deployConfigurationMap);
+ }
+ }
+
+ if (oldSteps.isEmpty()) // no android target?
+ continue;
+
+ const QString bcCountKey = QLatin1String("ProjectExplorer.Target.BuildConfigurationCount");
+ int buildConfigurationCount
+ = targetMap.value(bcCountKey).toInt();
+
+ if (!buildConfigurationCount) // should never happen
+ continue;
+
+ QString bcKey = QLatin1String("ProjectExplorer.Target.BuildConfiguration.");
+ for (int j = 0; j < buildConfigurationCount; ++j) {
+ QVariantMap oldBuildConfigurationMap = targetMap.value(bcKey + QString::number(j)).toMap();
+ oldBuildConfigurations.append(oldBuildConfigurationMap);
+ }
+
+ QList<QVariantMap> newBuildConfigurations;
+
+ NamePolicy policy = oldSteps.size() > 1 ? RenameBuildConfiguration : KeepName;
+
+ foreach (const QVariantMap &oldBuildConfiguration, oldBuildConfigurations) {
+ foreach (const OldStepMaps &oldStep, oldSteps) {
+ QVariantMap newBuildConfiguration = insertSteps(oldBuildConfiguration, oldStep, policy);
+ if (!newBuildConfiguration.isEmpty())
+ newBuildConfigurations.append(newBuildConfiguration);
+ }
+ }
+
+ targetMap.insert(bcCountKey, newBuildConfigurations.size());
+
+ for (int j = 0; j < newBuildConfigurations.size(); ++j)
+ targetMap.insert(bcKey + QString::number(j), newBuildConfigurations.at(j));
+ result.insert(targetKey, targetMap);
+ }
+
+ return result;
+}
diff --git a/src/plugins/projectexplorer/settingsaccessor.h b/src/plugins/projectexplorer/settingsaccessor.h
index dadeed63cd..1ff280447f 100644
--- a/src/plugins/projectexplorer/settingsaccessor.h
+++ b/src/plugins/projectexplorer/settingsaccessor.h
@@ -110,6 +110,7 @@ protected:
ProceedInfo reportIssues(const QVariantMap &data, const Utils::FileName &path, QWidget *parent) const;
virtual QVariantMap prepareSettings(const QVariantMap &data) const;
+ virtual QVariantMap prepareToSaveSettings(const QVariantMap &data) const;
virtual bool isBetterMatch(const QVariantMap &origData, const QVariantMap &newData) const;
@@ -146,6 +147,7 @@ public:
protected:
QVariantMap prepareSettings(const QVariantMap &data) const;
+ QVariantMap prepareToSaveSettings(const QVariantMap &data) const;
};
} // namespace Internal
diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp
index cb22811170..9d840890e8 100644
--- a/src/plugins/projectexplorer/target.cpp
+++ b/src/plugins/projectexplorer/target.cpp
@@ -47,6 +47,7 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <utils/qtcassert.h>
+#include <utils/algorithm.h>
#include <QDebug>
#include <QIcon>
@@ -218,9 +219,7 @@ void Target::addBuildConfiguration(BuildConfiguration *configuration)
// Check that we don't have a configuration with the same displayName
QString configurationDisplayName = configuration->displayName();
- QStringList displayNames;
- foreach (const BuildConfiguration *bc, d->m_buildConfigurations)
- displayNames << bc->displayName();
+ QStringList displayNames = Utils::transform(d->m_buildConfigurations, &BuildConfiguration::displayName);
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
if (configurationDisplayName != configuration->displayName()) {
if (configuration->usesDefaultDisplayName())
@@ -302,9 +301,7 @@ void Target::addDeployConfiguration(DeployConfiguration *dc)
// Check that we don't have a configuration with the same displayName
QString configurationDisplayName = dc->displayName();
- QStringList displayNames;
- foreach (const DeployConfiguration *current, d->m_deployConfigurations)
- displayNames << current->displayName();
+ QStringList displayNames = Utils::transform(d->m_deployConfigurations, &DeployConfiguration::displayName);
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
dc->setDisplayName(configurationDisplayName);
@@ -405,9 +402,7 @@ void Target::addRunConfiguration(RunConfiguration* runConfiguration)
// Check that we don't have a configuration with the same displayName
QString configurationDisplayName = runConfiguration->displayName();
- QStringList displayNames;
- foreach (const RunConfiguration *rc, d->m_runConfigurations)
- displayNames << rc->displayName();
+ QStringList displayNames = Utils::transform(d->m_runConfigurations, &RunConfiguration::displayName);
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
runConfiguration->setDisplayName(configurationDisplayName);
@@ -624,13 +619,10 @@ void Target::updateDefaultRunConfigurations()
// Create new RCs and put them into newConfigured/newUnconfigured
foreach (Core::Id id, autoCreateFactoryIds) {
- IRunConfigurationFactory *factory = 0;
- foreach (IRunConfigurationFactory *i, rcFactories) {
- if (i->canCreate(this, id)) {
- factory = i;
- break;
- }
- }
+ IRunConfigurationFactory *factory = Utils::findOrDefault(rcFactories,
+ [this, id] (IRunConfigurationFactory *i) {
+ return i->canCreate(this, id);
+ });
if (!factory)
continue;
@@ -687,12 +679,8 @@ void Target::updateDefaultRunConfigurations()
RunConfiguration *selected = newConfigured.at(0);
// Try to find a runconfiguration that matches the project name. That is a good
// candidate for something to run initially.
- foreach (RunConfiguration *rc, newConfigured) {
- if (rc->displayName() == project()->displayName()) {
- selected = rc;
- break;
- }
- }
+ selected = Utils::findOr(newConfigured, selected,
+ Utils::equal(&RunConfiguration::displayName, project()->displayName()));
setActiveRunConfiguration(selected);
} else if (!newUnconfigured.isEmpty()){
setActiveRunConfiguration(newUnconfigured.at(0));
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp
index d1b821f375..5ee453a96b 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.cpp
+++ b/src/plugins/projectexplorer/targetsettingspanel.cpp
@@ -33,9 +33,11 @@
#include "buildsettingspropertiespage.h"
#include "ipotentialkit.h"
#include "kitoptionspage.h"
+#include "panelswidget.h"
#include "project.h"
#include "projectimporter.h"
#include "projectwindow.h"
+#include "propertiespanel.h"
#include "runsettingspropertiespage.h"
#include "target.h"
#include "targetsettingswidget.h"
@@ -67,6 +69,8 @@ using namespace Core;
namespace ProjectExplorer {
namespace Internal {
+int TargetSettingsPanelWidget::s_targetSubIndex = -1;
+
///
// TargetSettingsWidget
///
@@ -194,6 +198,7 @@ void TargetSettingsPanelWidget::setupUi()
// Now set the correct target
int index = m_targets.indexOf(m_project->activeTarget());
m_selector->setCurrentIndex(index);
+ m_selector->setCurrentSubIndex(s_targetSubIndex);
currentTargetChanged(index, m_selector->currentSubIndex());
connect(m_selector, SIGNAL(currentChanged(int,int)),
@@ -231,6 +236,8 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
return;
}
+ s_targetSubIndex = subIndex;
+
Target *target = m_targets.at(targetIndex);
// Target was not actually changed:
@@ -245,21 +252,33 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
// Target has changed:
m_currentTarget = target;
+ auto wrapWidgetInPropertiesPanel
+ = [](QWidget *widget, const QString &displayName, const QIcon &icon) -> PropertiesPanel *{
+ PropertiesPanel *panel = new PropertiesPanel;
+ QWidget *w = new QWidget();
+ QVBoxLayout *l = new QVBoxLayout(w);
+ l->addWidget(widget);
+ l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ l->setContentsMargins(QMargins());
+ panel->setWidget(w);
+ panel->setIcon(icon);
+ panel->setDisplayName(displayName);
+ return panel;
+ };
+
+ PropertiesPanel *build = wrapWidgetInPropertiesPanel(new BuildSettingsWidget(target),
+ QCoreApplication::translate("BuildSettingsPanel", "Build Settings"),
+ QIcon(QLatin1String(":/projectexplorer/images/BuildSettings.png")));
+ PropertiesPanel *run= wrapWidgetInPropertiesPanel(new RunSettingsWidget(target),
+ RunSettingsWidget::tr("Run Settings"),
+ QIcon(QLatin1String(":/projectexplorer/images/RunSettings.png")));
+
PanelsWidget *buildPanel = new PanelsWidget(m_centralWidget);
PanelsWidget *runPanel = new PanelsWidget(m_centralWidget);
- foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::getObjects<ITargetPanelFactory>()) {
- if (panelFactory->id() == QLatin1String(BUILDSETTINGS_PANEL_ID)) {
- PropertiesPanel *panel = panelFactory->createPanel(target);
- buildPanel->addPropertiesPanel(panel);
- continue;
- }
- if (panelFactory->id() == QLatin1String(RUNSETTINGS_PANEL_ID)) {
- PropertiesPanel *panel = panelFactory->createPanel(target);
- runPanel->addPropertiesPanel(panel);
- continue;
- }
- }
+ buildPanel->addPropertiesPanel(build);
+ runPanel->addPropertiesPanel(run);
+
m_centralWidget->addWidget(buildPanel);
m_centralWidget->addWidget(runPanel);
diff --git a/src/plugins/projectexplorer/targetsettingspanel.h b/src/plugins/projectexplorer/targetsettingspanel.h
index 2de991f48a..57233db677 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.h
+++ b/src/plugins/projectexplorer/targetsettingspanel.h
@@ -103,6 +103,7 @@ private:
QAction *m_lastAction;
QAction *m_importAction;
int m_menuTargetIndex;
+ static int s_targetSubIndex;
};
} // namespace Internal
diff --git a/src/plugins/projectexplorer/targetsetuppage.cpp b/src/plugins/projectexplorer/targetsetuppage.cpp
index dd9ccbbcd0..b1dc331993 100644
--- a/src/plugins/projectexplorer/targetsetuppage.cpp
+++ b/src/plugins/projectexplorer/targetsetuppage.cpp
@@ -44,12 +44,14 @@
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/wizard.h>
+#include <utils/algorithm.h>
#include <QFileInfo>
#include <QLabel>
#include <QMessageBox>
#include <QScrollArea>
#include <QVBoxLayout>
+#include <QCheckBox>
namespace ProjectExplorer {
namespace Internal {
@@ -64,6 +66,7 @@ public:
QLabel *descriptionLabel;
QLabel *noValidKitLabel;
QLabel *optionHintLabel;
+ QCheckBox *allKitsCheckBox;
void setupUi(QWidget *q)
{
@@ -89,6 +92,10 @@ public:
optionHintLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
optionHintLabel->setVisible(false);
+ allKitsCheckBox = new QCheckBox(setupTargetPage);
+ allKitsCheckBox->setTristate(true);
+ allKitsCheckBox->setText(TargetSetupPage::tr("Select all kits"));
+
centralWidget = new QWidget(setupTargetPage);
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed);
policy.setHorizontalStretch(0);
@@ -115,6 +122,7 @@ public:
verticalLayout_2->addWidget(noValidKitLabel);
verticalLayout_2->addWidget(descriptionLabel);
verticalLayout_2->addWidget(optionHintLabel);
+ verticalLayout_2->addWidget(allKitsCheckBox);
verticalLayout_2->addWidget(centralWidget);
verticalLayout_2->addWidget(scrollAreaWidget);
@@ -124,6 +132,9 @@ public:
QObject::connect(optionHintLabel, SIGNAL(linkActivated(QString)),
q, SLOT(openOptions()));
+
+ QObject::connect(allKitsCheckBox, SIGNAL(clicked()),
+ q, SLOT(changeAllKitsSelections()));
}
};
@@ -133,8 +144,6 @@ using namespace Internal;
TargetSetupPage::TargetSetupPage(QWidget *parent) :
QWizardPage(parent),
- m_requiredMatcher(0),
- m_preferredMatcher(0),
m_importer(0),
m_baseLayout(0),
m_firstWidget(0),
@@ -193,12 +202,8 @@ void TargetSetupPage::initializePage()
selectAtLeastOneKit();
}
-void TargetSetupPage::setRequiredKitMatcher(KitMatcher *matcher)
+void TargetSetupPage::setRequiredKitMatcher(const KitMatcher &matcher)
{
- if (matcher == m_requiredMatcher)
- return;
- if (m_requiredMatcher)
- delete m_requiredMatcher;
m_requiredMatcher = matcher;
}
@@ -216,12 +221,8 @@ QList<Core::Id> TargetSetupPage::selectedKits() const
return result;
}
-void TargetSetupPage::setPreferredKitMatcher(KitMatcher *matcher)
+void TargetSetupPage::setPreferredKitMatcher(const KitMatcher &matcher)
{
- if (matcher == m_preferredMatcher)
- return;
- if (m_preferredMatcher)
- delete m_preferredMatcher;
m_preferredMatcher = matcher;
}
@@ -229,8 +230,6 @@ TargetSetupPage::~TargetSetupPage()
{
reset();
delete m_ui;
- delete m_preferredMatcher;
- delete m_requiredMatcher;
delete m_importer;
}
@@ -243,26 +242,22 @@ bool TargetSetupPage::isKitSelected(Core::Id id) const
void TargetSetupPage::setKitSelected(Core::Id id, bool selected)
{
TargetSetupWidget *widget = m_widgets.value(id);
- if (widget)
+ if (widget) {
widget->setKitSelected(selected);
+ kitSelectionChanged();
+ }
}
bool TargetSetupPage::isComplete() const
{
- foreach (TargetSetupWidget *widget, m_widgets)
- if (widget->isKitSelected())
- return true;
- return false;
+ return Utils::anyOf(m_widgets, &TargetSetupWidget::isKitSelected);
}
void TargetSetupPage::setupWidgets()
{
- QList<Kit *> kitList;
// Known profiles:
- if (m_requiredMatcher)
- kitList = KitManager::matchingKits(*m_requiredMatcher);
- else
- kitList = KitManager::kits();
+ QList<Kit *> kitList;
+ kitList = KitManager::matchingKits(m_requiredMatcher);
foreach (Kit *k, kitList)
addWidget(k);
@@ -289,6 +284,8 @@ void TargetSetupPage::reset()
m_widgets.clear();
m_firstWidget = 0;
+
+ m_ui->allKitsCheckBox->setChecked(false);
}
void TargetSetupPage::setProjectPath(const QString &path)
@@ -374,9 +371,7 @@ void TargetSetupPage::handleKitUpdate(Kit *k)
TargetSetupWidget *widget = m_widgets.value(k->id());
- bool acceptable = true;
- if (m_requiredMatcher && !m_requiredMatcher->matches(k))
- acceptable = false;
+ bool acceptable = m_requiredMatcher.matches(k);
if (widget && !acceptable)
removeWidget(k);
@@ -401,8 +396,10 @@ void TargetSetupPage::selectAtLeastOneKit()
Kit *defaultKit = KitManager::defaultKit();
if (defaultKit)
widget = m_widgets.value(defaultKit->id(), m_firstWidget);
- if (widget)
+ if (widget) {
widget->setKitSelected(true);
+ kitSelectionChanged();
+ }
m_firstWidget = 0;
}
emit completeChanged(); // Is this necessary?
@@ -417,6 +414,7 @@ void TargetSetupPage::updateVisibility()
bool hasKits = !m_widgets.isEmpty();
m_ui->noValidKitLabel->setVisible(!hasKits);
m_ui->optionHintLabel->setVisible(m_forceOptionHint || !hasKits);
+ m_ui->allKitsCheckBox->setVisible(hasKits);
emit completeChanged();
}
@@ -433,6 +431,34 @@ void TargetSetupPage::import(const Utils::FileName &path)
import(path, false);
}
+void TargetSetupPage::kitSelectionChanged()
+{
+ int selected = 0;
+ int deselected = 0;
+ foreach (TargetSetupWidget *widget, m_widgets) {
+ if (widget->isKitSelected())
+ ++selected;
+ else
+ ++deselected;
+ }
+ if (selected > 0 && deselected > 0)
+ m_ui->allKitsCheckBox->setCheckState(Qt::PartiallyChecked);
+ else if (selected > 0 && deselected == 0)
+ m_ui->allKitsCheckBox->setCheckState(Qt::Checked);
+ else
+ m_ui->allKitsCheckBox->setCheckState(Qt::Unchecked);
+}
+
+void TargetSetupPage::changeAllKitsSelections()
+{
+ if (m_ui->allKitsCheckBox->checkState() == Qt::PartiallyChecked)
+ m_ui->allKitsCheckBox->setCheckState(Qt::Checked);
+ bool checked = m_ui->allKitsCheckBox->isChecked();
+ foreach (TargetSetupWidget *widget, m_widgets)
+ widget->setKitSelected(checked);
+ emit completeChanged();
+}
+
bool TargetSetupPage::isUpdating() const
{
if (m_importer)
@@ -462,6 +488,7 @@ void TargetSetupPage::import(const Utils::FileName &path, bool silent)
widget->addBuildInfo(info, true);
widget->setKitSelected(true);
widget->expandWidget();
+ kitSelectionChanged();
}
emit completeChanged();
}
@@ -475,11 +502,12 @@ void TargetSetupPage::removeWidget(Kit *k)
m_firstWidget = 0;
widget->deleteLater();
m_widgets.remove(k->id());
+ kitSelectionChanged();
}
TargetSetupWidget *TargetSetupPage::addWidget(Kit *k)
{
- if (!k || (m_requiredMatcher && !m_requiredMatcher->matches(k)))
+ if (!k || !m_requiredMatcher.matches(k))
return 0;
IBuildConfigurationFactory *factory
@@ -497,8 +525,10 @@ TargetSetupWidget *TargetSetupPage::addWidget(Kit *k)
m_baseLayout->removeWidget(widget);
m_baseLayout->removeItem(m_spacer);
- widget->setKitSelected(m_preferredMatcher && m_preferredMatcher->matches(k));
+ widget->setKitSelected(m_preferredMatcher.matches(k));
m_widgets.insert(k->id(), widget);
+ connect(widget, SIGNAL(selectedToggled()),
+ this, SLOT(kitSelectionChanged()));
m_baseLayout->addWidget(widget);
m_baseLayout->addWidget(m_importWidget);
@@ -512,6 +542,8 @@ TargetSetupWidget *TargetSetupPage::addWidget(Kit *k)
if (!m_firstWidget)
m_firstWidget = widget;
+ kitSelectionChanged();
+
return widget;
}
diff --git a/src/plugins/projectexplorer/targetsetuppage.h b/src/plugins/projectexplorer/targetsetuppage.h
index 9a58db66f4..b6003ba81d 100644
--- a/src/plugins/projectexplorer/targetsetuppage.h
+++ b/src/plugins/projectexplorer/targetsetuppage.h
@@ -33,6 +33,7 @@
#include "projectexplorer_export.h"
#include "projectimporter.h"
+#include "kitinformation.h"
#include <QString>
#include <QWizardPage>
@@ -68,8 +69,8 @@ public:
void initializePage();
// Call these before initializePage!
- void setRequiredKitMatcher(KitMatcher *matcher);
- void setPreferredKitMatcher(KitMatcher *matcher);
+ void setRequiredKitMatcher(const KitMatcher &matcher);
+ void setPreferredKitMatcher(const KitMatcher &matcher);
/// Sets whether the targetsetupage uses a scrollarea
/// to host the widgets from the factories
@@ -96,6 +97,9 @@ private slots:
void openOptions();
void import(const Utils::FileName &path);
+ void kitSelectionChanged();
+ void changeAllKitsSelections();
+
private:
bool isUpdating() const;
void selectAtLeastOneKit();
@@ -108,8 +112,8 @@ private:
void setupWidgets();
void reset();
- KitMatcher *m_requiredMatcher;
- KitMatcher *m_preferredMatcher;
+ KitMatcher m_requiredMatcher;
+ KitMatcher m_preferredMatcher;
ProjectImporter *m_importer;
QLayout *m_baseLayout;
QString m_projectPath;
diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp
index 49fac5e537..eaa3c87a54 100644
--- a/src/plugins/projectexplorer/task.cpp
+++ b/src/plugins/projectexplorer/task.cpp
@@ -91,11 +91,11 @@ Task Task::buildConfigurationMissingTask()
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
}
-void Task::addMark(TextEditor::BaseTextMark *mark)
+void Task::addMark(TextEditor::TextMark *mark)
{
QTC_ASSERT(m_mark.isNull(), return);
- m_mark = QSharedPointer<TextEditor::BaseTextMark>(mark);
+ m_mark = QSharedPointer<TextEditor::TextMark>(mark);
}
bool Task::isNull() const
diff --git a/src/plugins/projectexplorer/task.h b/src/plugins/projectexplorer/task.h
index c51a48df88..5e8c3dec91 100644
--- a/src/plugins/projectexplorer/task.h
+++ b/src/plugins/projectexplorer/task.h
@@ -33,11 +33,11 @@
#include "projectexplorer_export.h"
#include <coreplugin/id.h>
-#include <texteditor/basetextmark.h>
+#include <texteditor/textmark.h>
#include <utils/fileutils.h>
+#include <QIcon>
#include <QMetaType>
-
#include <QTextLayout>
namespace ProjectExplorer {
@@ -71,7 +71,7 @@ public:
int movedLine; // contains a line number if the line was moved in the editor
Core::Id category;
QIcon icon;
- void addMark(TextEditor::BaseTextMark *mark);
+ void addMark(TextEditor::TextMark *mark);
// Having a QList<QTextLayout::FormatRange> in Task isn't that great
// It would be cleaner to split up the text into
@@ -84,7 +84,7 @@ public:
QList<QTextLayout::FormatRange> formats;
private:
- QSharedPointer<TextEditor::BaseTextMark> m_mark;
+ QSharedPointer<TextEditor::TextMark> m_mark;
static unsigned int s_nextId;
};
diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp
index 78e2e643ba..cd603b6ccb 100644
--- a/src/plugins/projectexplorer/taskhub.cpp
+++ b/src/plugins/projectexplorer/taskhub.cpp
@@ -38,11 +38,11 @@ using namespace ProjectExplorer;
TaskHub *m_instance = 0;
QSet<Core::Id> TaskHub::m_registeredCategories;
-class TaskMark : public TextEditor::BaseTextMark
+class TaskMark : public TextEditor::TextMark
{
public:
TaskMark(unsigned int id, const QString &fileName, int lineNumber, bool visible)
- : BaseTextMark(fileName, lineNumber), m_id(id)
+ : TextMark(fileName, lineNumber), m_id(id)
{
setVisible(visible);
}
@@ -60,13 +60,13 @@ private:
void TaskMark::updateLineNumber(int lineNumber)
{
TaskHub::updateTaskLineNumber(m_id, lineNumber);
- BaseTextMark::updateLineNumber(lineNumber);
+ TextMark::updateLineNumber(lineNumber);
}
void TaskMark::updateFileName(const QString &fileName)
{
TaskHub::updateTaskFileName(m_id, fileName);
- BaseTextMark::updateFileName(fileName);
+ TextMark::updateFileName(fileName);
}
void TaskMark::removedFromEditor()
@@ -131,13 +131,10 @@ void TaskHub::addTask(Task task)
if (task.line != -1 && !task.file.isEmpty()) {
TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, !task.icon.isNull());
mark->setIcon(task.icon);
- mark->setPriority(TextEditor::ITextMark::LowPriority);
+ mark->setPriority(TextEditor::TextMark::LowPriority);
task.addMark(mark);
- emit m_instance->taskAdded(task);
- mark->init();
- } else {
- emit m_instance->taskAdded(task);
}
+ emit m_instance->taskAdded(task);
}
void TaskHub::clearTasks(Core::Id categoryId)
diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp
index aeb04af22c..23cff40880 100644
--- a/src/plugins/projectexplorer/toolchainmanager.cpp
+++ b/src/plugins/projectexplorer/toolchainmanager.cpp
@@ -40,6 +40,7 @@
#include <utils/fileutils.h>
#include <utils/persistentsettings.h>
#include <utils/qtcassert.h>
+#include <utils/algorithm.h>
#include <QDir>
#include <QSettings>
@@ -313,11 +314,7 @@ ToolChain *ToolChainManager::findToolChain(const QString &id)
if (id.isEmpty())
return 0;
- foreach (ToolChain *tc, d->m_toolChains) {
- if (tc->id() == id)
- return tc;
- }
- return 0;
+ return Utils::findOrDefault(d->m_toolChains, Utils::equal(&ToolChain::id, id));
}
FileName ToolChainManager::defaultDebugger(const Abi &abi)
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp
index a757b01880..c2f3ca8ee4 100644
--- a/src/plugins/projectexplorer/toolchainoptionspage.cpp
+++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp
@@ -39,6 +39,7 @@
#include <utils/detailswidget.h>
#include <utils/qtcassert.h>
+#include <utils/algorithm.h>
#include <QAction>
#include <QApplication>
@@ -245,20 +246,18 @@ ToolChainConfigWidget *ToolChainModel::widget(const QModelIndex &index)
bool ToolChainModel::isDirty() const
{
- foreach (ToolChainNode *n, m_manualRoot->childNodes) {
- if (n->changed)
- return true;
- }
- return false;
+ return Utils::anyOf(m_manualRoot->childNodes,
+ [](ToolChainNode *n) {
+ return n->changed;
+ });
}
bool ToolChainModel::isDirty(ToolChain *tc) const
{
- foreach (ToolChainNode *n, m_manualRoot->childNodes) {
- if (n->toolChain == tc && n->changed)
- return true;
- }
- return false;
+ return Utils::anyOf(m_manualRoot->childNodes,
+ [tc](ToolChainNode *n) {
+ return n->toolChain == tc && n->changed;
+ });
}
void ToolChainModel::setDirty()
@@ -328,13 +327,7 @@ void ToolChainModel::apply()
void ToolChainModel::markForRemoval(ToolChain *tc)
{
- ToolChainNode *node = 0;
- foreach (ToolChainNode *n, m_manualRoot->childNodes) {
- if (n->toolChain == tc) {
- node = n;
- break;
- }
- }
+ ToolChainNode *node = findToolChain(m_manualRoot->childNodes, tc);
if (node) {
emit beginRemoveRows(index(m_manualRoot), m_manualRoot->childNodes.indexOf(node), m_manualRoot->childNodes.indexOf(node));
m_manualRoot->childNodes.removeOne(node);
@@ -380,17 +373,23 @@ ToolChainNode *ToolChainModel::createNode(ToolChainNode *parent, ToolChain *tc,
return node;
}
+ToolChainNode *ToolChainModel::findToolChain(const QList<ToolChainNode *> &container, ToolChain *tc)
+{
+ return Utils::findOrDefault(container, [tc](ToolChainNode *n) {
+ return n->toolChain == tc;
+ });
+}
+
void ToolChainModel::addToolChain(ToolChain *tc)
{
- QList<ToolChainNode *> nodes = m_toAddList;
- foreach (ToolChainNode *n, nodes) {
- if (n->toolChain == tc) {
- m_toAddList.removeOne(n);
- // do not delete n: Still used elsewhere!
- return;
- }
+ ToolChainNode *n = findToolChain(m_toAddList, tc);
+ if (n) {
+ m_toAddList.removeOne(n);
+ // do not delete n: Still used elsewhere!
+ return;
}
+
ToolChainNode *parent = m_manualRoot;
if (tc->isAutoDetected())
parent = m_autoRoot;
@@ -405,13 +404,11 @@ void ToolChainModel::addToolChain(ToolChain *tc)
void ToolChainModel::removeToolChain(ToolChain *tc)
{
- QList<ToolChainNode *> nodes = m_toRemoveList;
- foreach (ToolChainNode *n, nodes) {
- if (n->toolChain == tc) {
- m_toRemoveList.removeOne(n);
- delete n;
- return;
- }
+ ToolChainNode *n = findToolChain(m_toRemoveList, tc);
+ if (n) {
+ m_toRemoveList.removeOne(n);
+ delete n;
+ return;
}
ToolChainNode *parent = m_manualRoot;
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.h b/src/plugins/projectexplorer/toolchainoptionspage.h
index cccff782d7..58fd208211 100644
--- a/src/plugins/projectexplorer/toolchainoptionspage.h
+++ b/src/plugins/projectexplorer/toolchainoptionspage.h
@@ -98,6 +98,8 @@ private slots:
private:
QModelIndex index(ToolChainNode *, int column = 0) const;
ToolChainNode *createNode(ToolChainNode *parent, ToolChain *tc, bool changed);
+ static ToolChainNode *findToolChain(const QList<ToolChainNode *> &container, ToolChain *tc);
+
ToolChainNode *m_root;
ToolChainNode *m_autoRoot;
diff --git a/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp b/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp
index 345110e427..3ce3e3f452 100644
--- a/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp
+++ b/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp
@@ -48,41 +48,6 @@
namespace ProjectExplorer {
namespace Internal {
-UnconfiguredProjectPanel::UnconfiguredProjectPanel()
-{
-}
-
-QString UnconfiguredProjectPanel::id() const
-{
- return QLatin1String(Constants::UNCONFIGURED_PANEL_PAGE_ID);
-}
-
-QString UnconfiguredProjectPanel::displayName() const
-{
- return tr("Configure Project");
-}
-
-int UnconfiguredProjectPanel::priority() const
-{
- return -10;
-}
-
-bool UnconfiguredProjectPanel::supports(Project *project)
-{
- return project->targets().isEmpty() && project->supportsNoTargetPanel();
-}
-
-PropertiesPanel *UnconfiguredProjectPanel::createPanel(Project *project)
-{
- PropertiesPanel *panel = new PropertiesPanel;
- panel->setDisplayName(displayName());
- panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/unconfigured.png")));
-
- TargetSetupPageWrapper *w = new TargetSetupPageWrapper(project);
- panel->setWidget(w);
- return panel;
-}
-
/////////
/// TargetSetupPageWrapper
////////
@@ -98,8 +63,8 @@ TargetSetupPageWrapper::TargetSetupPageWrapper(Project *project) :
m_targetSetupPage->setProjectImporter(project->createProjectImporter());
m_targetSetupPage->setUseScrollArea(false);
m_targetSetupPage->setProjectPath(project->projectFilePath().toString());
- m_targetSetupPage->setRequiredKitMatcher(project->createRequiredKitMatcher());
- m_targetSetupPage->setPreferredKitMatcher(project->createPreferredKitMatcher());
+ m_targetSetupPage->setRequiredKitMatcher(project->requiredKitMatcher());
+ m_targetSetupPage->setPreferredKitMatcher(project->preferredKitMatcher());
m_targetSetupPage->initializePage();
m_targetSetupPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
updateNoteText();
diff --git a/src/plugins/projectexplorer/unconfiguredprojectpanel.h b/src/plugins/projectexplorer/unconfiguredprojectpanel.h
index 7f6967ebfd..d457061fb3 100644
--- a/src/plugins/projectexplorer/unconfiguredprojectpanel.h
+++ b/src/plugins/projectexplorer/unconfiguredprojectpanel.h
@@ -30,30 +30,18 @@
#ifndef UNCONFIGUREDPROJECTPANEL_H
#define UNCONFIGUREDPROJECTPANEL_H
-#include "iprojectproperties.h"
-
#include <QString>
+#include <QWidget>
QT_FORWARD_DECLARE_CLASS(QPushButton)
namespace ProjectExplorer {
class Kit;
+class Project;
class TargetSetupPage;
namespace Internal {
-class UnconfiguredProjectPanel : public IProjectPanelFactory
-{
- Q_OBJECT
-public:
- UnconfiguredProjectPanel();
- virtual QString id() const;
- virtual QString displayName() const;
- int priority() const;
- virtual bool supports(Project *project);
- virtual PropertiesPanel *createPanel(Project *project);
-};
-
class TargetSetupPageWrapper : public QWidget
{
Q_OBJECT
diff --git a/src/plugins/pythoneditor/pythoneditor.cpp b/src/plugins/pythoneditor/pythoneditor.cpp
index f68e7c8213..196091d480 100644
--- a/src/plugins/pythoneditor/pythoneditor.cpp
+++ b/src/plugins/pythoneditor/pythoneditor.cpp
@@ -47,21 +47,18 @@
namespace PythonEditor {
namespace Internal {
-PythonEditor::PythonEditor(EditorWidget *editorWidget)
+PythonEditor::PythonEditor(PythonEditorWidget *editorWidget)
:BaseTextEditor(editorWidget)
{
setContext(Core::Context(Constants::C_PYTHONEDITOR_ID,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
-}
-
-PythonEditor::~PythonEditor()
-{
+ setCommentStyle(Utils::CommentDefinition::HashStyle);
}
Core::IEditor *PythonEditor::duplicate()
{
- EditorWidget *widget = new EditorWidget(qobject_cast<EditorWidget *>(editorWidget()));
+ PythonEditorWidget *widget = new PythonEditorWidget(qobject_cast<PythonEditorWidget *>(editorWidget()));
TextEditor::TextEditorSettings::initializeEditor(widget);
return widget->editor();
}
@@ -71,7 +68,7 @@ bool PythonEditor::open(QString *errorString,
const QString &realFileName)
{
Core::MimeType mimeType = Core::MimeDatabase::findByFile(QFileInfo(fileName));
- baseTextDocument()->setMimeType(mimeType.type());
+ textDocument()->setMimeType(mimeType.type());
return TextEditor::BaseTextEditor::open(errorString, fileName, realFileName);
}
diff --git a/src/plugins/pythoneditor/pythoneditor.h b/src/plugins/pythoneditor/pythoneditor.h
index 0690118902..6c77597b73 100644
--- a/src/plugins/pythoneditor/pythoneditor.h
+++ b/src/plugins/pythoneditor/pythoneditor.h
@@ -35,15 +35,14 @@
namespace PythonEditor {
namespace Internal {
-class EditorWidget;
+class PythonEditorWidget;
class PythonEditor : public TextEditor::BaseTextEditor
{
Q_OBJECT
public:
- explicit PythonEditor(EditorWidget *editorWidget);
- virtual ~PythonEditor();
+ explicit PythonEditor(PythonEditorWidget *editorWidget);
Core::IEditor *duplicate();
diff --git a/src/plugins/pythoneditor/pythoneditorfactory.cpp b/src/plugins/pythoneditor/pythoneditorfactory.cpp
index c549646405..8a3c19e232 100644
--- a/src/plugins/pythoneditor/pythoneditorfactory.cpp
+++ b/src/plugins/pythoneditor/pythoneditorfactory.cpp
@@ -31,6 +31,7 @@
#include "pythoneditorconstants.h"
#include "pythoneditorwidget.h"
#include "pythoneditorplugin.h"
+#include "tools/pythonindenter.h"
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
@@ -39,6 +40,8 @@
#include <QDebug>
+using namespace TextEditor;
+
namespace PythonEditor {
namespace Internal {
@@ -57,7 +60,10 @@ EditorFactory::EditorFactory(QObject *parent)
Core::IEditor *EditorFactory::createEditor()
{
- EditorWidget *widget = new EditorWidget();
+ auto doc = new BaseTextDocument;
+ doc->setId(Constants::C_PYTHONEDITOR_ID);
+ doc->setIndenter(new PythonIndenter);
+ PythonEditorWidget *widget = new PythonEditorWidget(doc, 0);
TextEditor::TextEditorSettings::initializeEditor(widget);
return widget->editor();
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.h b/src/plugins/pythoneditor/pythoneditorplugin.h
index 2e8ac7d0fc..aa9457f6f6 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.h
+++ b/src/plugins/pythoneditor/pythoneditorplugin.h
@@ -37,7 +37,7 @@ namespace PythonEditor {
namespace Internal {
class EditorFactory;
-class EditorWidget;
+class PythonEditorWidget;
/**
\class PyEditor::Plugin implements ExtensionSystem::IPlugin
diff --git a/src/plugins/pythoneditor/pythoneditorwidget.cpp b/src/plugins/pythoneditor/pythoneditorwidget.cpp
index fc69254e9e..08e1f35258 100644
--- a/src/plugins/pythoneditor/pythoneditorwidget.cpp
+++ b/src/plugins/pythoneditor/pythoneditorwidget.cpp
@@ -35,7 +35,6 @@
#include "pythoneditorwidget.h"
#include "tools/pythonhighlighter.h"
-#include "tools/pythonindenter.h"
#include "pythoneditor.h"
#include "pythoneditorconstants.h"
@@ -48,46 +47,28 @@
namespace PythonEditor {
namespace Internal {
-EditorWidget::EditorWidget(QWidget *parent)
- : TextEditor::BaseTextEditorWidget(parent)
+PythonEditorWidget::PythonEditorWidget(TextEditor::BaseTextDocument *doc, QWidget *parent)
+ : TextEditor::BaseTextEditorWidget(doc, parent)
{
- baseTextDocument()->setId(Constants::C_PYTHONEDITOR_ID);
- baseTextDocument()->setIndenter(new PythonIndenter());
ctor();
}
-EditorWidget::EditorWidget(EditorWidget *other)
+PythonEditorWidget::PythonEditorWidget(PythonEditorWidget *other)
: TextEditor::BaseTextEditorWidget(other)
{
ctor();
}
-void EditorWidget::ctor()
+void PythonEditorWidget::ctor()
{
- m_commentDefinition.multiLineStart.clear();
- m_commentDefinition.multiLineEnd.clear();
- m_commentDefinition.singleLine = QLatin1Char('#');
-
setParenthesesMatchingEnabled(true);
setMarksVisible(true);
setCodeFoldingSupported(true);
- new PythonHighlighter(baseTextDocument());
-}
-
-EditorWidget::~EditorWidget()
-{
-}
-
-/**
- Comments or uncomments selection using Python commenting syntax
- */
-void EditorWidget::unCommentSelection()
-{
- Utils::unCommentSelection(this, m_commentDefinition);
+ new PythonHighlighter(textDocument());
}
-TextEditor::BaseTextEditor *EditorWidget::createEditor()
+TextEditor::BaseTextEditor *PythonEditorWidget::createEditor()
{
return new PythonEditor(this);
}
diff --git a/src/plugins/pythoneditor/pythoneditorwidget.h b/src/plugins/pythoneditor/pythoneditorwidget.h
index f9422d23a5..c182e195ad 100644
--- a/src/plugins/pythoneditor/pythoneditorwidget.h
+++ b/src/plugins/pythoneditor/pythoneditorwidget.h
@@ -31,29 +31,24 @@
#define PYTHONEDITORWIDGET_H
#include <texteditor/basetexteditor.h>
-#include <utils/uncommentselection.h>
namespace PythonEditor {
namespace Internal {
-class EditorWidget : public TextEditor::BaseTextEditorWidget
+class PythonEditorWidget : public TextEditor::BaseTextEditorWidget
{
Q_OBJECT
public:
- EditorWidget(QWidget *parent = 0);
- EditorWidget(EditorWidget *other);
- virtual ~EditorWidget();
-
- virtual void unCommentSelection();
+ PythonEditorWidget(TextEditor::BaseTextDocument *doc, QWidget *parent);
+ PythonEditorWidget(PythonEditorWidget *other);
protected:
TextEditor::BaseTextEditor *createEditor();
private:
- EditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
+ PythonEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
void ctor();
- Utils::CommentDefinition m_commentDefinition;
};
} // namespace Internal
diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp
index 65fded9055..e4f0cda681 100644
--- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp
+++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp
@@ -198,6 +198,11 @@ QStringList QbsBuildConfiguration::products() const
return m_products;
}
+void QbsBuildConfiguration::emitBuildTypeChanged()
+{
+ emit buildTypeChanged();
+}
+
QbsBuildConfiguration *QbsBuildConfiguration::setup(ProjectExplorer::Target *t,
const QString &defaultDisplayName,
const QString &displayName,
diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h
index b9360c6b14..44170adfb5 100644
--- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h
+++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h
@@ -76,6 +76,8 @@ public:
void setProducts(const QStringList &products);
QStringList products() const;
+ void emitBuildTypeChanged();
+
signals:
void qbsConfigurationChanged();
diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
index 1ee5ca17ec..00ed509aa9 100644
--- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
+++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
@@ -166,6 +166,9 @@ void QbsBuildStep::setQbsConfiguration(const QVariantMap &config)
if (tmp == m_qbsConfiguration)
return;
m_qbsConfiguration = tmp;
+ QbsBuildConfiguration *bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
+ if (bc)
+ bc->emitBuildTypeChanged();
emit qbsConfigurationChanged();
}
@@ -322,6 +325,9 @@ void QbsBuildStep::setBuildVariant(const QString &variant)
return;
m_qbsConfiguration.insert(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY), variant);
emit qbsConfigurationChanged();
+ QbsBuildConfiguration *bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
+ if (bc)
+ bc->emitBuildTypeChanged();
}
QString QbsBuildStep::profile() const
diff --git a/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui b/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui
index c0d88a9a7e..59a05486eb 100644
--- a/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui
+++ b/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui
@@ -108,7 +108,7 @@
<string/>
</property>
<property name="pixmap">
- <pixmap>:/coreplugin/images/warning.png</pixmap>
+ <pixmap resource="../coreplugin/core.qrc">:/core/images/warning.png</pixmap>
</property>
</widget>
</item>
@@ -248,6 +248,8 @@
<header location="global">qbsprojectmanager/qbspropertylineedit.h</header>
</customwidget>
</customwidgets>
- <resources/>
+ <resources>
+ <include location="../coreplugin/core.qrc"/>
+ </resources>
<connections/>
</ui>
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index 2d137cb64b..8e73b24a40 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -739,7 +739,7 @@ void QbsProject::updateQmlJsCodeModel(const qbs::ProjectData &prj)
return;
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
- QmlJSTools::defaultProjectInfoForProject(this);
+ modelManager->defaultProjectInfoForProject(this);
setProjectLanguage(ProjectExplorer::Constants::LANG_QMLJS, !projectInfo.sourceFiles.isEmpty());
modelManager->updateProjectInfo(projectInfo, this);
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
index 4cc2cbb8a1..b796b010f6 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
@@ -77,17 +77,6 @@ static QbsProject *currentEditorProject()
return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath())) : 0;
}
-class QbsFeatureProvider : public Core::IFeatureProvider
-{
- Core::FeatureSet availableFeatures(const QString & /* platform */) const {
- return Core::FeatureSet("Qbs.QbsSupport");
- }
-
- QStringList availablePlatforms() const { return QStringList(); }
- QString displayNameForPlatform(const QString & /* platform */) const { return QString(); }
-};
-
-
QbsProjectManagerPlugin::QbsProjectManagerPlugin() :
m_selectedProject(0),
m_selectedNode(0),
@@ -114,7 +103,6 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new QbsInstallStepFactory);
addAutoReleasedObject(new QbsDeployConfigurationFactory);
addAutoReleasedObject(new QbsRunConfigurationFactory);
- addAutoReleasedObject(new QbsFeatureProvider);
//menus
// Build Menu:
diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
index 1e115e71eb..5c5a52a066 100644
--- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
+++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
@@ -50,6 +50,8 @@
#include <qtsupport/qtkitinformation.h>
#include <utils/hostosinfo.h>
+#include "api/runenvironment.h"
+
#include <QFileInfo>
#include <QFormLayout>
#include <QLabel>
@@ -283,7 +285,19 @@ void QbsRunConfiguration::setRunMode(ApplicationLauncher::Mode runMode)
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
{
- // TODO: Use environment from Qbs!
+ QbsProject *project = static_cast<QbsProject *>(target()->project());
+ if (project) {
+ const qbs::ProductData product = findProduct(project->qbsProjectData(), m_qbsProduct);
+ if (product.isValid()) {
+ qbs::RunEnvironment qbsRunEnv = project->qbsProject().getRunEnvironment(product, env.toProcessEnvironment(), QbsManager::settings());
+ QProcessEnvironment procEnv = qbsRunEnv.runEnvironment();
+ if (!procEnv.isEmpty()) {
+ env = Utils::Environment();
+ foreach (const QString &key, procEnv.keys())
+ env.set(key, procEnv.value(key));
+ }
+ }
+ }
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
if (qtVersion)
diff --git a/src/plugins/qmakeandroidsupport/QmakeAndroidSupport.pluginspec.in b/src/plugins/qmakeandroidsupport/QmakeAndroidSupport.pluginspec.in
new file mode 100644
index 0000000000..d77e8fb4b2
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/QmakeAndroidSupport.pluginspec.in
@@ -0,0 +1,17 @@
+<plugin name=\"QmakeAndroidSupport\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_COMPAT_VERSION\">
+ <vendor>Digia Plc</vendor>
+ <copyright>(C) 2014 Digia Plc</copyright>
+ <license>
+Commercial Usage
+
+Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Digia.
+
+GNU Lesser General Public License Usage
+
+Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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.
+ </license>
+ <category>Build Systems</category>
+ <description>Android support for qmake project manager</description>
+ <url>http://www.qt-project.org</url>
+ $$dependencyList
+</plugin>
diff --git a/src/plugins/android/androidextralibrarylistmodel.cpp b/src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.cpp
index b2499bcc0b..7dc01541bb 100644
--- a/src/plugins/android/androidextralibrarylistmodel.cpp
+++ b/src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.cpp
@@ -33,7 +33,7 @@
#include <qmakeprojectmanager/qmakenodes.h>
#include <proparser/prowriter.h>
-using namespace Android;
+using namespace QmakeAndroidSupport;
using namespace Internal;
AndroidExtraLibraryListModel::AndroidExtraLibraryListModel(QmakeProjectManager::QmakeProject *project,
diff --git a/src/plugins/android/androidextralibrarylistmodel.h b/src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.h
index 86e82672ea..21be9dc81e 100644
--- a/src/plugins/android/androidextralibrarylistmodel.h
+++ b/src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.h
@@ -39,7 +39,8 @@ class QmakeProject;
class QmakeProFileNode;
}
-namespace Android {
+namespace QmakeAndroidSupport {
+
namespace Internal {
class AndroidExtraLibraryListModel : public QAbstractItemModel
{
@@ -72,6 +73,6 @@ private:
};
} // namespace Internal
-} // namespace Android
+} // namespace QmakeAndroidSupport
#endif // ANDROIDEXTRALIBRARYLISTMODEL_H
diff --git a/src/plugins/android/androidpackageinstallationfactory.cpp b/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.cpp
index 791f9a7bea..db95ff4776 100644
--- a/src/plugins/android/androidpackageinstallationfactory.cpp
+++ b/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.cpp
@@ -28,19 +28,18 @@
****************************************************************************/
#include "androidpackageinstallationfactory.h"
-
#include "androidpackageinstallationstep.h"
-#include "androidmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
+#include <android/androidmanager.h>
using namespace ProjectExplorer;
-namespace Android {
+namespace QmakeAndroidSupport {
namespace Internal {
AndroidPackageInstallationFactory::AndroidPackageInstallationFactory(QObject *parent)
@@ -77,9 +76,9 @@ BuildStep *AndroidPackageInstallationFactory::create(BuildStepList *parent, Core
bool AndroidPackageInstallationFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
{
- if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
+ if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD)
return false;
- if (!AndroidManager::supportsAndroid(parent->target()))
+ if (!Android::AndroidManager::supportsAndroid(parent->target()))
return false;
if (parent->contains(AndroidPackageInstallationStep::Id))
return false;
@@ -89,7 +88,7 @@ bool AndroidPackageInstallationFactory::canRestore(BuildStepList *parent, const
BuildStep *AndroidPackageInstallationFactory::restore(BuildStepList *parent, const QVariantMap &map)
{
Q_ASSERT(canRestore(parent, map));
- AndroidPackageInstallationStep * const step = new AndroidPackageInstallationStep(AndroidPackageInstallationStep::ProjectDirectory, parent);
+ AndroidPackageInstallationStep * const step = new AndroidPackageInstallationStep(parent);
if (!step->fromMap(map)) {
delete step;
return 0;
diff --git a/src/plugins/android/androidpackageinstallationfactory.h b/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.h
index b2ea80f89f..0e04938691 100644
--- a/src/plugins/android/androidpackageinstallationfactory.h
+++ b/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.h
@@ -32,7 +32,7 @@
#include <projectexplorer/buildstep.h>
-namespace Android {
+namespace QmakeAndroidSupport {
namespace Internal {
class AndroidPackageInstallationFactory: public ProjectExplorer::IBuildStepFactory
@@ -58,6 +58,6 @@ public:
};
} // namespace Internal
-} // namespace Android
+} // namespace QmakeAndroidSupport
#endif // ANDROIDPACKAGEINSTALLATIONFACTORY_H
diff --git a/src/plugins/android/androidpackageinstallationstep.cpp b/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp
index a3e0f34ac6..7ab25d14b3 100644
--- a/src/plugins/android/androidpackageinstallationstep.cpp
+++ b/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp
@@ -28,8 +28,8 @@
****************************************************************************/
#include "androidpackageinstallationstep.h"
-#include "androidmanager.h"
-#include "androidconstants.h"
+
+#include <android/androidconstants.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/target.h>
@@ -38,19 +38,15 @@
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/gnumakeparser.h>
#include <utils/hostosinfo.h>
-#include <qmakeprojectmanager/qmakeparser.h>
#include <QDir>
-using namespace Android::Internal;
+using namespace QmakeAndroidSupport::Internal;
const Core::Id AndroidPackageInstallationStep::Id = Core::Id("Qt4ProjectManager.AndroidPackageInstallationStep");
-namespace {
-const char ANDROIDDIRECTORY[] = "Android.AndroidPackageInstallationStep.AndroidDirectory";
-}
-AndroidPackageInstallationStep::AndroidPackageInstallationStep(AndroidDirectory mode,ProjectExplorer::BuildStepList *bsl)
- : AbstractProcessStep(bsl, Id), m_androidDirectory(mode)
+AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bsl)
+ : AbstractProcessStep(bsl, Id)
{
const QString name = tr("Copy application data");
setDefaultDisplayName(name);
@@ -64,13 +60,7 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::
bool AndroidPackageInstallationStep::init()
{
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
- if (!bc)
- bc = target()->activeBuildConfiguration();
- QString dirPath;
- if (m_androidDirectory == ProjectDirectory)
- dirPath = AndroidManager::dirPath(target()).toString();
- else
- dirPath = bc->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY)).toString();
+ QString dirPath = bc->buildDirectory().appendPath(QLatin1String(Android::Constants::ANDROID_BUILDDIRECTORY)).toString();
if (Utils::HostOsInfo::isWindowsHost())
if (bc->environment().searchInPath(QLatin1String("sh.exe")).isEmpty())
dirPath = QDir::toNativeSeparators(dirPath);
@@ -95,19 +85,11 @@ bool AndroidPackageInstallationStep::init()
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
- m_androidDirToClean = m_androidDirectory == BuildDirectory ? dirPath : QString();
+ m_androidDirToClean = dirPath;
return AbstractProcessStep::init();
}
-bool AndroidPackageInstallationStep::fromMap(const QVariantMap &map)
-{
- if (!AbstractProcessStep::fromMap(map))
- return false;
- m_androidDirectory = AndroidDirectory(map.value(QLatin1String(ANDROIDDIRECTORY)).toInt());
- return true;
-}
-
void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi)
{
QString error;
@@ -124,13 +106,6 @@ void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi)
AbstractProcessStep::run(fi);
}
-QVariantMap AndroidPackageInstallationStep::toMap() const
-{
- QVariantMap map = AbstractProcessStep::toMap();
- map.insert(QLatin1String(ANDROIDDIRECTORY), m_androidDirectory);
- return map;
-}
-
ProjectExplorer::BuildStepConfigWidget *AndroidPackageInstallationStep::createConfigWidget()
{
return new AndroidPackageInstallationStepWidget(this);
diff --git a/src/plugins/android/androidpackageinstallationstep.h b/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.h
index dd61729925..9f4439c46f 100644
--- a/src/plugins/android/androidpackageinstallationstep.h
+++ b/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.h
@@ -33,7 +33,7 @@
#include <projectexplorer/buildstep.h>
#include <projectexplorer/abstractprocessstep.h>
-namespace Android {
+namespace QmakeAndroidSupport {
namespace Internal {
class AndroidPackageInstallationStep : public ProjectExplorer::AbstractProcessStep
@@ -42,13 +42,9 @@ class AndroidPackageInstallationStep : public ProjectExplorer::AbstractProcessSt
friend class AndroidPackageInstallationFactory;
public:
- enum AndroidDirectory { ProjectDirectory, BuildDirectory };
- explicit AndroidPackageInstallationStep(AndroidDirectory mode, ProjectExplorer::BuildStepList *bsl);
+ explicit AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bsl);
bool init();
- bool fromMap(const QVariantMap &map);
- QVariantMap toMap() const;
-
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
bool immutable() const;
@@ -56,7 +52,6 @@ public:
private:
AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bc,
AndroidPackageInstallationStep *other);
- AndroidDirectory m_androidDirectory;
QString m_androidDirToClean;
static const Core::Id Id;
};
@@ -75,6 +70,6 @@ private:
};
} // namespace Internal
-} // namespace Android
+} // namespace QmakeAndroidSupport
#endif // ANDROIDPACKAGEINSTALLATIONSTEP_H
diff --git a/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.cpp b/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.cpp
new file mode 100644
index 0000000000..1390c6d3ec
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "androidqmakebuildconfigurationfactory.h"
+#include "qmakeandroidbuildapkstep.h"
+#include "androidpackageinstallationstep.h"
+
+#include <android/androidmanager.h>
+#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/projectexplorerconstants.h>
+
+using namespace QmakeAndroidSupport::Internal;
+
+int AndroidQmakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
+{
+ if (QmakeBuildConfigurationFactory::priority(k, projectPath) >= 0
+ && Android::AndroidManager::supportsAndroid(k))
+ return 1;
+ return -1;
+}
+
+int AndroidQmakeBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
+{
+ if (QmakeBuildConfigurationFactory::priority(parent) >= 0
+ && Android::AndroidManager::supportsAndroid(parent))
+ return 1;
+ return -1;
+}
+
+ProjectExplorer::BuildConfiguration *AndroidQmakeBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const ProjectExplorer::BuildInfo *info) const
+{
+ ProjectExplorer::BuildConfiguration *bc = QmakeBuildConfigurationFactory::create(parent, info);
+ ProjectExplorer::BuildStepList *buildSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
+ buildSteps->insertStep(2, new AndroidPackageInstallationStep(buildSteps));
+ buildSteps->insertStep(3, new QmakeAndroidBuildApkStep(buildSteps));
+
+ return bc;
+}
+
+// should the buildconfiguration have its own id?
+// and implement restore/clone then?
+
+
diff --git a/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.h b/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.h
new file mode 100644
index 0000000000..b8a40a2819
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef ANDROIDQMAKEBUILDCONFIGURATIONFACTORY_H
+#define ANDROIDQMAKEBUILDCONFIGURATIONFACTORY_H
+
+#include <qmakeprojectmanager/qmakebuildconfiguration.h>
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+class AndroidQmakeBuildConfigurationFactory : public QmakeProjectManager::QmakeBuildConfigurationFactory
+{
+public:
+ explicit AndroidQmakeBuildConfigurationFactory(QObject *parent = 0)
+ : QmakeBuildConfigurationFactory(parent)
+ { }
+
+ int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const;
+ int priority(const ProjectExplorer::Target *parent) const;
+
+ ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
+ const ProjectExplorer::BuildInfo *info) const;
+ // The clone and restore from QmakeBuildConfigurationFactory
+ // work for us too.
+};
+
+} // namespace Internal
+} // namespace QmakeProjectManager
+
+
+#endif // ANDROIDQMAKEBUILDCONFIGURATIONFACTORY_H
diff --git a/src/plugins/android/createandroidmanifestwizard.cpp b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp
index fffe8e5e5b..8e2f16239a 100644
--- a/src/plugins/android/createandroidmanifestwizard.cpp
+++ b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp
@@ -29,21 +29,30 @@
#include "createandroidmanifestwizard.h"
+#include <android/androidmanager.h>
+#include <android/androidqtsupport.h>
+
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/coreconstants.h>
+
#include <projectexplorer/target.h>
+
#include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakenodes.h>
+
#include <proparser/prowriter.h>
+
+#include <qtsupport/qtkitinformation.h>
+
#include <QComboBox>
#include <QFormLayout>
#include <QLabel>
#include <QMessageBox>
#include <QVBoxLayout>
-#include <qtsupport/qtkitinformation.h>
-#include <coreplugin/coreconstants.h>
-#include <coreplugin/editormanager/editormanager.h>
using namespace Android;
-using namespace Android::Internal;
+using namespace QmakeAndroidSupport::Internal;
+
using QmakeProjectManager::QmakeProject;
using QmakeProjectManager::QmakeProFileNode;
@@ -204,14 +213,21 @@ void CreateAndroidManifestWizard::setDirectory(const QString &directory)
m_directory = directory;
}
-QString CreateAndroidManifestWizard::sourceFileName() const
+QString CreateAndroidManifestWizard::sourceFolder() const
{
- QString result;
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_target->kit());
if (!version)
- return result;
+ return QString();
+ return version->qmakeProperty("QT_INSTALL_PREFIX");
+}
+
+QString CreateAndroidManifestWizard::sourceFileName() const
+{
+ QString srcFolder = sourceFolder();
+ if (srcFolder.isEmpty())
+ return srcFolder;
Utils::FileName srcPath
- = Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_PREFIX"))
+ = Utils::FileName::fromString(srcFolder)
.appendPath(QLatin1String("src/android/java"));
srcPath.appendPath(QLatin1String("AndroidManifest.xml"));
return srcPath.toString();
@@ -241,9 +257,20 @@ void CreateAndroidManifestWizard::createAndroidManifestFile()
}
}
- if (!QFile::copy(sourceFileName(), fileName)) {
+ QString srcFileName = sourceFileName();
+
+ if (!QFileInfo(srcFileName).exists()) {
+ QMessageBox::warning(this, tr("File Creation Error"),
+ tr("\"%1\" is missing.\n"
+ "Check your Qt installation here:\n"
+ "\"%2\"").arg(fileName).arg(sourceFolder()));
+ return;
+ }
+
+ if (!QFile::copy(srcFileName, fileName)) {
QMessageBox::warning(this, tr("File Creation Error"),
- tr("Could not create file %1.").arg(fileName));
+ tr("Could not create file %1.\n"
+ "Verify that you have writing rights in your project directory.").arg(fileName));
return;
}
diff --git a/src/plugins/android/createandroidmanifestwizard.h b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.h
index 8cb8c95b7f..fa1abca462 100644
--- a/src/plugins/android/createandroidmanifestwizard.h
+++ b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.h
@@ -40,7 +40,7 @@ QT_END_NAMESPACE
namespace ProjectExplorer { class Target; }
namespace QmakeProjectManager { class QmakeProFileNode; }
-namespace Android {
+namespace QmakeAndroidSupport {
namespace Internal {
class CreateAndroidManifestWizard;
@@ -92,6 +92,7 @@ public:
QmakeProjectManager::QmakeProFileNode *node() const;
void setNode(QmakeProjectManager::QmakeProFileNode *node);
+ QString sourceFolder() const;
QString sourceFileName() const;
void accept();
@@ -104,7 +105,8 @@ private:
QmakeProjectManager::QmakeProFileNode *m_node;
QString m_directory;
};
-}
-}
+
+} //namespace QmakeAndroidSupport
+} //namespace Internal
#endif // CREATEANDROIDMANIFESTWIZARD_H
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp
new file mode 100644
index 0000000000..44158c3c93
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp
@@ -0,0 +1,297 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "qmakeandroidbuildapkstep.h"
+#include "qmakeandroidbuildapkwidget.h"
+
+#include <android/androidconfigurations.h>
+#include <android/androidconstants.h>
+#include <android/androidmanager.h>
+#include <android/androidqtsupport.h>
+
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/qtkitinformation.h>
+#include <qmakeprojectmanager/qmakenodes.h>
+#include <qmakeprojectmanager/qmakeproject.h>
+
+#include <utils/qtcprocess.h>
+
+#include <QHBoxLayout>
+
+using namespace Android;
+using QmakeProjectManager::QmakeProject;
+using QmakeProjectManager::QmakeProFileNode;
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+const Core::Id ANDROID_BUILD_APK_ID("QmakeProjectManager.AndroidBuildApkStep");
+const QLatin1String ProFilePathForInputFile("ProFilePathForInputFile");
+
+
+//////////////////
+// QmakeAndroidBuildApkStepFactory
+/////////////////
+
+QmakeAndroidBuildApkStepFactory::QmakeAndroidBuildApkStepFactory(QObject *parent)
+ : IBuildStepFactory(parent)
+{
+}
+
+QList<Core::Id> QmakeAndroidBuildApkStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
+{
+ if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD
+ || !canHandle(parent->target())
+ || parent->contains(ANDROID_BUILD_APK_ID)) {
+ return QList<Core::Id>();
+ }
+
+ return QList<Core::Id>() << ANDROID_BUILD_APK_ID;
+}
+
+QString QmakeAndroidBuildApkStepFactory::displayNameForId(const Core::Id id) const
+{
+ if (id == ANDROID_BUILD_APK_ID)
+ return tr("Build Android APK");
+ return QString();
+}
+
+bool QmakeAndroidBuildApkStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
+{
+ return availableCreationIds(parent).contains(id);
+}
+
+ProjectExplorer::BuildStep *QmakeAndroidBuildApkStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
+{
+ Q_ASSERT(canCreate(parent, id));
+ Q_UNUSED(id);
+ return new QmakeAndroidBuildApkStep(parent);
+}
+
+bool QmakeAndroidBuildApkStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
+{
+ return canCreate(parent, ProjectExplorer::idFromMap(map));
+}
+
+ProjectExplorer::BuildStep *QmakeAndroidBuildApkStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
+{
+ Q_ASSERT(canRestore(parent, map));
+ QmakeAndroidBuildApkStep * const step = new QmakeAndroidBuildApkStep(parent);
+ if (!step->fromMap(map)) {
+ delete step;
+ return 0;
+ }
+ return step;
+}
+
+bool QmakeAndroidBuildApkStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
+{
+ return canCreate(parent, product->id());
+}
+
+ProjectExplorer::BuildStep *QmakeAndroidBuildApkStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
+{
+ Q_ASSERT(canClone(parent, product));
+ return new QmakeAndroidBuildApkStep(parent, static_cast<QmakeAndroidBuildApkStep *>(product));
+}
+
+bool QmakeAndroidBuildApkStepFactory::canHandle(ProjectExplorer::Target *t) const
+{
+ return t->project()->supportsKit(t->kit())
+ && AndroidManager::supportsAndroid(t)
+ && qobject_cast<QmakeProject *>(t->project());
+}
+
+
+QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc)
+ :Android::AndroidBuildApkStep(bc, ANDROID_BUILD_APK_ID)
+{
+ ctor();
+}
+
+QString QmakeAndroidBuildApkStep::proFilePathForInputFile() const
+{
+ return m_proFilePathForInputFile;
+}
+
+void QmakeAndroidBuildApkStep::setProFilePathForInputFile(const QString &path)
+{
+ m_proFilePathForInputFile = path;
+}
+
+QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, QmakeAndroidBuildApkStep *other)
+ : Android::AndroidBuildApkStep(bc, other),
+ m_proFilePathForInputFile(other->m_proFilePathForInputFile)
+{
+ ctor();
+}
+
+Utils::FileName QmakeAndroidBuildApkStep::androidPackageSourceDir() const
+{
+ QmakeProjectManager::QmakeProject *pro = static_cast<QmakeProjectManager::QmakeProject *>(project());
+ const QmakeProjectManager::QmakeProFileNode *node
+ = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile);
+ if (!node)
+ return Utils::FileName();
+ return Utils::FileName::fromString(node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir));
+}
+
+void QmakeAndroidBuildApkStep::ctor()
+{
+ connect(project(), SIGNAL(proFilesEvaluated()),
+ this, SLOT(updateInputFile()));
+}
+
+bool QmakeAndroidBuildApkStep::init()
+{
+ if (AndroidManager::checkForQt51Files(project()->projectDirectory()))
+ emit addOutput(tr("Found old folder \"android\" in source directory. Qt 5.2 does not use that folder by default."), ErrorOutput);
+
+ if (!Android::AndroidBuildApkStep::init())
+ return false;
+
+ QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ if (!version)
+ return false;
+
+ QString command = version->qmakeProperty("QT_HOST_BINS");
+ if (!command.endsWith(QLatin1Char('/')))
+ command += QLatin1Char('/');
+ command += QLatin1String("androiddeployqt");
+ if (Utils::HostOsInfo::isWindowsHost())
+ command += QLatin1String(".exe");
+
+ QString deploymentMethod;
+ if (m_deployAction == MinistroDeployment)
+ deploymentMethod = QLatin1String("ministro");
+ else if (m_deployAction == DebugDeployment)
+ deploymentMethod = QLatin1String("debug");
+ else if (m_deployAction == BundleLibrariesDeployment)
+ deploymentMethod = QLatin1String("bundled");
+
+ ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
+ QString outputDir = bc->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY)).toString();
+
+ const auto *pro = static_cast<QmakeProjectManager::QmakeProject *>(project());
+ const QmakeProjectManager::QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile);
+ if (!node) { // should never happen
+ emit addOutput(tr("Internal Error: Could not find .pro file."), BuildStep::ErrorMessageOutput);
+ return false;
+ }
+
+ QString inputFile = node->singleVariableValue(QmakeProjectManager::AndroidDeploySettingsFile);
+ if (inputFile.isEmpty()) { // should never happen
+ emit addOutput(tr("Internal Error: Unknown Android deployment JSON file location."), BuildStep::ErrorMessageOutput);
+ return false;
+ }
+
+ QStringList arguments;
+ arguments << QLatin1String("--input")
+ << inputFile
+ << QLatin1String("--output")
+ << outputDir
+ << QLatin1String("--deployment")
+ << deploymentMethod
+ << QLatin1String("--ant")
+ << AndroidConfigurations::currentConfig().antToolPath().toString()
+ << QLatin1String("--android-platform")
+ << AndroidManager::buildTargetSDK(target())
+ << QLatin1String("--jdk")
+ << AndroidConfigurations::currentConfig().openJDKLocation().toString();
+
+ if (m_verbose)
+ arguments << QLatin1String("--verbose");
+
+ if (buildConfiguration()->buildType() == ProjectExplorer::BuildConfiguration::Release)
+ arguments << QLatin1String("--release");
+
+ if (m_signPackage) {
+ arguments << QLatin1String("--sign")
+ << m_keystorePath.toString()
+ << m_certificateAlias
+ << QLatin1String("--storepass")
+ << m_keystorePasswd;
+ if (!m_certificatePasswd.isEmpty())
+ arguments << QLatin1String("--keypass")
+ << m_certificatePasswd;
+ }
+
+ ProjectExplorer::ProcessParameters *pp = processParameters();
+ pp->setMacroExpander(bc->macroExpander());
+ pp->setWorkingDirectory(bc->buildDirectory().toString());
+ Utils::Environment env = bc->environment();
+ pp->setEnvironment(env);
+ pp->setCommand(command);
+ pp->setArguments(Utils::QtcProcess::joinArgs(arguments));
+ pp->resolveAll();
+
+ return true;
+}
+
+ProjectExplorer::BuildStepConfigWidget *QmakeAndroidBuildApkStep::createConfigWidget()
+{
+ return new QmakeAndroidBuildApkWidget(this);
+}
+
+bool QmakeAndroidBuildApkStep::fromMap(const QVariantMap &map)
+{
+ m_proFilePathForInputFile = map.value(ProFilePathForInputFile).toString();
+ return Android::AndroidBuildApkStep::fromMap(map);
+}
+
+QVariantMap QmakeAndroidBuildApkStep::toMap() const
+{
+ QVariantMap map = Android::AndroidBuildApkStep::toMap();
+ map.insert(ProFilePathForInputFile, m_proFilePathForInputFile);
+ return map;
+}
+
+void QmakeAndroidBuildApkStep::updateInputFile()
+{
+ QmakeProject *pro = static_cast<QmakeProject *>(project());
+ QList<QmakeProFileNode *> nodes = pro->applicationProFiles();
+
+ const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile);
+ if (!nodes.contains(const_cast<QmakeProFileNode *>(node))) {
+ if (!nodes.isEmpty())
+ m_proFilePathForInputFile = nodes.first()->path();
+ else
+ m_proFilePathForInputFile.clear();
+ }
+
+ emit inputFileChanged();
+}
+
+} // namespace Internal
+} // namespace QmakeProjectManager
diff --git a/src/plugins/android/androiddeploystepfactory.h b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.h
index 8d27b85d51..73684f4e30 100644
--- a/src/plugins/android/androiddeploystepfactory.h
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.h
@@ -1,6 +1,7 @@
/**************************************************************************
**
** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
@@ -27,19 +28,19 @@
**
****************************************************************************/
-#ifndef ANDROIDDEPLOYSTEPFACTORY_H
-#define ANDROIDDEPLOYSTEPFACTORY_H
+#ifndef QMAKEANDROIDBUILDAPKSTEP_H
+#define QMAKEANDROIDBUILDAPKSTEP_H
-#include <projectexplorer/buildstep.h>
+#include <android/androidbuildapkstep.h>
-namespace Android {
+namespace QmakeAndroidSupport {
namespace Internal {
-class AndroidDeployStepFactory : public ProjectExplorer::IBuildStepFactory
+class QmakeAndroidBuildApkStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
- explicit AndroidDeployStepFactory(QObject *parent = 0);
+ explicit QmakeAndroidBuildApkStepFactory(QObject *parent = 0);
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(Core::Id id) const;
@@ -54,9 +55,45 @@ public:
ProjectExplorer::BuildStep *product) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *product);
+private:
+ bool canHandle(ProjectExplorer::Target *t) const;
+
+};
+
+class QmakeAndroidBuildApkStep : public Android::AndroidBuildApkStep
+{
+ Q_OBJECT
+public:
+ QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc);
+ QString proFilePathForInputFile() const;
+ void setProFilePathForInputFile(const QString &path);
+
+protected:
+ friend class QmakeAndroidBuildApkStepFactory;
+ QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc,
+ QmakeAndroidBuildApkStep *other);
+
+ Utils::FileName androidPackageSourceDir() const;
+
+protected:
+ void ctor();
+ bool init();
+ ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
+ bool fromMap(const QVariantMap &map);
+ QVariantMap toMap() const;
+
+signals:
+ // also on purpose emitted if the possible values of this changed
+ void inputFileChanged();
+
+private slots:
+ void updateInputFile();
+
+private:
+ QString m_proFilePathForInputFile;
};
} // namespace Internal
-} // namespace Android
+} // namespace QmakeAndroidSupport
-#endif // ANDROIDDEPLOYSTEPFACTORY_H
+#endif // QMAKEANDROIDBUILDAPKSTEP_H
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.cpp
new file mode 100644
index 0000000000..d5d9ffbe3b
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.cpp
@@ -0,0 +1,193 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "createandroidmanifestwizard.h"
+#include "qmakeandroidbuildapkstep.h"
+#include "qmakeandroidbuildapkwidget.h"
+#include "ui_qmakeandroidbuildapkwidget.h"
+
+#include <android/androidbuildapkwidget.h>
+#include <android/androidmanager.h>
+#include <qmakeprojectmanager/qmakenodes.h>
+#include <qmakeprojectmanager/qmakeproject.h>
+
+#include <QFileDialog>
+
+using QmakeProjectManager::QmakeProject;
+using QmakeProjectManager::QmakeProFileNode;
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+QmakeAndroidBuildApkWidget::QmakeAndroidBuildApkWidget(QmakeAndroidBuildApkStep *step) :
+ ProjectExplorer::BuildStepConfigWidget(),
+ m_ui(new Ui::QmakeAndroidBuildApkWidget),
+ m_step(step),
+ m_extraLibraryListModel(0),
+ m_ignoreChange(false)
+{
+ QVBoxLayout *topLayout = new QVBoxLayout;
+
+ QHBoxLayout *qt51WarningLayout = new QHBoxLayout();
+ QLabel *oldFilesWarningIcon = new QLabel(this);
+ oldFilesWarningIcon->setObjectName(QStringLiteral("oldFilesWarningIcon"));
+ QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
+ sizePolicy.setHorizontalStretch(0);
+ sizePolicy.setVerticalStretch(0);
+ sizePolicy.setHeightForWidth(oldFilesWarningIcon->sizePolicy().hasHeightForWidth());
+ oldFilesWarningIcon->setSizePolicy(sizePolicy);
+ oldFilesWarningIcon->setPixmap(QPixmap(QLatin1String(":/core/images/warning.png")));
+ oldFilesWarningIcon->setAlignment(Qt::Alignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop));
+ qt51WarningLayout->addWidget(oldFilesWarningIcon);
+
+ QLabel *oldFilesWarningLabel = new QLabel(this);
+ oldFilesWarningLabel->setObjectName(QStringLiteral("oldFilesWarningLabel"));
+ oldFilesWarningLabel->setWordWrap(true);
+ qt51WarningLayout->addWidget(oldFilesWarningLabel);
+
+ topLayout->addWidget(new Android::AndroidBuildApkWidget(step));
+
+ QWidget *widget = new QWidget(this);
+ m_ui->setupUi(widget);
+ topLayout->addWidget(widget);
+ setLayout(topLayout);
+
+ bool oldFiles = Android::AndroidManager::checkForQt51Files(m_step->project()->projectDirectory());
+ oldFilesWarningIcon->setVisible(oldFiles);
+ oldFilesWarningLabel->setVisible(oldFiles);
+
+ m_extraLibraryListModel = new AndroidExtraLibraryListModel(static_cast<QmakeProject *>(m_step->project()), this);
+ m_ui->androidExtraLibsListView->setModel(m_extraLibraryListModel);
+
+ updateInputFileUi();
+ connect(m_step, SIGNAL(inputFileChanged()),
+ SLOT(updateInputFileUi()));
+
+ connect(m_ui->inputFileComboBox, SIGNAL(currentIndexChanged(int)),
+ SLOT(inputFileComboBoxIndexChanged()));
+
+ connect(m_ui->createAndroidManifestButton, SIGNAL(clicked()),
+ SLOT(createManifestButton()));
+
+ connect(m_ui->addAndroidExtraLibButton, SIGNAL(clicked()),
+ SLOT(addAndroidExtraLib()));
+
+ connect(m_ui->removeAndroidExtraLibButton, SIGNAL(clicked()),
+ SLOT(removeAndroidExtraLib()));
+
+ connect(m_ui->androidExtraLibsListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ SLOT(checkEnableRemoveButton()));
+
+ connect(m_extraLibraryListModel, SIGNAL(enabledChanged(bool)),
+ m_ui->additionalLibrariesGroupBox, SLOT(setEnabled(bool)));
+
+ m_ui->additionalLibrariesGroupBox->setEnabled(m_extraLibraryListModel->isEnabled());
+}
+
+QmakeAndroidBuildApkWidget::~QmakeAndroidBuildApkWidget()
+{
+ delete m_ui;
+}
+
+void QmakeAndroidBuildApkWidget::updateInputFileUi()
+{
+ QmakeProject *project
+ = static_cast<QmakeProject *>(m_step->project());
+ QList<QmakeProFileNode *> nodes = project->applicationProFiles();
+ int size = nodes.size();
+ if (size == 0 || size == 1) {
+ // there's nothing to select, e.g. before parsing
+ m_ui->inputFileLabel->setVisible(false);
+ m_ui->inputFileComboBox->setVisible(false);
+ } else {
+ m_ignoreChange = true;
+ m_ui->inputFileLabel->setVisible(true);
+ m_ui->inputFileComboBox->setVisible(true);
+
+ m_ui->inputFileComboBox->clear();
+ foreach (QmakeProFileNode *node, nodes)
+ m_ui->inputFileComboBox->addItem(node->displayName(), node->path());
+
+ int index = m_ui->inputFileComboBox->findData(m_step->proFilePathForInputFile());
+ m_ui->inputFileComboBox->setCurrentIndex(index);
+ m_ignoreChange = false;
+ }
+}
+
+void QmakeAndroidBuildApkWidget::inputFileComboBoxIndexChanged()
+{
+ if (m_ignoreChange)
+ return;
+
+ QString proFilePath = m_ui->inputFileComboBox->itemData(m_ui->inputFileComboBox->currentIndex()).toString();
+ m_step->setProFilePathForInputFile(proFilePath);
+}
+
+void QmakeAndroidBuildApkWidget::createManifestButton()
+{
+ CreateAndroidManifestWizard wizard(m_step->target());
+ wizard.exec();
+}
+
+void QmakeAndroidBuildApkWidget::addAndroidExtraLib()
+{
+ QStringList fileNames = QFileDialog::getOpenFileNames(this,
+ tr("Select additional libraries"),
+ QDir::homePath(),
+ tr("Libraries (*.so)"));
+
+ if (!fileNames.isEmpty())
+ m_extraLibraryListModel->addEntries(fileNames);
+}
+
+void QmakeAndroidBuildApkWidget::removeAndroidExtraLib()
+{
+ QModelIndexList removeList = m_ui->androidExtraLibsListView->selectionModel()->selectedIndexes();
+ m_extraLibraryListModel->removeEntries(removeList);
+}
+
+void QmakeAndroidBuildApkWidget::checkEnableRemoveButton()
+{
+ m_ui->removeAndroidExtraLibButton->setEnabled(m_ui->androidExtraLibsListView->selectionModel()->hasSelection());
+}
+
+QString QmakeAndroidBuildApkWidget::summaryText() const
+{
+ return tr("<b>Build Android APK</b>");
+}
+
+QString QmakeAndroidBuildApkWidget::displayName() const
+{
+ return summaryText();
+}
+
+} // namespace Internal
+} // namespace QmakeProjectManager
+
+
diff --git a/src/plugins/android/androidpackagecreationfactory.h b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.h
index a987ed643b..155d0321e4 100644
--- a/src/plugins/android/androidpackagecreationfactory.h
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.h
@@ -27,37 +27,59 @@
**
****************************************************************************/
-#ifndef ANDROIDPACKAGECREATIONFACTORY_H
-#define ANDROIDPACKAGECREATIONFACTORY_H
+#ifndef QMAKEANDROIDBUILDAPKWIDGET_H
+#define QMAKEANDROIDBUILDAPKWIDGET_H
+
+#include "androidextralibrarylistmodel.h"
+
+#include <QWidget>
#include <projectexplorer/buildstep.h>
-namespace Android {
+QT_BEGIN_NAMESPACE
+class QLabel;
+QT_END_NAMESPACE
+
+namespace QmakeProjectManager { class QmakeBuildConfiguration; }
+
+namespace QmakeAndroidSupport {
namespace Internal {
-class AndroidPackageCreationFactory : public ProjectExplorer::IBuildStepFactory
+namespace Ui {
+class QmakeAndroidBuildApkWidget;
+}
+
+class QmakeAndroidBuildApkStep;
+
+class QmakeAndroidBuildApkWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
-public:
- explicit AndroidPackageCreationFactory(QObject *parent = 0);
- QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
- QString displayNameForId(Core::Id id) const;
+public:
+ explicit QmakeAndroidBuildApkWidget(QmakeAndroidBuildApkStep *step);
+ ~QmakeAndroidBuildApkWidget();
- bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
- ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
+private slots:
+ void updateInputFileUi();
+ void inputFileComboBoxIndexChanged();
+ void createManifestButton();
+ void addAndroidExtraLib();
+ void removeAndroidExtraLib();
+ void checkEnableRemoveButton();
- bool canRestore(ProjectExplorer::BuildStepList *parent,
- const QVariantMap &map) const;
- ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
+private:
+ Ui::QmakeAndroidBuildApkWidget *m_ui;
+ QmakeAndroidBuildApkStep *m_step;
+ AndroidExtraLibraryListModel *m_extraLibraryListModel;
+ bool m_ignoreChange;
- bool canClone(ProjectExplorer::BuildStepList *parent,
- ProjectExplorer::BuildStep *product) const;
- ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
- ProjectExplorer::BuildStep *product);
+ // BuildStepConfigWidget interface
+public:
+ QString summaryText() const;
+ QString displayName() const;
};
} // namespace Internal
-} // namespace Android
+} // namespace QmakeAndroidSupport
-#endif // ANDROIDPACKAGECREATIONFACTORY_H
+#endif // QMAKEANDROIDBUILDAPKWIDGET_H
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.ui b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.ui
new file mode 100644
index 0000000000..9e40690678
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkwidget.ui
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QmakeAndroidSupport::Internal::QmakeAndroidBuildApkWidget</class>
+ <widget class="QWidget" name="QmakeAndroidSupport::Internal::QmakeAndroidBuildApkWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>680</width>
+ <height>435</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="additionalLibrariesGroupBox_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Android</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="createAndroidManifestButton">
+ <property name="text">
+ <string>Create AndroidManifest.xml</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="inputFileLabel">
+ <property name="text">
+ <string>Input file for androiddeployqt:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="inputFileComboBox"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="additionalLibrariesGroupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Additional Libraries</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="androidExtraLibsLayout">
+ <item>
+ <widget class="QListView" name="androidExtraLibsListView">
+ <property name="toolTip">
+ <string>List of extra libraries to include in Android package and load on startup.</string>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="androidExtraLibsButtonLayout">
+ <item>
+ <widget class="QToolButton" name="addAndroidExtraLibButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Select library to include in package.</string>
+ </property>
+ <property name="text">
+ <string>Add...</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextOnly</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="removeAndroidExtraLibButton">
+ <property name="toolTip">
+ <string>Remove currently selected library from list.</string>
+ </property>
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp
new file mode 100644
index 0000000000..76d2012a79
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp
@@ -0,0 +1,139 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "qmakeandroidrunconfiguration.h"
+
+#include <projectexplorer/kitinformation.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/qtoutputformatter.h>
+#include <qtsupport/qtkitinformation.h>
+#include <qmakeprojectmanager/qmakeproject.h>
+#include <qmakeprojectmanager/qmakenodes.h>
+
+#include <utils/qtcassert.h>
+
+namespace {
+ QLatin1String PRO_FILE_KEY("QMakeProjectManager.QmakeAndroidRunConfiguration.ProFile");
+}
+
+using namespace ProjectExplorer;
+using QmakeProjectManager::QmakeProject;
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *parent, Core::Id id, const QString &path)
+ : AndroidRunConfiguration(parent, id)
+ , m_proFilePath(path)
+{
+ QmakeProject *project = static_cast<QmakeProject *>(parent->project());
+ m_parseSuccess = project->validParse(m_proFilePath);
+ m_parseInProgress = project->parseInProgress(m_proFilePath);
+ init();
+}
+
+QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *parent, QmakeAndroidRunConfiguration *source)
+ : AndroidRunConfiguration(parent, source)
+ , m_proFilePath(source->m_proFilePath)
+ , m_parseSuccess(source->m_parseSuccess)
+ , m_parseInProgress(source->m_parseInProgress)
+{
+ init();
+}
+
+void QmakeAndroidRunConfiguration::init()
+{
+ connect(target()->project(), SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)),
+ this, SLOT(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)));
+}
+
+bool QmakeAndroidRunConfiguration::fromMap(const QVariantMap &map)
+{
+ const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
+ m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(PRO_FILE_KEY).toString()));
+ m_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
+ m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(m_proFilePath);
+
+ return RunConfiguration::fromMap(map);
+}
+
+QVariantMap QmakeAndroidRunConfiguration::toMap() const
+{
+ if (m_proFilePath.isEmpty()) {
+ if (!target()->project()->rootProjectNode())
+ return QVariantMap();
+ m_proFilePath = target()->project()->rootProjectNode()->path();
+ }
+
+ const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
+ QVariantMap map(RunConfiguration::toMap());
+ map.insert(PRO_FILE_KEY, projectDir.relativeFilePath(m_proFilePath));
+ return map;
+}
+
+bool QmakeAndroidRunConfiguration::isEnabled() const
+{
+ return m_parseSuccess && !m_parseInProgress;
+}
+
+QString QmakeAndroidRunConfiguration::disabledReason() const
+{
+ if (m_parseInProgress)
+ return tr("The .pro file \"%1\" is currently being parsed.")
+ .arg(QFileInfo(m_proFilePath).fileName());
+
+ if (!m_parseSuccess)
+ return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
+ return QString();
+}
+
+void QmakeAndroidRunConfiguration::proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress)
+{
+ if (m_proFilePath.isEmpty() && target()->project()->rootProjectNode()) {
+ m_proFilePath = target()->project()->rootProjectNode()->path();
+ }
+
+ if (m_proFilePath != pro->path())
+ return;
+
+ bool enabled = isEnabled();
+ QString reason = disabledReason();
+ m_parseSuccess = success;
+ m_parseInProgress = parseInProgress;
+ if (enabled != isEnabled() || reason != disabledReason())
+ emit enabledChanged();
+}
+
+QString QmakeAndroidRunConfiguration::proFilePath() const
+{
+ return m_proFilePath;
+}
+
+} // namespace Internal
+} // namespace Android
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h b/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h
new file mode 100644
index 0000000000..c9cbe278d5
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h
@@ -0,0 +1,73 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QMAKE_ANDROIDRUNCONFIGURATION_H
+#define QMAKE_ANDROIDRUNCONFIGURATION_H
+
+#include <android/androidrunconfiguration.h>
+
+namespace QmakeProjectManager { class QmakeProFileNode; }
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+class QmakeAndroidRunConfiguration : public Android::AndroidRunConfiguration
+{
+ Q_OBJECT
+ friend class QmakeAndroidRunConfigurationFactory;
+
+public:
+ QmakeAndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path = QString());
+
+ QString proFilePath() const;
+
+ bool isEnabled() const;
+ QString disabledReason() const;
+
+protected:
+ QmakeAndroidRunConfiguration(ProjectExplorer::Target *parent, QmakeAndroidRunConfiguration *source);
+
+ bool fromMap(const QVariantMap &map);
+ QVariantMap toMap() const;
+
+private slots:
+ void proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress);
+
+private:
+ void init();
+
+ mutable QString m_proFilePath;
+ bool m_parseSuccess;
+ bool m_parseInProgress;
+};
+
+} // namespace Internal
+} // namespace QmakeAndroidSupport
+
+#endif // QMAKE_ANDROIDRUNCONFIGURATION_H
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
new file mode 100644
index 0000000000..ab073dd039
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
@@ -0,0 +1,149 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "qmakeandroidrunfactories.h"
+#include "qmakeandroidrunconfiguration.h"
+
+#include <android/androidmanager.h>
+
+#include <projectexplorer/project.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
+#include <debugger/debuggerconstants.h>
+#include <qmakeprojectmanager/qmakeproject.h>
+#include <qmakeprojectmanager/qmakenodes.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
+#include <qtsupport/qtkitinformation.h>
+#include <qtsupport/qtsupportconstants.h>
+
+using namespace Android;
+using namespace ProjectExplorer;
+using namespace QmakeProjectManager;
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+static const char ANDROID_RC_ID_PREFIX[] = "Qt4ProjectManager.AndroidRunConfiguration:";
+
+static QString pathFromId(const Core::Id id)
+{
+ return id.suffixAfter(ANDROID_RC_ID_PREFIX);
+}
+
+QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject *parent)
+ : ProjectExplorer::IRunConfigurationFactory(parent)
+{
+}
+
+QString QmakeAndroidRunConfigurationFactory::displayNameForId(Core::Id id) const
+{
+ return QFileInfo(pathFromId(id)).completeBaseName();
+}
+
+bool QmakeAndroidRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
+{
+ if (!canHandle(parent))
+ return false;
+ return availableCreationIds(parent).contains(id);
+}
+
+bool QmakeAndroidRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
+{
+ return canCreate(parent, ProjectExplorer::idFromMap(map));
+}
+
+bool QmakeAndroidRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
+{
+ return canCreate(parent, source->id());
+}
+
+QList<Core::Id> QmakeAndroidRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
+{
+ if (!canHandle(parent))
+ return QList<Core::Id>();
+
+ QmakeProject *project = static_cast<QmakeProject *>(parent->project());
+ QList<QmakeProFileNode *> nodes = project->allProFiles(QList<QmakeProjectType>()
+ << ApplicationTemplate
+ << LibraryTemplate);
+
+ if (mode == AutoCreate)
+ nodes = QmakeProject::nodesWithQtcRunnable(nodes);
+
+ const Core::Id base = Core::Id(ANDROID_RC_ID_PREFIX);
+ return QmakeProject::idsForNodes(base, nodes);
+}
+
+RunConfiguration *QmakeAndroidRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
+{
+ if (parent->project()->rootProjectNode())
+ return new QmakeAndroidRunConfiguration(parent, id, parent->project()->rootProjectNode()->path());
+ return new QmakeAndroidRunConfiguration(parent, id);
+}
+
+RunConfiguration *QmakeAndroidRunConfigurationFactory::doRestore(Target *parent,
+ const QVariantMap &map)
+{
+ Core::Id id = ProjectExplorer::idFromMap(map);
+ if (parent->project()->rootProjectNode())
+ return new QmakeAndroidRunConfiguration(parent, id, parent->project()->rootProjectNode()->path());
+ return new QmakeAndroidRunConfiguration(parent, id);
+}
+
+RunConfiguration *QmakeAndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
+{
+ if (!canClone(parent, source))
+ return 0;
+
+ QmakeAndroidRunConfiguration *old = static_cast<QmakeAndroidRunConfiguration *>(source);
+ return new QmakeAndroidRunConfiguration(parent, old);
+}
+
+bool QmakeAndroidRunConfigurationFactory::canHandle(Target *t) const
+{
+ return t->project()->supportsKit(t->kit())
+ && AndroidManager::supportsAndroid(t)
+ && qobject_cast<QmakeProject *>(t->project());
+}
+
+#ifdef Q_CC_GCC
+# warning FIX ME !!!
+#endif
+QList<RunConfiguration *> QmakeAndroidRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
+ if (QmakeAndroidRunConfiguration *qt4c = qobject_cast<QmakeAndroidRunConfiguration *>(rc))
+ if (qt4c->proFilePath() == n->path())
+ result << rc;
+ return result;
+}
+
+} // namespace Internal
+} // namespace Android
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h
new file mode 100644
index 0000000000..058aabfba3
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h
@@ -0,0 +1,78 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QMAKE_ANDROIDRUNFACTORIES_H
+#define QMAKE_ANDROIDRUNFACTORIES_H
+
+#include <android/androidrunfactories.h>
+#include <projectexplorer/runconfiguration.h>
+#include <qmakeprojectmanager/qmakerunconfigurationfactory.h>
+
+namespace ProjectExplorer {
+class RunControl;
+class RunConfigWidget;
+class Target;
+class Node;
+} // namespace ProjectExplorer
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+class QmakeAndroidRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
+{
+ Q_OBJECT
+
+public:
+ explicit QmakeAndroidRunConfigurationFactory(QObject *parent = 0);
+
+ QString displayNameForId(Core::Id id) const;
+ QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const;
+
+ bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const;
+
+ bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+
+ bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
+ ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
+
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
+ ProjectExplorer::Node *n);
+
+private:
+ bool canHandle(ProjectExplorer::Target *t) const;
+
+ ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id);
+ ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
+ const QVariantMap &map);
+};
+
+} // namespace Internal
+} // namespace QmakeAndroidSupport
+
+#endif // ANDROIDRUNFACTORIES_H
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp
new file mode 100644
index 0000000000..52542b8cd8
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp
@@ -0,0 +1,135 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "androidpackageinstallationstep.h"
+#include "qmakeandroidsupport.h"
+
+#include <android/androidconstants.h>
+#include <projectexplorer/buildmanager.h>
+#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/deployconfiguration.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/qtkitinformation.h>
+#include <qmakeprojectmanager/qmakebuildconfiguration.h>
+#include <qmakeprojectmanager/qmakenodes.h>
+#include <qmakeprojectmanager/qmakeproject.h>
+#include <qmakeprojectmanager/qmakestep.h>
+
+using namespace QmakeProjectManager;
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+bool QmakeAndroidSupport::canHandle(const ProjectExplorer::Target *target) const
+{
+ return qobject_cast<QmakeProject*>(target->project());
+}
+
+QStringList QmakeAndroidSupport::soLibSearchPath(const ProjectExplorer::Target *target) const
+{
+ QStringList res;
+ QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration*>(target->activeBuildConfiguration());
+ QmakeProject *project = qobject_cast<QmakeProject*>(target->project());
+ Q_ASSERT(project);
+ if (!project)
+ return res;
+
+ foreach (QmakeProFileNode *node, project->allProFiles()) {
+ res << node->buildDir(bc);
+ }
+
+ return res;
+}
+
+QStringList QmakeAndroidSupport::projectTargetApplications(const ProjectExplorer::Target *target) const
+{
+ QStringList apps;
+ QmakeProject *qmakeProject = qobject_cast<QmakeProject *>(target->project());
+ if (!qmakeProject)
+ return apps;
+ foreach (QmakeProFileNode *proFile, qmakeProject->applicationProFiles()) {
+ if (proFile->projectType() == ApplicationTemplate) {
+ if (proFile->targetInformation().target.startsWith(QLatin1String("lib"))
+ && proFile->targetInformation().target.endsWith(QLatin1String(".so")))
+ apps << proFile->targetInformation().target.mid(3, proFile->targetInformation().target.lastIndexOf(QLatin1Char('.')) - 3);
+ else
+ apps << proFile->targetInformation().target;
+ }
+ }
+ apps.sort();
+ return apps;
+
+}
+
+Utils::FileName QmakeAndroidSupport::apkPath(ProjectExplorer::Target *target, AndroidQtSupport::BuildType buildType) const
+{
+ QString packageName = QLatin1String("QtApp");
+ QString buildTypeName;
+ if (buildType == DebugBuild)
+ buildTypeName = QLatin1String("debug");
+ else if (buildType == ReleaseBuildUnsigned)
+ buildTypeName =QLatin1String("release-unsigned");
+ else
+ buildTypeName = QLatin1String("release");
+
+ return target->activeBuildConfiguration()->buildDirectory()
+ .appendPath(QLatin1String(Android::Constants::ANDROID_BUILDDIRECTORY))
+ .appendPath(QLatin1String("bin"))
+ .appendPath(QString::fromLatin1("%1-%2.apk")
+ .arg(packageName)
+ .arg(buildTypeName));
+}
+
+void QmakeAndroidSupport::resetBuild(const ProjectExplorer::Target *target)
+{
+ QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration*>(target->activeBuildConfiguration());
+ if (!bc)
+ return;
+
+ QMakeStep *qs = bc->qmakeStep();
+ if (!qs)
+ return;
+
+ qs->setForced(true);
+
+ ProjectExplorer::BuildManager::buildList(bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN),
+ ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
+ ProjectExplorer::BuildManager::appendStep(qs, ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
+ bc->setSubNodeBuild(0);
+ // Make the buildconfiguration emit a evironmentChanged() signal
+ // TODO find a better way
+ bool use = bc->useSystemEnvironment();
+ bc->setUseSystemEnvironment(!use);
+ bc->setUseSystemEnvironment(use);
+}
+
+} // namespace Internal
+} // namespace QmakeProjectManager
diff --git a/src/plugins/android/androiddeploystepwidget.h b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.h
index 31cdd527c8..3c13f6065a 100644
--- a/src/plugins/android/androiddeploystepwidget.h
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.h
@@ -27,46 +27,27 @@
**
****************************************************************************/
-#ifndef ANDROIDDEPLOYSTEPWIDGET_H
-#define ANDROIDDEPLOYSTEPWIDGET_H
+#ifndef QMAKEANDROIDSUPPORT_H
+#define QMAKEANDROIDSUPPORT_H
-#include <projectexplorer/buildstep.h>
+#include <android/androidqtsupport.h>
-QT_BEGIN_NAMESPACE
-namespace Ui { class AndroidDeployStepWidget; }
-QT_END_NAMESPACE
-
-namespace Android {
+namespace QmakeAndroidSupport {
namespace Internal {
-class AndroidDeployStep;
-class AndroidDeployStepWidget : public ProjectExplorer::BuildStepConfigWidget
+class QmakeAndroidSupport : public Android::AndroidQtSupport
{
Q_OBJECT
-
public:
- AndroidDeployStepWidget(AndroidDeployStep *step);
- ~AndroidDeployStepWidget();
-
-private slots:
- void setMinistro();
- void setDeployLocalQtLibs();
- void setBundleQtLibs();
-
- void setQASIPackagePath();
- void cleanLibsOnDevice();
- void resetDefaultDevices();
-
- void deployOptionsChanged();
-private:
- virtual QString summaryText() const;
- virtual QString displayName() const;
+ bool canHandle(const ProjectExplorer::Target *target) const;
+ QStringList soLibSearchPath(const ProjectExplorer::Target *target) const;
+ QStringList projectTargetApplications(const ProjectExplorer::Target *target) const;
+ Utils::FileName apkPath(ProjectExplorer::Target *target, BuildType buildType) const;
- Ui::AndroidDeployStepWidget *ui;
- AndroidDeployStep *m_step;
+ void resetBuild(const ProjectExplorer::Target *target);
};
} // namespace Internal
-} // namespace Android
+} // namespace QmakeProjectManager
-#endif // ANDROIDDEPLOYSTEPWIDGET_H
+#endif // QMAKEANDROIDSUPPORT_H
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro
new file mode 100644
index 0000000000..04a8cae51a
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro
@@ -0,0 +1,36 @@
+QT += network
+include(../../qtcreatorplugin.pri)
+
+DEFINES += \
+ QMAKEANDROID_LIBRARY
+
+HEADERS += \
+ androidextralibrarylistmodel.h \
+ androidpackageinstallationfactory.h \
+ androidpackageinstallationstep.h \
+ createandroidmanifestwizard.h \
+ qmakeandroidsupport.h \
+ qmakeandroidrunconfiguration.h \
+ qmakeandroidrunfactories.h \
+ qmakeandroidbuildapkstep.h \
+ qmakeandroidbuildapkwidget.h \
+ androidqmakebuildconfigurationfactory.h \
+ qmakeandroidsupportplugin.h
+
+SOURCES += \
+ androidextralibrarylistmodel.cpp \
+ androidpackageinstallationfactory.cpp \
+ androidpackageinstallationstep.cpp \
+ createandroidmanifestwizard.cpp \
+ qmakeandroidsupport.cpp \
+ qmakeandroidrunconfiguration.cpp \
+ qmakeandroidrunfactories.cpp \
+ qmakeandroidbuildapkstep.cpp \
+ qmakeandroidbuildapkwidget.cpp \
+ androidqmakebuildconfigurationfactory.cpp \
+ qmakeandroidsupportplugin.cpp
+
+FORMS += qmakeandroidbuildapkwidget.ui
+
+RESOURCES +=
+
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs
new file mode 100644
index 0000000000..9249e0bb3b
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs
@@ -0,0 +1,49 @@
+import qbs
+
+import QtcPlugin
+
+QtcPlugin {
+ name: "QmakeAndroidSupport"
+ Depends { name: "Android" }
+ Depends { name: "Core" }
+ Depends { name: "CppTools" }
+ Depends { name: "ProjectExplorer" }
+ Depends { name: "QmakeProjectManager" }
+ Depends { name: "QmlJS" }
+ Depends { name: "QmlJSTools" }
+ Depends { name: "QtSupport" }
+ Depends { name: "ResourceEditor" }
+ Depends { name: "Utils" }
+ Depends { name: "Qt.network" }
+ Depends { name: "Qt.widgets" }
+
+ cpp.includePaths: base.concat([
+ "../../shared",
+ ])
+
+ files: [
+ "androidextralibrarylistmodel.cpp",
+ "androidextralibrarylistmodel.h",
+ "androidpackageinstallationfactory.cpp",
+ "androidpackageinstallationfactory.h",
+ "androidpackageinstallationstep.cpp",
+ "androidpackageinstallationstep.h",
+ "createandroidmanifestwizard.cpp",
+ "createandroidmanifestwizard.h",
+ "qmakeandroidbuildapkstep.cpp",
+ "qmakeandroidbuildapkstep.h",
+ "qmakeandroidbuildapkwidget.cpp",
+ "qmakeandroidbuildapkwidget.h",
+ "qmakeandroidbuildapkwidget.ui",
+ "androidqmakebuildconfigurationfactory.cpp",
+ "androidqmakebuildconfigurationfactory.h",
+ "qmakeandroidrunconfiguration.cpp",
+ "qmakeandroidrunconfiguration.h",
+ "qmakeandroidrunfactories.cpp",
+ "qmakeandroidrunfactories.h",
+ "qmakeandroidsupport.cpp",
+ "qmakeandroidsupport.h",
+ "qmakeandroidsupportplugin.h",
+ "qmakeandroidsupportplugin.cpp",
+ ]
+}
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport_dependencies.pri b/src/plugins/qmakeandroidsupport/qmakeandroidsupport_dependencies.pri
new file mode 100644
index 0000000000..dc7c706fa6
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport_dependencies.pri
@@ -0,0 +1,16 @@
+QTC_PLUGIN_NAME = QmakeAndroidSupport
+QTC_LIB_DEPENDS += \
+ aggregation \
+ extensionsystem \
+ qmljs \
+ utils
+QTC_PLUGIN_DEPENDS += \
+ coreplugin \
+ projectexplorer \
+ qtsupport \
+ texteditor \
+ cpptools \
+ qmljstools \
+ resourceeditor \
+ android \
+ qmakeprojectmanager
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport_global.h b/src/plugins/qmakeandroidsupport/qmakeandroidsupport_global.h
new file mode 100644
index 0000000000..cf2d1436e7
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport_global.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QMAKEANDROID_GLOBAL_H
+#define QMAKEANDROID_GLOBAL_H
+
+#include <qglobal.h>
+
+#if defined(QMAKEANDROID_LIBRARY)
+# define QMAKEANDROIDSUPPORT_EXPORT Q_DECL_EXPORT
+#else
+# define QMAKEANDROIDSUPPORT_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // QMAKEANDROID_GLOBAL_H
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.cpp
new file mode 100644
index 0000000000..d0dc3cf4e6
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "qmakeandroidsupportplugin.h"
+
+#include "androidpackageinstallationfactory.h"
+#include "androidqmakebuildconfigurationfactory.h"
+#include "qmakeandroidbuildapkstep.h"
+#include "qmakeandroidrunfactories.h"
+#include "qmakeandroidsupport.h"
+
+#include <coreplugin/icore.h>
+
+#include <QtPlugin>
+
+using namespace QmakeAndroidSupport::Internal;
+using namespace QmakeAndroidSupport;
+
+QmakeAndroidSupportPlugin::QmakeAndroidSupportPlugin()
+{
+
+}
+
+QmakeAndroidSupportPlugin::~QmakeAndroidSupportPlugin()
+{
+}
+
+bool QmakeAndroidSupportPlugin::initialize(const QStringList &arguments, QString *errorMessage)
+{
+ Q_UNUSED(arguments)
+ Q_UNUSED(errorMessage)
+ addAutoReleasedObject(new AndroidQmakeBuildConfigurationFactory);
+ addAutoReleasedObject(new AndroidPackageInstallationFactory);
+ addAutoReleasedObject(new QmakeAndroidBuildApkStepFactory);
+ addAutoReleasedObject(new QmakeAndroidRunConfigurationFactory);
+ addAutoReleasedObject(new QmakeAndroidSupport);
+
+ return true;
+}
+
+void QmakeAndroidSupportPlugin::extensionsInitialized()
+{ }
+
+Q_EXPORT_PLUGIN(QmakeAndroidSupportPlugin)
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.h b/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.h
new file mode 100644
index 0000000000..3f46fcc7c6
--- /dev/null
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QMAKEANDROIDSUPPORTPLUGIN_H
+#define QMAKEANDROIDSUPPORTPLUGIN_H
+
+#include <extensionsystem/iplugin.h>
+
+namespace QmakeAndroidSupport {
+namespace Internal {
+
+class QmakeAndroidSupportPlugin : public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmakeAndroidSupport.json")
+
+public:
+ QmakeAndroidSupportPlugin();
+ ~QmakeAndroidSupportPlugin();
+ bool initialize(const QStringList &arguments, QString *errorMessage);
+ void extensionsInitialized();
+};
+
+} // namespace Internal
+} // namespace QmakeAndroidSupport
+
+#endif // QMAKEANDROIDSUPPORTPLUGIN_H
diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
index 5e1eb8da2e..2bada9f66a 100644
--- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
+++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
@@ -36,23 +36,6 @@
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
-namespace {
-
-class DesktopQtKitMatcher : public ProjectExplorer::KitMatcher
-{
-public:
- bool matches(const ProjectExplorer::Kit *k) const
- {
- ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k);
- if (dev.isNull() || dev->id() != ProjectExplorer::Constants::DESKTOP_DEVICE_ID)
- return false;
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
- return version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT);
- }
-};
-
-} // namespace
-
namespace QmakeProjectManager {
namespace Internal {
diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp
index 575332e0b4..31b2e4b477 100644
--- a/src/plugins/qmakeprojectmanager/profileeditor.cpp
+++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp
@@ -58,6 +58,8 @@ ProFileEditor::ProFileEditor(ProFileEditorWidget *editor)
setContext(Core::Context(Constants::C_PROFILEEDITOR,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
+ setCommentStyle(Utils::CommentDefinition::HashStyle);
+ setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<ProFileCompletionAssistProvider>());
}
Core::IEditor *ProFileEditor::duplicate()
@@ -68,37 +70,17 @@ Core::IEditor *ProFileEditor::duplicate()
return ret->editor();
}
-TextEditor::CompletionAssistProvider *ProFileEditor::completionAssistProvider()
-{
- return ExtensionSystem::PluginManager::getObject<ProFileCompletionAssistProvider>();
-}
-
//
// ProFileEditorWidget
//
ProFileEditorWidget::ProFileEditorWidget(QWidget *parent)
: BaseTextEditorWidget(new ProFileDocument(), parent)
-{
- ctor();
-}
+{}
ProFileEditorWidget::ProFileEditorWidget(ProFileEditorWidget *other)
: BaseTextEditorWidget(other)
-{
- ctor();
-}
-
-void ProFileEditorWidget::ctor()
-{
- m_commentDefinition.clearCommentStyles();
- m_commentDefinition.singleLine = QLatin1Char('#');
-}
-
-void ProFileEditorWidget::unCommentSelection()
-{
- Utils::unCommentSelection(this, m_commentDefinition);
-}
+{}
static bool isValidFileNameChar(const QChar &c)
{
@@ -169,7 +151,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
}
}
- QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
+ QDir dir(QFileInfo(textDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
diff --git a/src/plugins/qmakeprojectmanager/profileeditor.h b/src/plugins/qmakeprojectmanager/profileeditor.h
index f3695b75df..d586cc49b4 100644
--- a/src/plugins/qmakeprojectmanager/profileeditor.h
+++ b/src/plugins/qmakeprojectmanager/profileeditor.h
@@ -48,7 +48,6 @@ public:
ProFileEditor(ProFileEditorWidget *);
Core::IEditor *duplicate();
- TextEditor::CompletionAssistProvider *completionAssistProvider();
};
class ProFileEditorWidget : public TextEditor::BaseTextEditorWidget
@@ -59,8 +58,6 @@ public:
ProFileEditorWidget(QWidget *parent = 0);
ProFileEditorWidget(ProFileEditorWidget *other);
- void unCommentSelection();
-
protected:
virtual Link findLinkAt(const QTextCursor &, bool resolveTarget = true,
bool inNextSplit = false);
@@ -69,8 +66,6 @@ protected:
private:
ProFileEditorWidget(BaseTextEditorWidget *); // avoid stupidity
- void ctor();
- Utils::CommentDefinition m_commentDefinition;
};
class ProFileDocument : public TextEditor::BaseTextDocument
diff --git a/src/plugins/qmakeprojectmanager/profilehoverhandler.cpp b/src/plugins/qmakeprojectmanager/profilehoverhandler.cpp
index d4fdac0bcf..ee9a37f502 100644
--- a/src/plugins/qmakeprojectmanager/profilehoverhandler.cpp
+++ b/src/plugins/qmakeprojectmanager/profilehoverhandler.cpp
@@ -61,7 +61,7 @@ bool ProFileHoverHandler::acceptEditor(IEditor *editor)
return false;
}
-void ProFileHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
+void ProFileHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos)
{
m_docFragment.clear();
m_manualKind = UnknownManual;
diff --git a/src/plugins/qmakeprojectmanager/profilehoverhandler.h b/src/plugins/qmakeprojectmanager/profilehoverhandler.h
index 77e05e66ad..547440a5e6 100644
--- a/src/plugins/qmakeprojectmanager/profilehoverhandler.h
+++ b/src/plugins/qmakeprojectmanager/profilehoverhandler.h
@@ -41,7 +41,7 @@ QT_END_NAMESPACE
namespace Core { class IEditor; }
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace QmakeProjectManager {
namespace Internal {
@@ -58,7 +58,7 @@ signals:
private:
virtual bool acceptEditor(Core::IEditor *editor);
- virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos);
+ virtual void identifyMatch(TextEditor::BaseTextEditor *editor, int pos);
void identifyQMakeKeyword(const QString &text, int pos);
enum ManualKind {
diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp
index c97e2b80c3..b716816786 100644
--- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp
@@ -52,6 +52,7 @@
#include <qtsupport/qtversionmanager.h>
#include <utils/qtcassert.h>
#include <QDebug>
+#include <android/androidmanager.h>
#include <QInputDialog>
@@ -276,6 +277,7 @@ void QmakeBuildConfiguration::setQMakeBuildConfiguration(BaseQtVersion::QmakeBui
emit qmakeBuildConfigurationChanged();
emitProFileEvaluateNeeded();
+ emit buildTypeChanged();
}
void QmakeBuildConfiguration::emitProFileEvaluateNeeded()
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
index 50505a4c66..cb8052a5dd 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
@@ -804,6 +804,7 @@ bool QmakePriFileNode::deploysFolder(const QString &folder) const
const QChar slash = QLatin1Char('/');
if (!f.endsWith(slash))
f.append(slash);
+
foreach (const QString &wf, m_watchedFolders) {
if (f.startsWith(wf)
&& (wf.endsWith(slash)
@@ -955,9 +956,7 @@ bool QmakePriFileNode::removeSubProjects(const QStringList &proFilePaths)
QStringList failedOriginalFiles;
changeFiles(QLatin1String(Constants::PROFILE_MIMETYPE), proFilePaths, &failedOriginalFiles, RemoveFromProFile);
- QStringList simplifiedProFiles;
- foreach (const QString &proFile, failedOriginalFiles)
- simplifiedProFiles.append(simplifyProFilePath(proFile));
+ QStringList simplifiedProFiles = Utils::transform(failedOriginalFiles, &simplifyProFilePath);
QStringList failedSimplifiedFiles;
changeFiles(QLatin1String(Constants::PROFILE_MIMETYPE), simplifiedProFiles, &failedSimplifiedFiles, RemoveFromProFile);
@@ -979,7 +978,7 @@ bool QmakePriFileNode::addFiles(const QStringList &filePaths, QStringList *notAd
typedef QMap<QString, QStringList> TypeFileMap;
// Split into lists by file type and bulk-add them.
TypeFileMap typeFileMap;
- foreach (const QString file, filePaths) {
+ foreach (const QString &file, filePaths) {
const Core::MimeType mt = Core::MimeDatabase::findByFile(file);
typeFileMap[mt.type()] << file;
}
@@ -1026,7 +1025,7 @@ bool QmakePriFileNode::removeFiles(const QStringList &filePaths,
typedef QMap<QString, QStringList> TypeFileMap;
// Split into lists by file type and bulk-add them.
TypeFileMap typeFileMap;
- foreach (const QString file, filePaths) {
+ foreach (const QString &file, filePaths) {
const Core::MimeType mt = Core::MimeDatabase::findByFile(file);
typeFileMap[mt.type()] << file;
}
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index cc89d31e85..83ac0be0f4 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -46,7 +46,7 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/documentmanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
-#include <qmljstools/qmljsmodelmanager.h>
+#include <qmljs/qmljsmodelmanagerinterface.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deploymentdata.h>
@@ -344,6 +344,7 @@ QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
setId(Constants::QMAKEPROJECT_ID);
setProjectContext(Core::Context(QmakeProjectManager::Constants::PROJECT_ID));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
+ setRequiredKitMatcher(QtSupport::QtKitInformation::qtVersionMatcher());
m_asyncUpdateTimer.setSingleShot(true);
m_asyncUpdateTimer.setInterval(3000);
@@ -600,7 +601,7 @@ void QmakeProject::updateQmlJSCodeModel()
return;
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
- QmlJSTools::defaultProjectInfoForProject(this);
+ modelManager->defaultProjectInfoForProject(this);
FindQmakeProFiles findQt4ProFiles;
QList<QmakeProFileNode *> proFiles = findQt4ProFiles(rootProjectNode());
@@ -609,7 +610,9 @@ void QmakeProject::updateQmlJSCodeModel()
bool hasQmlLib = false;
foreach (QmakeProFileNode *node, proFiles) {
- projectInfo.importPaths.append(node->variableValue(QmlImportPathVar));
+ foreach (const QString &path, node->variableValue(QmlImportPathVar))
+ projectInfo.importPaths.maybeInsert(Utils::FileName::fromString(path),
+ QmlJS::Dialect::Qml);
projectInfo.activeResourceFiles.append(node->variableValue(ExactResourceVar));
projectInfo.allResourceFiles.append(node->variableValue(ResourceVar));
if (!hasQmlLib) {
@@ -629,7 +632,6 @@ void QmakeProject::updateQmlJSCodeModel()
pl.add(ProjectExplorer::Constants::LANG_QMLJS);
setProjectLanguages(pl);
- projectInfo.importPaths.removeDuplicates();
projectInfo.activeResourceFiles.removeDuplicates();
projectInfo.allResourceFiles.removeDuplicates();
@@ -1398,9 +1400,9 @@ void QmakeProject::configureAsExampleProject(const QStringList &platforms)
ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
}
-bool QmakeProject::supportsNoTargetPanel() const
+bool QmakeProject::requiresTargetPanel() const
{
- return true;
+ return false;
}
// All the Qmake run configurations should share code.
@@ -1644,11 +1646,6 @@ ProjectImporter *QmakeProject::createProjectImporter() const
return new QmakeProjectImporter(projectFilePath().toString());
}
-KitMatcher *QmakeProject::createRequiredKitMatcher() const
-{
- return new QtSupport::QtVersionKitMatcher;
-}
-
} // namespace QmakeProjectManager
#include "qmakeproject.moc"
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h
index 0c19acb408..789e2213c3 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.h
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.h
@@ -124,7 +124,7 @@ public:
void configureAsExampleProject(const QStringList &platforms);
- bool supportsNoTargetPanel() const;
+ bool requiresTargetPanel() const;
/// \internal
QString disabledReasonForRunConfiguration(const QString &proFilePath);
@@ -140,7 +140,6 @@ public:
ProjectExplorer::ProjectImporter *createProjectImporter() const;
- ProjectExplorer::KitMatcher *createRequiredKitMatcher() const;
signals:
void proFileUpdated(QmakeProjectManager::QmakeProFileNode *node, bool, bool);
void buildDirectoryInitialized();
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp
index a51dbb0338..6d1d3b0fdf 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp
@@ -240,6 +240,20 @@ void QmakeProjectImporter::cleanupKit(ProjectExplorer::Kit *k)
QtSupport::QtVersionManager::removeVersion(version);
}
+void QmakeProjectImporter::makePermanent(ProjectExplorer::Kit *k)
+{
+ int tempId = k->value(QT_IS_TEMPORARY, -1).toInt();
+ int qtId = QtSupport::QtKitInformation::qtVersionId(k);
+ if (tempId != qtId) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::version(tempId);
+ if (version)
+ QtSupport::QtVersionManager::removeVersion(version);
+ }
+
+ k->removeKey(QT_IS_TEMPORARY);
+ ProjectImporter::makePermanent(k);
+}
+
ProjectExplorer::Kit *QmakeProjectImporter::createTemporaryKit(QtSupport::BaseQtVersion *version,
bool temporaryVersion,
const Utils::FileName &parsedSpec)
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.h b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.h
index 05033e880f..af94da41c8 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.h
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.h
@@ -52,6 +52,8 @@ public:
void cleanupKit(ProjectExplorer::Kit *k);
+ void makePermanent(ProjectExplorer::Kit *k);
+
private:
ProjectExplorer::Kit *createTemporaryKit(QtSupport::BaseQtVersion *version,
bool temporaryVersion,
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
index 11845289b2..d6a6b6aa75 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
@@ -39,6 +39,7 @@
#include "addlibrarywizard.h"
#include "wizards/qtquickapp.h"
+#include <coreplugin/icore.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/session.h>
@@ -146,7 +147,7 @@ void QmakeManager::addLibraryContextMenu()
void QmakeManager::addLibrary(const QString &fileName, ProFileEditor *editor)
{
- AddLibraryWizard wizard(fileName, Core::EditorManager::instance());
+ AddLibraryWizard wizard(fileName, Core::ICore::dialogParent());
if (wizard.exec() != QDialog::Accepted)
return;
@@ -156,7 +157,7 @@ void QmakeManager::addLibrary(const QString &fileName, ProFileEditor *editor)
if (!editor)
return;
- const int endOfDoc = editor->position(TextEditor::ITextEditor::EndOfDoc);
+ const int endOfDoc = editor->position(TextEditor::BaseTextEditor::EndOfDoc);
editor->setCursorPosition(endOfDoc);
QString snippet = wizard.snippet();
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
index 7146c0f11b..db881dfdd6 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
@@ -103,7 +103,7 @@ SOURCES += \
librarydetailscontroller.cpp \
findqmakeprofiles.cpp \
desktopqmakerunconfiguration.cpp \
- profilecompletionassist.cpp
+ profilecompletionassist.cpp \
FORMS += makestep.ui \
qmakestep.ui \
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
index 564a0b75a7..9372bfa867 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
@@ -15,7 +15,6 @@ QtcPlugin {
Depends { name: "QtSupport" }
Depends { name: "CppTools" }
Depends { name: "TextEditor" }
- Depends { name: "QmlJSTools" }
Depends { name: "ResourceEditor" }
pluginRecommends: [
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager_dependencies.pri b/src/plugins/qmakeprojectmanager/qmakeprojectmanager_dependencies.pri
index 60744c7674..321a5785f6 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager_dependencies.pri
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager_dependencies.pri
@@ -10,7 +10,7 @@ QTC_PLUGIN_DEPENDS += \
qtsupport \
texteditor \
cpptools \
- qmljstools \
resourceeditor
+
QTC_PLUGIN_RECOMMENDS += \
designer
diff --git a/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.cpp
index 2bcd4fc682..bf06c2297e 100644
--- a/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.cpp
@@ -43,7 +43,9 @@
#include <projectexplorer/session.h>
#include <coreplugin/editormanager/editormanager.h>
+using namespace Core;
using namespace ProjectExplorer;
+using namespace QtSupport;
namespace QmakeProjectManager {
@@ -75,14 +77,13 @@ void AbstractMobileAppWizardDialog::updateKitsPage()
QString platform = selectedPlatform();
if (platform.isEmpty()) {
m_kitsPage->setPreferredKitMatcher(
- new QtSupport::QtVersionKitMatcher(
- Core::FeatureSet( QtSupport::Constants::FEATURE_MOBILE)));
+ QtKitInformation::qtVersionMatcher(FeatureSet(QtSupport::Constants::FEATURE_MOBILE)));
} else {
- m_kitsPage->setPreferredKitMatcher(new QtSupport::QtPlatformKitMatcher(platform));
+ m_kitsPage->setPreferredKitMatcher(QtKitInformation::platformMatcher(platform));
}
- m_kitsPage->setRequiredKitMatcher(new QtSupport::QtVersionKitMatcher(requiredFeatures(),
- m_minimumQtVersionNumber,
- m_maximumQtVersionNumber));
+ m_kitsPage->setRequiredKitMatcher(QtKitInformation::qtVersionMatcher(requiredFeatures(),
+ m_minimumQtVersionNumber,
+ m_maximumQtVersionNumber));
}
}
diff --git a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
index f159b6fbb0..e41f744524 100644
--- a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
@@ -39,6 +39,7 @@
#include <cpptools/cpptoolsconstants.h>
+#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/targetsetuppage.h>
@@ -53,6 +54,7 @@
using namespace ProjectExplorer;
using namespace QmakeProjectManager;
using namespace QmakeProjectManager::Internal;
+using namespace QtSupport;
// -------------------- QtWizard
QtWizard::QtWizard()
@@ -209,11 +211,11 @@ int BaseQmakeProjectWizardDialog::addTargetSetupPage(int id)
const QString platform = selectedPlatform();
Core::FeatureSet features = Core::FeatureSet(QtSupport::Constants::FEATURE_DESKTOP);
if (platform.isEmpty())
- m_targetSetupPage->setPreferredKitMatcher(new QtSupport::QtVersionKitMatcher(features));
+ m_targetSetupPage->setPreferredKitMatcher(QtKitInformation::qtVersionMatcher(features));
else
- m_targetSetupPage->setPreferredKitMatcher(new QtSupport::QtPlatformKitMatcher(platform));
+ m_targetSetupPage->setPreferredKitMatcher(QtKitInformation::platformMatcher(platform));
- m_targetSetupPage->setRequiredKitMatcher(new QtSupport::QtVersionKitMatcher(requiredFeatures()));
+ m_targetSetupPage->setRequiredKitMatcher(QtKitInformation::qtVersionMatcher(requiredFeatures()));
resize(900, 450);
if (id >= 0)
@@ -285,7 +287,7 @@ bool BaseQmakeProjectWizardDialog::isQtPlatformSelected(const QString &platform)
{
QList<Core::Id> selectedKitList = selectedKits();
- foreach (Kit *k, KitManager::matchingKits(QtSupport::QtPlatformKitMatcher(platform)))
+ foreach (Kit *k, KitManager::matchingKits(QtKitInformation::platformMatcher(platform)))
if (selectedKitList.contains(k->id()))
return true;
diff --git a/src/plugins/qmldesigner/components/importmanager/importlabel.cpp b/src/plugins/qmldesigner/components/importmanager/importlabel.cpp
index 342ca49281..8c24050f1d 100644
--- a/src/plugins/qmldesigner/components/importmanager/importlabel.cpp
+++ b/src/plugins/qmldesigner/components/importmanager/importlabel.cpp
@@ -44,7 +44,7 @@ ImportLabel::ImportLabel(QWidget *parent) :
m_removeButton = new QPushButton(this);
- m_removeButton->setIcon(QIcon(Core::Constants::ICON_CLOSE_DOCUMENT));
+ m_removeButton->setIcon(QIcon(Core::Constants::ICON_BUTTON_CLOSE));
m_removeButton->setFlat(true);
m_removeButton->setMaximumWidth(20);
m_removeButton->setMaximumHeight(20);
@@ -78,7 +78,7 @@ void ImportLabel::setReadOnly(bool readOnly) const
if (readOnly)
m_removeButton->setIcon(QIcon());
else
- m_removeButton->setIcon(QIcon(Core::Constants::ICON_CLOSE_DOCUMENT));
+ m_removeButton->setIcon(QIcon(Core::Constants::ICON_BUTTON_CLOSE));
}
void ImportLabel::emitRemoveImport()
diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp
index 737cabc1fc..beee3b46d5 100644
--- a/src/plugins/qmldesigner/components/integration/designdocument.cpp
+++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp
@@ -590,9 +590,9 @@ Core::IEditor *DesignDocument::editor() const
return m_textEditor.data();
}
-TextEditor::ITextEditor *DesignDocument::textEditor() const
+TextEditor::BaseTextEditor *DesignDocument::textEditor() const
{
- return qobject_cast<TextEditor::ITextEditor*>(editor());
+ return qobject_cast<TextEditor::BaseTextEditor*>(editor());
}
QPlainTextEdit *DesignDocument::plainTextEdit() const
diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h
index 4828b79b25..30dfeac1f3 100644
--- a/src/plugins/qmldesigner/components/integration/designdocument.h
+++ b/src/plugins/qmldesigner/components/integration/designdocument.h
@@ -93,7 +93,7 @@ public:
void setEditor(Core::IEditor *editor);
Core::IEditor *editor() const;
- TextEditor::ITextEditor *textEditor() const;
+ TextEditor::BaseTextEditor *textEditor() const;
QPlainTextEdit *plainTextEdit() const;
QString fileName() const;
ProjectExplorer::Kit *currentKit() const;
diff --git a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp
index c247d90f13..c3eb6e8c7d 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp
@@ -36,7 +36,7 @@ using namespace QmlDesigner;
using namespace QmlJS::AST;
ASTObjectTextExtractor::ASTObjectTextExtractor(const QString &text):
- m_document(Document::create("<ASTObjectTextExtractor>", Language::Qml))
+ m_document(Document::create("<ASTObjectTextExtractor>", Dialect::Qml))
{
m_document->setSource(text);
m_document->parseQml();
diff --git a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp
index 340b27a4b2..b044dfabb2 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp
@@ -38,7 +38,7 @@ using namespace QmlDesigner;
using namespace QmlJS::AST;
FirstDefinitionFinder::FirstDefinitionFinder(const QString &text):
- m_doc(Document::create("<internal>", Language::Qml))
+ m_doc(Document::create("<internal>", Dialect::Qml))
{
m_doc->setSource(text);
bool ok = m_doc->parseQml();
diff --git a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp
index 6ce6a7aaff..c9d920d387 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp
@@ -36,7 +36,7 @@ using namespace QmlDesigner;
using namespace QmlJS::AST;
ObjectLengthCalculator::ObjectLengthCalculator():
- m_doc(Document::create("<internal>", Language::Qml))
+ m_doc(Document::create("<internal>", Dialect::Qml))
{
}
diff --git a/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp b/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp
index 7dc79a2074..51b80a588f 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp
@@ -59,7 +59,7 @@ bool QmlRefactoring::reparseDocument()
// qDebug() << "QmlRefactoring::reparseDocument() new QML source:" << newSource;
- Document::MutablePtr tmpDocument(Document::create("<ModelToTextMerger>", Language::Qml));
+ Document::MutablePtr tmpDocument(Document::create("<ModelToTextMerger>", Dialect::Qml));
tmpDocument->setSource(newSource);
if (tmpDocument->parseQml()) {
diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
index 3eee5fe7c0..303376aea2 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
@@ -278,7 +278,7 @@ class PropertyMemberProcessor : public MemberProcessor
public:
PropertyMemberProcessor(const ContextPtr &context) : m_context(context)
{}
- bool processProperty(const QString &name, const Value *value)
+ bool processProperty(const QString &name, const Value *value, const QmlJS::PropertyInfo &)
{
PropertyName propertyName = name.toUtf8();
const ASTPropertyReference *ref = value_cast<ASTPropertyReference>(value);
diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp
index fc92f460d1..74b8234653 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp
@@ -82,7 +82,7 @@ static inline bool checkIfDerivedFromItem(const QString &fileName)
QmlJS::Document::MutablePtr document =
QmlJS::Document::create(fileName.isEmpty() ?
- QStringLiteral("<internal>") : fileName, QmlJS::Language::Qml);
+ QStringLiteral("<internal>") : fileName, QmlJS::Dialect::Qml);
document->setSource(source);
document->parseQml();
diff --git a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp
index e30e2fb6a1..345c66f07c 100644
--- a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp
+++ b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp
@@ -49,7 +49,7 @@ void BaseTextEditModifier::indent(int offset, int length)
if (TextEditor::BaseTextEditorWidget *baseTextEditorWidget = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit())) {
- TextEditor::BaseTextDocument *baseTextEditorDocument = baseTextEditorWidget->baseTextDocument();
+ TextEditor::BaseTextDocument *baseTextEditorDocument = baseTextEditorWidget->textDocument();
QTextDocument *textDocument = baseTextEditorWidget->document();
TextEditor::BaseTextEditor *baseTextEditor = baseTextEditorWidget->editor();
@@ -83,7 +83,7 @@ void BaseTextEditModifier::indent(int offset, int length)
int BaseTextEditModifier::indentDepth() const
{
if (TextEditor::BaseTextEditorWidget *bte = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit()))
- return bte->baseTextDocument()->tabSettings().m_indentSize;
+ return bte->textDocument()->tabSettings().m_indentSize;
else
return 0;
}
@@ -92,7 +92,7 @@ bool BaseTextEditModifier::renameId(const QString &oldId, const QString &newId)
{
if (TextEditor::BaseTextEditorWidget *bte = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit())) {
if (QmlJSEditor::QmlJSEditorDocument *document
- = qobject_cast<QmlJSEditor::QmlJSEditorDocument *>(bte->baseTextDocument())) {
+ = qobject_cast<QmlJSEditor::QmlJSEditorDocument *>(bte->textDocument())) {
Utils::ChangeSet changeSet;
foreach (const QmlJS::AST::SourceLocation &loc,
document->semanticInfo().idLocations.value(oldId)) {
diff --git a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp
index b493514c77..1623e1ab21 100644
--- a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp
+++ b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp
@@ -222,7 +222,7 @@ void ModelToTextMerger::applyChanges()
if (m_rewriteActions.isEmpty())
return;
- Document::MutablePtr tmpDocument(Document::create(QStringLiteral("<ModelToTextMerger>"), Language::Qml));
+ Document::MutablePtr tmpDocument(Document::create(QStringLiteral("<ModelToTextMerger>"), Dialect::Qml));
tmpDocument->setSource(m_rewriterView->textModifier()->text());
if (!tmpDocument->parseQml()) {
qDebug() << "*** Possible problem: QML file wasn't parsed correctly.";
diff --git a/src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp
index 71c22c9d3d..25eadec4e1 100644
--- a/src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp
+++ b/src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp
@@ -204,7 +204,7 @@ QStringList PlainTextEditModifier::importPaths() const
QString documentFilePath = textDocument()->baseUrl().toLocalFile();
if (!documentFilePath.isEmpty()) {
QmlJS::Document::Ptr qmljsDocument = modelManager->snapshot().document(documentFilePath);
- return modelManager->defaultVContext(QmlJS::Language::Qml, qmljsDocument, true).paths;
+ return modelManager->defaultVContext(QmlJS::Dialect::Qml, qmljsDocument, true).paths;
}
}
diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
index 17971b192d..64d91e80fe 100644
--- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
+++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
@@ -834,7 +834,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
try {
Snapshot snapshot = m_rewriterView->textModifier()->qmljsSnapshot();
const QString fileName = url.toLocalFile();
- Document::MutablePtr doc = Document::create(fileName.isEmpty() ? QStringLiteral("<internal>") : fileName, Language::Qml);
+ Document::MutablePtr doc = Document::create(fileName.isEmpty() ? QStringLiteral("<internal>") : fileName, Dialect::Qml);
doc->setSource(data);
doc->parseQml();
@@ -847,7 +847,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
return false;
}
snapshot.insert(doc);
- QmlJS::ViewerContext vContext = QmlJS::ModelManagerInterface::instance()->defaultVContext(Language::Qml, doc, true);
+ QmlJS::ViewerContext vContext = QmlJS::ModelManagerInterface::instance()->defaultVContext(Dialect::Qml, doc, true);
ReadingContext ctxt(snapshot, doc, vContext);
m_scopeChain = QSharedPointer<const ScopeChain>(
new ScopeChain(ctxt.scopeChain()));
diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp
index 7a2fdaaa23..342aae4f00 100644
--- a/src/plugins/qmldesigner/designmodewidget.cpp
+++ b/src/plugins/qmldesigner/designmodewidget.cpp
@@ -173,7 +173,7 @@ void DocumentWarningWidget::goToError()
DesignModeWidget::DesignModeWidget(QWidget *parent) :
QWidget(parent),
m_mainSplitter(0),
- m_toolBar(Core::EditorManager::createToolBar(this)),
+ m_toolBar(new Core::EditorToolBar(this)),
m_crumbleBar(new CrumbleBar(this)),
m_isDisabled(false),
m_showSidebars(true),
@@ -288,7 +288,7 @@ void DesignModeWidget::updateErrorStatus(const QList<RewriterView::Error> &error
}
}
-TextEditor::ITextEditor *DesignModeWidget::textEditor() const
+TextEditor::BaseTextEditor *DesignModeWidget::textEditor() const
{
return currentDesignDocument()->textEditor();
}
diff --git a/src/plugins/qmldesigner/designmodewidget.h b/src/plugins/qmldesigner/designmodewidget.h
index 73d872ce98..3569b541f3 100644
--- a/src/plugins/qmldesigner/designmodewidget.h
+++ b/src/plugins/qmldesigner/designmodewidget.h
@@ -99,7 +99,7 @@ public:
void readSettings();
void saveSettings();
- TextEditor::ITextEditor *textEditor() const;
+ TextEditor::BaseTextEditor *textEditor() const;
DesignDocument *currentDesignDocument() const;
ViewManager &viewManager();
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp
index 8a08aaf055..2c846eb851 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.cpp
+++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp
@@ -364,9 +364,9 @@ static bool checkIfEditorIsQtQuick(Core::IEditor *editor)
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
QmlJS::Document::Ptr document = modelManager->ensuredGetDocumentForPath(editor->document()->filePath());
if (!document.isNull())
- return document->language() == QmlJS::Language::QmlQtQuick1
- || document->language() == QmlJS::Language::QmlQtQuick2
- || document->language() == QmlJS::Language::Qml;
+ return document->language() == QmlJS::Dialect::QmlQtQuick1
+ || document->language() == QmlJS::Dialect::QmlQtQuick2
+ || document->language() == QmlJS::Dialect::Qml;
}
return false;
diff --git a/src/plugins/qmljseditor/qmlexpressionundercursor.cpp b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp
index 39f2b09f14..aa6510f43a 100644
--- a/src/plugins/qmljseditor/qmlexpressionundercursor.cpp
+++ b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp
@@ -134,7 +134,7 @@ QmlJS::AST::ExpressionNode *QmlExpressionUnderCursor::operator()(const QTextCurs
_text = expressionUnderCursor(cursor);
Document::MutablePtr newDoc = Document::create(
- QLatin1String("<expression>"), Language::JavaScript);
+ QLatin1String("<expression>"), Dialect::JavaScript);
newDoc->setSource(_text);
newDoc->parseExpression();
exprDoc = newDoc;
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp
index 015ee485a2..a3eebd02de 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.cpp
+++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp
@@ -245,7 +245,7 @@ private:
(*_propertyProcessor)(_currentObject, name, value);
}
- bool processProperty(const QString &name, const Value *value) QTC_OVERRIDE
+ bool processProperty(const QString &name, const Value *value, const PropertyInfo &) QTC_OVERRIDE
{
process(name, value);
return true;
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 1b2c3ff137..f10a5f280f 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -35,7 +35,6 @@
#include "qmljseditorplugin.h"
#include "qmloutlinemodel.h"
#include "qmljsfindreferences.h"
-#include "qmljsautocompleter.h"
#include "qmljscompletionassist.h"
#include "qmljsquickfixassist.h"
@@ -112,7 +111,7 @@ QmlJSTextEditorWidget::QmlJSTextEditorWidget(QmlJSTextEditorWidget *other)
void QmlJSTextEditorWidget::ctor()
{
- m_qmlJsEditorDocument = static_cast<QmlJSEditorDocument *>(baseTextDocument());
+ m_qmlJsEditorDocument = static_cast<QmlJSEditorDocument *>(textDocument());
m_outlineCombo = 0;
m_contextPane = 0;
m_findReferences = new FindReferences(this);
@@ -120,7 +119,6 @@ void QmlJSTextEditorWidget::ctor()
setParenthesesMatchingEnabled(true);
setMarksVisible(true);
setCodeFoldingSupported(true);
- setAutoCompleter(new AutoCompleter);
setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
m_updateUsesTimer = new QTimer(this);
@@ -134,7 +132,7 @@ void QmlJSTextEditorWidget::ctor()
m_updateOutlineIndexTimer->setSingleShot(true);
connect(m_updateOutlineIndexTimer, SIGNAL(timeout()), this, SLOT(updateOutlineIndexNow()));
- baseTextDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
+ textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
m_modelManager = QmlJS::ModelManagerInterface::instance();
m_contextPane = ExtensionSystem::PluginManager::getObject<QmlJS::IContextPane>();
@@ -188,7 +186,7 @@ IEditor *QmlJSEditor::duplicate()
bool QmlJSEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
bool b = TextEditor::BaseTextEditor::open(errorString, fileName, realFileName);
- baseTextDocument()->setMimeType(MimeDatabase::findByFile(QFileInfo(fileName)).type());
+ textDocument()->setMimeType(MimeDatabase::findByFile(QFileInfo(fileName)).type());
return b;
}
@@ -232,7 +230,7 @@ void QmlJSTextEditorWidget::updateCodeWarnings(QmlJS::Document::Ptr doc)
{
if (doc->ast()) {
setExtraSelections(CodeWarningsSelection, QList<QTextEdit::ExtraSelection>());
- } else if (Document::isFullySupportedLanguage(doc->language())) {
+ } else if (doc->language().isFullySupportedLanguage()) {
// show parsing errors
QList<QTextEdit::ExtraSelection> selections;
appendExtraSelectionsForMessages(&selections, doc->diagnosticMessages(), document());
@@ -245,7 +243,7 @@ void QmlJSTextEditorWidget::updateCodeWarnings(QmlJS::Document::Ptr doc)
void QmlJSTextEditorWidget::modificationChanged(bool changed)
{
if (!changed && m_modelManager)
- m_modelManager->fileChangedOnDisk(baseTextDocument()->filePath());
+ m_modelManager->fileChangedOnDisk(textDocument()->filePath());
}
void QmlJSTextEditorWidget::jumpToOutlineElement(int /*index*/)
@@ -369,7 +367,7 @@ void QmlJSTextEditorWidget::updateUses()
continue;
QTextEdit::ExtraSelection sel;
- sel.format = baseTextDocument()->fontSettings().toTextCharFormat(TextEditor::C_OCCURRENCES);
+ sel.format = textDocument()->fontSettings().toTextCharFormat(TextEditor::C_OCCURRENCES);
sel.cursor = textCursor();
sel.cursor.setPosition(loc.begin());
sel.cursor.setPosition(loc.end(), QTextCursor::KeepAnchor);
@@ -580,7 +578,7 @@ void QmlJSTextEditorWidget::createToolBar(QmlJSEditor *editor)
connect(this, SIGNAL(cursorPositionChanged()), m_updateOutlineIndexTimer, SLOT(start()));
- editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo);
+ editor->editorWidget()->insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, m_outlineCombo);
}
TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const QTextCursor &cursor,
@@ -668,12 +666,12 @@ TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const Q
void QmlJSTextEditorWidget::findUsages()
{
- m_findReferences->findUsages(baseTextDocument()->filePath(), textCursor().position());
+ m_findReferences->findUsages(textDocument()->filePath(), textCursor().position());
}
void QmlJSTextEditorWidget::renameUsages()
{
- m_findReferences->renameUsages(baseTextDocument()->filePath(), textCursor().position());
+ m_findReferences->renameUsages(textDocument()->filePath(), textCursor().position());
}
void QmlJSTextEditorWidget::showContextPane()
@@ -800,11 +798,6 @@ void QmlJSTextEditorWidget::resizeEvent(QResizeEvent *event)
hideContextPane();
}
-void QmlJSTextEditorWidget::unCommentSelection()
-{
- Utils::unCommentSelection(this);
-}
-
QmlJSEditorDocument *QmlJSTextEditorWidget::qmlJsEditorDocument() const
{
return m_qmlJsEditorDocument;
@@ -814,7 +807,7 @@ void QmlJSTextEditorWidget::semanticInfoUpdated(const SemanticInfo &semanticInfo
{
if (isVisible()) {
// trigger semantic highlighting and model update if necessary
- baseTextDocument()->triggerPendingUpdates();
+ textDocument()->triggerPendingUpdates();
}
if (m_contextPane) {
diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h
index 2c520a3876..9dc4e206d6 100644
--- a/src/plugins/qmljseditor/qmljseditor.h
+++ b/src/plugins/qmljseditor/qmljseditor.h
@@ -78,8 +78,6 @@ public:
QmlJSTextEditorWidget(QmlJSTextEditorWidget *other);
~QmlJSTextEditorWidget();
- virtual void unCommentSelection();
-
QmlJSEditorDocument *qmlJsEditorDocument() const;
QModelIndex outlineModelIndex();
diff --git a/src/plugins/qmljseditor/qmljseditoreditable.cpp b/src/plugins/qmljseditor/qmljseditoreditable.cpp
index bf66c83d26..e2d77d3cf5 100644
--- a/src/plugins/qmljseditor/qmljseditoreditable.cpp
+++ b/src/plugins/qmljseditor/qmljseditoreditable.cpp
@@ -31,6 +31,7 @@
#include "qmljseditor.h"
#include "qmljseditorconstants.h"
#include "qmljscompletionassist.h"
+#include "qmljsautocompleter.h"
#include <qmljstools/qmljstoolsconstants.h>
#include <texteditor/texteditorconstants.h>
@@ -54,6 +55,9 @@ QmlJSEditor::QmlJSEditor(QmlJSTextEditorWidget *editor)
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
m_context.add(ProjectExplorer::Constants::LANG_QMLJS);
setDuplicateSupported(true);
+ setCommentStyle(Utils::CommentDefinition::CppStyle);
+ setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<Internal::QmlJSCompletionAssistProvider>());
+ setAutoCompleter(new AutoCompleter);
}
bool QmlJSEditor::isDesignModePreferred() const
@@ -65,15 +69,5 @@ bool QmlJSEditor::isDesignModePreferred() const
return false;
}
-const Utils::CommentDefinition *QmlJSEditor::commentDefinition() const
-{
- return &m_commentDefinition;
-}
-
-TextEditor::CompletionAssistProvider *QmlJSEditor::completionAssistProvider()
-{
- return ExtensionSystem::PluginManager::getObject<Internal::QmlJSCompletionAssistProvider>();
-}
-
} // namespace Internal
} // namespace QmlJSEditor
diff --git a/src/plugins/qmljseditor/qmljseditoreditable.h b/src/plugins/qmljseditor/qmljseditoreditable.h
index d13f30669a..32dc6e12b0 100644
--- a/src/plugins/qmljseditor/qmljseditoreditable.h
+++ b/src/plugins/qmljseditor/qmljseditoreditable.h
@@ -49,12 +49,6 @@ public:
Core::IEditor *duplicate();
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
bool isDesignModePreferred() const;
-
- const Utils::CommentDefinition *commentDefinition() const;
-
- TextEditor::CompletionAssistProvider *completionAssistProvider();
-private:
- Utils::CommentDefinition m_commentDefinition;
};
} // namespace Internal
diff --git a/src/plugins/qmljseditor/qmljseditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h
index 6caebaba77..aac9959e89 100644
--- a/src/plugins/qmljseditor/qmljseditorplugin.h
+++ b/src/plugins/qmljseditor/qmljseditorplugin.h
@@ -47,7 +47,7 @@ class ActionManager;
class IEditor;
}
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace QmlJS { class ModelManagerInterface; }
diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp
index 0af1dbd349..01698457ce 100644
--- a/src/plugins/qmljseditor/qmljsfindreferences.cpp
+++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp
@@ -812,14 +812,14 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
if (oldDoc && oldDoc->editorRevision() == it.value().second)
continue;
- Language::Enum language;
+ Dialect language;
if (oldDoc)
language = oldDoc->language();
else
language = ModelManagerInterface::guessLanguageOfFile(fileName);
- if (language == Language::NoLanguage) {
+ if (language == Dialect::NoLanguage) {
qCDebug(qmljsLog) << "NoLanguage in qmljsfindreferences.cpp find_helper for " << fileName;
- language = Language::AnyLanguage;
+ language = Dialect::AnyLanguage;
}
Document::MutablePtr newDoc = snapshot.documentFromSource(
diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp
index b632de221e..90333eea2d 100644
--- a/src/plugins/qmljseditor/qmljshoverhandler.cpp
+++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp
@@ -45,7 +45,6 @@
#include <qmljs/parser/qmljsastfwd_p.h>
#include <qmljs/qmljsutils.h>
#include <qmljs/qmljsqrcparser.h>
-#include <texteditor/itexteditor.h>
#include <texteditor/basetexteditor.h>
#include <texteditor/helpitem.h>
#include <utils/tooltip/tooltip.h>
@@ -184,7 +183,7 @@ bool HoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Document::
return true;
}
-void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
+void HoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos)
{
reset();
@@ -377,7 +376,7 @@ void HoverHandler::reset()
m_colorTip = QColor();
}
-void HoverHandler::operateTooltip(TextEditor::ITextEditor *editor, const QPoint &point)
+void HoverHandler::operateTooltip(TextEditor::BaseTextEditor *editor, const QPoint &point)
{
if (toolTip().isEmpty())
Utils::ToolTip::hide();
diff --git a/src/plugins/qmljseditor/qmljshoverhandler.h b/src/plugins/qmljseditor/qmljshoverhandler.h
index ced89f1c5b..bbc3cc2d59 100644
--- a/src/plugins/qmljseditor/qmljshoverhandler.h
+++ b/src/plugins/qmljseditor/qmljshoverhandler.h
@@ -41,7 +41,7 @@ QT_END_NAMESPACE
namespace Core { class IEditor; }
-namespace TextEditor { class ITextEditor; }
+namespace TextEditor { class BaseTextEditor; }
namespace QmlJS {
class ScopeChain;
@@ -67,8 +67,8 @@ private:
void reset();
virtual bool acceptEditor(Core::IEditor *editor);
- virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos);
- virtual void operateTooltip(TextEditor::ITextEditor *editor, const QPoint &point);
+ virtual void identifyMatch(TextEditor::BaseTextEditor *editor, int pos);
+ virtual void operateTooltip(TextEditor::BaseTextEditor *editor, const QPoint &point);
bool matchDiagnosticMessage(QmlJSTextEditorWidget *qmlEditor, int pos);
bool matchColorItem(const QmlJS::ScopeChain &lookupContext,
diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.cpp b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
index 8e9135a9ea..475aff7515 100644
--- a/src/plugins/qmljseditor/qmljsquickfixassist.cpp
+++ b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
@@ -49,7 +49,7 @@ using namespace Internal;
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSTextEditorWidget *editor,
TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(),
- editor->baseTextDocument()->filePath(), reason)
+ editor->textDocument()->filePath(), reason)
, m_semanticInfo(editor->qmlJsEditorDocument()->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(editor, m_semanticInfo.document))
{}
diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
index 4d76c94eae..f597d29078 100644
--- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
+++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
@@ -434,7 +434,7 @@ private:
void run()
{
int nMessages = 0;
- if (Document::isFullySupportedLanguage(m_scopeChain.document()->language())) {
+ if (m_scopeChain.document()->language().isFullySupportedLanguage()) {
nMessages = m_scopeChain.document()->diagnosticMessages().size()
+ m_semanticInfo.semanticMessages.size()
+ m_semanticInfo.staticAnalysisMessages.size();
diff --git a/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp b/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp
index 84d280aa24..3a5743945a 100644
--- a/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp
+++ b/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp
@@ -128,7 +128,7 @@ QmlJSTools::SemanticInfo SemanticInfoUpdater::makeNewSemanticInfo(const QmlJS::D
ScopeChain *scopeChain = new ScopeChain(doc, semanticInfo.context);
semanticInfo.setRootScopeChain(QSharedPointer<const ScopeChain>(scopeChain));
- if (doc->language() == Language::Json) {
+ if (doc->language() == Dialect::Json) {
Utils::JsonSchema *schema =
QmlJSEditorPlugin::instance()->jsonManager()->schemaForFile(doc->fileName());
if (schema) {
diff --git a/src/plugins/qmljseditor/qmljssnippetprovider.cpp b/src/plugins/qmljseditor/qmljssnippetprovider.cpp
index 746765700e..83ec7eb6ec 100644
--- a/src/plugins/qmljseditor/qmljssnippetprovider.cpp
+++ b/src/plugins/qmljseditor/qmljssnippetprovider.cpp
@@ -65,6 +65,6 @@ QString QmlJSSnippetProvider::displayName() const
void QmlJSSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *editor) const
{
editor->setSyntaxHighlighter(new Highlighter);
- editor->baseTextDocument()->setIndenter(new Indenter);
- editor->setAutoCompleter(new AutoCompleter);
+ editor->textDocument()->setIndenter(new Indenter);
+ editor->editor()->setAutoCompleter(new AutoCompleter);
}
diff --git a/src/plugins/qmljseditor/qmltaskmanager.cpp b/src/plugins/qmljseditor/qmltaskmanager.cpp
index cf3e35ead3..dbc50b59d3 100644
--- a/src/plugins/qmljseditor/qmltaskmanager.cpp
+++ b/src/plugins/qmljseditor/qmltaskmanager.cpp
@@ -109,7 +109,7 @@ void QmlTaskManager::collectMessages(
FileErrorMessages result;
result.fileName = fileName;
- if (Document::isFullySupportedLanguage(document->language())) {
+ if (document->language().isFullySupportedLanguage()) {
result.tasks = convertToTasks(document->diagnosticMessages(),
Utils::FileName::fromString(fileName),
Core::Id(Constants::TASK_CATEGORY_QML));
@@ -161,7 +161,7 @@ void QmlTaskManager::updateMessagesNow(bool updateSemantic)
QFuture<FileErrorMessages> future =
QtConcurrent::run<FileErrorMessages>(
&collectMessages, modelManager->newestSnapshot(), modelManager->projectInfos(),
- modelManager->defaultVContext(Language::AnyLanguage), updateSemantic);
+ modelManager->defaultVContext(Dialect::AnyLanguage), updateSemantic);
m_messageCollector.setFuture(future);
}
diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp
index 5a50f7afce..416a47a9a2 100644
--- a/src/plugins/qmljseditor/quicktoolbar.cpp
+++ b/src/plugins/qmljseditor/quicktoolbar.cpp
@@ -423,7 +423,7 @@ void QuickToolBar::onEnabledChanged(bool b)
void QuickToolBar::indentLines(int startLine, int endLine)
{
if (startLine > 0) {
- TextEditor::TabSettings tabSettings = m_editor->baseTextDocument()->tabSettings();
+ TextEditor::TabSettings tabSettings = m_editor->textDocument()->tabSettings();
for (int i = startLine; i <= endLine; i++) {
QTextBlock start = m_editor->editorWidget()->document()->findBlockByNumber(i);
diff --git a/src/plugins/qmljstools/qmlconsolepane.cpp b/src/plugins/qmljstools/qmlconsolepane.cpp
index 9c01ebc345..a79b36ae5f 100644
--- a/src/plugins/qmljstools/qmlconsolepane.cpp
+++ b/src/plugins/qmljstools/qmlconsolepane.cpp
@@ -119,7 +119,7 @@ QmlConsolePane::QmlConsolePane(QObject *parent)
m_showWarningButtonAction = new Utils::SavedAction(this);
m_showWarningButtonAction->setDefaultValue(true);
m_showWarningButtonAction->setSettingsKey(QLatin1String(CONSOLE), QLatin1String(SHOW_WARNING));
- m_showWarningButtonAction->setToolTip(tr("Show debug, log, and info messages."));
+ m_showWarningButtonAction->setToolTip(tr("Show warning messages."));
m_showWarningButtonAction->setCheckable(true);
m_showWarningButtonAction->setIcon(QIcon(QLatin1String(Core::Constants::ICON_WARNING)));
connect(m_showWarningButtonAction, SIGNAL(toggled(bool)), m_proxyModel,
@@ -132,7 +132,7 @@ QmlConsolePane::QmlConsolePane(QObject *parent)
m_showErrorButtonAction = new Utils::SavedAction(this);
m_showErrorButtonAction->setDefaultValue(true);
m_showErrorButtonAction->setSettingsKey(QLatin1String(CONSOLE), QLatin1String(SHOW_ERROR));
- m_showErrorButtonAction->setToolTip(tr("Show debug, log, and info messages."));
+ m_showErrorButtonAction->setToolTip(tr("Show error messages."));
m_showErrorButtonAction->setCheckable(true);
m_showErrorButtonAction->setIcon(QIcon(QLatin1String(Core::Constants::ICON_ERROR)));
connect(m_showErrorButtonAction, SIGNAL(toggled(bool)), m_proxyModel,
diff --git a/src/plugins/qmljstools/qmljsbundleprovider.cpp b/src/plugins/qmljstools/qmljsbundleprovider.cpp
index 1c065c2c81..5b125591f1 100644
--- a/src/plugins/qmljstools/qmljsbundleprovider.cpp
+++ b/src/plugins/qmljstools/qmljsbundleprovider.cpp
@@ -112,21 +112,21 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit
{
QHash<QString,QString> myReplacements = replacements;
- bundles.mergeBundleForLanguage(Language::QmlQbs, defaultQbsBundle());
- bundles.mergeBundleForLanguage(Language::QmlTypeInfo, defaultQmltypesBundle());
- bundles.mergeBundleForLanguage(Language::QmlProject, defaultQmlprojectBundle());
+ bundles.mergeBundleForLanguage(Dialect::QmlQbs, defaultQbsBundle());
+ bundles.mergeBundleForLanguage(Dialect::QmlTypeInfo, defaultQmltypesBundle());
+ bundles.mergeBundleForLanguage(Dialect::QmlProject, defaultQmlprojectBundle());
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(kit);
if (!qtVersion) {
QmlBundle b1(defaultQt4QtQuick1Bundle());
- bundles.mergeBundleForLanguage(Language::Qml, b1);
- bundles.mergeBundleForLanguage(Language::QmlQtQuick1, b1);
+ bundles.mergeBundleForLanguage(Dialect::Qml, b1);
+ bundles.mergeBundleForLanguage(Dialect::QmlQtQuick1, b1);
QmlBundle b11(defaultQt5QtQuick1Bundle());
- bundles.mergeBundleForLanguage(Language::Qml, b11);
- bundles.mergeBundleForLanguage(Language::QmlQtQuick1, b11);
+ bundles.mergeBundleForLanguage(Dialect::Qml, b11);
+ bundles.mergeBundleForLanguage(Dialect::QmlQtQuick1, b11);
QmlBundle b2(defaultQt5QtQuick2Bundle());
- bundles.mergeBundleForLanguage(Language::Qml, b2);
- bundles.mergeBundleForLanguage(Language::QmlQtQuick2, b2);
+ bundles.mergeBundleForLanguage(Dialect::Qml, b2);
+ bundles.mergeBundleForLanguage(Dialect::QmlQtQuick2, b2);
return;
}
QString qtImportsPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS");
@@ -157,8 +157,8 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit
qtQuick1Bundle.merge(defaultQt5QtQuick1Bundle());
}
qtQuick1Bundle.replaceVars(myReplacements);
- bundles.mergeBundleForLanguage(Language::Qml, qtQuick1Bundle);
- bundles.mergeBundleForLanguage(Language::QmlQtQuick1, qtQuick1Bundle);
+ bundles.mergeBundleForLanguage(Dialect::Qml, qtQuick1Bundle);
+ bundles.mergeBundleForLanguage(Dialect::QmlQtQuick1, qtQuick1Bundle);
}
if (features.contains(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2))) {
myReplacements.insert(QLatin1String("$(CURRENT_DIRECTORY)"), qtQmlPath);
@@ -179,8 +179,8 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit
qtQuick2Bundle.merge(defaultQt5QtQuick2Bundle());
}
qtQuick2Bundle.replaceVars(myReplacements);
- bundles.mergeBundleForLanguage(Language::Qml, qtQuick2Bundle);
- bundles.mergeBundleForLanguage(Language::QmlQtQuick2, qtQuick2Bundle);
+ bundles.mergeBundleForLanguage(Dialect::Qml, qtQuick2Bundle);
+ bundles.mergeBundleForLanguage(Dialect::QmlQtQuick2, qtQuick2Bundle);
}
}
diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
index 14a75894b5..a554542f8b 100644
--- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
+++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
@@ -101,7 +101,7 @@ void QmlJSCodeStylePreferencesWidget::decorateEditor(const TextEditor::FontSetti
return current->groupId() == QLatin1String(QmlJSEditor::Constants::QML_SNIPPETS_GROUP_ID);
});
- m_ui->previewTextEdit->baseTextDocument()->setFontSettings(fontSettings);
+ m_ui->previewTextEdit->textDocument()->setFontSettings(fontSettings);
if (provider)
provider->decorateEditor(m_ui->previewTextEdit);
}
@@ -125,7 +125,7 @@ void QmlJSCodeStylePreferencesWidget::updatePreview()
const TextEditor::TabSettings &ts = m_preferences
? m_preferences->currentTabSettings()
: TextEditorSettings::codeStyle()->tabSettings();
- m_ui->previewTextEdit->baseTextDocument()->setTabSettings(ts);
+ m_ui->previewTextEdit->textDocument()->setTabSettings(ts);
CreatorCodeFormatter formatter(ts);
formatter.invalidateCache(doc);
@@ -133,7 +133,7 @@ void QmlJSCodeStylePreferencesWidget::updatePreview()
QTextCursor tc = m_ui->previewTextEdit->textCursor();
tc.beginEditBlock();
while (block.isValid()) {
- m_ui->previewTextEdit->baseTextDocument()->indenter()
+ m_ui->previewTextEdit->textDocument()->indenter()
->indentBlock(doc, block, QChar::Null, ts);
block = block.next();
}
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp
index 3c5a53806d..fc3f0f744b 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.cpp
+++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp
@@ -68,8 +68,8 @@ using namespace QmlJSTools;
using namespace QmlJSTools::Internal;
-ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
- ProjectExplorer::Project *project)
+ModelManagerInterface::ProjectInfo QmlJSTools::Internal::ModelManager::defaultProjectInfoForProject(
+ ProjectExplorer::Project *project) const
{
ModelManagerInterface::ProjectInfo projectInfo(project);
ProjectExplorer::Target *activeTarget = 0;
@@ -174,26 +174,26 @@ void QmlJSTools::setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo &
}
}
-QHash<QString,QmlJS::Language::Enum> ModelManager::languageForSuffix() const
+QHash<QString,QmlJS::Dialect> ModelManager::languageForSuffix() const
{
- QHash<QString,QmlJS::Language::Enum> res = ModelManagerInterface::languageForSuffix();
+ QHash<QString,QmlJS::Dialect> res = ModelManagerInterface::languageForSuffix();
if (ICore::instance()) {
MimeType jsSourceTy = MimeDatabase::findByType(QLatin1String(Constants::JS_MIMETYPE));
foreach (const QString &suffix, jsSourceTy.suffixes())
- res[suffix] = Language::JavaScript;
+ res[suffix] = Dialect::JavaScript;
MimeType qmlSourceTy = MimeDatabase::findByType(QLatin1String(Constants::QML_MIMETYPE));
foreach (const QString &suffix, qmlSourceTy.suffixes())
- res[suffix] = Language::Qml;
+ res[suffix] = Dialect::Qml;
MimeType qbsSourceTy = MimeDatabase::findByType(QLatin1String(Constants::QBS_MIMETYPE));
foreach (const QString &suffix, qbsSourceTy.suffixes())
- res[suffix] = Language::QmlQbs;
+ res[suffix] = Dialect::QmlQbs;
MimeType qmlProjectSourceTy = MimeDatabase::findByType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
foreach (const QString &suffix, qmlProjectSourceTy.suffixes())
- res[suffix] = Language::QmlProject;
+ res[suffix] = Dialect::QmlProject;
MimeType jsonSourceTy = MimeDatabase::findByType(QLatin1String(Constants::JSON_MIMETYPE));
foreach (const QString &suffix, jsonSourceTy.suffixes())
- res[suffix] = Language::Json;
+ res[suffix] = Dialect::Json;
}
return res;
}
@@ -226,7 +226,7 @@ void ModelManager::delayedInitialization()
SLOT(updateDefaultProjectInfo()));
QmlJS::ViewerContext qbsVContext;
- qbsVContext.language = Language::QmlQbs;
+ qbsVContext.language = Dialect::QmlQbs;
qbsVContext.maybeAddPath(ICore::resourcePath() + QLatin1String("/qbs"));
setDefaultVContext(qbsVContext);
}
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.h b/src/plugins/qmljstools/qmljsmodelmanager.h
index efc8de8bb5..ca0b2504a1 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.h
+++ b/src/plugins/qmljstools/qmljsmodelmanager.h
@@ -68,10 +68,11 @@ public:
void delayedInitialization();
protected:
- QHash<QString, QmlJS::Language::Enum> languageForSuffix() const QTC_OVERRIDE;
+ QHash<QString, QmlJS::Dialect> languageForSuffix() const QTC_OVERRIDE;
void writeMessageInternal(const QString &msg) const QTC_OVERRIDE;
WorkingCopy workingCopyInternal() const QTC_OVERRIDE;
void addTaskInternal(QFuture<void> result, const QString &msg, const char *taskId) const QTC_OVERRIDE;
+ ProjectInfo defaultProjectInfoForProject(ProjectExplorer::Project *project) const QTC_OVERRIDE;
private slots:
void updateDefaultProjectInfo();
private:
@@ -81,8 +82,6 @@ private:
} // namespace Internal
-QMLJSTOOLS_EXPORT QmlJS::ModelManagerInterface::ProjectInfo defaultProjectInfoForProject(
- ProjectExplorer::Project *project);
QMLJSTOOLS_EXPORT void setupProjectInfoQmlBundles(QmlJS::ModelManagerInterface::ProjectInfo &projectInfo);
} // namespace QmlJSTools
diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
index 4ef9bb2206..fb1c14f036 100644
--- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
+++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
@@ -124,7 +124,7 @@ QmlJSRefactoringFile::QmlJSRefactoringFile(const QString &fileName, const QShare
: RefactoringFile(fileName, data)
{
// the RefactoringFile is invalid if its not for a file with qml or js code
- if (ModelManagerInterface::guessLanguageOfFile(fileName) == Language::NoLanguage)
+ if (ModelManagerInterface::guessLanguageOfFile(fileName) == Dialect::NoLanguage)
m_fileName.clear();
}
diff --git a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp
index 38b0808774..be79adeaca 100644
--- a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp
@@ -136,7 +136,7 @@ void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId,
QFileInfo fileInfo(localFile);
if (!fileInfo.exists() || !fileInfo.isReadable())
return;
- if (!QmlJS::Document::isQmlLikeLanguage(QmlJS::ModelManagerInterface::guessLanguageOfFile(localFile)))
+ if (!QmlJS::ModelManagerInterface::guessLanguageOfFile(localFile).isQmlLikeLanguage())
return;
PendingEvent ev = {location, localFile, requestId};
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index be95ab4689..5af5ffc07d 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -51,7 +51,7 @@
#include <projectexplorer/session.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/localapplicationrunconfiguration.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
@@ -67,15 +67,15 @@
#include <qtsupport/qtkitinformation.h>
#include <QApplication>
+#include <QFileDialog>
#include <QHBoxLayout>
#include <QLabel>
-#include <QToolButton>
-#include <QMessageBox>
-#include <QFileDialog>
#include <QMenu>
-#include <QTimer>
-#include <QTime>
+#include <QMessageBox>
#include <QTcpServer>
+#include <QTime>
+#include <QTimer>
+#include <QToolButton>
using namespace Core;
using namespace Core::Constants;
@@ -112,6 +112,8 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
: IAnalyzerTool(parent), d(new QmlProfilerToolPrivate)
{
setObjectName(QLatin1String("QmlProfilerTool"));
+ setRunMode(QmlProfilerRunMode);
+ setToolMode(AnyMode);
d->m_profilerState = 0;
d->m_viewContainer = 0;
@@ -135,20 +137,20 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
Command *command = 0;
const Context globalContext(C_GLOBAL);
- ActionContainer *menu = Core::ActionManager::actionContainer(M_DEBUG_ANALYZER);
- ActionContainer *options = Core::ActionManager::createMenu(M_DEBUG_ANALYZER_QML_OPTIONS);
+ ActionContainer *menu = ActionManager::actionContainer(M_DEBUG_ANALYZER);
+ ActionContainer *options = ActionManager::createMenu(M_DEBUG_ANALYZER_QML_OPTIONS);
options->menu()->setTitle(tr("QML Profiler Options"));
menu->addMenu(options, G_ANALYZER_OPTIONS);
options->menu()->setEnabled(true);
QAction *act = d->m_loadQmlTrace = new QAction(tr("Load QML Trace"), options);
- command = Core::ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace", globalContext);
+ command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace", globalContext);
connect(act, SIGNAL(triggered()), this, SLOT(showLoadDialog()));
options->addAction(command);
act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options);
d->m_saveQmlTrace->setEnabled(false);
- command = Core::ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace", globalContext);
+ command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace", globalContext);
connect(act, SIGNAL(triggered()), this, SLOT(showSaveDialog()));
options->addAction(command);
@@ -161,16 +163,6 @@ QmlProfilerTool::~QmlProfilerTool()
delete d;
}
-RunMode QmlProfilerTool::runMode() const
-{
- return QmlProfilerRunMode;
-}
-
-IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
-{
- return AnyMode;
-}
-
AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
{
@@ -222,9 +214,9 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParamet
static QString sysroot(RunConfiguration *runConfig)
{
QTC_ASSERT(runConfig, return QString());
- ProjectExplorer::Kit *k = runConfig->target()->kit();
- if (k && ProjectExplorer::SysRootKitInformation::hasSysRoot(k))
- return ProjectExplorer::SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
+ Kit *k = runConfig->target()->kit();
+ if (k && SysRootKitInformation::hasSysRoot(k))
+ return SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
return QString();
}
@@ -349,7 +341,7 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber,
return;
IEditor *editor = EditorManager::openEditor(projectFileName);
- TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);
+ TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor);
if (textEditor) {
EditorManager::addCurrentPositionToNavigationHistory();
@@ -434,8 +426,6 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
void QmlProfilerTool::startTool(StartMode mode)
{
- using namespace ProjectExplorer;
-
// Make sure mode is shown.
AnalyzerManager::showMode();
@@ -450,7 +440,7 @@ void QmlProfilerTool::startTool(StartMode mode)
void QmlProfilerTool::logState(const QString &msg)
{
- MessageManager::write(msg, Core::MessageManager::Flash);
+ MessageManager::write(msg, MessageManager::Flash);
}
void QmlProfilerTool::logError(const QString &msg)
@@ -460,7 +450,7 @@ void QmlProfilerTool::logError(const QString &msg)
void QmlProfilerTool::showErrorDialog(const QString &error)
{
- QMessageBox *errorDialog = new QMessageBox(Core::ICore::mainWindow());
+ QMessageBox *errorDialog = new QMessageBox(ICore::mainWindow());
errorDialog->setIcon(QMessageBox::Warning);
errorDialog->setWindowTitle(tr("QML Profiler"));
errorDialog->setText(error);
@@ -477,7 +467,7 @@ void QmlProfilerTool::showSaveOption()
void QmlProfilerTool::showSaveDialog()
{
- QString filename = QFileDialog::getSaveFileName(Core::ICore::mainWindow(), tr("Save QML Trace"), QString(),
+ QString filename = QFileDialog::getSaveFileName(ICore::mainWindow(), tr("Save QML Trace"), QString(),
tr("QML traces (*%1)").arg(QLatin1String(TraceFileExtension)));
if (!filename.isEmpty()) {
if (!filename.endsWith(QLatin1String(TraceFileExtension)))
@@ -493,7 +483,7 @@ void QmlProfilerTool::showLoadDialog()
AnalyzerManager::selectTool(this, StartRemote);
- QString filename = QFileDialog::getOpenFileName(Core::ICore::mainWindow(), tr("Load QML Trace"), QString(),
+ QString filename = QFileDialog::getOpenFileName(ICore::mainWindow(), tr("Load QML Trace"), QString(),
tr("QML traces (*%1)").arg(QLatin1String(TraceFileExtension)));
if (!filename.isEmpty()) {
@@ -550,7 +540,7 @@ QList <QAction *> QmlProfilerTool::profilerContextMenuActions() const
void QmlProfilerTool::showNonmodalWarning(const QString &warningMsg)
{
- QMessageBox *noExecWarning = new QMessageBox(Core::ICore::mainWindow());
+ QMessageBox *noExecWarning = new QMessageBox(ICore::mainWindow());
noExecWarning->setIcon(QMessageBox::Warning);
noExecWarning->setWindowTitle(tr("QML Profiler"));
noExecWarning->setText(warningMsg);
@@ -562,7 +552,7 @@ void QmlProfilerTool::showNonmodalWarning(const QString &warningMsg)
QMessageBox *QmlProfilerTool::requestMessageBox()
{
- return new QMessageBox(Core::ICore::mainWindow());
+ return new QMessageBox(ICore::mainWindow());
}
void QmlProfilerTool::handleHelpRequest(const QString &link)
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h
index 49ab19592d..9c87a53054 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.h
+++ b/src/plugins/qmlprofiler/qmlprofilertool.h
@@ -48,9 +48,6 @@ public:
explicit QmlProfilerTool(QObject *parent);
~QmlProfilerTool();
- ProjectExplorer::RunMode runMode() const;
- ToolMode toolMode() const;
-
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index 5acffaf8b3..5b45fb560e 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -41,7 +41,7 @@
#include <coreplugin/documentmanager.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
-#include <qmljstools/qmljsmodelmanager.h>
+#include <qmljs/qmljsmodelmanagerinterface.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/target.h>
@@ -55,60 +55,12 @@ using namespace ProjectExplorer;
namespace QmlProjectManager {
namespace Internal {
-class QmlProjectKitMatcher : public ProjectExplorer::KitMatcher
-{
-public:
- QmlProjectKitMatcher(const QmlProject::QmlImport &import)
- : import(import)
- {
- }
-
- bool matches(const ProjectExplorer::Kit *k) const
- {
- if (!k->isValid())
- return false;
-
- ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k);
- if (dev.isNull() || dev->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
- return false;
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
- if (!version || version->type() != QLatin1String(QtSupport::Constants::DESKTOPQT))
- return false;
-
- bool hasViewer = false; // Initialization needed for dumb compilers.
- QtSupport::QtVersionNumber minVersion;
- switch (import) {
- case QmlProject::UnknownImport:
- minVersion = QtSupport::QtVersionNumber(4, 7, 0);
- hasViewer = !version->qmlviewerCommand().isEmpty() || !version->qmlsceneCommand().isEmpty();
- break;
- case QmlProject::QtQuick1Import:
- minVersion = QtSupport::QtVersionNumber(4, 7, 1);
- hasViewer = !version->qmlviewerCommand().isEmpty();
- break;
- case QmlProject::QtQuick2Import:
- minVersion = QtSupport::QtVersionNumber(5, 0, 0);
- hasViewer = !version->qmlsceneCommand().isEmpty();
- break;
- }
-
- if (version->qtVersion() >= minVersion
- && hasViewer)
- return true;
-
- return false;
- }
-private:
- QmlProject::QmlImport import;
-};
-
} // namespace Internal
QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
: m_manager(manager),
m_fileName(fileName),
m_defaultImport(UnknownImport),
- m_modelManager(QmlJS::ModelManagerInterface::instance()),
m_activeTarget(0)
{
setId("QmlProjectManager.QmlProject");
@@ -210,7 +162,8 @@ void QmlProject::parseProject(RefreshOptions options)
}
if (m_projectItem) {
m_projectItem.data()->setSourceDirectory(projectDir().path());
- m_modelManager->updateSourceFiles(m_projectItem.data()->files(), true);
+ if (modelManager())
+ modelManager()->updateSourceFiles(m_projectItem.data()->files(), true);
QString mainFilePath = m_projectItem.data()->mainFile();
if (!mainFilePath.isEmpty()) {
@@ -243,11 +196,16 @@ void QmlProject::refresh(RefreshOptions options)
if (options & Files)
m_rootNode->refresh();
+ if (!modelManager())
+ return;
+
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
- QmlJSTools::defaultProjectInfoForProject(this);
- projectInfo.importPaths = customImportPaths();
+ modelManager()->defaultProjectInfoForProject(this);
+ foreach (const QString &searchPath, customImportPaths())
+ projectInfo.importPaths.maybeInsert(Utils::FileName::fromString(searchPath),
+ QmlJS::Dialect::Qml);
- m_modelManager->updateProjectInfo(projectInfo, this);
+ modelManager()->updateProjectInfo(projectInfo, this);
}
QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
@@ -262,6 +220,11 @@ QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
return absolutePaths;
}
+QmlJS::ModelManagerInterface *QmlProject::modelManager() const
+{
+ return QmlJS::ModelManagerInterface::instance();
+}
+
QStringList QmlProject::files() const
{
QStringList files;
@@ -316,8 +279,8 @@ QmlProject::QmlImport QmlProject::defaultImport() const
void QmlProject::refreshFiles(const QSet<QString> &/*added*/, const QSet<QString> &removed)
{
refresh(Files);
- if (!removed.isEmpty())
- m_modelManager->removeFiles(removed.toList());
+ if (!removed.isEmpty() && modelManager())
+ modelManager()->removeFiles(removed.toList());
}
QString QmlProject::displayName() const
@@ -386,8 +349,37 @@ bool QmlProject::fromMap(const QVariantMap &map)
if (!activeTarget()) {
// find a kit that matches prerequisites (prefer default one)
- Internal::QmlProjectKitMatcher matcher(defaultImport());
- QList<Kit*> kits = KitManager::matchingKits(matcher);
+ QList<Kit*> kits = KitManager::matchingKits(
+ std::function<bool(const Kit *)>([this](const Kit *k) -> bool {
+ if (!k->isValid())
+ return false;
+
+ IDevice::ConstPtr dev = DeviceKitInformation::device(k);
+ if (dev.isNull() || dev->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
+ return false;
+ QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
+ if (!version || version->type() != QLatin1String(QtSupport::Constants::DESKTOPQT))
+ return false;
+
+ bool hasViewer = false; // Initialization needed for dumb compilers.
+ QtSupport::QtVersionNumber minVersion;
+ switch (m_defaultImport) {
+ case QmlProject::UnknownImport:
+ minVersion = QtSupport::QtVersionNumber(4, 7, 0);
+ hasViewer = !version->qmlviewerCommand().isEmpty() || !version->qmlsceneCommand().isEmpty();
+ break;
+ case QmlProject::QtQuick1Import:
+ minVersion = QtSupport::QtVersionNumber(4, 7, 1);
+ hasViewer = !version->qmlviewerCommand().isEmpty();
+ break;
+ case QmlProject::QtQuick2Import:
+ minVersion = QtSupport::QtVersionNumber(5, 0, 0);
+ hasViewer = !version->qmlsceneCommand().isEmpty();
+ break;
+ }
+
+ return version->qtVersion() >= minVersion && hasViewer;
+ }));
if (!kits.isEmpty()) {
Kit *kit = 0;
diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h
index 87626091fa..fe0d7acdab 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.h
+++ b/src/plugins/qmlprojectmanager/qmlproject.h
@@ -107,13 +107,13 @@ private:
// plain format
void parseProject(RefreshOptions options);
QStringList convertToAbsoluteFiles(const QStringList &paths) const;
+ QmlJS::ModelManagerInterface *modelManager() const;
Internal::Manager *m_manager;
QString m_fileName;
Internal::QmlProjectFile *m_file;
QString m_projectName;
QmlImport m_defaultImport;
- QmlJS::ModelManagerInterface *m_modelManager;
ProjectExplorer::Target *m_activeTarget;
// plain format
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
index 527250f72d..be5d123edb 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
@@ -11,7 +11,6 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "ProjectExplorer" }
- Depends { name: "QmlJSTools" }
Depends { name: "QtSupport" }
Group {
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri b/src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri
index ee0072b42e..280e2c9a8d 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri
@@ -6,5 +6,4 @@ QTC_LIB_DEPENDS += \
QTC_PLUGIN_DEPENDS += \
coreplugin \
projectexplorer \
- qmljstools \
qtsupport
diff --git a/src/plugins/qnx/bardescriptoreditor.cpp b/src/plugins/qnx/bardescriptoreditor.cpp
index dfd3d707fe..dee7b4fae8 100644
--- a/src/plugins/qnx/bardescriptoreditor.cpp
+++ b/src/plugins/qnx/bardescriptoreditor.cpp
@@ -159,7 +159,7 @@ void BarDescriptorEditor::updateCursorPosition()
const int line = block.blockNumber() + 1;
const int column = cursor.position() - block.position();
m_cursorPositionLabel->setText(tr("Line: %1, Col: %2").arg(line)
- .arg(editorWidget->sourceWidget()->baseTextDocument()
+ .arg(editorWidget->sourceWidget()->textDocument()
->tabSettings().columnAt(block.text(), column)+1),
tr("Line: 9999, Col: 999"));
if (!block.isVisible())
diff --git a/src/plugins/qnx/bardescriptoreditorwidget.cpp b/src/plugins/qnx/bardescriptoreditorwidget.cpp
index af1238e6ce..20c7eb6a9d 100644
--- a/src/plugins/qnx/bardescriptoreditorwidget.cpp
+++ b/src/plugins/qnx/bardescriptoreditorwidget.cpp
@@ -41,14 +41,17 @@
#include "bardescriptoreditorpackageinformationwidget.h"
#include "bardescriptoreditorpermissionswidget.h"
+#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
-#include <projectexplorer/iprojectproperties.h>
-#include <projectexplorer/projectwindow.h>
+#include <projectexplorer/panelswidget.h>
+#include <projectexplorer/propertiespanel.h>
#include <projectexplorer/task.h>
#include <projectexplorer/taskhub.h>
-#include <texteditor/plaintexteditor.h>
+#include <texteditor/basetextdocument.h>
+#include <texteditor/basetexteditor.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/texteditorconstants.h>
+#include <texteditor/normalindenter.h>
#include <utils/qtcassert.h>
using namespace Qnx;
@@ -165,11 +168,16 @@ void BarDescriptorEditorWidget::initAssetsPage()
void BarDescriptorEditorWidget::initSourcePage()
{
- m_xmlSourceWidget = new TextEditor::PlainTextEditorWidget(this);
+ auto doc = new TextEditor::BaseTextDocument;
+ doc->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID); // FIXME: This looks odd.
+ doc->setIndenter(new TextEditor::NormalIndenter);
+
+ m_xmlSourceWidget = new TextEditor::BaseTextEditorWidget(doc, this);
+ m_xmlSourceWidget->setupAsPlainEditor();
addWidget(m_xmlSourceWidget);
TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget);
- m_xmlSourceWidget->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
+ m_xmlSourceWidget->configureMimeType(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
}
void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget)
@@ -185,7 +193,7 @@ TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() cons
void BarDescriptorEditorWidget::setFilePath(const QString &filePath)
{
- Core::IDocument *doc = m_xmlSourceWidget->baseTextDocument();
+ Core::IDocument *doc = m_xmlSourceWidget->textDocument();
if (doc)
doc->setFilePath(filePath);
}
diff --git a/src/plugins/qnx/bardescriptoreditorwidget.h b/src/plugins/qnx/bardescriptoreditorwidget.h
index 4532a255a5..0c2251a498 100644
--- a/src/plugins/qnx/bardescriptoreditorwidget.h
+++ b/src/plugins/qnx/bardescriptoreditorwidget.h
@@ -40,10 +40,7 @@ namespace Core { class IEditor; }
namespace ProjectExplorer { class PanelsWidget; }
-namespace TextEditor {
-class PlainTextEditorWidget;
-class BaseTextEditorWidget;
-}
+namespace TextEditor { class BaseTextEditorWidget; }
namespace Qnx {
namespace Internal {
@@ -97,7 +94,7 @@ private:
BarDescriptorEditorAssetsWidget *m_assetsWidget;
- TextEditor::PlainTextEditorWidget *m_xmlSourceWidget;
+ TextEditor::BaseTextEditorWidget *m_xmlSourceWidget;
};
diff --git a/src/plugins/qnx/blackberryapplicationrunner.cpp b/src/plugins/qnx/blackberryapplicationrunner.cpp
index 20d210d846..64447725a6 100644
--- a/src/plugins/qnx/blackberryapplicationrunner.cpp
+++ b/src/plugins/qnx/blackberryapplicationrunner.cpp
@@ -86,7 +86,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(const BlackBerryApplica
Target *target = runConfiguration->target();
BuildConfiguration *buildConfig = target->activeBuildConfiguration();
m_environment = buildConfig->environment();
- m_deployCmd = m_environment.searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD));
+ m_deployCmd = m_environment.searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)).toString();
QFileInfo fi(target->kit()->autoDetectionSource());
m_bbApiLevelVersion = QnxVersionNumber::fromNdkEnvFileName(fi.baseName());
@@ -310,7 +310,7 @@ void BlackBerryApplicationRunner::checkQmlJsDebugArguments()
}
emit output(tr("Checking qmljsdebugger command line argument."), Utils::StdOutFormat);
- QString nativePackagerCmd = m_environment.searchInPath(QLatin1String("blackberry-nativepackager"));
+ QString nativePackagerCmd = m_environment.searchInPath(QLatin1String("blackberry-nativepackager")).toString();
if (nativePackagerCmd.isEmpty()) {
emit output(tr("Cannot find Native Packager executable."), Utils::StdErrFormat);
return;
diff --git a/src/plugins/qnx/blackberrycreatepackagestep.cpp b/src/plugins/qnx/blackberrycreatepackagestep.cpp
index 2227315a13..0af33f58dd 100644
--- a/src/plugins/qnx/blackberrycreatepackagestep.cpp
+++ b/src/plugins/qnx/blackberrycreatepackagestep.cpp
@@ -225,7 +225,8 @@ bool BlackBerryCreatePackageStep::init()
if (!BlackBerryAbstractDeployStep::init())
return false;
- const QString packageCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(PACKAGER_CMD));
+ const Utils::FileName packageCmd =
+ target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(PACKAGER_CMD));
if (packageCmd.isEmpty()) {
raiseError(tr("Could not find packager command \"%1\" in the build environment.")
.arg(QLatin1String(PACKAGER_CMD)));
@@ -296,7 +297,7 @@ bool BlackBerryCreatePackageStep::init()
args << QLatin1String("-package") << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath()));
args << QnxUtils::addQuotes(QDir::toNativeSeparators(appDescriptorPath));
- addCommand(packageCmd, args);
+ addCommand(packageCmd.toString(), args);
}
return true;
diff --git a/src/plugins/qnx/blackberrydeploystep.cpp b/src/plugins/qnx/blackberrydeploystep.cpp
index a0fe3286c9..04d255b85b 100644
--- a/src/plugins/qnx/blackberrydeploystep.cpp
+++ b/src/plugins/qnx/blackberrydeploystep.cpp
@@ -69,7 +69,9 @@ bool BlackBerryDeployStep::init()
if (!BlackBerryAbstractDeployStep::init())
return false;
- QString deployCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD));
+ Utils::FileName deployCmd =
+ target()->activeBuildConfiguration()->environment().searchInPath(
+ QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD));
if (deployCmd.isEmpty()) {
raiseError(tr("Could not find deploy command \"%1\" in the build environment")
.arg(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)));
@@ -98,7 +100,7 @@ bool BlackBerryDeployStep::init()
args << QLatin1String("-password") << password();
args << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath()));
- addCommand(deployCmd, args);
+ addCommand(deployCmd.toString(), args);
}
return true;
diff --git a/src/plugins/qnx/blackberrydeviceconnection.cpp b/src/plugins/qnx/blackberrydeviceconnection.cpp
index a3578151e7..fc69c2890a 100644
--- a/src/plugins/qnx/blackberrydeviceconnection.cpp
+++ b/src/plugins/qnx/blackberrydeviceconnection.cpp
@@ -71,7 +71,7 @@ void BlackBerryDeviceConnection::connectDevice(const ProjectExplorer::IDevice::C
// Since killing the blackberry-connect script won't kill the java process it launches,
// let's just call the java process directly instead.
- QString command = env.searchInPath(QLatin1String("java"));
+ Utils::FileName command = env.searchInPath(QLatin1String("java"));
if (command.isEmpty()) {
const QString line = tr("Error connecting to device: java could not be found in the environment.") + QLatin1Char('\n');
emit processOutput(line);
@@ -90,7 +90,7 @@ void BlackBerryDeviceConnection::connectDevice(const ProjectExplorer::IDevice::C
args << QLatin1String("-sshPublicKey") << publicKeyFile;
m_connectionState = Connecting;
- m_process->start(command, args);
+ m_process->start(command.toString(), args);
m_messageLog.clear();
emit deviceAboutToConnect();
}
diff --git a/src/plugins/qnx/blackberryrunconfigurationfactory.cpp b/src/plugins/qnx/blackberryrunconfigurationfactory.cpp
index 25dde64e0f..ab91531272 100644
--- a/src/plugins/qnx/blackberryrunconfigurationfactory.cpp
+++ b/src/plugins/qnx/blackberryrunconfigurationfactory.cpp
@@ -65,7 +65,7 @@ QList<Core::Id> BlackBerryRunConfigurationFactory::availableCreationIds(ProjectE
QList<QmakeProjectManager::QmakeProFileNode *> nodes = qt4Project->applicationProFiles();
if (mode == AutoCreate)
nodes = QmakeProject::nodesWithQtcRunnable(nodes);
- return QmakeProject::idsForNodes(Core::Id(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX),
+ return QmakeProject::idsForNodes(Core::Id(Constants::QNX_BB_RUNCONFIGURATION_PREFIX),
nodes);
}
diff --git a/src/plugins/qnx/blackberrysigningutils.cpp b/src/plugins/qnx/blackberrysigningutils.cpp
index 300ab06195..6699443f1e 100644
--- a/src/plugins/qnx/blackberrysigningutils.cpp
+++ b/src/plugins/qnx/blackberrysigningutils.cpp
@@ -244,7 +244,7 @@ void BlackBerrySigningUtils::saveDebugTokens()
settings->beginGroup(DebugTokensGroup);
int count = 0;
- foreach (QString dt, m_debugTokens) {
+ foreach (const QString &dt, m_debugTokens) {
settings->beginGroup(QString::fromLatin1("debugToken_%1").arg(++count));
settings->setValue(DebugTokensPath, dt);
settings->endGroup();
diff --git a/src/plugins/qnx/cascadesimport/projectfileconverter.cpp b/src/plugins/qnx/cascadesimport/projectfileconverter.cpp
index bc6f588be7..46eb87c031 100644
--- a/src/plugins/qnx/cascadesimport/projectfileconverter.cpp
+++ b/src/plugins/qnx/cascadesimport/projectfileconverter.cpp
@@ -94,11 +94,11 @@ static QString updateVariable(const QString &varStr, const QString &varsToAdd,
QSet<QString> var = parseVariable(varStr);
QSet<QString> ss = parseVariable(varsToAdd);
- foreach (QString s, ss)
+ foreach (const QString &s, ss)
var << s;
ss = parseVariable(varsToRemove);
- foreach (QString s, ss)
+ foreach (const QString &s, ss)
var.remove(s);
QStringList sl = QStringList::fromSet(var);
diff --git a/src/plugins/qnx/qnxbaseconfiguration.cpp b/src/plugins/qnx/qnxbaseconfiguration.cpp
index e34f507626..b698f6be15 100644
--- a/src/plugins/qnx/qnxbaseconfiguration.cpp
+++ b/src/plugins/qnx/qnxbaseconfiguration.cpp
@@ -187,7 +187,7 @@ QnxToolChain *QnxBaseConfiguration::createToolChain(QnxArchitecture arch,
const QString &ndkPath)
{
QnxToolChain *toolChain = new QnxToolChain(ProjectExplorer::ToolChain::AutoDetection);
- toolChain->setCompilerCommand(m_qccCompiler);
+ toolChain->resetToolChain(m_qccCompiler);
toolChain->setTargetAbi(Abi((arch == Qnx::ArmLeV7) ? Abi::ArmArchitecture : Abi::X86Architecture,
Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 32));
toolChain->setDisplayName(displayName);
diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp
index 4c9d44f929..00a6e45aed 100644
--- a/src/plugins/qnx/qnxplugin.cpp
+++ b/src/plugins/qnx/qnxplugin.cpp
@@ -77,6 +77,7 @@
#include <QAction>
#include <QtPlugin>
+using namespace ProjectExplorer;
using namespace Qnx::Internal;
QnxPlugin::QnxPlugin()
@@ -178,11 +179,10 @@ ExtensionSystem::IPlugin::ShutdownFlag QnxPlugin::aboutToShutdown()
void QnxPlugin::updateDebuggerActions()
{
bool hasValidQnxKit = false;
- ProjectExplorer::DeviceTypeMatcher qnxTypeMatcher(Constants::QNX_QNX_OS_TYPE);
- const QList<ProjectExplorer::Kit *> qnxKits = ProjectExplorer::KitManager::matchingKits(qnxTypeMatcher);
- foreach (ProjectExplorer::Kit *qnxKit, qnxKits) {
- if (qnxKit->isValid() && !ProjectExplorer::DeviceKitInformation::device(qnxKit).isNull()) {
+ KitMatcher matcher = DeviceTypeKitInformation::deviceTypeMatcher(Constants::QNX_QNX_OS_TYPE);
+ foreach (Kit *qnxKit, KitManager::matchingKits(matcher)) {
+ if (qnxKit->isValid() && !DeviceKitInformation::device(qnxKit).isNull()) {
hasValidQnxKit = true;
break;
}
diff --git a/src/plugins/qnx/qnxtoolchain.cpp b/src/plugins/qnx/qnxtoolchain.cpp
index 45023f4bcb..5205e0f9e9 100644
--- a/src/plugins/qnx/qnxtoolchain.cpp
+++ b/src/plugins/qnx/qnxtoolchain.cpp
@@ -242,7 +242,7 @@ void QnxToolChainConfigWidget::applyImpl()
QnxToolChain *tc = static_cast<QnxToolChain *>(toolChain());
Q_ASSERT(tc);
QString displayName = tc->displayName();
- tc->setCompilerCommand(m_compilerCommand->fileName());
+ tc->resetToolChain(m_compilerCommand->fileName());
tc->setDisplayName(displayName); // reset display name
tc->setNdkPath(m_ndkPath->fileName().toString());
tc->setTargetAbi(m_abiWidget->currentAbi());
diff --git a/src/plugins/qtsupport/codegensettings.cpp b/src/plugins/qtsupport/codegensettings.cpp
new file mode 100644
index 0000000000..60c1cfbec6
--- /dev/null
+++ b/src/plugins/qtsupport/codegensettings.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "codegensettings.h"
+
+#include <coreplugin/icore.h>
+
+#include <QSettings>
+
+static const char CODE_GEN_GROUP[] = "FormClassWizardPage";
+static const char TRANSLATION_KEY[] = "RetranslationSupport";
+static const char EMBEDDING_KEY[] = "Embedding";
+static const char INCLUDE_QT_MODULE_KEY[] = "IncludeQtModule";
+static const char ADD_QT_VERSION_CHECK_KEY[] = "AddQtVersionCheck";
+
+static const bool retranslationSupportDefault = false;
+
+namespace QtSupport {
+
+CodeGenSettings::CodeGenSettings() :
+ embedding(PointerAggregatedUiClass),
+ retranslationSupport(retranslationSupportDefault),
+ includeQtModule(false),
+ addQtVersionCheck(false)
+{
+
+}
+
+bool CodeGenSettings::equals(const CodeGenSettings &rhs) const
+{
+ return embedding == rhs.embedding
+ && retranslationSupport == rhs.retranslationSupport
+ && includeQtModule == rhs.includeQtModule
+ && addQtVersionCheck == rhs.addQtVersionCheck;
+}
+
+void CodeGenSettings::fromSettings(const QSettings *settings)
+{
+ QString group = QLatin1String(CODE_GEN_GROUP) + QLatin1Char('/');
+
+ retranslationSupport = settings->value(group + QLatin1String(TRANSLATION_KEY), retranslationSupportDefault).toBool();
+ embedding = static_cast<UiClassEmbedding>(settings->value(group + QLatin1String(EMBEDDING_KEY), int(PointerAggregatedUiClass)).toInt());
+ includeQtModule = settings->value(group + QLatin1String(INCLUDE_QT_MODULE_KEY), false).toBool();
+ addQtVersionCheck = settings->value(group + QLatin1String(ADD_QT_VERSION_CHECK_KEY), false).toBool();
+}
+
+void CodeGenSettings::toSettings(QSettings *settings) const
+{
+ settings->beginGroup(QLatin1String(CODE_GEN_GROUP));
+ settings->setValue(QLatin1String(TRANSLATION_KEY), retranslationSupport);
+ settings->setValue(QLatin1String(EMBEDDING_KEY), embedding);
+ settings->setValue(QLatin1String(INCLUDE_QT_MODULE_KEY), includeQtModule);
+ settings->setValue(QLatin1String(ADD_QT_VERSION_CHECK_KEY), addQtVersionCheck);
+ settings->endGroup();
+
+}
+
+} // namespace QtSupport
diff --git a/src/plugins/qtsupport/codegensettings.h b/src/plugins/qtsupport/codegensettings.h
new file mode 100644
index 0000000000..6c68ecc9da
--- /dev/null
+++ b/src/plugins/qtsupport/codegensettings.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef CODEGENSETTINGS_H
+#define CODEGENSETTINGS_H
+
+#include "qtsupport_global.h"
+
+QT_FORWARD_DECLARE_CLASS(QSettings)
+
+namespace QtSupport {
+
+class QTSUPPORT_EXPORT CodeGenSettings
+{
+public:
+ // How to embed the Ui::Form class.
+ enum UiClassEmbedding
+ {
+ PointerAggregatedUiClass, // "Ui::Form *m_ui";
+ AggregatedUiClass, // "Ui::Form m_ui";
+ InheritedUiClass // "...private Ui::Form..."
+ };
+
+ CodeGenSettings();
+ bool equals(const CodeGenSettings &rhs) const;
+
+ void fromSettings(const QSettings *settings);
+ void toSettings(QSettings *settings) const;
+
+ UiClassEmbedding embedding;
+ bool retranslationSupport; // Add handling for language change events
+ bool includeQtModule; // Include "<QtGui/[Class]>" or just "<[Class]>"
+ bool addQtVersionCheck; // Include #ifdef when using "#include <QtGui/..."
+};
+
+inline bool operator==(const CodeGenSettings &p1, const CodeGenSettings &p2) { return p1.equals(p2); }
+inline bool operator!=(const CodeGenSettings &p1, const CodeGenSettings &p2) { return !p1.equals(p2); }
+
+} // namespace QtSupport
+
+#endif // CODEGENSETTINGS_H
diff --git a/src/plugins/designer/cpp/cppsettingspage.cpp b/src/plugins/qtsupport/codegensettingspage.cpp
index f3ddc32379..51cb741dde 100644
--- a/src/plugins/designer/cpp/cppsettingspage.cpp
+++ b/src/plugins/qtsupport/codegensettingspage.cpp
@@ -27,19 +27,22 @@
**
****************************************************************************/
-#include "cppsettingspage.h"
-#include <designer/designerconstants.h>
+#include "codegensettingspage.h"
+
+#include "qtsupportconstants.h"
+
+#include <cpptools/cpptoolsconstants.h>
#include <QCoreApplication>
#include <QTextStream>
#include <coreplugin/icore.h>
-namespace Designer {
+namespace QtSupport {
namespace Internal {
-// ---------- CppSettingsPageWidget
+// ---------- CodeGenSettingsPageWidget
-CppSettingsPageWidget::CppSettingsPageWidget(QWidget *parent) :
+CodeGenSettingsPageWidget::CodeGenSettingsPageWidget(QWidget *parent) :
QWidget(parent)
{
m_ui.setupUi(this);
@@ -47,17 +50,17 @@ CppSettingsPageWidget::CppSettingsPageWidget(QWidget *parent) :
m_ui.addQtVersionCheckBox, SLOT(setEnabled(bool)));
}
-FormClassWizardGenerationParameters CppSettingsPageWidget::parameters() const
+CodeGenSettings CodeGenSettingsPageWidget::parameters() const
{
- FormClassWizardGenerationParameters rc;
- rc.embedding = static_cast<UiClassEmbedding>(uiEmbedding());
+ CodeGenSettings rc;
+ rc.embedding = static_cast<CodeGenSettings::UiClassEmbedding>(uiEmbedding());
rc.retranslationSupport =m_ui.retranslateCheckBox->isChecked();
rc.includeQtModule = m_ui.includeQtModuleCheckBox->isChecked();
rc.addQtVersionCheck = m_ui.addQtVersionCheckBox->isChecked();
return rc;
}
-void CppSettingsPageWidget::setParameters(const FormClassWizardGenerationParameters &p)
+void CodeGenSettingsPageWidget::setParameters(const CodeGenSettings &p)
{
m_ui.retranslateCheckBox->setChecked(p.retranslationSupport);
m_ui.includeQtModuleCheckBox->setChecked(p.includeQtModule);
@@ -65,54 +68,56 @@ void CppSettingsPageWidget::setParameters(const FormClassWizardGenerationParamet
setUiEmbedding(p.embedding);
}
-int CppSettingsPageWidget::uiEmbedding() const
+int CodeGenSettingsPageWidget::uiEmbedding() const
{
if (m_ui.ptrAggregationRadioButton->isChecked())
- return PointerAggregatedUiClass;
+ return CodeGenSettings::PointerAggregatedUiClass;
if (m_ui.aggregationButton->isChecked())
- return AggregatedUiClass;
- return InheritedUiClass;
+ return CodeGenSettings::AggregatedUiClass;
+ return CodeGenSettings::InheritedUiClass;
}
-void CppSettingsPageWidget::setUiEmbedding(int v)
+void CodeGenSettingsPageWidget::setUiEmbedding(int v)
{
switch (v) {
- case PointerAggregatedUiClass:
+ case CodeGenSettings::PointerAggregatedUiClass:
m_ui.ptrAggregationRadioButton->setChecked(true);
break;
- case AggregatedUiClass:
+ case CodeGenSettings::AggregatedUiClass:
m_ui.aggregationButton->setChecked(true);
break;
- case InheritedUiClass:
+ case CodeGenSettings::InheritedUiClass:
m_ui.multipleInheritanceButton->setChecked(true);
break;
}
}
-// ---------- CppSettingsPage
-CppSettingsPage::CppSettingsPage(QObject *parent) : Core::IOptionsPage(parent)
+// ---------- CodeGenSettingsPage
+CodeGenSettingsPage::CodeGenSettingsPage(QObject *parent) :
+ Core::IOptionsPage(parent),
+ m_widget(0)
{
m_parameters.fromSettings(Core::ICore::settings());
- setId(Designer::Constants::SETTINGS_CPP_SETTINGS_ID);
- setDisplayName(QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_CPP_SETTINGS_NAME));
- setCategory(Designer::Constants::SETTINGS_CATEGORY);
- setDisplayCategory(QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_TR_CATEGORY));
- setCategoryIcon(QLatin1String(Designer::Constants::SETTINGS_CATEGORY_ICON));
+ setId(Constants::CODEGEN_SETTINGS_PAGE_ID);
+ setDisplayName(QCoreApplication::translate("QtSupport", Constants::CODEGEN_SETTINGS_PAGE_NAME));
+ setCategory(CppTools::Constants::CPP_SETTINGS_CATEGORY);
+ setDisplayCategory(QCoreApplication::translate("CppTools", CppTools::Constants::CPP_SETTINGS_TR_CATEGORY));
+ setCategoryIcon(QLatin1String(CppTools::Constants::SETTINGS_CATEGORY_CPP_ICON));
}
-QWidget *CppSettingsPage::widget()
+QWidget *CodeGenSettingsPage::widget()
{
if (!m_widget) {
- m_widget = new CppSettingsPageWidget;
+ m_widget = new CodeGenSettingsPageWidget;
m_widget->setParameters(m_parameters);
}
return m_widget;
}
-void CppSettingsPage::apply()
+void CodeGenSettingsPage::apply()
{
if (m_widget) {
- const FormClassWizardGenerationParameters newParameters = m_widget->parameters();
+ const CodeGenSettings newParameters = m_widget->parameters();
if (newParameters != m_parameters) {
m_parameters = newParameters;
m_parameters.toSettings(Core::ICore::settings());
@@ -120,10 +125,10 @@ void CppSettingsPage::apply()
}
}
-void CppSettingsPage::finish()
+void CodeGenSettingsPage::finish()
{
delete m_widget;
}
} // namespace Internal
-} // namespace Designer
+} // namespace QtSupport
diff --git a/src/plugins/designer/cpp/cppsettingspage.h b/src/plugins/qtsupport/codegensettingspage.h
index 644c6da33c..e3ec44bd60 100644
--- a/src/plugins/designer/cpp/cppsettingspage.h
+++ b/src/plugins/qtsupport/codegensettingspage.h
@@ -27,50 +27,51 @@
**
****************************************************************************/
-#ifndef CPPSETTINGSPAGE_H
-#define CPPSETTINGSPAGE_H
+#ifndef CODEGENSETTINGSPAGE_H
+#define CODEGENSETTINGSPAGE_H
-#include "ui_cppsettingspagewidget.h"
-#include <designer/qtdesignerformclasscodegenerator.h>
+#include "ui_codegensettingspagewidget.h"
+
+#include "codegensettings.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <QPointer>
-namespace Designer {
+namespace QtSupport {
namespace Internal {
-class CppSettingsPageWidget : public QWidget
+class CodeGenSettingsPageWidget : public QWidget
{
Q_OBJECT
public:
- explicit CppSettingsPageWidget(QWidget *parent = 0);
+ explicit CodeGenSettingsPageWidget(QWidget *parent = 0);
- FormClassWizardGenerationParameters parameters() const;
- void setParameters(const FormClassWizardGenerationParameters &p);
+ CodeGenSettings parameters() const;
+ void setParameters(const CodeGenSettings &p);
private:
int uiEmbedding() const;
void setUiEmbedding(int);
- Ui::CppSettingsPageWidget m_ui;
+ Ui::CodeGenSettingsPageWidget m_ui;
};
-class CppSettingsPage : public Core::IOptionsPage
+class CodeGenSettingsPage : public Core::IOptionsPage
{
public:
- explicit CppSettingsPage(QObject *parent = 0);
+ explicit CodeGenSettingsPage(QObject *parent = 0);
QWidget *widget();
void apply();
void finish();
private:
- QPointer<CppSettingsPageWidget> m_widget;
- FormClassWizardGenerationParameters m_parameters;
+ QPointer<CodeGenSettingsPageWidget> m_widget;
+ CodeGenSettings m_parameters;
};
} // namespace Internal
-} // namespace Designer
+} // namespace QtSupport
-#endif // CPPSETTINGSPAGE_H
+#endif // CODEGENSETTINGSPAGE_H
diff --git a/src/plugins/designer/cpp/cppsettingspagewidget.ui b/src/plugins/qtsupport/codegensettingspagewidget.ui
index f9a88364ca..7ad9af8196 100644
--- a/src/plugins/designer/cpp/cppsettingspagewidget.ui
+++ b/src/plugins/qtsupport/codegensettingspagewidget.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>Designer::Internal::CppSettingsPageWidget</class>
- <widget class="QWidget" name="Designer::Internal::CppSettingsPageWidget">
+ <class>QtSupport::Internal::CodeGenSettingsPageWidget</class>
+ <widget class="QWidget" name="QtSupport::Internal::CodeGenSettingsPageWidget">
<property name="geometry">
<rect>
<x>0</x>
diff --git a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
index a5c1b6d3df..e134ff83d6 100644
--- a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
+++ b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
@@ -201,8 +201,8 @@ bool CustomExecutableRunConfiguration::validateExecutable(QString *executable, Q
EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>();
if (aspect)
env = aspect->environment();
- const QString exec = env.searchInPath(Utils::expandMacros(m_executable, macroExpander()),
- QStringList(workingDirectory()));
+ const Utils::FileName exec = env.searchInPath(Utils::expandMacros(m_executable, macroExpander()),
+ QStringList(workingDirectory()));
if (exec.isEmpty()) {
if (errorMessage)
*errorMessage = tr("The executable\n%1\ncannot be found in the path.").
@@ -210,7 +210,7 @@ bool CustomExecutableRunConfiguration::validateExecutable(QString *executable, Q
return false;
}
if (executable)
- *executable = QDir::cleanPath(exec);
+ *executable = exec.toString();
return true;
}
diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp
index 37c2840a42..7e3f465f1b 100644
--- a/src/plugins/qtsupport/exampleslistmodel.cpp
+++ b/src/plugins/qtsupport/exampleslistmodel.cpp
@@ -264,9 +264,7 @@ static QString fixStringForTags(const QString &string)
static QStringList trimStringList(const QStringList &stringlist)
{
- return Utils::transform(stringlist, [](const QString &string) {
- return string.trimmed();
- });
+ return Utils::transform(stringlist, [](const QString &str) { return str.trimmed(); });
}
static QString relativeOrInstallPath(const QString &path, const QString &manifestPath,
@@ -546,11 +544,8 @@ void ExamplesListModel::updateQtVersions()
// try to select the previously selected Qt version, or
// select examples corresponding to 'highest' Qt version
int currentQtId = m_exampleSetModel->getQtId(currentIndex);
- BaseQtVersion *newQtVersion = Utils::findOr(m_qtVersions,
- 0,
- [&currentQtId](BaseQtVersion *version) {
- return version->uniqueId() == currentQtId;
- });
+ BaseQtVersion *newQtVersion = Utils::findOrDefault(m_qtVersions,
+ Utils::equal(&BaseQtVersion::uniqueId, currentQtId));
if (!newQtVersion)
newQtVersion = findHighestQtVersion();
@@ -782,10 +777,9 @@ bool ExamplesListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex
const QStringList tags = sourceModel()->index(sourceRow, 0, sourceParent).data(Tags).toStringList();
if (!m_filterTags.isEmpty()) {
- foreach (const QString &tag, m_filterTags)
- if (!tags.contains(tag, Qt::CaseInsensitive))
- return false;
- return true;
+ return Utils::allOf(m_filterTags, [tags](const QString &filterTag) {
+ return tags.contains(filterTag);
+ });
}
if (!m_searchString.isEmpty()) {
diff --git a/src/plugins/qtsupport/qtkitconfigwidget.cpp b/src/plugins/qtsupport/qtkitconfigwidget.cpp
index 9d5af8e307..1c4d9d2238 100644
--- a/src/plugins/qtsupport/qtkitconfigwidget.cpp
+++ b/src/plugins/qtsupport/qtkitconfigwidget.cpp
@@ -37,6 +37,7 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h>
+#include <utils/algorithm.h>
#include <QComboBox>
#include <QPushButton>
@@ -50,9 +51,7 @@ QtKitConfigWidget::QtKitConfigWidget(ProjectExplorer::Kit *k, const ProjectExplo
m_combo = new QComboBox;
m_combo->addItem(tr("None"), -1);
- QList<int> versionIds;
- foreach (BaseQtVersion *v, QtVersionManager::versions())
- versionIds.append(v->uniqueId());
+ QList<int> versionIds = Utils::transform(QtVersionManager::versions(), &BaseQtVersion::uniqueId);
versionsChanged(versionIds, QList<int>(), QList<int>());
m_manageButton = new QPushButton(KitConfigWidget::msgManage());
diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp
index 07f28a8971..1cb6b20abe 100644
--- a/src/plugins/qtsupport/qtkitinformation.cpp
+++ b/src/plugins/qtsupport/qtkitinformation.cpp
@@ -37,6 +37,8 @@
#include <utils/buildablehelperlibrary.h>
#include <utils/qtcassert.h>
+using namespace ProjectExplorer;
+
namespace QtSupport {
QtKitInformation::QtKitInformation()
@@ -195,27 +197,51 @@ void QtKitInformation::kitsWereLoaded()
this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
}
-QtPlatformKitMatcher::QtPlatformKitMatcher(const QString &platform) :
- m_platform(platform)
-{ }
+KitMatcher QtKitInformation::platformMatcher(const QString &platform)
+{
+ return std::function<bool(const Kit *)>([platform](const Kit *kit) -> bool {
+ BaseQtVersion *version = QtKitInformation::qtVersion(kit);
+ return version && version->platformName() == platform;
+ });
+}
+
+KitMatcher QtKitInformation::qtVersionMatcher(const Core::FeatureSet &required,
+ const QtVersionNumber &min, const QtVersionNumber &max)
+{
+ return std::function<bool(const Kit *)>([required, min, max](const Kit *kit) -> bool {
+ BaseQtVersion *version = QtKitInformation::qtVersion(kit);
+ if (!version)
+ return false;
+ QtVersionNumber current = version->qtVersion();
+ if (min.majorVersion > -1 && current < min)
+ return false;
+ if (max.majorVersion > -1 && current > max)
+ return false;
+ return version->availableFeatures().contains(required);
+ });
+}
+
+QSet<QString> QtKitInformation::availablePlatforms(const Kit *k) const
+{
+ QSet<QString> result;
+ BaseQtVersion *version = QtKitInformation::qtVersion(k);
+ if (version)
+ result.insert(version->platformName());
+ return result;
+}
-bool QtPlatformKitMatcher::matches(const ProjectExplorer::Kit *k) const
+QString QtKitInformation::displayNameForPlatform(const Kit *k, const QString &platform) const
{
BaseQtVersion *version = QtKitInformation::qtVersion(k);
- return version && version->platformName() == m_platform;
+ if (version && version->platformName() == platform)
+ return version->platformDisplayName();
+ return QString();
}
-bool QtVersionKitMatcher::matches(const ProjectExplorer::Kit *k) const
+Core::FeatureSet QtKitInformation::availableFeatures(const Kit *k) const
{
BaseQtVersion *version = QtKitInformation::qtVersion(k);
- if (!version)
- return false;
- QtVersionNumber current = version->qtVersion();
- if (m_min.majorVersion > -1 && current < m_min)
- return false;
- if (m_max.majorVersion > -1 && current > m_max)
- return false;
- return version->availableFeatures().contains(m_features);
+ return version ? version->availableFeatures() : Core::FeatureSet();
}
} // namespace QtSupport
diff --git a/src/plugins/qtsupport/qtkitinformation.h b/src/plugins/qtsupport/qtkitinformation.h
index ebd5700246..9b52c3459e 100644
--- a/src/plugins/qtsupport/qtkitinformation.h
+++ b/src/plugins/qtsupport/qtkitinformation.h
@@ -66,6 +66,15 @@ public:
static BaseQtVersion *qtVersion(const ProjectExplorer::Kit *k);
static void setQtVersion(ProjectExplorer::Kit *k, const BaseQtVersion *v);
+ static ProjectExplorer::KitMatcher platformMatcher(const QString &availablePlatforms);
+ static ProjectExplorer::KitMatcher qtVersionMatcher(const Core::FeatureSet &required = Core::FeatureSet(),
+ const QtVersionNumber &min = QtVersionNumber(0, 0, 0),
+ const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX));
+
+ QSet<QString> availablePlatforms(const ProjectExplorer::Kit *k) const;
+ QString displayNameForPlatform(const ProjectExplorer::Kit *k, const QString &platform) const;
+ Core::FeatureSet availableFeatures(const ProjectExplorer::Kit *k) const;
+
private slots:
void qtVersionsChanged(const QList<int> &addedIds,
const QList<int> &removedIds,
@@ -73,34 +82,6 @@ private slots:
void kitsWereLoaded();
};
-class QTSUPPORT_EXPORT QtPlatformKitMatcher : public ProjectExplorer::KitMatcher
-{
-public:
- QtPlatformKitMatcher(const QString &platform);
-
- bool matches(const ProjectExplorer::Kit *k) const;
-
-private:
- QString m_platform;
-};
-
-class QTSUPPORT_EXPORT QtVersionKitMatcher : public ProjectExplorer::KitMatcher
-{
-public:
- explicit QtVersionKitMatcher(const Core::FeatureSet &required = Core::FeatureSet(),
- const QtVersionNumber &min = QtVersionNumber(0, 0, 0),
- const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) :
- m_min(min), m_max(max), m_features(required)
- { }
-
- bool matches(const ProjectExplorer::Kit *k) const;
-
-private:
- QtVersionNumber m_min;
- QtVersionNumber m_max;
- Core::FeatureSet m_features;
-};
-
} // namespace QtSupport
#endif // QTSUPPORT_QTKITINFORMATION_H
diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp
index 171ac83ab7..2c8ca2cae3 100644
--- a/src/plugins/qtsupport/qtoptionspage.cpp
+++ b/src/plugins/qtsupport/qtoptionspage.cpp
@@ -151,9 +151,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent)
m_manualItem->setFirstColumnSpanned(true);
m_manualItem->setFlags(Qt::ItemIsEnabled);
- QList<int> additions;
- foreach (BaseQtVersion *v, QtVersionManager::versions())
- additions.append(v->uniqueId());
+ QList<int> additions = transform(QtVersionManager::versions(), &BaseQtVersion::uniqueId);
updateQtVersions(additions, QList<int>(), QList<int>());
@@ -611,11 +609,8 @@ void QtOptionsPageWidget::addQtDir()
if (BuildableHelperLibrary::isQtChooser(fi))
qtVersion = FileName::fromString(BuildableHelperLibrary::qtChooserToQmakePath(fi.symLinkTarget()));
- BaseQtVersion *version = Utils::findOr(m_versions,
- 0,
- [&qtVersion](BaseQtVersion *v) {
- return v->qmakeCommand() == qtVersion;
- });
+ BaseQtVersion *version = Utils::findOrDefault(m_versions,
+ Utils::equal(&BaseQtVersion::qmakeCommand, qtVersion));
if (version) {
// Already exist
QMessageBox::warning(this, tr("Qt Version Already Known"),
@@ -842,7 +837,7 @@ void QtOptionsPageWidget::updateDescriptionLabel()
m_infoBrowser->setHtml(version->toHtml(true));
setInfoWidgetVisibility();
} else {
- m_infoBrowser->setHtml(QString());
+ m_infoBrowser->clear();
m_ui->versionInfoWidget->setVisible(false);
m_ui->infoWidget->setVisible(false);
m_ui->debuggingHelperWidget->setVisible(false);
@@ -900,7 +895,7 @@ void QtOptionsPageWidget::updateWidgets()
}
} else {
m_versionUi->nameEdit->clear();
- m_versionUi->qmakePath->setText(QString()); // clear()
+ m_versionUi->qmakePath->clear();
}
const bool enabled = version != 0;
diff --git a/src/plugins/qtsupport/qtparser.cpp b/src/plugins/qtsupport/qtparser.cpp
index 89a237b2a1..1c4a90083d 100644
--- a/src/plugins/qtsupport/qtparser.cpp
+++ b/src/plugins/qtsupport/qtparser.cpp
@@ -39,7 +39,7 @@ using ProjectExplorer::Task;
#define FILE_PATTERN "^(([A-Za-z]:)?[^:]+\\.[^:]+)"
QtParser::QtParser() :
- m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+)\\)?:\\s([Ww]arning|[Ee]rror):\\s(.+)$")),
+ m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+)\\)?:\\s([Ww]arning|[Ee]rror|[Nn]ote):\\s(.+)$")),
m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*) in '(.*)'$"))
{
setObjectName(QLatin1String("QtParser"));
@@ -56,8 +56,11 @@ void QtParser::stdError(const QString &line)
if (!ok)
lineno = -1;
Task::TaskType type = Task::Error;
- if (m_mocRegExp.cap(4).compare(QLatin1String("Warning"), Qt::CaseInsensitive) == 0)
+ const QString level = m_mocRegExp.cap(4);
+ if (level.compare(QLatin1String("Warning"), Qt::CaseInsensitive) == 0)
type = Task::Warning;
+ if (level.compare(QLatin1String("Note"), Qt::CaseInsensitive) == 0)
+ type = Task::Unknown;
Task task(type, m_mocRegExp.cap(5).trimmed() /* description */,
Utils::FileName::fromUserInput(m_mocRegExp.cap(1)) /* filename */,
lineno,
@@ -154,6 +157,15 @@ void QtSupportPlugin::testQtOutputParser_data()
Utils::FileName::fromUserInput(QLatin1String("c:\\code\\test.h")), 96,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
<< QString();
+ QTest::newRow("moc note")
+ << QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
+ << OutputParserTester::STDERR
+ << QString() << QString()
+ << (QList<ProjectExplorer::Task>() << Task(Task::Unknown,
+ QLatin1String("No relevant classes found. No output generated."),
+ Utils::FileName::fromUserInput(QLatin1String("/home/qtwebkithelpviewer.h")), 0,
+ ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
+ << QString();
QTest::newRow("ninja with moc")
<< QString::fromLatin1("E:/sandbox/creator/loaden/src/libs/utils/iwelcomepage.h(54): Error: Undefined interface")
<< OutputParserTester::STDERR
diff --git a/src/plugins/qtsupport/qtsupport.pro b/src/plugins/qtsupport/qtsupport.pro
index dcea5b3330..f1e794c4ff 100644
--- a/src/plugins/qtsupport/qtsupport.pro
+++ b/src/plugins/qtsupport/qtsupport.pro
@@ -7,6 +7,8 @@ DEFINES += QMAKE_LIBRARY
include(../../shared/proparser/proparser.pri)
HEADERS += \
+ codegensettings.h \
+ codegensettingspage.h \
qtsupportplugin.h \
qtsupport_global.h \
qtkitconfigwidget.h \
@@ -27,7 +29,6 @@ HEADERS += \
exampleslistmodel.h \
screenshotcropper.h \
qtconfigwidget.h \
- qtfeatureprovider.h \
desktopqtversionfactory.h \
simulatorqtversionfactory.h \
desktopqtversion.h \
@@ -36,6 +37,8 @@ HEADERS += \
winceqtversion.h
SOURCES += \
+ codegensettings.cpp \
+ codegensettingspage.cpp \
qtsupportplugin.cpp \
qtkitconfigwidget.cpp \
qtkitinformation.cpp \
@@ -68,6 +71,7 @@ greaterThan(QT_MAJOR_VERSION, 4) {
}
FORMS += \
+ codegensettingspagewidget.ui \
showbuildlog.ui \
qtversioninfo.ui \
debugginghelper.ui \
diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs
index fedbd84578..0a2229a61a 100644
--- a/src/plugins/qtsupport/qtsupport.qbs
+++ b/src/plugins/qtsupport/qtsupport.qbs
@@ -60,6 +60,11 @@ QtcPlugin {
files: [
"baseqtversion.cpp",
"baseqtversion.h",
+ "codegensettings.cpp",
+ "codegensettings.h",
+ "codegensettingspage.cpp",
+ "codegensettingspage.h",
+ "codegensettingspagewidget.ui",
"qtconfigwidget.cpp",
"qtconfigwidget.h",
"qtsupport.qrc",
@@ -96,7 +101,6 @@ QtcPlugin {
"qtversionmanager.cpp",
"qtversionmanager.h",
"qtversionmanager.ui",
- "qtfeatureprovider.h",
"screenshotcropper.cpp",
"screenshotcropper.h",
"showbuildlog.ui",
diff --git a/src/plugins/qtsupport/qtsupportconstants.h b/src/plugins/qtsupport/qtsupportconstants.h
index 93d9c4fc2c..6e43613742 100644
--- a/src/plugins/qtsupport/qtsupportconstants.h
+++ b/src/plugins/qtsupport/qtsupportconstants.h
@@ -33,9 +33,12 @@
namespace QtSupport {
namespace Constants {
-// Qt4 settings pages
+// Qt settings pages
const char QTVERSION_SETTINGS_PAGE_ID[] = "H.Qt Versions";
-const char QTVERSION_SETTINGS_PAGE_NAME[] = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Qt Versions");
+const char QTVERSION_SETTINGS_PAGE_NAME[] = QT_TRANSLATE_NOOP("QtSupport", "Qt Versions");
+
+const char CODEGEN_SETTINGS_PAGE_ID[] = "Class Generation";
+const char CODEGEN_SETTINGS_PAGE_NAME[] = QT_TRANSLATE_NOOP("QtSupport", "Qt Class Generation");
// QtVersions
const char DESKTOPQT[] = "Qt4ProjectManager.QtVersion.Desktop";
diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp
index 9a9d2e2c72..d275985c09 100644
--- a/src/plugins/qtsupport/qtsupportplugin.cpp
+++ b/src/plugins/qtsupport/qtsupportplugin.cpp
@@ -29,9 +29,9 @@
#include "qtsupportplugin.h"
+#include "codegensettingspage.h"
#include "customexecutablerunconfiguration.h"
#include "desktopqtversionfactory.h"
-#include "qtfeatureprovider.h"
#include "qtkitinformation.h"
#include "qtoptionspage.h"
#include "qtversionmanager.h"
@@ -78,9 +78,7 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
addAutoReleasedObject(new WinCeQtVersionFactory);
addAutoReleasedObject(new UiCodeModelManager);
- QtFeatureProvider *featureMgr = new QtFeatureProvider;
- addAutoReleasedObject(featureMgr);
-
+ addAutoReleasedObject(new CodeGenSettingsPage);
addAutoReleasedObject(new QtOptionsPage);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp
index 17c0bdbbee..03d8d719e0 100644
--- a/src/plugins/qtsupport/qtversionmanager.cpp
+++ b/src/plugins/qtsupport/qtversionmanager.cpp
@@ -32,7 +32,6 @@
#include "qtkitinformation.h"
#include "qtversionfactory.h"
#include "baseqtversion.h"
-#include "qtfeatureprovider.h"
#include "qtsupportconstants.h"
#include <coreplugin/icore.h>
@@ -641,13 +640,7 @@ FileName QtVersionManager::findQMakeBinaryFromMakefile(const QString &makefile)
BaseQtVersion *QtVersionManager::qtVersionForQMakeBinary(const FileName &qmakePath)
{
- foreach (BaseQtVersion *version, versions()) {
- if (version->qmakeCommand() == qmakePath) {
- return version;
- break;
- }
- }
- return 0;
+ return Utils::findOrDefault(versions(), Utils::equal(&BaseQtVersion::qmakeCommand, qmakePath));
}
void dumpQMakeAssignments(const QList<QMakeAssignment> &list)
@@ -819,35 +812,4 @@ static BaseQtVersion::QmakeBuildConfigs qmakeBuildConfigFromCmdArgs(QList<QMakeA
return result;
}
-Core::FeatureSet QtFeatureProvider::availableFeatures(const QString &platformName) const
-{
- Core::FeatureSet features;
- foreach (BaseQtVersion *const qtVersion, QtVersionManager::validVersions()) {
- if (qtVersion->platformName() == platformName || platformName.isEmpty())
- features |= qtVersion->availableFeatures();
- }
-
- return features;
-}
-
-QStringList QtFeatureProvider::availablePlatforms() const
-{
- QStringList platforms;
- foreach (BaseQtVersion *const qtVersion, QtVersionManager::validVersions()) {
- if (!qtVersion->platformName().isEmpty())
- platforms.append(qtVersion->platformName());
- }
- platforms.removeDuplicates();
- return platforms;
-}
-
-QString QtFeatureProvider::displayNameForPlatform(const QString &string) const
-{
- foreach (BaseQtVersion *const qtVersion, QtVersionManager::validVersions()) {
- if (qtVersion->platformName() == string)
- return qtVersion->platformDisplayName();
- }
- return QString();
-}
-
} // namespace QtVersion
diff --git a/src/plugins/qtsupport/uicodemodelsupport.cpp b/src/plugins/qtsupport/uicodemodelsupport.cpp
index 134d50cc84..4c297a5f28 100644
--- a/src/plugins/qtsupport/uicodemodelsupport.cpp
+++ b/src/plugins/qtsupport/uicodemodelsupport.cpp
@@ -40,6 +40,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
+#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QFile>
@@ -333,11 +334,7 @@ UiCodeModelManager::~UiCodeModelManager()
static UiCodeModelSupport *findUiFile(const QList<UiCodeModelSupport *> &range, const QString &uiFile)
{
- foreach (UiCodeModelSupport *support, range) {
- if (support->uiFileName() == uiFile)
- return support;
- }
- return 0;
+ return Utils::findOrDefault(range, Utils::equal(&UiCodeModelSupport::uiFileName, uiFile));
}
void UiCodeModelManager::update(ProjectExplorer::Project *project, QHash<QString, QString> uiHeaders)
diff --git a/src/plugins/subversion/checkoutwizard.cpp b/src/plugins/subversion/checkoutwizard.cpp
index 5b703871e5..566ec4bdec 100644
--- a/src/plugins/subversion/checkoutwizard.cpp
+++ b/src/plugins/subversion/checkoutwizard.cpp
@@ -82,7 +82,7 @@ VcsBase::Command *CheckoutWizard::createCommand(Utils::FileName *checkoutDir)
QTC_ASSERT(cwp, return 0);
const SubversionSettings settings = SubversionPlugin::instance()->settings();
- const QString binary = settings.binaryPath();
+ const Utils::FileName binary = settings.binaryPath();
const QString directory = cwp->directory();
QStringList args;
args << QLatin1String("checkout") << cwp->repository() << directory;
diff --git a/src/plugins/subversion/settingspage.cpp b/src/plugins/subversion/settingspage.cpp
index 41dec9b870..9d383fed3c 100644
--- a/src/plugins/subversion/settingspage.cpp
+++ b/src/plugins/subversion/settingspage.cpp
@@ -71,7 +71,7 @@ SubversionSettings SettingsPageWidget::settings() const
void SettingsPageWidget::setSettings(const SubversionSettings &s)
{
- m_ui.pathChooser->setPath(s.binaryPath());
+ m_ui.pathChooser->setFileName(s.binaryPath());
m_ui.usernameLineEdit->setText(s.stringValue(SubversionSettings::userKey));
m_ui.passwordLineEdit->setText(s.stringValue(SubversionSettings::passwordKey));
m_ui.userGroupBox->setChecked(s.boolValue(SubversionSettings::useAuthenticationKey));
diff --git a/src/plugins/subversion/subversionclient.h b/src/plugins/subversion/subversionclient.h
index 421797040c..f515219641 100644
--- a/src/plugins/subversion/subversionclient.h
+++ b/src/plugins/subversion/subversionclient.h
@@ -33,6 +33,8 @@
#include "subversionsettings.h"
#include <vcsbase/vcsbaseclient.h>
+#include <utils/fileutils.h>
+
namespace Subversion {
namespace Internal {
@@ -83,7 +85,7 @@ protected:
const QStringList &files,
const QStringList &extraOptions);
private:
- QString m_svnVersionBinary;
+ Utils::FileName m_svnVersionBinary;
QString m_svnVersion;
};
diff --git a/src/plugins/subversion/subversionconstants.h b/src/plugins/subversion/subversionconstants.h
index 1e980b1ca7..c149b2fc89 100644
--- a/src/plugins/subversion/subversionconstants.h
+++ b/src/plugins/subversion/subversionconstants.h
@@ -35,12 +35,6 @@
namespace Subversion {
namespace Constants {
-const char SUBVERSION_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.svn.submit";
-const char SUBVERSIONCOMMITEDITOR[] = "Subversion Commit Editor";
-const char SUBVERSIONCOMMITEDITOR_ID[] = "Subversion Commit Editor";
-const char SUBVERSIONCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Subversion Commit Editor");
-const char SUBMIT_CURRENT[] = "Subversion.SubmitCurrentLog";
-const char DIFF_SELECTED[] = "Subversion.DiffSelectedFilesInLog";
const char NON_INTERACTIVE_OPTION[] = "--non-interactive";
enum { debug = 0 };
diff --git a/src/plugins/subversion/subversioncontrol.cpp b/src/plugins/subversion/subversioncontrol.cpp
index 833e8d939d..bdd1dc87c8 100644
--- a/src/plugins/subversion/subversioncontrol.cpp
+++ b/src/plugins/subversion/subversioncontrol.cpp
@@ -55,10 +55,10 @@ Core::Id SubversionControl::id() const
bool SubversionControl::isConfigured() const
{
- const QString binary = m_plugin->settings().binaryPath();
+ const Utils::FileName binary = m_plugin->settings().binaryPath();
if (binary.isEmpty())
return false;
- QFileInfo fi(binary);
+ QFileInfo fi = binary.toFileInfo();
return fi.exists() && fi.isFile() && fi.isExecutable();
}
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 942fd1ab20..12a68f84d0 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -44,25 +44,24 @@
#include <vcsbase/basevcssubmiteditorfactory.h>
#include <vcsbase/vcsbaseoutputwindow.h>
#include <vcsbase/vcsbaseeditorparameterwidget.h>
-#include <utils/synchronousprocess.h>
-#include <utils/parameteraction.h>
-#include <utils/fileutils.h>
-#include <utils/hostosinfo.h>
-#include <coreplugin/icore.h>
-#include <coreplugin/coreconstants.h>
-#include <coreplugin/documentmanager.h>
-#include <coreplugin/messagemanager.h>
-#include <coreplugin/mimedatabase.h>
-#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
-#include <coreplugin/id.h>
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/editormanager.h>
-
+#include <coreplugin/icore.h>
+#include <coreplugin/id.h>
#include <coreplugin/locator/commandlocator.h>
+#include <coreplugin/messagemanager.h>
+#include <coreplugin/mimedatabase.h>
+#include <utils/fileutils.h>
+#include <utils/hostosinfo.h>
+#include <utils/parameteraction.h>
#include <utils/qtcassert.h>
+#include <utils/synchronousprocess.h>
#include <QDebug>
#include <QDir>
@@ -77,6 +76,7 @@
#include <QMenu>
#include <QMessageBox>
#include <QInputDialog>
+
#include <limits.h>
#ifdef WITH_TESTS
@@ -90,32 +90,35 @@ using namespace VcsBase;
namespace Subversion {
namespace Internal {
-static const char CMD_ID_SUBVERSION_MENU[] = "Subversion.Menu";
-static const char CMD_ID_ADD[] = "Subversion.Add";
-static const char CMD_ID_DELETE_FILE[] = "Subversion.Delete";
-static const char CMD_ID_REVERT[] = "Subversion.Revert";
-static const char CMD_ID_DIFF_PROJECT[] = "Subversion.DiffAll";
-static const char CMD_ID_DIFF_CURRENT[] = "Subversion.DiffCurrent";
-static const char CMD_ID_COMMIT_ALL[] = "Subversion.CommitAll";
-static const char CMD_ID_REVERT_ALL[] = "Subversion.RevertAll";
-static const char CMD_ID_COMMIT_CURRENT[] = "Subversion.CommitCurrent";
-static const char CMD_ID_FILELOG_CURRENT[] = "Subversion.FilelogCurrent";
-static const char CMD_ID_ANNOTATE_CURRENT[] = "Subversion.AnnotateCurrent";
-static const char CMD_ID_STATUS[] = "Subversion.Status";
-static const char CMD_ID_PROJECTLOG[] = "Subversion.ProjectLog";
-static const char CMD_ID_REPOSITORYLOG[] = "Subversion.RepositoryLog";
-static const char CMD_ID_REPOSITORYUPDATE[] = "Subversion.RepositoryUpdate";
-static const char CMD_ID_REPOSITORYDIFF[] = "Subversion.RepositoryDiff";
-static const char CMD_ID_REPOSITORYSTATUS[] = "Subversion.RepositoryStatus";
-static const char CMD_ID_UPDATE[] = "Subversion.Update";
-static const char CMD_ID_COMMIT_PROJECT[] = "Subversion.CommitProject";
-static const char CMD_ID_DESCRIBE[] = "Subversion.Describe";
-
-static const char nonInteractiveOptionC[] = "--non-interactive";
-
-
-
-static const VcsBaseEditorParameters editorParameters[] = {
+const char CMD_ID_SUBVERSION_MENU[] = "Subversion.Menu";
+const char CMD_ID_ADD[] = "Subversion.Add";
+const char CMD_ID_DELETE_FILE[] = "Subversion.Delete";
+const char CMD_ID_REVERT[] = "Subversion.Revert";
+const char CMD_ID_DIFF_PROJECT[] = "Subversion.DiffAll";
+const char CMD_ID_DIFF_CURRENT[] = "Subversion.DiffCurrent";
+const char CMD_ID_COMMIT_ALL[] = "Subversion.CommitAll";
+const char CMD_ID_REVERT_ALL[] = "Subversion.RevertAll";
+const char CMD_ID_COMMIT_CURRENT[] = "Subversion.CommitCurrent";
+const char CMD_ID_FILELOG_CURRENT[] = "Subversion.FilelogCurrent";
+const char CMD_ID_ANNOTATE_CURRENT[] = "Subversion.AnnotateCurrent";
+const char CMD_ID_STATUS[] = "Subversion.Status";
+const char CMD_ID_PROJECTLOG[] = "Subversion.ProjectLog";
+const char CMD_ID_REPOSITORYLOG[] = "Subversion.RepositoryLog";
+const char CMD_ID_REPOSITORYUPDATE[] = "Subversion.RepositoryUpdate";
+const char CMD_ID_REPOSITORYDIFF[] = "Subversion.RepositoryDiff";
+const char CMD_ID_REPOSITORYSTATUS[] = "Subversion.RepositoryStatus";
+const char CMD_ID_UPDATE[] = "Subversion.Update";
+const char CMD_ID_COMMIT_PROJECT[] = "Subversion.CommitProject";
+const char CMD_ID_DESCRIBE[] = "Subversion.Describe";
+
+const char SUBVERSION_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.svn.submit";
+const char SUBVERSIONCOMMITEDITOR[] = "Subversion Commit Editor";
+const char SUBVERSIONCOMMITEDITOR_ID[] = "Subversion Commit Editor";
+const char SUBVERSIONCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Subversion Commit Editor");
+const char SUBMIT_CURRENT[] = "Subversion.SubmitCurrentLog";
+const char DIFF_SELECTED[] = "Subversion.DiffSelectedFilesInLog";
+
+const VcsBaseEditorParameters editorParameters[] = {
{
LogOutput,
"Subversion File Log Editor", // id
@@ -234,10 +237,10 @@ bool SubversionPlugin::isCommitEditorOpen() const
}
const VcsBaseSubmitEditorParameters submitParameters = {
- Subversion::Constants::SUBVERSION_SUBMIT_MIMETYPE,
- Subversion::Constants::SUBVERSIONCOMMITEDITOR_ID,
- Subversion::Constants::SUBVERSIONCOMMITEDITOR_DISPLAY_NAME,
- Subversion::Constants::SUBVERSIONCOMMITEDITOR,
+ SUBVERSION_SUBMIT_MIMETYPE,
+ SUBVERSIONCOMMITEDITOR_ID,
+ SUBVERSIONCOMMITEDITOR_DISPLAY_NAME,
+ SUBVERSIONCOMMITEDITOR,
VcsBaseSubmitEditorParameters::DiffFiles
};
@@ -433,15 +436,15 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command);
// Actions of the submit editor
- Context svncommitcontext(Constants::SUBVERSIONCOMMITEDITOR);
+ Context svncommitcontext(SUBVERSIONCOMMITEDITOR);
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- command = ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext);
+ command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, svncommitcontext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- command = ActionManager::registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, svncommitcontext);
+ command = ActionManager::registerAction(m_submitDiffAction , DIFF_SELECTED, svncommitcontext);
m_submitUndoAction = new QAction(tr("&Undo"), this);
command = ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, svncommitcontext);
@@ -513,7 +516,7 @@ void SubversionPlugin::diffCommitFiles(const QStringList &files)
SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName)
{
- IEditor *editor = EditorManager::openEditor(fileName, Constants::SUBVERSIONCOMMITEDITOR_ID);
+ IEditor *editor = EditorManager::openEditor(fileName, SUBVERSIONCOMMITEDITOR_ID);
SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return 0);
setSubmitEditor(submitEditor);
@@ -714,7 +717,7 @@ bool SubversionPlugin::commit(const QString &messageFile,
// "[ADM]<blanks>file" into an args list. The files of the status log
// can be relative or absolute depending on where the command was run.
QStringList args = QStringList(QLatin1String("commit"));
- args << QLatin1String(nonInteractiveOptionC) << QLatin1String("--file") << messageFile;
+ args << QLatin1String(Constants::NON_INTERACTIVE_OPTION) << QLatin1String("--file") << messageFile;
args.append(subVersionFileList);
const SubversionResponse response =
runSvn(m_commitRepository, args, 10 * m_settings.timeOutMs(),
@@ -828,7 +831,7 @@ void SubversionPlugin::updateProject()
void SubversionPlugin::svnUpdate(const QString &workingDir, const QString &relativePath)
{
QStringList args(QLatin1String("update"));
- args.push_back(QLatin1String(nonInteractiveOptionC));
+ args.push_back(QLatin1String(Constants::NON_INTERACTIVE_OPTION));
if (!relativePath.isEmpty())
args.append(relativePath);
const SubversionResponse response =
@@ -1000,7 +1003,7 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
const QStringList &arguments, int timeOut,
unsigned flags, QTextCodec *outputCodec) const
{
- const QString executable = m_settings.binaryPath();
+ const FileName executable = m_settings.binaryPath();
SubversionResponse response;
if (executable.isEmpty()) {
response.error = true;
@@ -1015,7 +1018,7 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
response.error = sp_resp.result != SynchronousProcessResponse::Finished;
if (response.error)
- response.message = sp_resp.exitMessage(executable, timeOut);
+ response.message = sp_resp.exitMessage(executable.toString(), timeOut);
response.stdErr = sp_resp.stdErr;
response.stdOut = sp_resp.stdOut;
return response;
@@ -1040,7 +1043,7 @@ IEditor *SubversionPlugin::showOutputInEditor(const QString &title, const QStrin
return 0;
e->setForceReadOnly(true);
s.replace(QLatin1Char(' '), QLatin1Char('_'));
- e->baseTextDocument()->setSuggestedFileName(s);
+ e->textDocument()->setSuggestedFileName(s);
if (!source.isEmpty())
e->setSource(source);
if (codec)
@@ -1108,7 +1111,7 @@ bool SubversionPlugin::vcsCheckout(const QString &directory, const QByteArray &u
QString username = tempUrl.userName();
QString password = tempUrl.password();
QStringList args = QStringList(QLatin1String("checkout"));
- args << QLatin1String(nonInteractiveOptionC) ;
+ args << QLatin1String(Constants::NON_INTERACTIVE_OPTION) ;
if (!username.isEmpty() && !password.isEmpty()) {
// If url contains username and password we have to use separate username and password
diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h
index a1165187cd..d78578a422 100644
--- a/src/plugins/subversion/subversionplugin.h
+++ b/src/plugins/subversion/subversionplugin.h
@@ -43,13 +43,10 @@ QT_END_NAMESPACE
namespace Core {
class CommandLocator;
- class IVersionControl;
class IEditor;
}
namespace Utils { class ParameterAction; }
-namespace VcsBase { class VcsBaseSubmitEditor; }
-
namespace Subversion {
namespace Internal {
diff --git a/src/plugins/tasklist/tasklistplugin.cpp b/src/plugins/tasklist/tasklistplugin.cpp
index d8c28177f8..2b25630c4f 100644
--- a/src/plugins/tasklist/tasklistplugin.cpp
+++ b/src/plugins/tasklist/tasklistplugin.cpp
@@ -206,8 +206,6 @@ bool TaskListPlugin::initialize(const QStringList &arguments, QString *errorMess
return false;
m_fileFactory = new IDocumentFactory;
- m_fileFactory->setId("ProjectExplorer.TaskFileFactory");
- m_fileFactory->setDisplayName(tr("Task file reader"));
m_fileFactory->addMimeType(QLatin1String("text/x-tasklist"));
m_fileFactory->setOpener([this](const QString &fileName) -> IDocument * {
ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::currentProject();
diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp
index 91983c9b10..1fee2bca11 100644
--- a/src/plugins/texteditor/basefilefind.cpp
+++ b/src/plugins/texteditor/basefilefind.cpp
@@ -37,7 +37,7 @@
#include <coreplugin/dialogs/readonlyfilesdialog.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/find/ifindsupport.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <texteditor/refactoringchanges.h>
#include <utils/stylehelper.h>
#include <utils/qtcassert.h>
@@ -174,12 +174,12 @@ void BaseFileFind::runSearch(Core::SearchResult *search)
watcher->setFuture(Utils::findInFilesRegExp(parameters.text,
files(parameters.nameFilters, parameters.additionalParameters),
textDocumentFlagsForFindFlags(parameters.flags),
- ITextEditorDocument::openedTextDocumentContents()));
+ BaseTextDocument::openedTextDocumentContents()));
} else {
watcher->setFuture(Utils::findInFiles(parameters.text,
files(parameters.nameFilters, parameters.additionalParameters),
textDocumentFlagsForFindFlags(parameters.flags),
- ITextEditorDocument::openedTextDocumentContents()));
+ BaseTextDocument::openedTextDocumentContents()));
}
FutureProgress *progress =
ProgressManager::addTask(watcher->future(), tr("Searching"), Constants::TASK_SEARCH);
diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp
index ffee52f447..3b0e5845ab 100644
--- a/src/plugins/texteditor/basehoverhandler.cpp
+++ b/src/plugins/texteditor/basehoverhandler.cpp
@@ -28,7 +28,6 @@
****************************************************************************/
#include "basehoverhandler.h"
-#include "itexteditor.h"
#include "basetexteditor.h"
#include <coreplugin/icore.h>
@@ -41,7 +40,7 @@ using namespace Core;
namespace TextEditor {
-static BaseTextEditorWidget *baseTextEditor(ITextEditor *editor)
+static BaseTextEditorWidget *baseTextEditor(BaseTextEditor *editor)
{
if (!editor)
return 0;
@@ -63,16 +62,16 @@ void BaseHoverHandler::editorOpened(Core::IEditor *editor)
if (acceptEditor(editor)) {
BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(editor);
if (textEditor) {
- connect(textEditor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
- this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
+ connect(textEditor, SIGNAL(tooltipRequested(TextEditor::BaseTextEditor*,QPoint,int)),
+ this, SLOT(showToolTip(TextEditor::BaseTextEditor*,QPoint,int)));
- connect(textEditor, SIGNAL(contextHelpIdRequested(TextEditor::ITextEditor*,int)),
- this, SLOT(updateContextHelpId(TextEditor::ITextEditor*,int)));
+ connect(textEditor, SIGNAL(contextHelpIdRequested(TextEditor::BaseTextEditor*,int)),
+ this, SLOT(updateContextHelpId(TextEditor::BaseTextEditor*,int)));
}
}
}
-void BaseHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint &point, int pos)
+void BaseHoverHandler::showToolTip(TextEditor::BaseTextEditor *editor, const QPoint &point, int pos)
{
BaseTextEditorWidget *baseEditor = baseTextEditor(editor);
if (!baseEditor)
@@ -84,7 +83,7 @@ void BaseHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
operateTooltip(editor, point);
}
-void BaseHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int pos)
+void BaseHoverHandler::updateContextHelpId(TextEditor::BaseTextEditor *editor, int pos)
{
BaseTextEditorWidget *baseEditor = baseTextEditor(editor);
if (!baseEditor)
@@ -150,7 +149,7 @@ void BaseHoverHandler::clear()
m_lastHelpItemIdentified = HelpItem();
}
-void BaseHoverHandler::process(ITextEditor *editor, int pos)
+void BaseHoverHandler::process(BaseTextEditor *editor, int pos)
{
clear();
identifyMatch(editor, pos);
@@ -172,7 +171,7 @@ void BaseHoverHandler::decorateToolTip()
}
}
-void BaseHoverHandler::operateTooltip(ITextEditor *editor, const QPoint &point)
+void BaseHoverHandler::operateTooltip(BaseTextEditor *editor, const QPoint &point)
{
if (m_toolTip.isEmpty())
Utils::ToolTip::hide();
diff --git a/src/plugins/texteditor/basehoverhandler.h b/src/plugins/texteditor/basehoverhandler.h
index ea6c781568..7d487b21b1 100644
--- a/src/plugins/texteditor/basehoverhandler.h
+++ b/src/plugins/texteditor/basehoverhandler.h
@@ -44,7 +44,7 @@ namespace Core { class IEditor; }
namespace TextEditor {
-class ITextEditor;
+class BaseTextEditor;
class BaseTextEditorWidget;
class TEXTEDITOR_EXPORT BaseHoverHandler : public QObject
@@ -57,8 +57,8 @@ public:
private slots:
void editorOpened(Core::IEditor *editor);
- void showToolTip(TextEditor::ITextEditor *editor, const QPoint &point, int pos);
- void updateContextHelpId(TextEditor::ITextEditor *editor, int pos);
+ void showToolTip(TextEditor::BaseTextEditor *editor, const QPoint &point, int pos);
+ void updateContextHelpId(TextEditor::BaseTextEditor *editor, int pos);
protected:
void setToolTip(const QString &tooltip);
@@ -75,12 +75,12 @@ protected:
private:
void clear();
- void process(ITextEditor *editor, int pos);
+ void process(BaseTextEditor *editor, int pos);
virtual bool acceptEditor(Core::IEditor *editor) = 0;
- virtual void identifyMatch(ITextEditor *editor, int pos) = 0;
+ virtual void identifyMatch(BaseTextEditor *editor, int pos) = 0;
virtual void decorateToolTip();
- virtual void operateTooltip(ITextEditor *editor, const QPoint &point);
+ virtual void operateTooltip(BaseTextEditor *editor, const QPoint &point);
bool m_diagnosticTooltip;
QString m_toolTip;
diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp
index cfb9964ce2..48d70f0fd5 100644
--- a/src/plugins/texteditor/basetextdocument.cpp
+++ b/src/plugins/texteditor/basetextdocument.cpp
@@ -40,6 +40,7 @@
#include "tabsettings.h"
#include "texteditorconstants.h"
#include "typingsettings.h"
+#include <texteditor/generichighlighter/highlighter.h>
#include <QApplication>
#include <QDir>
@@ -49,6 +50,7 @@
#include <QStringList>
#include <QTextCodec>
+#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <utils/qtcassert.h>
@@ -59,11 +61,15 @@ using namespace Core;
\class TextEditor::BaseTextDocument
\brief The BaseTextDocument class is the base class for QTextDocument based documents.
+ It is the base class for documents used by implementations of the BaseTextEditor class,
+ and contains basic functions for retrieving text content and markers (like bookmarks).
+
Subclasses of BaseTextEditor can either use BaseTextDocument as is (and this is the default),
or created subclasses of BaseTextDocument if they have special requirements.
*/
namespace TextEditor {
+
class BaseTextDocumentPrivate : public QObject
{
Q_OBJECT
@@ -92,6 +98,8 @@ public:
bool m_fileIsReadOnly;
int m_autoSaveRevision;
+
+ TextMarks m_marksCache; // Marks not owned
};
BaseTextDocumentPrivate::BaseTextDocumentPrivate(BaseTextDocument *q) :
@@ -191,7 +199,14 @@ void BaseTextDocumentPrivate::onModificationChanged(bool modified)
updateRevisions();
}
-BaseTextDocument::BaseTextDocument() : d(new BaseTextDocumentPrivate(this))
+///////////////////////////////////////////////////////////////////////
+//
+// BaseTextDocument
+//
+///////////////////////////////////////////////////////////////////////
+
+BaseTextDocument::BaseTextDocument()
+ : d(new BaseTextDocumentPrivate(this))
{
connect(d->m_document, SIGNAL(modificationChanged(bool)), d, SLOT(onModificationChanged(bool)));
connect(d->m_document, SIGNAL(modificationChanged(bool)), this, SIGNAL(changed()));
@@ -215,6 +230,32 @@ BaseTextDocument::~BaseTextDocument()
delete d;
}
+QMap<QString, QString> BaseTextDocument::openedTextDocumentContents()
+{
+ QMap<QString, QString> workingCopy;
+ foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) {
+ BaseTextDocument *textEditorDocument = qobject_cast<BaseTextDocument *>(document);
+ if (!textEditorDocument)
+ continue;
+ QString fileName = textEditorDocument->filePath();
+ workingCopy[fileName] = textEditorDocument->plainText();
+ }
+ return workingCopy;
+}
+
+QMap<QString, QTextCodec *> BaseTextDocument::openedTextDocumentEncodings()
+{
+ QMap<QString, QTextCodec *> workingCopy;
+ foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) {
+ BaseTextDocument *textEditorDocument = qobject_cast<BaseTextDocument *>(document);
+ if (!textEditorDocument)
+ continue;
+ QString fileName = textEditorDocument->filePath();
+ workingCopy[fileName] = const_cast<QTextCodec *>(textEditorDocument->codec());
+ }
+ return workingCopy;
+}
+
QString BaseTextDocument::plainText() const
{
return document()->toPlainText();
@@ -255,6 +296,10 @@ void BaseTextDocument::setTabSettings(const TextEditor::TabSettings &tabSettings
if (tabSettings == d->m_tabSettings)
return;
d->m_tabSettings = tabSettings;
+
+ if (Highlighter *highlighter = qobject_cast<Highlighter *>(d->m_highlighter))
+ highlighter->setTabSettings(tabSettings);
+
emit tabSettingsChanged();
}
@@ -373,14 +418,6 @@ SyntaxHighlighter *BaseTextDocument::syntaxHighlighter() const
return d->m_highlighter;
}
-ITextMarkable *BaseTextDocument::markableInterface() const
-{
- BaseTextDocumentLayout *documentLayout =
- qobject_cast<BaseTextDocumentLayout *>(d->m_document->documentLayout());
- QTC_ASSERT(documentLayout, return 0);
- return documentLayout->markableInterface();
-}
-
/*!
* Saves the document to the file specified by \a fileName. If errors occur,
* \a errorString contains their cause.
@@ -531,7 +568,7 @@ bool BaseTextDocument::open(QString *errorString, const QString &fileName, const
d->m_document->setModified(false);
const int chunks = content.size();
if (chunks == 0) {
- d->m_document->setPlainText(QString());
+ d->m_document->clear();
} else if (chunks == 1) {
d->m_document->setPlainText(content.at(0));
} else {
@@ -583,7 +620,7 @@ bool BaseTextDocument::reload(QString *errorString)
bool success = open(errorString, filePath(), filePath());
if (documentLayout)
- documentLayout->documentReloaded(marks); // readds text marks
+ documentLayout->documentReloaded(marks, this); // re-adds text marks
emit reloadFinished(success);
return success;
}
@@ -684,6 +721,130 @@ void BaseTextDocument::ensureFinalNewLine(QTextCursor& cursor)
}
}
+TextMarks BaseTextDocument::marks() const
+{
+ return d->m_marksCache;
+}
+
+bool BaseTextDocument::addMark(TextMark *mark)
+{
+ if (mark->baseTextDocument())
+ return false;
+ QTC_ASSERT(mark->lineNumber() >= 1, return false);
+ int blockNumber = mark->lineNumber() - 1;
+ auto documentLayout = qobject_cast<BaseTextDocumentLayout*>(d->m_document->documentLayout());
+ QTC_ASSERT(documentLayout, return false);
+ QTextBlock block = d->m_document->findBlockByNumber(blockNumber);
+
+ if (block.isValid()) {
+ TextBlockUserData *userData = BaseTextDocumentLayout::userData(block);
+ userData->addMark(mark);
+ d->m_marksCache.append(mark);
+ mark->updateLineNumber(blockNumber + 1);
+ QTC_CHECK(mark->lineNumber() == blockNumber + 1); // Checks that the base class is called
+ mark->updateBlock(block);
+ mark->setBaseTextDocument(this);
+ if (!mark->isVisible())
+ return true;
+ // Update document layout
+ double newMaxWidthFactor = qMax(mark->widthFactor(), documentLayout->maxMarkWidthFactor);
+ bool fullUpdate = newMaxWidthFactor > documentLayout->maxMarkWidthFactor || !documentLayout->hasMarks;
+ documentLayout->hasMarks = true;
+ documentLayout->maxMarkWidthFactor = newMaxWidthFactor;
+ if (fullUpdate)
+ documentLayout->requestUpdate();
+ else
+ documentLayout->requestExtraAreaUpdate();
+ return true;
+ }
+ return false;
+}
+
+TextMarks BaseTextDocument::marksAt(int line) const
+{
+ QTC_ASSERT(line >= 1, return TextMarks());
+ int blockNumber = line - 1;
+ QTextBlock block = d->m_document->findBlockByNumber(blockNumber);
+
+ if (block.isValid()) {
+ if (TextBlockUserData *userData = BaseTextDocumentLayout::testUserData(block))
+ return userData->marks();
+ }
+ return TextMarks();
+}
+
+void BaseTextDocument::removeMarkFromMarksCache(TextMark *mark)
+{
+ auto documentLayout = qobject_cast<BaseTextDocumentLayout*>(d->m_document->documentLayout());
+ QTC_ASSERT(documentLayout, return);
+ d->m_marksCache.removeAll(mark);
+
+ if (d->m_marksCache.isEmpty()) {
+ documentLayout->hasMarks = false;
+ documentLayout->maxMarkWidthFactor = 1.0;
+ documentLayout->requestUpdate();
+ return;
+ }
+
+ if (!mark->isVisible())
+ return;
+
+ if (documentLayout->maxMarkWidthFactor == 1.0
+ || mark->widthFactor() == 1.0
+ || mark->widthFactor() < documentLayout->maxMarkWidthFactor) {
+ // No change in width possible
+ documentLayout->requestExtraAreaUpdate();
+ } else {
+ double maxWidthFactor = 1.0;
+ foreach (const TextMark *mark, marks()) {
+ if (!mark->isVisible())
+ continue;
+ maxWidthFactor = qMax(mark->widthFactor(), maxWidthFactor);
+ if (maxWidthFactor == documentLayout->maxMarkWidthFactor)
+ break; // Still a mark with the maxMarkWidthFactor
+ }
+
+ if (maxWidthFactor != documentLayout->maxMarkWidthFactor) {
+ documentLayout->maxMarkWidthFactor = maxWidthFactor;
+ documentLayout->requestUpdate();
+ } else {
+ documentLayout->requestExtraAreaUpdate();
+ }
+ }
+}
+
+void BaseTextDocument::removeMark(TextMark *mark)
+{
+ QTextBlock block = d->m_document->findBlockByNumber(mark->lineNumber() - 1);
+ if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData())) {
+ if (!data->removeMark(mark))
+ qDebug() << "Could not find mark" << mark << "on line" << mark->lineNumber();
+ }
+
+ removeMarkFromMarksCache(mark);
+ mark->setBaseTextDocument(0);
+}
+
+void BaseTextDocument::updateMark(TextMark *mark)
+{
+ Q_UNUSED(mark)
+ auto documentLayout = qobject_cast<BaseTextDocumentLayout*>(d->m_document->documentLayout());
+ QTC_ASSERT(documentLayout, return);
+ documentLayout->requestUpdate();
+}
+
+void BaseTextDocument::moveMark(TextMark *mark, int previousLine)
+{
+ QTextBlock block = d->m_document->findBlockByNumber(previousLine - 1);
+ if (TextBlockUserData *data = BaseTextDocumentLayout::testUserData(block)) {
+ if (!data->removeMark(mark))
+ qDebug() << "Could not find mark" << mark << "on line" << previousLine;
+ }
+ removeMarkFromMarksCache(mark);
+ mark->setBaseTextDocument(0);
+ addMark(mark);
+}
+
} // namespace TextEditor
#include "basetextdocument.moc"
diff --git a/src/plugins/texteditor/basetextdocument.h b/src/plugins/texteditor/basetextdocument.h
index eb08ca2bde..437c843270 100644
--- a/src/plugins/texteditor/basetextdocument.h
+++ b/src/plugins/texteditor/basetextdocument.h
@@ -32,7 +32,12 @@
#include "texteditor_global.h"
-#include "itexteditor.h"
+#include <coreplugin/textdocument.h>
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/editormanager/ieditor.h>
+
+#include <QList>
+#include <QMap>
QT_BEGIN_NAMESPACE
class QTextCursor;
@@ -44,14 +49,16 @@ namespace TextEditor {
class BaseTextDocumentPrivate;
class ExtraEncodingSettings;
class FontSettings;
-class ITextMarkable;
class Indenter;
class StorageSettings;
class SyntaxHighlighter;
class TabSettings;
+class TextMark;
class TypingSettings;
-class TEXTEDITOR_EXPORT BaseTextDocument : public ITextEditorDocument
+typedef QList<TextMark *> TextMarks;
+
+class TEXTEDITOR_EXPORT BaseTextDocument : public Core::TextDocument
{
Q_OBJECT
@@ -59,10 +66,12 @@ public:
BaseTextDocument();
virtual ~BaseTextDocument();
- // ITextEditorDocument
- QString plainText() const;
- QString textAt(int pos, int length) const;
- QChar characterAt(int pos) const;
+ static QMap<QString, QString> openedTextDocumentContents();
+ static QMap<QString, QTextCodec *> openedTextDocumentEncodings();
+
+ virtual QString plainText() const;
+ virtual QString textAt(int pos, int length) const;
+ virtual QChar characterAt(int pos) const;
void setTypingSettings(const TypingSettings &typingSettings);
void setStorageSettings(const StorageSettings &storageSettings);
@@ -81,7 +90,13 @@ public:
QTextCursor indent(const QTextCursor &cursor);
QTextCursor unindent(const QTextCursor &cursor);
- ITextMarkable *markableInterface() const;
+ TextMarks marks() const;
+ bool addMark(TextMark *mark);
+ TextMarks marksAt(int line) const;
+ void removeMark(TextMark *mark);
+ void updateMark(TextMark *mark);
+ void moveMark(TextMark *mark, int previousLine);
+ void removeMarkFromMarksCache(TextEditor::TextMark *mark);
// IDocument implementation.
bool save(QString *errorString, const QString &fileName, bool autoSave);
@@ -118,6 +133,7 @@ public slots:
void setFontSettings(const TextEditor::FontSettings &fontSettings);
signals:
+ void contentsChanged();
void tabSettingsChanged();
void fontSettingsChanged();
diff --git a/src/plugins/texteditor/basetextdocumentlayout.cpp b/src/plugins/texteditor/basetextdocumentlayout.cpp
index 619085e3d7..09d6104623 100644
--- a/src/plugins/texteditor/basetextdocumentlayout.cpp
+++ b/src/plugins/texteditor/basetextdocumentlayout.cpp
@@ -33,165 +33,6 @@
using namespace TextEditor;
-namespace TextEditor {
-namespace Internal {
-
-class DocumentMarker : public ITextMarkable
-{
- Q_OBJECT
-public:
- DocumentMarker(QTextDocument *);
- ~DocumentMarker();
-
- TextMarks marks() const { return m_marksCache; }
-
- // ITextMarkable
- bool addMark(ITextMark *mark);
- TextMarks marksAt(int line) const;
- void removeMark(ITextMark *mark);
- void updateMark(ITextMark *mark);
- void moveMark(ITextMark *mark, int previousLine);
-
- void removeMarkFromMarksCache(TextEditor::ITextMark *mark);
-private:
- TextMarks m_marksCache; // not owned
- QTextDocument *document;
-};
-
-DocumentMarker::DocumentMarker(QTextDocument *doc)
- : ITextMarkable(doc), document(doc)
-{
-}
-
-DocumentMarker::~DocumentMarker()
-{
-
-}
-
-bool DocumentMarker::addMark(TextEditor::ITextMark *mark)
-{
- if (mark->markableInterface())
- return false;
- QTC_ASSERT(mark->lineNumber() >= 1, return false);
- int blockNumber = mark->lineNumber() - 1;
- BaseTextDocumentLayout *documentLayout =
- qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
- QTC_ASSERT(documentLayout, return false);
- QTextBlock block = document->findBlockByNumber(blockNumber);
-
- if (block.isValid()) {
- TextBlockUserData *userData = BaseTextDocumentLayout::userData(block);
- userData->addMark(mark);
- m_marksCache.append(mark);
- mark->updateLineNumber(blockNumber + 1);
- QTC_CHECK(mark->lineNumber() == blockNumber + 1); // Checks that the base class is called
- mark->updateBlock(block);
- mark->setMarkableInterface(this);
- if (!mark->isVisible())
- return true;
- // Update document layout
- double newMaxWidthFactor = qMax(mark->widthFactor(), documentLayout->maxMarkWidthFactor);
- bool fullUpdate = newMaxWidthFactor > documentLayout->maxMarkWidthFactor || !documentLayout->hasMarks;
- documentLayout->hasMarks = true;
- documentLayout->maxMarkWidthFactor = newMaxWidthFactor;
- if (fullUpdate)
- documentLayout->requestUpdate();
- else
- documentLayout->requestExtraAreaUpdate();
- return true;
- }
- return false;
-}
-
-TextEditor::TextMarks DocumentMarker::marksAt(int line) const
-{
- QTC_ASSERT(line >= 1, return TextMarks());
- int blockNumber = line - 1;
- QTextBlock block = document->findBlockByNumber(blockNumber);
-
- if (block.isValid()) {
- if (TextBlockUserData *userData = BaseTextDocumentLayout::testUserData(block))
- return userData->marks();
- }
- return TextMarks();
-}
-
-void DocumentMarker::removeMarkFromMarksCache(TextEditor::ITextMark *mark)
-{
- BaseTextDocumentLayout *documentLayout =
- qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
- QTC_ASSERT(documentLayout, return);
- m_marksCache.removeAll(mark);
-
- if (m_marksCache.isEmpty()) {
- documentLayout->hasMarks = false;
- documentLayout->maxMarkWidthFactor = 1.0;
- documentLayout->requestUpdate();
- return;
- }
-
- if (!mark->isVisible())
- return;
-
- if (documentLayout->maxMarkWidthFactor == 1.0
- || mark->widthFactor() == 1.0
- || mark->widthFactor() < documentLayout->maxMarkWidthFactor) {
- // No change in width possible
- documentLayout->requestExtraAreaUpdate();
- } else {
- double maxWidthFactor = 1.0;
- foreach (const ITextMark *mark, marks()) {
- if (!mark->isVisible())
- continue;
- maxWidthFactor = qMax(mark->widthFactor(), maxWidthFactor);
- if (maxWidthFactor == documentLayout->maxMarkWidthFactor)
- break; // Still a mark with the maxMarkWidthFactor
- }
-
- if (maxWidthFactor != documentLayout->maxMarkWidthFactor) {
- documentLayout->maxMarkWidthFactor = maxWidthFactor;
- documentLayout->requestUpdate();
- } else {
- documentLayout->requestExtraAreaUpdate();
- }
- }
-}
-
-void DocumentMarker::removeMark(TextEditor::ITextMark *mark)
-{
- QTextBlock block = document->findBlockByNumber(mark->lineNumber() - 1);
- if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData())) {
- if (!data->removeMark(mark))
- qDebug() << "Could not find mark" << mark << "on line" << mark->lineNumber();
- }
-
- removeMarkFromMarksCache(mark);
- mark->setMarkableInterface(0);
-}
-
-void DocumentMarker::updateMark(ITextMark *mark)
-{
- Q_UNUSED(mark)
- BaseTextDocumentLayout *documentLayout =
- qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
- QTC_ASSERT(documentLayout, return);
- documentLayout->requestUpdate();
-}
-
-void DocumentMarker::moveMark(ITextMark *mark, int previousLine)
-{
- QTextBlock block = document->findBlockByNumber(previousLine - 1);
- if (TextBlockUserData *data = BaseTextDocumentLayout::testUserData(block)) {
- if (!data->removeMark(mark))
- qDebug() << "Could not find mark" << mark << "on line" << previousLine;
- }
- removeMarkFromMarksCache(mark);
- mark->setMarkableInterface(0);
- addMark(mark);
-}
-
-} // namespace Internal
-} // namespace TextEditor
CodeFormatterData::~CodeFormatterData()
{
@@ -199,11 +40,9 @@ CodeFormatterData::~CodeFormatterData()
TextBlockUserData::~TextBlockUserData()
{
- foreach (ITextMark *mrk, m_marks) {
- TextEditor::Internal::DocumentMarker *documentMarker
- = static_cast<TextEditor::Internal::DocumentMarker *>(mrk->markableInterface());
- documentMarker->removeMarkFromMarksCache(mrk);
- mrk->setMarkableInterface(0);
+ foreach (TextMark *mrk, m_marks) {
+ mrk->baseTextDocument()->removeMarkFromMarksCache(mrk);
+ mrk->setBaseTextDocument(0);
mrk->removedFromEditor();
}
@@ -537,7 +376,7 @@ void TextBlockUserData::setCodeFormatterData(CodeFormatterData *data)
m_codeFormatterData = data;
}
-void TextBlockUserData::addMark(ITextMark *mark)
+void TextBlockUserData::addMark(TextMark *mark)
{
int i = 0;
for ( ; i < m_marks.size(); ++i) {
@@ -553,11 +392,8 @@ BaseTextDocumentLayout::BaseTextDocumentLayout(QTextDocument *doc)
lastSaveRevision(0),
hasMarks(false),
maxMarkWidthFactor(1.0),
- m_requiredWidth(0),
- m_documentMarker(new Internal::DocumentMarker(doc))
-{
-
-}
+ m_requiredWidth(0)
+{}
BaseTextDocumentLayout::~BaseTextDocumentLayout()
{
@@ -702,11 +538,6 @@ void BaseTextDocumentLayout::requestExtraAreaUpdate()
emit updateExtraArea();
}
-ITextMarkable *BaseTextDocumentLayout::markableInterface()
-{
- return m_documentMarker;
-}
-
void BaseTextDocumentLayout::doFoldOrUnfold(const QTextBlock& block, bool unfold)
{
if (!canFold(block))
@@ -760,22 +591,20 @@ TextMarks BaseTextDocumentLayout::documentClosing()
return marks;
}
-void BaseTextDocumentLayout::documentReloaded(TextMarks marks)
+void BaseTextDocumentLayout::documentReloaded(TextMarks marks, BaseTextDocument *baseTextDocument)
{
- foreach (ITextMark *mark, marks) {
+ foreach (TextMark *mark, marks) {
int blockNumber = mark->lineNumber() - 1;
QTextBlock block = document()->findBlockByNumber(blockNumber);
if (block.isValid()) {
TextBlockUserData *userData = BaseTextDocumentLayout::userData(block);
userData->addMark(mark);
- mark->setMarkableInterface(m_documentMarker);
+ mark->setBaseTextDocument(baseTextDocument);
mark->updateBlock(block);
} else {
- TextEditor::Internal::DocumentMarker *documentMarker
- = static_cast<TextEditor::Internal::DocumentMarker *>(m_documentMarker);
- documentMarker->removeMarkFromMarksCache(mark);
+ baseTextDocument->removeMarkFromMarksCache(mark);
mark->removedFromEditor();
- mark->setMarkableInterface(0);
+ mark->setBaseTextDocument(0);
}
}
requestUpdate();
@@ -789,7 +618,7 @@ void BaseTextDocumentLayout::updateMarksLineNumber()
int blockNumber = 0;
while (block.isValid()) {
if (const TextBlockUserData *userData = testUserData(block))
- foreach (ITextMark *mrk, userData->marks())
+ foreach (TextMark *mrk, userData->marks())
mrk->updateLineNumber(blockNumber + 1);
block = block.next();
++blockNumber;
@@ -799,7 +628,7 @@ void BaseTextDocumentLayout::updateMarksLineNumber()
void BaseTextDocumentLayout::updateMarksBlock(const QTextBlock &block)
{
if (const TextBlockUserData *userData = testUserData(block))
- foreach (ITextMark *mrk, userData->marks())
+ foreach (TextMark *mrk, userData->marks())
mrk->updateBlock(block);
}
@@ -868,5 +697,3 @@ void BaseTextDocumentLayout::FoldValidator::finalize()
m_layout->emitDocumentSizeChanged();
}
}
-
-#include "basetextdocumentlayout.moc"
diff --git a/src/plugins/texteditor/basetextdocumentlayout.h b/src/plugins/texteditor/basetextdocumentlayout.h
index ffeda3b045..cf7e85066f 100644
--- a/src/plugins/texteditor/basetextdocumentlayout.h
+++ b/src/plugins/texteditor/basetextdocumentlayout.h
@@ -32,7 +32,8 @@
#include "texteditor_global.h"
-#include "itexteditor.h"
+#include "basetexteditor.h"
+#include "textmark.h"
#include <QTextBlockUserData>
#include <QPlainTextDocumentLayout>
@@ -75,13 +76,13 @@ public:
~TextBlockUserData();
inline TextMarks marks() const { return m_marks; }
- void addMark(ITextMark *mark);
- inline bool removeMark(ITextMark *mark) { return m_marks.removeAll(mark); }
+ void addMark(TextMark *mark);
+ inline bool removeMark(TextMark *mark) { return m_marks.removeAll(mark); }
inline TextMarks documentClosing() {
TextMarks marks = m_marks;
- foreach (ITextMark *mrk, m_marks)
- mrk->setMarkableInterface(0);
+ foreach (TextMark *mrk, m_marks)
+ mrk->setBaseTextDocument(0);
m_marks.clear();
return marks;
}
@@ -205,21 +206,19 @@ public:
void requestExtraAreaUpdate();
void emitDocumentSizeChanged() { emit documentSizeChanged(documentSize()); }
- ITextMarkable *markableInterface();
int lastSaveRevision;
bool hasMarks;
double maxMarkWidthFactor;
int m_requiredWidth;
- ITextMarkable *m_documentMarker;
void setRequiredWidth(int width);
QSizeF documentSize() const;
TextMarks documentClosing();
- void documentReloaded(TextMarks marks);
+ void documentReloaded(TextMarks marks, BaseTextDocument *baseextDocument);
void updateMarksLineNumber();
void updateMarksBlock(const QTextBlock &block);
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 7e5671bd87..312db11157 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -47,9 +47,17 @@
#include "texteditoroverlay.h"
#include "circularclipboard.h"
#include "circularclipboardassist.h"
+#include "highlighterutils.h"
+#include "basetexteditor.h"
#include <texteditor/codeassist/codeassistant.h>
#include <texteditor/codeassist/defaultassistinterface.h>
+#include <texteditor/generichighlighter/context.h>
+#include <texteditor/generichighlighter/highlightdefinition.h>
+#include <texteditor/generichighlighter/highlighter.h>
+#include <texteditor/generichighlighter/highlightersettings.h>
+#include <texteditor/generichighlighter/manager.h>
+#include <coreplugin/icore.h>
#include <aggregation/aggregate.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
@@ -107,18 +115,379 @@
/*!
\class TextEditor::BaseTextEditor
- \brief The BaseTextEditor class is a base class for QPlainTextEdit-based text editors.
+ \brief The BaseTextEditor class is base implementation for QPlainTextEdit-based
+ text editors. It can use the Kate text highlighting definitions, and some basic
+ auto indentation.
+
+ The corresponding document base class is BaseTextDocument, the corresponding
+ widget base class is BaseTextEditorWidget.
- The corresponding document base class is BaseTextDocument, the corresponding widget base class
- is BaseTextEditorWidget.
+ It is the default editor for text files used by \QC, if no other editor
+ implementation matches the MIME type.
*/
+
using namespace Core;
using namespace Utils;
namespace TextEditor {
namespace Internal {
+typedef QString (TransformationMethod)(const QString &);
+
+static QString QString_toUpper(const QString &str)
+{
+ return str.toUpper();
+}
+
+static QString QString_toLower(const QString &str)
+{
+ return str.toLower();
+}
+
+class BaseTextEditorAnimator : public QObject
+{
+ Q_OBJECT
+
+public:
+ BaseTextEditorAnimator(QObject *parent);
+
+ inline void setPosition(int position) { m_position = position; }
+ inline int position() const { return m_position; }
+
+ void setData(const QFont &f, const QPalette &pal, const QString &text);
+
+ void draw(QPainter *p, const QPointF &pos);
+ QRectF rect() const;
+
+ inline qreal value() const { return m_value; }
+ inline QPointF lastDrawPos() const { return m_lastDrawPos; }
+
+ void finish();
+
+ bool isRunning() const;
+
+signals:
+ void updateRequest(int position, QPointF lastPos, QRectF rect);
+
+
+private slots:
+ void step(qreal v);
+
+private:
+ QTimeLine *m_timeline;
+ qreal m_value;
+ int m_position;
+ QPointF m_lastDrawPos;
+ QFont m_font;
+ QPalette m_palette;
+ QString m_text;
+ QSizeF m_size;
+};
+
+class BaseTextEditorPrivate
+{
+public:
+ BaseTextEditorPrivate()
+ : m_autoCompleter(new AutoCompleter)
+ {}
+
+ // Note: This is always a copy of IContext::m_widget.
+ BaseTextEditorWidget *m_editorWidget;
+
+ CommentDefinition m_commentDefinition;
+ std::function<CompletionAssistProvider *()> m_completionAssistProvider;
+ QScopedPointer<AutoCompleter> m_autoCompleter;
+};
+
+class BaseTextEditorWidgetPrivate : public QObject
+{
+public:
+ BaseTextEditorWidgetPrivate(BaseTextEditorWidget *parent);
+ ~BaseTextEditorWidgetPrivate() { delete m_toolBar; }
+
+ // FIXME: Remove after relevant members have been moved to BaseTextEditorPrivate
+ BaseTextEditorPrivate *dd() { return q->editor()->d; }
+
+ void setupDocumentSignals();
+ void updateLineSelectionColor();
+
+ void print(QPrinter *printer);
+
+ void maybeSelectLine();
+ void updateCannotDecodeInfo();
+ void collectToCircularClipboard();
+
+ void ctor(const QSharedPointer<BaseTextDocument> &doc);
+ void handleHomeKey(bool anchor);
+ void handleBackspaceKey();
+ void moveLineUpDown(bool up);
+ void copyLineUpDown(bool up);
+ void saveCurrentCursorPositionForNavigation();
+ void updateHighlights();
+ void updateCurrentLineHighlight();
+
+ void drawFoldingMarker(QPainter *painter, const QPalette &pal,
+ const QRect &rect,
+ bool expanded,
+ bool active,
+ bool hovered) const;
+
+ void toggleBlockVisible(const QTextBlock &block);
+ QRect foldBox();
+
+ QTextBlock foldedBlockAt(const QPoint &pos, QRect *box = 0) const;
+
+ void updateLink(QMouseEvent *e);
+ void showLink(const BaseTextEditorWidget::Link &);
+ void clearLink();
+
+ void universalHelper(); // test function for development
+
+ bool cursorMoveKeyEvent(QKeyEvent *e);
+ bool camelCaseRight(QTextCursor &cursor, QTextCursor::MoveMode mode);
+ bool camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveMode mode);
+
+ void processTooltipRequest(const QTextCursor &c);
+
+ void transformSelection(Internal::TransformationMethod method);
+ void transformBlockSelection(Internal::TransformationMethod method);
+
+ bool inFindScope(const QTextCursor &cursor);
+ bool inFindScope(int selectionStart, int selectionEnd);
+
+//public slots:
+ void slotUpdateExtraAreaWidth();
+ void slotUpdateRequest(const QRect &r, int dy);
+ void slotUpdateBlockNotify(const QTextBlock &);
+ void updateTabStops();
+ void applyFontSettingsDelayed();
+
+ void editorContentsChange(int position, int charsRemoved, int charsAdded);
+ void documentAboutToBeReloaded();
+ void documentReloadFinished(bool success);
+ void highlightSearchResultsSlot(const QString &txt, Core::FindFlags findFlags);
+ void setFindScope(const QTextCursor &start, const QTextCursor &end, int, int);
+
+ void updateCursorPosition();
+
+ // parentheses matcher
+ void _q_matchParentheses();
+ void _q_highlightBlocks();
+ void slotSelectionChanged();
+ void _q_animateUpdate(int position, QPointF lastPos, QRectF rect);
+ void updateCodeFoldingVisible();
+
+public:
+ BaseTextEditorWidget *q;
+ QToolBar *m_toolBar;
+ QWidget *m_stretchWidget;
+ Utils::LineColumnLabel *m_cursorPositionLabel;
+ Utils::LineColumnLabel *m_fileEncodingLabel;
+ QAction *m_cursorPositionLabelAction;
+ QAction *m_fileEncodingLabelAction;
+
+ bool m_contentsChanged;
+ bool m_lastCursorChangeWasInteresting;
+
+ QSharedPointer<BaseTextDocument> m_document;
+ QByteArray m_tempState;
+ QByteArray m_tempNavigationState;
+
+ bool m_parenthesesMatchingEnabled;
+
+ // parentheses matcher
+ bool m_formatRange;
+ QTextCharFormat m_mismatchFormat;
+ QTimer m_parenthesesMatchingTimer;
+ // end parentheses matcher
+
+ QWidget *m_extraArea;
+
+ Core::Id m_tabSettingsId;
+ ICodeStylePreferences *m_codeStylePreferences;
+ DisplaySettings m_displaySettings;
+ MarginSettings m_marginSettings;
+ bool m_fontSettingsNeedsApply;
+ BehaviorSettings m_behaviorSettings;
+
+ int extraAreaSelectionAnchorBlockNumber;
+ int extraAreaToggleMarkBlockNumber;
+ int extraAreaHighlightFoldedBlockNumber;
+
+ TextEditorOverlay *m_overlay;
+ TextEditorOverlay *m_snippetOverlay;
+ TextEditorOverlay *m_searchResultOverlay;
+ bool snippetCheckCursor(const QTextCursor &cursor);
+ void snippetTabOrBacktab(bool forward);
+
+ RefactorOverlay *m_refactorOverlay;
+
+ QBasicTimer foldedBlockTimer;
+ int visibleFoldedBlockNumber;
+ int suggestedVisibleFoldedBlockNumber;
+ void clearVisibleFoldedBlock();
+ bool m_mouseOnFoldedMarker;
+ void foldLicenseHeader();
+
+ QBasicTimer autoScrollTimer;
+ uint m_marksVisible : 1;
+ uint m_codeFoldingVisible : 1;
+ uint m_codeFoldingSupported : 1;
+ uint m_revisionsVisible : 1;
+ uint m_lineNumbersVisible : 1;
+ uint m_highlightCurrentLine : 1;
+ uint m_requestMarkEnabled : 1;
+ uint m_lineSeparatorsAllowed : 1;
+ uint autoParenthesisOverwriteBackup : 1;
+ uint surroundWithEnabledOverwriteBackup : 1;
+ uint m_maybeFakeTooltipEvent : 1;
+ int m_visibleWrapColumn;
+
+ BaseTextEditorWidget::Link m_currentLink;
+ bool m_linkPressed;
+
+ QRegExp m_searchExpr;
+ Core::FindFlags m_findFlags;
+ void highlightSearchResults(const QTextBlock &block, TextEditorOverlay *overlay);
+ QTimer m_delayedUpdateTimer;
+
+ BaseTextEditor *m_editor;
+
+ QList<QTextEdit::ExtraSelection> m_extraSelections[BaseTextEditorWidget::NExtraSelectionKinds];
+
+ // block selection mode
+ bool m_inBlockSelectionMode;
+ QString copyBlockSelection();
+ void insertIntoBlockSelection(const QString &text = QString());
+ void setCursorToColumn(QTextCursor &cursor, int column,
+ QTextCursor::MoveMode moveMode = QTextCursor::MoveAnchor);
+ void removeBlockSelection();
+ void enableBlockSelection(const QTextCursor &cursor);
+ void enableBlockSelection(int positionBlock, int positionColumn,
+ int anchorBlock, int anchorColumn);
+ void disableBlockSelection(bool keepSelection = true);
+ void resetCursorFlashTimer();
+ QBasicTimer m_cursorFlashTimer;
+ bool m_cursorVisible;
+ bool m_moveLineUndoHack;
+
+ QTextCursor m_findScopeStart;
+ QTextCursor m_findScopeEnd;
+ int m_findScopeVerticalBlockSelectionFirstColumn;
+ int m_findScopeVerticalBlockSelectionLastColumn;
+
+ QTextCursor m_selectBlockAnchor;
+
+ Internal::BaseTextBlockSelection m_blockSelection;
+
+ void moveCursorVisible(bool ensureVisible = true);
+
+ int visualIndent(const QTextBlock &block) const;
+ BaseTextEditorPrivateHighlightBlocks m_highlightBlocksInfo;
+ QTimer m_highlightBlocksTimer;
+
+ QScopedPointer<CodeAssistant> m_codeAssistant;
+ bool m_assistRelevantContentAdded;
+
+ QPointer<BaseTextEditorAnimator> m_animator;
+ int m_cursorBlockNumber;
+ int m_blockCount;
+
+ QPoint m_markDragStart;
+ bool m_markDragging;
+
+ QScopedPointer<Internal::ClipboardAssistProvider> m_clipboardAssistProvider;
+
+ bool m_isMissingSyntaxDefinition;
+};
+
+BaseTextEditorWidgetPrivate::BaseTextEditorWidgetPrivate(BaseTextEditorWidget *parent)
+ : q(parent),
+ m_toolBar(0),
+ m_stretchWidget(0),
+ m_cursorPositionLabel(0),
+ m_fileEncodingLabel(0),
+ m_cursorPositionLabelAction(0),
+ m_fileEncodingLabelAction(0),
+ m_contentsChanged(false),
+ m_lastCursorChangeWasInteresting(false),
+ m_parenthesesMatchingEnabled(false),
+ m_formatRange(false),
+ m_parenthesesMatchingTimer(0),
+ m_extraArea(0),
+ m_codeStylePreferences(0),
+ m_fontSettingsNeedsApply(true), // apply when making visible the first time, for the split case
+ extraAreaSelectionAnchorBlockNumber(-1),
+ extraAreaToggleMarkBlockNumber(-1),
+ extraAreaHighlightFoldedBlockNumber(-1),
+ m_overlay(0),
+ m_snippetOverlay(0),
+ m_searchResultOverlay(0),
+ m_refactorOverlay(0),
+ visibleFoldedBlockNumber(-1),
+ suggestedVisibleFoldedBlockNumber(-1),
+ m_mouseOnFoldedMarker(false),
+ m_marksVisible(false),
+ m_codeFoldingVisible(false),
+ m_codeFoldingSupported(false),
+ m_revisionsVisible(false),
+ m_lineNumbersVisible(true),
+ m_highlightCurrentLine(true),
+ m_requestMarkEnabled(true),
+ m_lineSeparatorsAllowed(false),
+ m_maybeFakeTooltipEvent(false),
+ m_visibleWrapColumn(0),
+ m_linkPressed(false),
+ m_delayedUpdateTimer(0),
+ m_editor(0),
+ m_inBlockSelectionMode(false),
+ m_moveLineUndoHack(false),
+ m_findScopeVerticalBlockSelectionFirstColumn(-1),
+ m_findScopeVerticalBlockSelectionLastColumn(-1),
+ m_highlightBlocksTimer(0),
+ m_codeAssistant(new CodeAssistant),
+ m_assistRelevantContentAdded(false),
+ m_cursorBlockNumber(-1),
+ m_blockCount(0),
+ m_markDragging(false),
+ m_clipboardAssistProvider(new Internal::ClipboardAssistProvider),
+ m_isMissingSyntaxDefinition(false)
+{
+ Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
+ BaseTextFind *baseTextFind = new BaseTextFind(q);
+ connect(baseTextFind, &BaseTextFind::highlightAll,
+ this, &BaseTextEditorWidgetPrivate::highlightSearchResultsSlot);
+ connect(baseTextFind, &BaseTextFind::findScopeChanged,
+ this, &BaseTextEditorWidgetPrivate::setFindScope);
+ aggregate->add(baseTextFind);
+ aggregate->add(q);
+
+ m_stretchWidget = new QWidget;
+ m_stretchWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ m_toolBar = new QToolBar;
+ m_toolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+ m_toolBar->addWidget(m_stretchWidget);
+
+ m_cursorPositionLabel = new Utils::LineColumnLabel;
+ const int spacing = q->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2;
+ m_cursorPositionLabel->setContentsMargins(spacing, 0, spacing, 0);
+
+ m_fileEncodingLabel = new Utils::LineColumnLabel;
+ m_fileEncodingLabel->setContentsMargins(spacing, 0, spacing, 0);
+
+ m_cursorPositionLabelAction = m_toolBar->addWidget(m_cursorPositionLabel);
+ m_fileEncodingLabelAction = m_toolBar->addWidget(m_fileEncodingLabel);
+
+ connect(m_cursorPositionLabel, &LineColumnLabel::clicked, [this] {
+ Core::EditorManager::activateEditor(q->editor(), Core::EditorManager::IgnoreNavigationHistory);
+ if (Core::Command *cmd = Core::ActionManager::command(Core::Constants::GOTO)) {
+ if (QAction *act = cmd->action())
+ act->trigger();
+ }
+ });
+}
+
class TextEditExtraArea : public QWidget
{
public:
@@ -197,58 +566,65 @@ QString BaseTextEditorWidget::convertToPlainText(const QString &txt)
static const char kTextBlockMimeType[] = "application/vnd.qtcreator.blocktext";
-BaseTextEditorWidget::BaseTextEditorWidget(QWidget *parent)
- : QPlainTextEdit(parent)
-{
- ctor(QSharedPointer<BaseTextDocument>(new BaseTextDocument));
-}
-
BaseTextEditorWidget::BaseTextEditorWidget(BaseTextDocument *doc, QWidget *parent)
: QPlainTextEdit(parent)
{
- ctor(QSharedPointer<BaseTextDocument>(doc));
+ d = new BaseTextEditorWidgetPrivate(this);
+ d->ctor(QSharedPointer<BaseTextDocument>(doc));
}
BaseTextEditorWidget::BaseTextEditorWidget(BaseTextEditorWidget *other)
{
- ctor(other->d->m_document);
+ d = new BaseTextEditorWidgetPrivate(this);
+ d->ctor(other->d->m_document);
d->m_revisionsVisible = other->d->m_revisionsVisible;
}
-void BaseTextEditorWidget::ctor(const QSharedPointer<BaseTextDocument> &doc)
+void BaseTextEditorWidgetPrivate::ctor(const QSharedPointer<BaseTextDocument> &doc)
{
- d = new BaseTextEditorWidgetPrivate;
- d->q = this;
- d->m_extraArea = new TextEditExtraArea(this);
- d->m_extraArea->setMouseTracking(true);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+ m_extraArea = new TextEditExtraArea(q);
+ m_extraArea->setMouseTracking(true);
+ q->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
- d->m_overlay = new TextEditorOverlay(this);
- d->m_snippetOverlay = new TextEditorOverlay(this);
- d->m_searchResultOverlay = new TextEditorOverlay(this);
- d->m_refactorOverlay = new RefactorOverlay(this);
+ m_overlay = new TextEditorOverlay(q);
+ m_snippetOverlay = new TextEditorOverlay(q);
+ m_searchResultOverlay = new TextEditorOverlay(q);
+ m_refactorOverlay = new RefactorOverlay(q);
- d->m_document = doc;
- d->setupDocumentSignals();
+ m_document = doc;
+ setupDocumentSignals();
// from RESEARCH
- setLayoutDirection(Qt::LeftToRight);
- viewport()->setMouseTracking(true);
- d->extraAreaSelectionAnchorBlockNumber
- = d->extraAreaToggleMarkBlockNumber
- = d->extraAreaHighlightFoldedBlockNumber
- = -1;
+ q->setLayoutDirection(Qt::LeftToRight);
+ q->viewport()->setMouseTracking(true);
+
+ extraAreaSelectionAnchorBlockNumber = -1;
+ extraAreaToggleMarkBlockNumber = -1;
+ extraAreaHighlightFoldedBlockNumber = -1;
+ visibleFoldedBlockNumber = -1;
+ suggestedVisibleFoldedBlockNumber = -1;
+
+ QObject::connect(m_codeAssistant.data(), &CodeAssistant::finished,
+ q, &BaseTextEditorWidget::assistFinished);
+
+ QObject::connect(q, &QPlainTextEdit::blockCountChanged,
+ this, &BaseTextEditorWidgetPrivate::slotUpdateExtraAreaWidth);
+
+ QObject::connect(q, &BaseTextEditorWidget::modificationChanged, m_extraArea,
+ static_cast<void (QWidget::*)()>(&QWidget::update));
+
+ QObject::connect(q, &QPlainTextEdit::cursorPositionChanged,
+ q, &BaseTextEditorWidget::slotCursorPositionChanged);
- d->visibleFoldedBlockNumber = d->suggestedVisibleFoldedBlockNumber = -1;
+ QObject::connect(q, &QPlainTextEdit::cursorPositionChanged,
+ this, &BaseTextEditorWidgetPrivate::updateCursorPosition);
- connect(d->m_codeAssistant.data(), SIGNAL(finished()), this, SIGNAL(assistFinished()));
+ QObject::connect(q, &QPlainTextEdit::updateRequest,
+ this, &BaseTextEditorWidgetPrivate::slotUpdateRequest);
- connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(slotUpdateExtraAreaWidth()));
- connect(this, SIGNAL(modificationChanged(bool)), d->m_extraArea, SLOT(update()));
- connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(slotCursorPositionChanged()));
- connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(slotUpdateRequest(QRect,int)));
- connect(this, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()));
+ QObject::connect(q, &QPlainTextEdit::selectionChanged,
+ this, &BaseTextEditorWidgetPrivate::slotSelectionChanged);
// (void) new QShortcut(tr("CTRL+L"), this, SLOT(centerCursor()), 0, Qt::WidgetShortcut);
// (void) new QShortcut(tr("F9"), this, SLOT(slotToggleMark()), 0, Qt::WidgetShortcut);
@@ -258,27 +634,29 @@ void BaseTextEditorWidget::ctor(const QSharedPointer<BaseTextDocument> &doc)
(void) new QShortcut(tr("CTRL+D"), this, SLOT(doFoo()));
#endif
-
// parentheses matcher
- d->m_formatRange = true;
- d->m_mismatchFormat.setBackground(palette().color(QPalette::Base).value() < 128
+ m_formatRange = true;
+ m_mismatchFormat.setBackground(q->palette().color(QPalette::Base).value() < 128
? Qt::darkMagenta : Qt::magenta);
- d->m_parenthesesMatchingTimer.setSingleShot(true);
- connect(&d->m_parenthesesMatchingTimer, SIGNAL(timeout()), this, SLOT(_q_matchParentheses()));
+ m_parenthesesMatchingTimer.setSingleShot(true);
+ QObject::connect(&m_parenthesesMatchingTimer, &QTimer::timeout,
+ this, &BaseTextEditorWidgetPrivate::_q_matchParentheses);
- d->m_highlightBlocksTimer.setSingleShot(true);
- connect(&d->m_highlightBlocksTimer, SIGNAL(timeout()), this, SLOT(_q_highlightBlocks()));
+ m_highlightBlocksTimer.setSingleShot(true);
+ QObject::connect(&m_highlightBlocksTimer, &QTimer::timeout,
+ this, &BaseTextEditorWidgetPrivate::_q_highlightBlocks);
- d->m_animator = 0;
+ m_animator = 0;
slotUpdateExtraAreaWidth();
updateHighlights();
- setFrameStyle(QFrame::NoFrame);
+ q->setFrameStyle(QFrame::NoFrame);
- d->m_delayedUpdateTimer.setSingleShot(true);
- connect(&d->m_delayedUpdateTimer, SIGNAL(timeout()), viewport(), SLOT(update()));
+ m_delayedUpdateTimer.setSingleShot(true);
+ QObject::connect(&m_delayedUpdateTimer, &QTimer::timeout, q->viewport(),
+ static_cast<void (QWidget::*)()>(&QWidget::update));
- d->m_moveLineUndoHack = false;
+ m_moveLineUndoHack = false;
}
BaseTextEditorWidget::~BaseTextEditorWidget()
@@ -531,7 +909,8 @@ void BaseTextEditorWidget::selectEncoding()
void BaseTextEditorWidget::updateTextCodecLabel()
{
- editor()->setFileEncodingLabelText(QString::fromLatin1(d->m_document->codec()->name()));
+ QString text = QString::fromLatin1(d->m_document->codec()->name());
+ d->m_fileEncodingLabel->setText(text, text);
}
QString BaseTextEditorWidget::msgTextTooLarge(quint64 size)
@@ -556,18 +935,18 @@ QString BaseTextEditorWidget::selectedText() const
return textCursor().selectedText();
}
-void BaseTextEditorWidget::updateCannotDecodeInfo()
+void BaseTextEditorWidgetPrivate::updateCannotDecodeInfo()
{
- setReadOnly(d->m_document->hasDecodingError());
- Core::InfoBar *infoBar = d->m_document->infoBar();
+ q->setReadOnly(m_document->hasDecodingError());
+ Core::InfoBar *infoBar = m_document->infoBar();
Core::Id selectEncodingId(Constants::SELECT_ENCODING);
- if (d->m_document->hasDecodingError()) {
+ if (m_document->hasDecodingError()) {
if (!infoBar->canInfoBeAdded(selectEncodingId))
return;
Core::InfoBarEntry info(selectEncodingId,
- tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
- .arg(d->m_document->displayName()).arg(QString::fromLatin1(d->m_document->codec()->name())));
- info.setCustomButtonInfo(tr("Select Encoding"), this, SLOT(selectEncoding()));
+ BaseTextEditorWidget::tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
+ .arg(m_document->displayName()).arg(QString::fromLatin1(m_document->codec()->name())));
+ info.setCustomButtonInfo(BaseTextEditorWidget::tr("Select Encoding"), q, SLOT(selectEncoding()));
infoBar->addInfo(info);
} else {
infoBar->removeInfo(selectEncodingId);
@@ -578,9 +957,9 @@ bool BaseTextEditorWidget::open(QString *errorString, const QString &fileName, c
{
if (d->m_document->open(errorString, fileName, realFileName)) {
moveCursor(QTextCursor::Start);
- updateCannotDecodeInfo();
- if (editor()->m_fileEncodingLabel) {
- connect(editor()->m_fileEncodingLabel, SIGNAL(clicked()), this,
+ d->updateCannotDecodeInfo();
+ if (d->m_fileEncodingLabel) {
+ connect(d->m_fileEncodingLabel, SIGNAL(clicked()), this,
SLOT(selectEncoding()), Qt::UniqueConnection);
connect(d->m_document->document(), SIGNAL(modificationChanged(bool)), this,
SLOT(updateTextCodecLabel()), Qt::UniqueConnection);
@@ -617,18 +996,18 @@ void BaseTextEditorWidgetPrivate::foldLicenseHeader()
}
}
-BaseTextDocument *BaseTextEditorWidget::baseTextDocument() const
+BaseTextDocument *BaseTextEditorWidget::textDocument() const
{
return d->m_document.data();
}
-void BaseTextEditorWidget::editorContentsChange(int position, int charsRemoved, int charsAdded)
+void BaseTextEditorWidgetPrivate::editorContentsChange(int position, int charsRemoved, int charsAdded)
{
- if (d->m_animator)
- d->m_animator->finish();
+ if (m_animator)
+ m_animator->finish();
- d->m_contentsChanged = true;
- QTextDocument *doc = document();
+ m_contentsChanged = true;
+ QTextDocument *doc = q->document();
BaseTextDocumentLayout *documentLayout = static_cast<BaseTextDocumentLayout*>(doc->documentLayout());
const QTextBlock posBlock = doc->findBlock(position);
@@ -647,28 +1026,28 @@ void BaseTextEditorWidget::editorContentsChange(int position, int charsRemoved,
}
}
- if (d->m_snippetOverlay->isVisible()) {
- QTextCursor cursor = textCursor();
+ if (m_snippetOverlay->isVisible()) {
+ QTextCursor cursor = q->textCursor();
cursor.setPosition(position);
- d->snippetCheckCursor(cursor);
+ snippetCheckCursor(cursor);
}
- if (charsAdded != 0 && document()->characterAt(position + charsAdded - 1).isPrint())
- d->m_assistRelevantContentAdded = true;
+ if (charsAdded != 0 && q->document()->characterAt(position + charsAdded - 1).isPrint())
+ m_assistRelevantContentAdded = true;
int newBlockCount = doc->blockCount();
- if (!hasFocus() && newBlockCount != d->m_blockCount) {
+ if (!q->hasFocus() && newBlockCount != m_blockCount) {
// lines were inserted or removed from outside, keep viewport on same part of text
- if (firstVisibleBlock().blockNumber() > posBlock.blockNumber())
- verticalScrollBar()->setValue(verticalScrollBar()->value() + newBlockCount - d->m_blockCount);
+ if (q->firstVisibleBlock().blockNumber() > posBlock.blockNumber())
+ q->verticalScrollBar()->setValue(q->verticalScrollBar()->value() + newBlockCount - m_blockCount);
}
- d->m_blockCount = newBlockCount;
+ m_blockCount = newBlockCount;
}
-void BaseTextEditorWidget::slotSelectionChanged()
+void BaseTextEditorWidgetPrivate::slotSelectionChanged()
{
- if (!textCursor().hasSelection() && !d->m_selectBlockAnchor.isNull())
- d->m_selectBlockAnchor = QTextCursor();
+ if (!q->textCursor().hasSelection() && !m_selectBlockAnchor.isNull())
+ m_selectBlockAnchor = QTextCursor();
// Clear any link which might be showing when the selection changes
clearLink();
}
@@ -678,7 +1057,7 @@ void BaseTextEditorWidget::gotoBlockStart()
QTextCursor cursor = textCursor();
if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, false)) {
setTextCursor(cursor);
- _q_matchParentheses();
+ d->_q_matchParentheses();
}
}
@@ -687,7 +1066,7 @@ void BaseTextEditorWidget::gotoBlockEnd()
QTextCursor cursor = textCursor();
if (TextBlockUserData::findNextClosingParenthesis(&cursor, false)) {
setTextCursor(cursor);
- _q_matchParentheses();
+ d->_q_matchParentheses();
}
}
@@ -696,7 +1075,7 @@ void BaseTextEditorWidget::gotoBlockStartWithSelection()
QTextCursor cursor = textCursor();
if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, true)) {
setTextCursor(cursor);
- _q_matchParentheses();
+ d->_q_matchParentheses();
}
}
@@ -705,19 +1084,18 @@ void BaseTextEditorWidget::gotoBlockEndWithSelection()
QTextCursor cursor = textCursor();
if (TextBlockUserData::findNextClosingParenthesis(&cursor, true)) {
setTextCursor(cursor);
- _q_matchParentheses();
+ d->_q_matchParentheses();
}
}
-
void BaseTextEditorWidget::gotoLineStart()
{
- handleHomeKey(false);
+ d->handleHomeKey(false);
}
void BaseTextEditorWidget::gotoLineStartWithSelection()
{
- handleHomeKey(true);
+ d->handleHomeKey(true);
}
void BaseTextEditorWidget::gotoLineEnd()
@@ -797,28 +1175,28 @@ void BaseTextEditorWidget::gotoNextWordWithSelection()
void BaseTextEditorWidget::gotoPreviousWordCamelCase()
{
QTextCursor c = textCursor();
- camelCaseLeft(c, QTextCursor::MoveAnchor);
+ d->camelCaseLeft(c, QTextCursor::MoveAnchor);
setTextCursor(c);
}
void BaseTextEditorWidget::gotoPreviousWordCamelCaseWithSelection()
{
QTextCursor c = textCursor();
- camelCaseLeft(c, QTextCursor::KeepAnchor);
+ d->camelCaseLeft(c, QTextCursor::KeepAnchor);
setTextCursor(c);
}
void BaseTextEditorWidget::gotoNextWordCamelCase()
{
QTextCursor c = textCursor();
- camelCaseRight(c, QTextCursor::MoveAnchor);
+ d->camelCaseRight(c, QTextCursor::MoveAnchor);
setTextCursor(c);
}
void BaseTextEditorWidget::gotoNextWordCamelCaseWithSelection()
{
QTextCursor c = textCursor();
- camelCaseRight(c, QTextCursor::KeepAnchor);
+ d->camelCaseRight(c, QTextCursor::KeepAnchor);
setTextCursor(c);
}
@@ -844,7 +1222,7 @@ bool BaseTextEditorWidget::selectBlockUp()
return false;
setTextCursor(flippedCursor(cursor));
- _q_matchParentheses();
+ d->_q_matchParentheses();
return true;
}
@@ -869,24 +1247,24 @@ bool BaseTextEditorWidget::selectBlockDown()
TextBlockUserData::findNextClosingParenthesis(&cursor, true);
setTextCursor(flippedCursor(cursor));
- _q_matchParentheses();
+ d->_q_matchParentheses();
return true;
}
void BaseTextEditorWidget::copyLineUp()
{
- copyLineUpDown(true);
+ d->copyLineUpDown(true);
}
void BaseTextEditorWidget::copyLineDown()
{
- copyLineUpDown(false);
+ d->copyLineUpDown(false);
}
// @todo: Potential reuse of some code around the following functions...
-void BaseTextEditorWidget::copyLineUpDown(bool up)
+void BaseTextEditorWidgetPrivate::copyLineUpDown(bool up)
{
- QTextCursor cursor = textCursor();
+ QTextCursor cursor = q->textCursor();
QTextCursor move = cursor;
move.beginEditBlock();
@@ -929,10 +1307,10 @@ void BaseTextEditorWidget::copyLineUpDown(bool up)
move.setPosition(start);
move.setPosition(end, QTextCursor::KeepAnchor);
- d->m_document->autoIndent(move);
+ m_document->autoIndent(move);
move.endEditBlock();
- setTextCursor(move);
+ q->setTextCursor(move);
}
void BaseTextEditorWidget::joinLines()
@@ -998,32 +1376,32 @@ void BaseTextEditorWidget::insertLineBelow()
void BaseTextEditorWidget::moveLineUp()
{
- moveLineUpDown(true);
+ d->moveLineUpDown(true);
}
void BaseTextEditorWidget::moveLineDown()
{
- moveLineUpDown(false);
+ d->moveLineUpDown(false);
}
void BaseTextEditorWidget::uppercaseSelection()
{
- transformSelection(&QString::toUpper);
+ d->transformSelection(&QString_toUpper);
}
void BaseTextEditorWidget::lowercaseSelection()
{
- transformSelection(&QString::toLower);
+ d->transformSelection(&QString_toLower);
}
void BaseTextEditorWidget::indent()
{
- setTextCursor(baseTextDocument()->indent(textCursor()));
+ setTextCursor(textDocument()->indent(textCursor()));
}
void BaseTextEditorWidget::unindent()
{
- setTextCursor(baseTextDocument()->unindent(textCursor()));
+ setTextCursor(textDocument()->unindent(textCursor()));
}
void BaseTextEditorWidget::undo()
@@ -1059,14 +1437,14 @@ void BaseTextEditorWidget::abortAssist()
d->m_codeAssistant->destroyContext();
}
-void BaseTextEditorWidget::moveLineUpDown(bool up)
+void BaseTextEditorWidgetPrivate::moveLineUpDown(bool up)
{
- QTextCursor cursor = textCursor();
+ QTextCursor cursor = q->textCursor();
QTextCursor move = cursor;
move.setVisualNavigation(false); // this opens folded items instead of destroying them
- if (d->m_moveLineUndoHack)
+ if (m_moveLineUndoHack)
move.joinPreviousEditBlock();
else
move.beginEditBlock();
@@ -1074,8 +1452,8 @@ void BaseTextEditorWidget::moveLineUpDown(bool up)
bool hasSelection = cursor.hasSelection();
if (hasSelection) {
- if (d->m_inBlockSelectionMode)
- d->disableBlockSelection(true);
+ if (m_inBlockSelectionMode)
+ disableBlockSelection(true);
move.setPosition(cursor.selectionStart());
move.movePosition(QTextCursor::StartOfBlock);
move.setPosition(cursor.selectionEnd(), QTextCursor::KeepAnchor);
@@ -1091,7 +1469,7 @@ void BaseTextEditorWidget::moveLineUpDown(bool up)
RefactorMarkers nonAffectedMarkers;
QList<int> markerOffsets;
- foreach (const RefactorMarker &marker, d->m_refactorOverlay->markers()) {
+ foreach (const RefactorMarker &marker, m_refactorOverlay->markers()) {
//test if marker is part of the selection to be moved
if ((move.selectionStart() <= marker.cursor.position())
&& (move.selectionEnd() >= marker.cursor.position())) {
@@ -1139,21 +1517,21 @@ void BaseTextEditorWidget::moveLineUpDown(bool up)
int newPosition = start + markerOffsets.at(i);
affectedMarkers[i].cursor.setPosition(newPosition);
}
- d->m_refactorOverlay->setMarkers(nonAffectedMarkers + affectedMarkers);
+ m_refactorOverlay->setMarkers(nonAffectedMarkers + affectedMarkers);
bool shouldReindent = true;
- const CommentDefinition *commentDefinition(editor()->commentDefinition());
- if (commentDefinition) {
+ const CommentDefinition &cd = q->editor()->commentDefinition();
+ if (cd.isValid()) {
QString trimmedText(text.trimmed());
- if (commentDefinition->hasSingleLineStyle()) {
- if (trimmedText.startsWith(commentDefinition->singleLine))
+ if (cd.hasSingleLineStyle()) {
+ if (trimmedText.startsWith(cd.singleLine))
shouldReindent = false;
}
- if (shouldReindent && commentDefinition->hasMultiLineStyle()) {
+ if (shouldReindent && cd.hasMultiLineStyle()) {
// Don't have any single line comments; try multi line.
- if (trimmedText.startsWith(commentDefinition->multiLineStart)
- && trimmedText.endsWith(commentDefinition->multiLineEnd)) {
+ if (trimmedText.startsWith(cd.multiLineStart)
+ && trimmedText.endsWith(cd.multiLineEnd)) {
shouldReindent = false;
}
}
@@ -1161,12 +1539,12 @@ void BaseTextEditorWidget::moveLineUpDown(bool up)
if (shouldReindent) {
// The text was not commented at all; re-indent.
- d->m_document->autoReindent(move);
+ m_document->autoReindent(move);
}
move.endEditBlock();
- setTextCursor(move);
- d->m_moveLineUndoHack = true;
+ q->setTextCursor(move);
+ m_moveLineUndoHack = true;
}
void BaseTextEditorWidget::cleanWhitespace()
@@ -1190,7 +1568,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor)
return layout->lineForTextPosition(relativePos);
}
-bool BaseTextEditorWidget::camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveMode mode)
+bool BaseTextEditorWidgetPrivate::camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveMode mode)
{
int state = 0;
enum Input {
@@ -1205,7 +1583,7 @@ bool BaseTextEditorWidget::camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveM
return false;
forever {
- QChar c = document()->characterAt(cursor.position());
+ QChar c = q->document()->characterAt(cursor.position());
Input input = Input_other;
if (c.isUpper())
input = Input_U;
@@ -1300,7 +1678,7 @@ bool BaseTextEditorWidget::camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveM
}
}
-bool BaseTextEditorWidget::camelCaseRight(QTextCursor &cursor, QTextCursor::MoveMode mode)
+bool BaseTextEditorWidgetPrivate::camelCaseRight(QTextCursor &cursor, QTextCursor::MoveMode mode)
{
int state = 0;
enum Input {
@@ -1312,7 +1690,7 @@ bool BaseTextEditorWidget::camelCaseRight(QTextCursor &cursor, QTextCursor::Move
};
forever {
- QChar c = document()->characterAt(cursor.position());
+ QChar c = q->document()->characterAt(cursor.position());
Input input = Input_other;
if (c.isUpper())
input = Input_U;
@@ -1416,9 +1794,9 @@ bool BaseTextEditorWidget::camelCaseRight(QTextCursor &cursor, QTextCursor::Move
}
}
-bool BaseTextEditorWidget::cursorMoveKeyEvent(QKeyEvent *e)
+bool BaseTextEditorWidgetPrivate::cursorMoveKeyEvent(QKeyEvent *e)
{
- QTextCursor cursor = textCursor();
+ QTextCursor cursor = q->textCursor();
QTextCursor::MoveMode mode = QTextCursor::MoveAnchor;
QTextCursor::MoveOperation op = QTextCursor::NoMove;
@@ -1509,16 +1887,16 @@ bool BaseTextEditorWidget::cursorMoveKeyEvent(QKeyEvent *e)
bool visualNavigation = cursor.visualNavigation();
cursor.setVisualNavigation(true);
- if (camelCaseNavigationEnabled() && op == QTextCursor::WordRight)
+ if (q->camelCaseNavigationEnabled() && op == QTextCursor::WordRight)
camelCaseRight(cursor, mode);
- else if (camelCaseNavigationEnabled() && op == QTextCursor::WordLeft)
+ else if (q->camelCaseNavigationEnabled() && op == QTextCursor::WordLeft)
camelCaseLeft(cursor, mode);
else if (!cursor.movePosition(op, mode) && mode == QTextCursor::MoveAnchor)
cursor.clearSelection();
cursor.setVisualNavigation(visualNavigation);
- setTextCursor(cursor);
- ensureCursorVisible();
+ q->setTextCursor(cursor);
+ q->ensureCursorVisible();
return true;
}
@@ -1639,7 +2017,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
cursor.beginEditBlock();
int extraBlocks =
- d->m_autoCompleter->paragraphSeparatorAboutToBeInserted(cursor,
+ dd()->m_autoCompleter->paragraphSeparatorAboutToBeInserted(cursor,
d->m_document->tabSettings());
QString previousIndentationString;
@@ -1680,7 +2058,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
e->accept();
return;
}
- handleHomeKey(e == QKeySequence::SelectStartOfBlock);
+ d->handleHomeKey(e == QKeySequence::SelectStartOfBlock);
e->accept();
return;
} else if (!ro
@@ -1693,7 +2071,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
QTextCursor cursor = textCursor();
if (QTextLayout *layout = cursor.block().layout()) {
if (layout->lineForTextPosition(cursor.position() - cursor.block().position()).lineNumber() == 0) {
- handleHomeKey(e == QKeySequence::SelectStartOfLine);
+ d->handleHomeKey(e == QKeySequence::SelectStartOfLine);
e->accept();
return;
}
@@ -1706,12 +2084,12 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
QTextCursor c = textCursor();
int pos = c.position();
if (camelCaseNavigationEnabled())
- camelCaseLeft(c, QTextCursor::MoveAnchor);
+ d->camelCaseLeft(c, QTextCursor::MoveAnchor);
else
c.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
int targetpos = c.position();
forever {
- handleBackspaceKey();
+ d->handleBackspaceKey();
int cpos = textCursor().position();
if (cpos == pos || cpos <= targetpos)
break;
@@ -1722,7 +2100,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
e->accept();
QTextCursor c = textCursor();
if (camelCaseNavigationEnabled())
- camelCaseLeft(c, QTextCursor::KeepAnchor);
+ d->camelCaseLeft(c, QTextCursor::KeepAnchor);
else
c.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor);
c.removeSelectedText();
@@ -1731,7 +2109,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
e->accept();
QTextCursor c = textCursor();
if (camelCaseNavigationEnabled())
- camelCaseRight(c, QTextCursor::KeepAnchor);
+ d->camelCaseRight(c, QTextCursor::KeepAnchor);
else
c.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
c.removeSelectedText();
@@ -1793,7 +2171,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
| Qt::AltModifier
| Qt::MetaModifier)) == Qt::NoModifier
&& !textCursor().hasSelection()) {
- handleBackspaceKey();
+ d->handleBackspaceKey();
e->accept();
return;
}
@@ -1839,16 +2217,17 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
case Qt::Key_Insert:
if (ro) break;
if (e->modifiers() == Qt::NoModifier) {
+ AutoCompleter *ac = dd()->m_autoCompleter.data();
if (inOverwriteMode) {
- d->m_autoCompleter->setAutoParenthesesEnabled(d->autoParenthesisOverwriteBackup);
- d->m_autoCompleter->setSurroundWithEnabled(d->surroundWithEnabledOverwriteBackup);
+ ac->setAutoParenthesesEnabled(d->autoParenthesisOverwriteBackup);
+ ac->setSurroundWithEnabled(d->surroundWithEnabledOverwriteBackup);
setOverwriteMode(false);
viewport()->update();
} else {
- d->autoParenthesisOverwriteBackup = d->m_autoCompleter->isAutoParenthesesEnabled();
- d->surroundWithEnabledOverwriteBackup = d->m_autoCompleter->isSurroundWithEnabled();
- d->m_autoCompleter->setAutoParenthesesEnabled(false);
- d->m_autoCompleter->setSurroundWithEnabled(false);
+ d->autoParenthesisOverwriteBackup = ac->isAutoParenthesesEnabled();
+ d->surroundWithEnabledOverwriteBackup = ac->isSurroundWithEnabled();
+ ac->setAutoParenthesesEnabled(false);
+ ac->setSurroundWithEnabled(false);
setOverwriteMode(true);
}
e->accept();
@@ -1870,13 +2249,13 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
if (e->key() == Qt::Key_H
&& e->modifiers() == Qt::KeyboardModifiers(HostOsInfo::controlModifier())) {
- universalHelper();
+ d->universalHelper();
e->accept();
return;
}
if (ro || !isPrintableText(eventText)) {
- if (!cursorMoveKeyEvent(e)) {
+ if (!d->cursorMoveKeyEvent(e)) {
QTextCursor cursor = textCursor();
bool cursorWithinSnippet = false;
if (d->m_snippetOverlay->isVisible()
@@ -1897,7 +2276,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
// only go here if control is not pressed, except if also alt is pressed
// because AltGr maps to Alt + Ctrl
QTextCursor cursor = textCursor();
- const QString &autoText = d->m_autoCompleter->autoComplete(cursor, eventText);
+ const QString &autoText = dd()->m_autoCompleter->autoComplete(cursor, eventText);
QChar electricChar;
if (d->m_document->typingSettings().m_autoIndent) {
@@ -1937,7 +2316,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
//Select the inserted text, to be able to re-indent the inserted text
cursor.setPosition(pos, QTextCursor::KeepAnchor);
}
- if (!electricChar.isNull() && d->m_autoCompleter->contextAllowsElectricCharacters(cursor))
+ if (!electricChar.isNull() && dd()->m_autoCompleter->contextAllowsElectricCharacters(cursor))
d->m_document->autoIndent(cursor, electricChar);
if (!autoText.isEmpty())
cursor.setPosition(autoText.length() == 1 ? cursor.position() : cursor.anchor());
@@ -1982,8 +2361,8 @@ void BaseTextEditorWidget::insertCodeSnippet(const QTextCursor &cursor_arg, cons
QTextEdit::ExtraSelection selection;
selection.cursor = tc;
selection.format = (length
- ? baseTextDocument()->fontSettings().toTextCharFormat(C_OCCURRENCES)
- : baseTextDocument()->fontSettings().toTextCharFormat(C_OCCURRENCES_RENAME));
+ ? textDocument()->fontSettings().toTextCharFormat(C_OCCURRENCES)
+ : textDocument()->fontSettings().toTextCharFormat(C_OCCURRENCES_RENAME));
selections.append(selection);
manglers << data.ranges.at(i).mangler;
}
@@ -2009,7 +2388,7 @@ void BaseTextEditorWidget::insertCodeSnippet(const QTextCursor &cursor_arg, cons
}
}
-void BaseTextEditorWidget::universalHelper()
+void BaseTextEditorWidgetPrivate::universalHelper()
{
// Test function for development. Place your new fangled experiment here to
// give it proper scrutiny before pushing it onto others.
@@ -2025,7 +2404,7 @@ void BaseTextEditorWidget::setTextCursor(const QTextCursor &cursor, bool keepBlo
c.setVisualNavigation(true);
QPlainTextEdit::setTextCursor(c);
if (selectionChange)
- slotSelectionChanged();
+ d->slotSelectionChanged();
}
void BaseTextEditorWidget::setTextCursor(const QTextCursor &cursor)
@@ -2056,31 +2435,31 @@ void BaseTextEditorWidget::gotoLine(int line, int column, bool centerLine)
else
ensureCursorVisible();
}
- saveCurrentCursorPositionForNavigation();
+ d->saveCurrentCursorPositionForNavigation();
}
-int BaseTextEditorWidget::position(ITextEditor::PositionOperation posOp, int at) const
+int BaseTextEditorWidget::position(BaseTextEditor::PositionOperation posOp, int at) const
{
QTextCursor tc = textCursor();
if (at != -1)
tc.setPosition(at);
- if (posOp == ITextEditor::Current)
+ if (posOp == BaseTextEditor::Current)
return tc.position();
switch (posOp) {
- case ITextEditor::EndOfLine:
+ case BaseTextEditor::EndOfLine:
tc.movePosition(QTextCursor::EndOfLine);
return tc.position();
- case ITextEditor::StartOfLine:
+ case BaseTextEditor::StartOfLine:
tc.movePosition(QTextCursor::StartOfLine);
return tc.position();
- case ITextEditor::Anchor:
+ case BaseTextEditor::Anchor:
if (tc.hasSelection())
return tc.anchor();
break;
- case ITextEditor::EndOfDoc:
+ case BaseTextEditor::EndOfDoc:
tc.movePosition(QTextCursor::End);
return tc.position();
default:
@@ -2130,31 +2509,31 @@ void BaseTextEditorWidget::inputMethodEvent(QInputMethodEvent *e)
QPlainTextEdit::inputMethodEvent(e);
}
-void BaseTextEditorWidget::documentAboutToBeReloaded()
+void BaseTextEditorWidgetPrivate::documentAboutToBeReloaded()
{
//memorize cursor position
- d->m_tempState = saveState();
+ m_tempState = q->saveState();
// remove extra selections (loads of QTextCursor objects)
- for (int i = 0; i < NExtraSelectionKinds; ++i)
- d->m_extraSelections[i].clear();
- QPlainTextEdit::setExtraSelections(QList<QTextEdit::ExtraSelection>());
+ for (int i = 0; i < BaseTextEditorWidget::NExtraSelectionKinds; ++i)
+ m_extraSelections[i].clear();
+ q->QPlainTextEdit::setExtraSelections(QList<QTextEdit::ExtraSelection>());
// clear all overlays
- d->m_overlay->clear();
- d->m_snippetOverlay->clear();
- d->m_searchResultOverlay->clear();
- d->m_refactorOverlay->clear();
+ m_overlay->clear();
+ m_snippetOverlay->clear();
+ m_searchResultOverlay->clear();
+ m_refactorOverlay->clear();
}
-void BaseTextEditorWidget::documentReloadFinished(bool success)
+void BaseTextEditorWidgetPrivate::documentReloadFinished(bool success)
{
if (!success)
return;
// restore cursor position
- restoreState(d->m_tempState);
+ q->restoreState(m_tempState);
updateCannotDecodeInfo();
}
@@ -2232,7 +2611,7 @@ bool BaseTextEditorWidget::restoreState(const QByteArray &state)
gotoLine(lval, cval);
verticalScrollBar()->setValue(vval);
horizontalScrollBar()->setValue(hval);
- saveCurrentCursorPositionForNavigation();
+ d->saveCurrentCursorPositionForNavigation();
return true;
}
@@ -2249,7 +2628,7 @@ bool BaseTextEditorWidget::isParenthesesMatchingEnabled() const
void BaseTextEditorWidget::setHighlightCurrentLine(bool b)
{
d->m_highlightCurrentLine = b;
- updateCurrentLineHighlight();
+ d->updateCurrentLineHighlight();
}
bool BaseTextEditorWidget::highlightCurrentLine() const
@@ -2260,7 +2639,7 @@ bool BaseTextEditorWidget::highlightCurrentLine() const
void BaseTextEditorWidget::setLineNumbersVisible(bool b)
{
d->m_lineNumbersVisible = b;
- slotUpdateExtraAreaWidth();
+ d->slotUpdateExtraAreaWidth();
}
bool BaseTextEditorWidget::lineNumbersVisible() const
@@ -2278,11 +2657,10 @@ bool BaseTextEditorWidget::alwaysOpenLinksInNextSplit() const
return d->m_displaySettings.m_openLinksInNextSplit;
}
-
void BaseTextEditorWidget::setMarksVisible(bool b)
{
d->m_marksVisible = b;
- slotUpdateExtraAreaWidth();
+ d->slotUpdateExtraAreaWidth();
}
bool BaseTextEditorWidget::marksVisible() const
@@ -2310,11 +2688,11 @@ bool BaseTextEditorWidget::lineSeparatorsAllowed() const
return d->m_lineSeparatorsAllowed;
}
-void BaseTextEditorWidget::updateCodeFoldingVisible()
+void BaseTextEditorWidgetPrivate::updateCodeFoldingVisible()
{
- const bool visible = d->m_codeFoldingSupported && d->m_displaySettings.m_displayFoldingMarkers;
- if (d->m_codeFoldingVisible != visible) {
- d->m_codeFoldingVisible = visible;
+ const bool visible = m_codeFoldingSupported && m_displaySettings.m_displayFoldingMarkers;
+ if (m_codeFoldingVisible != visible) {
+ m_codeFoldingVisible = visible;
slotUpdateExtraAreaWidth();
}
}
@@ -2333,7 +2711,7 @@ bool BaseTextEditorWidget::codeFoldingVisible() const
void BaseTextEditorWidget::setCodeFoldingSupported(bool b)
{
d->m_codeFoldingSupported = b;
- updateCodeFoldingVisible();
+ d->updateCodeFoldingVisible();
}
bool BaseTextEditorWidget::codeFoldingSupported() const
@@ -2394,7 +2772,7 @@ bool BaseTextEditorWidget::camelCaseNavigationEnabled() const
void BaseTextEditorWidget::setRevisionsVisible(bool b)
{
d->m_revisionsVisible = b;
- slotUpdateExtraAreaWidth();
+ d->slotUpdateExtraAreaWidth();
}
bool BaseTextEditorWidget::revisionsVisible() const
@@ -2413,70 +2791,18 @@ int BaseTextEditorWidget::visibleWrapColumn() const
return d->m_visibleWrapColumn;
}
-void BaseTextEditorWidget::setAutoCompleter(AutoCompleter *autoCompleter)
+void BaseTextEditor::setAutoCompleter(AutoCompleter *autoCompleter)
{
d->m_autoCompleter.reset(autoCompleter);
}
-AutoCompleter *BaseTextEditorWidget::autoCompleter() const
+AutoCompleter *BaseTextEditor::autoCompleter() const
{
return d->m_autoCompleter.data();
}
//--------- BaseTextEditorPrivate -----------
-BaseTextEditorWidgetPrivate::BaseTextEditorWidgetPrivate()
- :
- q(0),
- m_contentsChanged(false),
- m_lastCursorChangeWasInteresting(false),
- m_parenthesesMatchingEnabled(false),
- m_formatRange(false),
- m_parenthesesMatchingTimer(0),
- m_extraArea(0),
- m_codeStylePreferences(0),
- m_fontSettingsNeedsApply(true), // apply when making visible the first time, for the split case
- extraAreaSelectionAnchorBlockNumber(-1),
- extraAreaToggleMarkBlockNumber(-1),
- extraAreaHighlightFoldedBlockNumber(-1),
- m_overlay(0),
- m_snippetOverlay(0),
- m_searchResultOverlay(0),
- m_refactorOverlay(0),
- visibleFoldedBlockNumber(-1),
- suggestedVisibleFoldedBlockNumber(-1),
- m_mouseOnFoldedMarker(false),
- m_marksVisible(false),
- m_codeFoldingVisible(false),
- m_codeFoldingSupported(false),
- m_revisionsVisible(false),
- m_lineNumbersVisible(true),
- m_highlightCurrentLine(true),
- m_requestMarkEnabled(true),
- m_lineSeparatorsAllowed(false),
- m_maybeFakeTooltipEvent(false),
- m_visibleWrapColumn(0),
- m_linkPressed(false),
- m_delayedUpdateTimer(0),
- m_editor(0),
- m_inBlockSelectionMode(false),
- m_moveLineUndoHack(false),
- m_findScopeVerticalBlockSelectionFirstColumn(-1),
- m_findScopeVerticalBlockSelectionLastColumn(-1),
- m_highlightBlocksTimer(0),
- m_codeAssistant(new CodeAssistant),
- m_assistRelevantContentAdded(false),
- m_cursorBlockNumber(-1),
- m_blockCount(0),
- m_markDragging(false),
- m_autoCompleter(new AutoCompleter),
- m_clipboardAssistProvider(new Internal::ClipboardAssistProvider)
-{
-}
-
-BaseTextEditorWidgetPrivate::~BaseTextEditorWidgetPrivate()
-{
-}
void BaseTextEditorWidgetPrivate::setupDocumentSignals()
{
@@ -2486,16 +2812,32 @@ void BaseTextEditorWidgetPrivate::setupDocumentSignals()
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_CHECK(documentLayout);
- QObject::connect(documentLayout, SIGNAL(updateBlock(QTextBlock)), q, SLOT(slotUpdateBlockNotify(QTextBlock)));
- QObject::connect(documentLayout, SIGNAL(updateExtraArea()), q, SLOT(slotUpdateExtraArea()));
- QObject::connect(q, SIGNAL(requestBlockUpdate(QTextBlock)), documentLayout, SIGNAL(updateBlock(QTextBlock)));
- QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), q,
- SLOT(editorContentsChange(int,int,int)), Qt::DirectConnection);
- QObject::connect(m_document.data(), SIGNAL(aboutToReload()), q, SLOT(documentAboutToBeReloaded()));
- QObject::connect(m_document.data(), SIGNAL(reloadFinished(bool)), q, SLOT(documentReloadFinished(bool)));
- QObject::connect(m_document.data(), SIGNAL(tabSettingsChanged()), q, SLOT(updateTabStops()));
- QObject::connect(m_document.data(), SIGNAL(fontSettingsChanged()), q, SLOT(applyFontSettingsDelayed()));
- q->slotUpdateExtraAreaWidth();
+
+ QObject::connect(documentLayout, &QPlainTextDocumentLayout::updateBlock,
+ this, &BaseTextEditorWidgetPrivate::slotUpdateBlockNotify);
+
+ QObject::connect(documentLayout, &BaseTextDocumentLayout::updateExtraArea,
+ m_extraArea, static_cast<void (QWidget::*)()>(&QWidget::update));
+
+ QObject::connect(q, &BaseTextEditorWidget::requestBlockUpdate,
+ documentLayout, &QPlainTextDocumentLayout::updateBlock);
+
+ QObject::connect(doc, &QTextDocument::contentsChange,
+ this, &BaseTextEditorWidgetPrivate::editorContentsChange);
+
+ QObject::connect(m_document.data(), &BaseTextDocument::aboutToReload,
+ this, &BaseTextEditorWidgetPrivate::documentAboutToBeReloaded);
+
+ QObject::connect(m_document.data(), &BaseTextDocument::reloadFinished,
+ this, &BaseTextEditorWidgetPrivate::documentReloadFinished);
+
+ QObject::connect(m_document.data(), &BaseTextDocument::tabSettingsChanged,
+ this, &BaseTextEditorWidgetPrivate::updateTabStops);
+
+ QObject::connect(m_document.data(), &BaseTextDocument::fontSettingsChanged,
+ this, &BaseTextEditorWidgetPrivate::applyFontSettingsDelayed);
+
+ slotUpdateExtraAreaWidth();
}
@@ -2563,11 +2905,11 @@ QPoint BaseTextEditorWidget::toolTipPosition(const QTextCursor &c) const
return cursorPos + QPoint(d->m_extraArea->width(), HostOsInfo::isWindowsHost() ? -24 : -16);
}
-void BaseTextEditorWidget::processTooltipRequest(const QTextCursor &c)
+void BaseTextEditorWidgetPrivate::processTooltipRequest(const QTextCursor &c)
{
- const QPoint toolTipPoint = toolTipPosition(c);
+ const QPoint toolTipPoint = q->toolTipPosition(c);
bool handled = false;
- BaseTextEditor *ed = editor();
+ BaseTextEditor *ed = q->editor();
emit ed->tooltipOverrideRequested(ed, toolTipPoint, c.position(), &handled);
if (!handled)
emit ed->tooltipRequested(ed, toolTipPoint, c.position());
@@ -2603,7 +2945,7 @@ bool BaseTextEditorWidget::viewportEvent(QEvent *event)
// and not if the mouse is e.g. in the empty space behind a short line.
if (line.isValid()
&& pos.x() <= blockBoundingGeometry(block).left() + line.naturalTextRect().right()) {
- processTooltipRequest(tc);
+ d->processTooltipRequest(tc);
return true;
}
}
@@ -2620,49 +2962,49 @@ void BaseTextEditorWidget::resizeEvent(QResizeEvent *e)
QRect(cr.left(), cr.top(), extraAreaWidth(), cr.height())));
}
-QRect BaseTextEditorWidget::foldBox()
+QRect BaseTextEditorWidgetPrivate::foldBox()
{
- if (d->m_highlightBlocksInfo.isEmpty() || d->extraAreaHighlightFoldedBlockNumber < 0)
+ if (m_highlightBlocksInfo.isEmpty() || extraAreaHighlightFoldedBlockNumber < 0)
return QRect();
- QTextBlock begin = document()->findBlockByNumber(d->m_highlightBlocksInfo.open.last());
+ QTextBlock begin = q->document()->findBlockByNumber(m_highlightBlocksInfo.open.last());
- QTextBlock end = document()->findBlockByNumber(d->m_highlightBlocksInfo.close.first());
+ QTextBlock end = q->document()->findBlockByNumber(m_highlightBlocksInfo.close.first());
if (!begin.isValid() || !end.isValid())
return QRect();
- QRectF br = blockBoundingGeometry(begin).translated(contentOffset());
- QRectF er = blockBoundingGeometry(end).translated(contentOffset());
+ QRectF br = q->blockBoundingGeometry(begin).translated(q->contentOffset());
+ QRectF er = q->blockBoundingGeometry(end).translated(q->contentOffset());
- return QRect(d->m_extraArea->width() - foldBoxWidth(fontMetrics()),
+ return QRect(m_extraArea->width() - foldBoxWidth(q->fontMetrics()),
int(br.top()),
- foldBoxWidth(fontMetrics()),
+ foldBoxWidth(q->fontMetrics()),
er.bottom() - br.top());
}
-QTextBlock BaseTextEditorWidget::foldedBlockAt(const QPoint &pos, QRect *box) const
+QTextBlock BaseTextEditorWidgetPrivate::foldedBlockAt(const QPoint &pos, QRect *box) const
{
- QPointF offset(contentOffset());
- QTextBlock block = firstVisibleBlock();
- qreal top = blockBoundingGeometry(block).translated(offset).top();
- qreal bottom = top + blockBoundingRect(block).height();
+ QPointF offset = q->contentOffset();
+ QTextBlock block = q->firstVisibleBlock();
+ qreal top = q->blockBoundingGeometry(block).translated(offset).top();
+ qreal bottom = top + q->blockBoundingRect(block).height();
- int viewportHeight = viewport()->height();
+ int viewportHeight = q->viewport()->height();
while (block.isValid() && top <= viewportHeight) {
QTextBlock nextBlock = block.next();
- if (block.isVisible() && bottom >= 0 && replacementVisible(block.blockNumber())) {
+ if (block.isVisible() && bottom >= 0 && q->replacementVisible(block.blockNumber())) {
if (nextBlock.isValid() && !nextBlock.isVisible()) {
QTextLayout *layout = block.layout();
QTextLine line = layout->lineAt(layout->lineCount()-1);
QRectF lineRect = line.naturalTextRect().translated(offset.x(), top);
lineRect.adjust(0, 0, -1, -1);
- QString replacement = QLatin1String(" {") + foldReplacementText(block)
+ QString replacement = QLatin1String(" {") + q->foldReplacementText(block)
+ QLatin1String("}; ");
QRectF collapseRect(lineRect.right() + 12,
lineRect.top(),
- fontMetrics().width(replacement),
+ q->fontMetrics().width(replacement),
lineRect.height());
if (collapseRect.contains(pos)) {
QTextBlock result = block;
@@ -2681,7 +3023,7 @@ QTextBlock BaseTextEditorWidget::foldedBlockAt(const QPoint &pos, QRect *box) co
block = nextBlock;
top = bottom;
- bottom = top + blockBoundingRect(block).height();
+ bottom = top + q->blockBoundingRect(block).height();
}
return QTextBlock();
}
@@ -2712,7 +3054,7 @@ void BaseTextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block
|| (idx + l < text.length() && text.at(idx + l).isLetterOrNumber())))
continue;
- if (!q->inFindScope(blockPosition + idx, blockPosition + idx + l))
+ if (!inFindScope(blockPosition + idx, blockPosition + idx + l))
continue;
const QTextCharFormat &searchResultFormat
@@ -3050,7 +3392,7 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
QTextDocument *doc = document();
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
- const FontSettings &fs = baseTextDocument()->fontSettings();
+ const FontSettings &fs = textDocument()->fontSettings();
const QTextCharFormat &searchScopeFormat = fs.toTextCharFormat(C_SEARCH_SCOPE);
const QTextCharFormat &ifdefedOutFormat = fs.toTextCharFormat(C_DISABLED_CODE);
@@ -3745,7 +4087,7 @@ void BaseTextEditorWidget::drawCollapsedBlockPopup(QPainter &painter,
painter.translate(.5, .5);
QBrush brush = palette().base();
const QTextCharFormat &ifdefedOutFormat
- = baseTextDocument()->fontSettings().toTextCharFormat(C_DISABLED_CODE);
+ = textDocument()->fontSettings().toTextCharFormat(C_DISABLED_CODE);
if (ifdefedOutFormat.hasProperty(QTextFormat::BackgroundBrush))
brush = ifdefedOutFormat.background();
painter.setBrush(brush);
@@ -3792,7 +4134,7 @@ int BaseTextEditorWidget::extraAreaWidth(int *markWidthPtr) const
// this works under the assumption that bold or italic
// can only make a font wider
const QTextCharFormat &currentLineNumberFormat
- = baseTextDocument()->fontSettings().toTextCharFormat(C_CURRENT_LINE_NUMBER);
+ = textDocument()->fontSettings().toTextCharFormat(C_CURRENT_LINE_NUMBER);
fnt.setBold(currentLineNumberFormat.font().bold());
fnt.setItalic(currentLineNumberFormat.font().italic());
const QFontMetrics linefm(fnt);
@@ -3821,12 +4163,12 @@ int BaseTextEditorWidget::extraAreaWidth(int *markWidthPtr) const
return space;
}
-void BaseTextEditorWidget::slotUpdateExtraAreaWidth()
+void BaseTextEditorWidgetPrivate::slotUpdateExtraAreaWidth()
{
- if (isLeftToRight())
- setViewportMargins(extraAreaWidth(), 0, 0, 0);
+ if (q->isLeftToRight())
+ q->setViewportMargins(q->extraAreaWidth(), 0, 0, 0);
else
- setViewportMargins(0, 0, extraAreaWidth(), 0);
+ q->setViewportMargins(0, 0, q->extraAreaWidth(), 0);
}
static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool end,
@@ -3933,7 +4275,7 @@ void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e)
}
TextMarks::const_iterator end = marks.constEnd();
for ( ; it != end; ++it) {
- ITextMark *mark = *it;
+ TextMark *mark = *it;
if (!mark->isVisible())
continue;
const int height = fmLineSpacing - 1;
@@ -3988,7 +4330,7 @@ void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e)
int size = boxWidth/4;
QRect box(extraAreaWidth + size, top + size,
2 * (size) + 1, 2 * (size) + 1);
- drawFoldingMarker(&painter, pal, box, expanded, active, hovered);
+ d->drawFoldingMarker(&painter, pal, box, expanded, active, hovered);
}
}
@@ -4019,7 +4361,7 @@ void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e)
painter.save();
QFont f = painter.font();
const QTextCharFormat &currentLineNumberFormat
- = baseTextDocument()->fontSettings().toTextCharFormat(C_CURRENT_LINE_NUMBER);
+ = textDocument()->fontSettings().toTextCharFormat(C_CURRENT_LINE_NUMBER);
f.setBold(currentLineNumberFormat.font().bold());
f.setItalic(currentLineNumberFormat.font().italic());
painter.setFont(f);
@@ -4037,13 +4379,13 @@ void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e)
}
}
-void BaseTextEditorWidget::drawFoldingMarker(QPainter *painter, const QPalette &pal,
+void BaseTextEditorWidgetPrivate::drawFoldingMarker(QPainter *painter, const QPalette &pal,
const QRect &rect,
bool expanded,
bool active,
bool hovered) const
{
- QStyle *s = style();
+ QStyle *s = q->style();
if (ManhattanStyle *ms = qobject_cast<ManhattanStyle*>(s))
s = ms->baseStyle();
@@ -4092,63 +4434,61 @@ void BaseTextEditorWidget::drawFoldingMarker(QPainter *painter, const QPalette &
else if (!qstrcmp(s->metaObject()->className(), "QMacStyle"))
opt.rect.translate(-1, 0);
- s->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this);
+ s->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, q);
}
}
-void BaseTextEditorWidget::slotUpdateRequest(const QRect &r, int dy)
+void BaseTextEditorWidgetPrivate::slotUpdateRequest(const QRect &r, int dy)
{
if (dy) {
- d->m_extraArea->scroll(0, dy);
+ m_extraArea->scroll(0, dy);
} else if (r.width() > 4) { // wider than cursor width, not just cursor blinking
- d->m_extraArea->update(0, r.y(), d->m_extraArea->width(), r.height());
- if (!d->m_searchExpr.isEmpty()) {
- const int m = d->m_searchResultOverlay->dropShadowWidth();
- viewport()->update(r.adjusted(-m, -m, m, m));
+ m_extraArea->update(0, r.y(), m_extraArea->width(), r.height());
+ if (!m_searchExpr.isEmpty()) {
+ const int m = m_searchResultOverlay->dropShadowWidth();
+ q->viewport()->update(r.adjusted(-m, -m, m, m));
}
}
- if (r.contains(viewport()->rect()))
+ if (r.contains(q->viewport()->rect()))
slotUpdateExtraAreaWidth();
}
-void BaseTextEditorWidget::saveCurrentCursorPositionForNavigation()
+void BaseTextEditorWidgetPrivate::saveCurrentCursorPositionForNavigation()
{
- d->m_lastCursorChangeWasInteresting = true;
- d->m_tempNavigationState = saveState();
+ m_lastCursorChangeWasInteresting = true;
+ m_tempNavigationState = q->saveState();
}
-void BaseTextEditorWidget::updateCurrentLineHighlight()
+void BaseTextEditorWidgetPrivate::updateCurrentLineHighlight()
{
QList<QTextEdit::ExtraSelection> extraSelections;
- if (d->m_highlightCurrentLine) {
+ if (m_highlightCurrentLine) {
QTextEdit::ExtraSelection sel;
- sel.format.setBackground(baseTextDocument()->fontSettings()
+ sel.format.setBackground(q->textDocument()->fontSettings()
.toTextCharFormat(C_CURRENT_LINE).background());
sel.format.setProperty(QTextFormat::FullWidthSelection, true);
- sel.cursor = textCursor();
+ sel.cursor = q->textCursor();
sel.cursor.clearSelection();
extraSelections.append(sel);
}
- setExtraSelections(CurrentLineSelection, extraSelections);
-
+ q->setExtraSelections(BaseTextEditorWidget::CurrentLineSelection, extraSelections);
// the extra area shows information for the entire current block, not just the currentline.
// This is why we must force a bigger update region.
- int cursorBlockNumber = textCursor().blockNumber();
- if (cursorBlockNumber != d->m_cursorBlockNumber) {
- QPointF offset = contentOffset();
- QTextBlock block = document()->findBlockByNumber(d->m_cursorBlockNumber);
+ int cursorBlockNumber = q->textCursor().blockNumber();
+ if (cursorBlockNumber != m_cursorBlockNumber) {
+ QPointF offset = q->contentOffset();
+ QTextBlock block = q->document()->findBlockByNumber(m_cursorBlockNumber);
if (block.isValid())
- d->m_extraArea->update(blockBoundingGeometry(block).translated(offset).toAlignedRect());
- block = document()->findBlockByNumber(cursorBlockNumber);
+ m_extraArea->update(q->blockBoundingGeometry(block).translated(offset).toAlignedRect());
+ block = q->document()->findBlockByNumber(cursorBlockNumber);
if (block.isValid() && block.isVisible())
- d->m_extraArea->update(blockBoundingGeometry(block).translated(offset).toAlignedRect());
- d->m_cursorBlockNumber = cursorBlockNumber;
+ m_extraArea->update(q->blockBoundingGeometry(block).translated(offset).toAlignedRect());
+ m_cursorBlockNumber = cursorBlockNumber;
}
-
}
void BaseTextEditorWidget::slotCursorPositionChanged()
@@ -4162,51 +4502,51 @@ void BaseTextEditorWidget::slotCursorPositionChanged()
Core::EditorManager::addCurrentPositionToNavigationHistory(editor(), d->m_tempNavigationState);
d->m_lastCursorChangeWasInteresting = false;
} else if (d->m_contentsChanged) {
- saveCurrentCursorPositionForNavigation();
+ d->saveCurrentCursorPositionForNavigation();
}
- updateHighlights();
+ d->updateHighlights();
}
-void BaseTextEditorWidget::updateHighlights()
+void BaseTextEditorWidgetPrivate::updateHighlights()
{
- if (d->m_parenthesesMatchingEnabled && hasFocus()) {
+ if (m_parenthesesMatchingEnabled && q->hasFocus()) {
// Delay update when no matching is displayed yet, to avoid flicker
- if (extraSelections(ParenthesesMatchingSelection).isEmpty()
- && d->m_animator == 0) {
- d->m_parenthesesMatchingTimer.start(50);
+ if (q->extraSelections(BaseTextEditorWidget::ParenthesesMatchingSelection).isEmpty()
+ && m_animator == 0) {
+ m_parenthesesMatchingTimer.start(50);
} else {
// when we uncheck "highlight matching parentheses"
// we need clear current selection before viewport update
// otherwise we get sticky highlighted parentheses
- if (!d->m_displaySettings.m_highlightMatchingParentheses)
- setExtraSelections(ParenthesesMatchingSelection, QList<QTextEdit::ExtraSelection>());
+ if (!m_displaySettings.m_highlightMatchingParentheses)
+ q->setExtraSelections(BaseTextEditorWidget::ParenthesesMatchingSelection, QList<QTextEdit::ExtraSelection>());
// use 0-timer, not direct call, to give the syntax highlighter a chance
// to update the parentheses information
- d->m_parenthesesMatchingTimer.start(0);
+ m_parenthesesMatchingTimer.start(0);
}
}
updateCurrentLineHighlight();
- if (d->m_displaySettings.m_highlightBlocks) {
- QTextCursor cursor = textCursor();
- d->extraAreaHighlightFoldedBlockNumber = cursor.blockNumber();
- d->m_highlightBlocksTimer.start(100);
+ if (m_displaySettings.m_highlightBlocks) {
+ QTextCursor cursor = q->textCursor();
+ extraAreaHighlightFoldedBlockNumber = cursor.blockNumber();
+ m_highlightBlocksTimer.start(100);
}
}
-void BaseTextEditorWidget::slotUpdateBlockNotify(const QTextBlock &block)
+void BaseTextEditorWidgetPrivate::slotUpdateBlockNotify(const QTextBlock &block)
{
static bool blockRecursion = false;
if (blockRecursion)
return;
blockRecursion = true;
- if (d->m_overlay->isVisible()) {
+ if (m_overlay->isVisible()) {
/* an overlay might draw outside the block bounderies, force
complete viewport update */
- viewport()->update();
+ q->viewport()->update();
} else {
if (block.previous().isValid() && block.userState() != block.previous().userState()) {
/* The syntax highlighting state changes. This opens up for
@@ -4214,27 +4554,22 @@ void BaseTextEditorWidget::slotUpdateBlockNotify(const QTextBlock &block)
code folding. In this case, do the save thing and also
update the previous block, which might contain a fold
box which now is invalid.*/
- emit requestBlockUpdate(block.previous());
+ emit q->requestBlockUpdate(block.previous());
}
- if (!d->m_findScopeStart.isNull()) {
- if (block.position() < d->m_findScopeEnd.position()
- && block.position()+block.length() >= d->m_findScopeStart.position()) {
- QTextBlock b = block.document()->findBlock(d->m_findScopeStart.position());
+ if (!m_findScopeStart.isNull()) {
+ if (block.position() < m_findScopeEnd.position()
+ && block.position() + block.length() >= m_findScopeStart.position()) {
+ QTextBlock b = block.document()->findBlock(m_findScopeStart.position());
do {
- emit requestBlockUpdate(b);
+ emit q->requestBlockUpdate(b);
b = b.next();
- } while (b.isValid() && b.position() < d->m_findScopeEnd.position());
+ } while (b.isValid() && b.position() < m_findScopeEnd.position());
}
}
}
blockRecursion = false;
}
-void BaseTextEditorWidget::slotUpdateExtraArea()
-{
- d->m_extraArea->update();
-}
-
void BaseTextEditorWidget::timerEvent(QTimerEvent *e)
{
if (e->timerId() == d->autoScrollTimer.timerId()) {
@@ -4279,10 +4614,10 @@ void BaseTextEditorWidgetPrivate::clearVisibleFoldedBlock()
void BaseTextEditorWidget::mouseMoveEvent(QMouseEvent *e)
{
- updateLink(e);
+ d->updateLink(e);
if (e->buttons() == Qt::NoButton) {
- const QTextBlock collapsedBlock = foldedBlockAt(e->pos());
+ const QTextBlock collapsedBlock = d->foldedBlockAt(e->pos());
const int blockNumber = collapsedBlock.next().blockNumber();
if (blockNumber < 0) {
d->clearVisibleFoldedBlock();
@@ -4381,9 +4716,9 @@ void BaseTextEditorWidget::mousePressEvent(QMouseEvent *e)
if (d->m_inBlockSelectionMode)
d->disableBlockSelection(false); // just in case, otherwise we might get strange drag and drop
- QTextBlock foldedBlock = foldedBlockAt(e->pos());
+ QTextBlock foldedBlock = d->foldedBlockAt(e->pos());
if (foldedBlock.isValid()) {
- toggleBlockVisible(foldedBlock);
+ d->toggleBlockVisible(foldedBlock);
viewport()->setCursor(Qt::IBeamCursor);
}
@@ -4391,7 +4726,7 @@ void BaseTextEditorWidget::mousePressEvent(QMouseEvent *e)
if (refactorMarker.isValid()) {
emit refactorMarkerClicked(refactorMarker);
} else {
- updateLink(e);
+ d->updateLink(e);
if (d->m_currentLink.hasValidLinkText())
d->m_linkPressed = true;
@@ -4424,7 +4759,7 @@ void BaseTextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
bool inNextSplit = ((e->modifiers() & Qt::AltModifier) && !alwaysOpenLinksInNextSplit())
|| (alwaysOpenLinksInNextSplit() && !(e->modifiers() & Qt::AltModifier));
if (openLink(findLinkAt(cursorForPosition(e->pos())), inNextSplit)) {
- clearLink();
+ d->clearLink();
return;
}
}
@@ -4452,14 +4787,14 @@ void BaseTextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)
void BaseTextEditorWidget::leaveEvent(QEvent *e)
{
// Clear link emulation when the mouse leaves the editor
- clearLink();
+ d->clearLink();
QPlainTextEdit::leaveEvent(e);
}
void BaseTextEditorWidget::keyReleaseEvent(QKeyEvent *e)
{
if (e->key() == Qt::Key_Control) {
- clearLink();
+ d->clearLink();
} else if (e->key() == Qt::Key_Shift
&& d->m_behaviorSettings.m_constrainHoverTooltips
&& ToolTip::isVisible()) {
@@ -4467,7 +4802,7 @@ void BaseTextEditorWidget::keyReleaseEvent(QKeyEvent *e)
} else if (e->key() == Qt::Key_Alt
&& d->m_maybeFakeTooltipEvent) {
d->m_maybeFakeTooltipEvent = false;
- processTooltipRequest(textCursor());
+ d->processTooltipRequest(textCursor());
}
QPlainTextEdit::keyReleaseEvent(e);
@@ -4581,14 +4916,14 @@ void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
int boxWidth = foldBoxWidth(fontMetrics());
if (d->m_codeFoldingVisible && e->pos().x() > extraArea()->width() - boxWidth) {
if (!cursor.block().next().isVisible()) {
- toggleBlockVisible(cursor.block());
+ d->toggleBlockVisible(cursor.block());
d->moveCursorVisible(false);
- } else if (foldBox().contains(e->pos())) {
+ } else if (d->foldBox().contains(e->pos())) {
cursor.setPosition(
document()->findBlockByNumber(d->m_highlightBlocksInfo.open.last()).position()
);
QTextBlock c = cursor.block();
- toggleBlockVisible(c);
+ d->toggleBlockVisible(c);
d->moveCursorVisible(false);
}
} else if (d->m_lineNumbersVisible && !inMarkArea) {
@@ -4605,7 +4940,7 @@ void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData())) {
TextMarks marks = data->marks();
for (int i = marks.size(); --i >= 0; ) {
- ITextMark *mark = marks.at(i);
+ TextMark *mark = marks.at(i);
if (mark->isDraggable()) {
d->m_markDragStart = e->pos();
break;
@@ -4653,7 +4988,7 @@ void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData())) {
TextMarks marks = data->marks();
for (int i = marks.size(); --i >= 0; ) {
- ITextMark *mark = marks.at(i);
+ TextMark *mark = marks.at(i);
if (sameLine) {
if (mark->isClickable()) {
mark->clicked();
@@ -4673,11 +5008,11 @@ void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
}
}
int line = n + 1;
- ITextEditor::MarkRequestKind kind;
+ BaseTextEditor::MarkRequestKind kind;
if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
- kind = ITextEditor::BookmarkRequest;
+ kind = BaseTextEditor::BookmarkRequest;
else
- kind = ITextEditor::BreakpointRequest;
+ kind = BaseTextEditor::BreakpointRequest;
emit editor()->markRequested(editor(), line, kind);
}
@@ -4711,9 +5046,9 @@ void BaseTextEditorWidget::ensureCursorVisible()
QPlainTextEdit::ensureCursorVisible();
}
-void BaseTextEditorWidget::toggleBlockVisible(const QTextBlock &block)
+void BaseTextEditorWidgetPrivate::toggleBlockVisible(const QTextBlock &block)
{
- BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(document()->documentLayout());
+ auto documentLayout = qobject_cast<BaseTextDocumentLayout*>(q->document()->documentLayout());
QTC_ASSERT(documentLayout, return);
BaseTextDocumentLayout::doFoldOrUnfold(block, BaseTextDocumentLayout::isFolded(block));
@@ -4721,7 +5056,6 @@ void BaseTextEditorWidget::toggleBlockVisible(const QTextBlock &block)
documentLayout->emitDocumentSizeChanged();
}
-
void BaseTextEditorWidget::setLanguageSettingsId(Core::Id settingsId)
{
d->m_tabSettingsId = settingsId;
@@ -4734,7 +5068,7 @@ Core::Id BaseTextEditorWidget::languageSettingsId() const
void BaseTextEditorWidget::setCodeStyle(ICodeStylePreferences *preferences)
{
- baseTextDocument()->indenter()->setCodeStylePreferences(preferences);
+ textDocument()->indenter()->setCodeStylePreferences(preferences);
if (d->m_codeStylePreferences) {
disconnect(d->m_codeStylePreferences, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)),
d->m_document.data(), SLOT(setTabSettings(TextEditor::TabSettings)));
@@ -4767,9 +5101,9 @@ const MarginSettings &BaseTextEditorWidget::marginSettings() const
return d->m_marginSettings;
}
-void BaseTextEditorWidget::handleHomeKey(bool anchor)
+void BaseTextEditorWidgetPrivate::handleHomeKey(bool anchor)
{
- QTextCursor cursor = textCursor();
+ QTextCursor cursor = q->textCursor();
QTextCursor::MoveMode mode = QTextCursor::MoveAnchor;
if (anchor)
@@ -4777,14 +5111,14 @@ void BaseTextEditorWidget::handleHomeKey(bool anchor)
const int initpos = cursor.position();
int pos = cursor.block().position();
- QChar character = document()->characterAt(pos);
+ QChar character = q->document()->characterAt(pos);
const QLatin1Char tab = QLatin1Char('\t');
while (character == tab || character.category() == QChar::Separator_Space) {
++pos;
if (pos == initpos)
break;
- character = document()->characterAt(pos);
+ character = q->document()->characterAt(pos);
}
// Go to the start of the block when we're already at the start of the text
@@ -4792,12 +5126,12 @@ void BaseTextEditorWidget::handleHomeKey(bool anchor)
pos = cursor.block().position();
cursor.setPosition(pos, mode);
- setTextCursor(cursor);
+ q->setTextCursor(cursor);
}
-void BaseTextEditorWidget::handleBackspaceKey()
+void BaseTextEditorWidgetPrivate::handleBackspaceKey()
{
- QTextCursor cursor = textCursor();
+ QTextCursor cursor = q->textCursor();
QTC_ASSERT(!cursor.hasSelection(), return);
const int pos = cursor.position();
@@ -4805,16 +5139,16 @@ void BaseTextEditorWidget::handleBackspaceKey()
return;
bool cursorWithinSnippet = false;
- if (d->m_snippetOverlay->isVisible()) {
+ if (m_snippetOverlay->isVisible()) {
QTextCursor snippetCursor = cursor;
snippetCursor.movePosition(QTextCursor::Left);
- cursorWithinSnippet = d->snippetCheckCursor(snippetCursor);
+ cursorWithinSnippet = snippetCheckCursor(snippetCursor);
}
- const TextEditor::TabSettings &tabSettings = d->m_document->tabSettings();
- const TextEditor::TypingSettings &typingSettings = d->m_document->typingSettings();
+ const TextEditor::TabSettings &tabSettings = m_document->tabSettings();
+ const TextEditor::TypingSettings &typingSettings = m_document->typingSettings();
- if (typingSettings.m_autoIndent && d->m_autoCompleter->autoBackspace(cursor))
+ if (typingSettings.m_autoIndent && dd()->m_autoCompleter->autoBackspace(cursor))
return;
bool handled = false;
@@ -4834,8 +5168,8 @@ void BaseTextEditorWidget::handleBackspaceKey()
handled = true;
} else {
if (cursorWithinSnippet) {
- d->m_snippetOverlay->mangle();
- d->m_snippetOverlay->clear();
+ m_snippetOverlay->mangle();
+ m_snippetOverlay->clear();
cursorWithinSnippet = false;
}
int previousIndent = 0;
@@ -4860,18 +5194,18 @@ void BaseTextEditorWidget::handleBackspaceKey()
}
}
} else if (typingSettings.m_smartBackspaceBehavior == TypingSettings::BackspaceUnindents) {
- const QChar &c = document()->characterAt(pos - 1);
+ const QChar c = q->document()->characterAt(pos - 1);
if (!(c == QLatin1Char(' ') || c == QLatin1Char('\t'))) {
if (cursorWithinSnippet)
cursor.beginEditBlock();
cursor.deletePreviousChar();
} else {
if (cursorWithinSnippet) {
- d->m_snippetOverlay->mangle();
- d->m_snippetOverlay->clear();
+ m_snippetOverlay->mangle();
+ m_snippetOverlay->clear();
cursorWithinSnippet = false;
}
- unindent();
+ q->unindent();
}
handled = true;
}
@@ -4884,10 +5218,10 @@ void BaseTextEditorWidget::handleBackspaceKey()
if (cursorWithinSnippet) {
cursor.endEditBlock();
- d->m_snippetOverlay->updateEquivalentSelections(cursor);
+ m_snippetOverlay->updateEquivalentSelections(cursor);
}
- setTextCursor(cursor);
+ q->setTextCursor(cursor);
}
void BaseTextEditorWidget::wheelEvent(QWheelEvent *e)
@@ -4932,7 +5266,7 @@ bool BaseTextEditorWidget::openLink(const Link &link, bool inNextSplit)
if (inNextSplit) {
Core::EditorManager::gotoOtherSplit();
- } else if (baseTextDocument()->filePath() == link.targetFileName) {
+ } else if (textDocument()->filePath() == link.targetFileName) {
Core::EditorManager::addCurrentPositionToNavigationHistory();
gotoLine(link.targetLine, link.targetColumn);
setFocus();
@@ -4942,23 +5276,23 @@ bool BaseTextEditorWidget::openLink(const Link &link, bool inNextSplit)
return Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn);
}
-void BaseTextEditorWidget::updateLink(QMouseEvent *e)
+void BaseTextEditorWidgetPrivate::updateLink(QMouseEvent *e)
{
bool linkFound = false;
- if (mouseNavigationEnabled() && e->modifiers() & Qt::ControlModifier) {
+ if (q->mouseNavigationEnabled() && e->modifiers() & Qt::ControlModifier) {
// Link emulation behaviour for 'go to definition'
- const QTextCursor cursor = cursorForPosition(e->pos());
+ const QTextCursor cursor = q->cursorForPosition(e->pos());
// Check that the mouse was actually on the text somewhere
- bool onText = cursorRect(cursor).right() >= e->x();
+ bool onText = q->cursorRect(cursor).right() >= e->x();
if (!onText) {
QTextCursor nextPos = cursor;
nextPos.movePosition(QTextCursor::Right);
- onText = cursorRect(nextPos).right() >= e->x();
+ onText = q->cursorRect(nextPos).right() >= e->x();
}
- const Link link = findLinkAt(cursor, false);
+ const BaseTextEditorWidget::Link link = q->findLinkAt(cursor, false);
if (onText && link.hasValidLinkText()) {
showLink(link);
@@ -4970,46 +5304,46 @@ void BaseTextEditorWidget::updateLink(QMouseEvent *e)
clearLink();
}
-void BaseTextEditorWidget::showLink(const Link &link)
+void BaseTextEditorWidgetPrivate::showLink(const BaseTextEditorWidget::Link &link)
{
- if (d->m_currentLink == link)
+ if (m_currentLink == link)
return;
QTextEdit::ExtraSelection sel;
- sel.cursor = textCursor();
+ sel.cursor = q->textCursor();
sel.cursor.setPosition(link.linkTextStart);
sel.cursor.setPosition(link.linkTextEnd, QTextCursor::KeepAnchor);
- sel.format = baseTextDocument()->fontSettings().toTextCharFormat(C_LINK);
+ sel.format = q->textDocument()->fontSettings().toTextCharFormat(C_LINK);
sel.format.setFontUnderline(true);
- setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
- viewport()->setCursor(Qt::PointingHandCursor);
- d->m_currentLink = link;
- d->m_linkPressed = false;
+ q->setExtraSelections(BaseTextEditorWidget::OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
+ q->viewport()->setCursor(Qt::PointingHandCursor);
+ m_currentLink = link;
+ m_linkPressed = false;
}
-void BaseTextEditorWidget::clearLink()
+void BaseTextEditorWidgetPrivate::clearLink()
{
- if (!d->m_currentLink.hasValidLinkText())
+ if (!m_currentLink.hasValidLinkText())
return;
- setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>());
- viewport()->setCursor(Qt::IBeamCursor);
- d->m_currentLink = Link();
- d->m_linkPressed = false;
+ q->setExtraSelections(BaseTextEditorWidget::OtherSelection, QList<QTextEdit::ExtraSelection>());
+ q->viewport()->setCursor(Qt::IBeamCursor);
+ m_currentLink = BaseTextEditorWidget::Link();
+ m_linkPressed = false;
}
-void BaseTextEditorWidget::highlightSearchResults(const QString &txt, Core::FindFlags findFlags)
+void BaseTextEditorWidgetPrivate::highlightSearchResultsSlot(const QString &txt, Core::FindFlags findFlags)
{
- if (d->m_searchExpr.pattern() == txt)
+ if (m_searchExpr.pattern() == txt)
return;
- d->m_searchExpr.setPattern(txt);
- d->m_searchExpr.setPatternSyntax((findFlags & FindRegularExpression) ?
+ m_searchExpr.setPattern(txt);
+ m_searchExpr.setPatternSyntax((findFlags & FindRegularExpression) ?
QRegExp::RegExp : QRegExp::FixedString);
- d->m_searchExpr.setCaseSensitivity((findFlags & FindCaseSensitively) ?
+ m_searchExpr.setCaseSensitivity((findFlags & FindCaseSensitively) ?
Qt::CaseSensitive : Qt::CaseInsensitive);
- d->m_findFlags = findFlags;
+ m_findFlags = findFlags;
- d->m_delayedUpdateTimer.start(50);
+ m_delayedUpdateTimer.start(50);
}
int BaseTextEditorWidget::verticalBlockSelectionFirstColumn() const
@@ -5041,29 +5375,29 @@ QRegion BaseTextEditorWidget::translatedLineRegion(int lineStart, int lineEnd) c
return region;
}
-void BaseTextEditorWidget::setFindScope(const QTextCursor &start, const QTextCursor &end,
+void BaseTextEditorWidgetPrivate::setFindScope(const QTextCursor &start, const QTextCursor &end,
int verticalBlockSelectionFirstColumn,
int verticalBlockSelectionLastColumn)
{
- if (start != d->m_findScopeStart
- || end != d->m_findScopeEnd
- || verticalBlockSelectionFirstColumn != d->m_findScopeVerticalBlockSelectionFirstColumn
- || verticalBlockSelectionLastColumn != d->m_findScopeVerticalBlockSelectionLastColumn) {
- d->m_findScopeStart = start;
- d->m_findScopeEnd = end;
- d->m_findScopeVerticalBlockSelectionFirstColumn = verticalBlockSelectionFirstColumn;
- d->m_findScopeVerticalBlockSelectionLastColumn = verticalBlockSelectionLastColumn;
- viewport()->update();
+ if (start != m_findScopeStart
+ || end != m_findScopeEnd
+ || verticalBlockSelectionFirstColumn != m_findScopeVerticalBlockSelectionFirstColumn
+ || verticalBlockSelectionLastColumn != m_findScopeVerticalBlockSelectionLastColumn) {
+ m_findScopeStart = start;
+ m_findScopeEnd = end;
+ m_findScopeVerticalBlockSelectionFirstColumn = verticalBlockSelectionFirstColumn;
+ m_findScopeVerticalBlockSelectionLastColumn = verticalBlockSelectionLastColumn;
+ q->viewport()->update();
}
}
-void BaseTextEditorWidget::_q_animateUpdate(int position, QPointF lastPos, QRectF rect)
+void BaseTextEditorWidgetPrivate::_q_animateUpdate(int position, QPointF lastPos, QRectF rect)
{
- QTextCursor cursor(textCursor());
+ QTextCursor cursor = q->textCursor();
cursor.setPosition(position);
- viewport()->update(QRectF(cursorRect(cursor).topLeft() + rect.topLeft(), rect.size()).toAlignedRect());
+ q->viewport()->update(QRectF(q->cursorRect(cursor).topLeft() + rect.topLeft(), rect.size()).toAlignedRect());
if (!lastPos.isNull())
- viewport()->update(QRectF(lastPos + rect.topLeft(), rect.size()).toAlignedRect());
+ q->viewport()->update(QRectF(lastPos + rect.topLeft(), rect.size()).toAlignedRect());
}
@@ -5132,16 +5466,16 @@ void BaseTextEditorAnimator::finish()
deleteLater();
}
-void BaseTextEditorWidget::_q_matchParentheses()
+void BaseTextEditorWidgetPrivate::_q_matchParentheses()
{
- if (isReadOnly()
- || !(d->m_displaySettings.m_highlightMatchingParentheses
- || d->m_displaySettings.m_animateMatchingParentheses))
+ if (q->isReadOnly()
+ || !(m_displaySettings.m_highlightMatchingParentheses
+ || m_displaySettings.m_animateMatchingParentheses))
return;
- QTextCursor backwardMatch = textCursor();
- QTextCursor forwardMatch = textCursor();
- if (overwriteMode())
+ QTextCursor backwardMatch = q->textCursor();
+ QTextCursor forwardMatch = q->textCursor();
+ if (q->overwriteMode())
backwardMatch.movePosition(QTextCursor::Right);
const TextBlockUserData::MatchType backwardMatchType = TextBlockUserData::matchCursorBackward(&backwardMatch);
const TextBlockUserData::MatchType forwardMatchType = TextBlockUserData::matchCursorForward(&forwardMatch);
@@ -5149,18 +5483,18 @@ void BaseTextEditorWidget::_q_matchParentheses()
QList<QTextEdit::ExtraSelection> extraSelections;
if (backwardMatchType == TextBlockUserData::NoMatch && forwardMatchType == TextBlockUserData::NoMatch) {
- setExtraSelections(ParenthesesMatchingSelection, extraSelections); // clear
+ q->setExtraSelections(BaseTextEditorWidget::ParenthesesMatchingSelection, extraSelections); // clear
return;
}
const QTextCharFormat &matchFormat
- = baseTextDocument()->fontSettings().toTextCharFormat(C_PARENTHESES);
+ = q->textDocument()->fontSettings().toTextCharFormat(C_PARENTHESES);
int animatePosition = -1;
if (backwardMatch.hasSelection()) {
QTextEdit::ExtraSelection sel;
if (backwardMatchType == TextBlockUserData::Mismatch) {
sel.cursor = backwardMatch;
- sel.format = d->m_mismatchFormat;
+ sel.format = m_mismatchFormat;
extraSelections.append(sel);
} else {
@@ -5171,7 +5505,7 @@ void BaseTextEditorWidget::_q_matchParentheses()
sel.cursor.setPosition(sel.cursor.position() + 1, QTextCursor::KeepAnchor);
extraSelections.append(sel);
- if (d->m_displaySettings.m_animateMatchingParentheses && sel.cursor.block().isVisible())
+ if (m_displaySettings.m_animateMatchingParentheses && sel.cursor.block().isVisible())
animatePosition = backwardMatch.selectionStart();
sel.cursor.setPosition(backwardMatch.selectionEnd());
@@ -5184,7 +5518,7 @@ void BaseTextEditorWidget::_q_matchParentheses()
QTextEdit::ExtraSelection sel;
if (forwardMatchType == TextBlockUserData::Mismatch) {
sel.cursor = forwardMatch;
- sel.format = d->m_mismatchFormat;
+ sel.format = m_mismatchFormat;
extraSelections.append(sel);
} else {
@@ -5199,14 +5533,14 @@ void BaseTextEditorWidget::_q_matchParentheses()
sel.cursor.setPosition(sel.cursor.position() - 1, QTextCursor::KeepAnchor);
extraSelections.append(sel);
- if (d->m_displaySettings.m_animateMatchingParentheses && sel.cursor.block().isVisible())
+ if (m_displaySettings.m_animateMatchingParentheses && sel.cursor.block().isVisible())
animatePosition = forwardMatch.selectionEnd() - 1;
}
}
if (animatePosition >= 0) {
- foreach (const QTextEdit::ExtraSelection &sel, BaseTextEditorWidget::extraSelections(ParenthesesMatchingSelection)) {
+ foreach (const QTextEdit::ExtraSelection &sel, q->extraSelections(BaseTextEditorWidget::ParenthesesMatchingSelection)) {
if (sel.cursor.selectionStart() == animatePosition
|| sel.cursor.selectionEnd() - 1 == animatePosition) {
animatePosition = -1;
@@ -5216,28 +5550,28 @@ void BaseTextEditorWidget::_q_matchParentheses()
}
if (animatePosition >= 0) {
- if (d->m_animator)
- d->m_animator->finish(); // one animation is enough
- d->m_animator = new BaseTextEditorAnimator(this);
- d->m_animator->setPosition(animatePosition);
+ if (m_animator)
+ m_animator->finish(); // one animation is enough
+ m_animator = new BaseTextEditorAnimator(this);
+ m_animator->setPosition(animatePosition);
QPalette pal;
pal.setBrush(QPalette::Text, matchFormat.foreground());
pal.setBrush(QPalette::Base, matchFormat.background());
- d->m_animator->setData(font(), pal, document()->characterAt(d->m_animator->position()));
- connect(d->m_animator, SIGNAL(updateRequest(int,QPointF,QRectF)),
- this, SLOT(_q_animateUpdate(int,QPointF,QRectF)));
+ m_animator->setData(q->font(), pal, q->document()->characterAt(m_animator->position()));
+ connect(m_animator.data(), &BaseTextEditorAnimator::updateRequest,
+ this, &BaseTextEditorWidgetPrivate::_q_animateUpdate);
}
- if (d->m_displaySettings.m_highlightMatchingParentheses)
- setExtraSelections(ParenthesesMatchingSelection, extraSelections);
+ if (m_displaySettings.m_highlightMatchingParentheses)
+ q->setExtraSelections(BaseTextEditorWidget::ParenthesesMatchingSelection, extraSelections);
}
-void BaseTextEditorWidget::_q_highlightBlocks()
+void BaseTextEditorWidgetPrivate::_q_highlightBlocks()
{
BaseTextEditorPrivateHighlightBlocks highlightBlocksInfo;
QTextBlock block;
- if (d->extraAreaHighlightFoldedBlockNumber >= 0) {
- block = document()->findBlockByNumber(d->extraAreaHighlightFoldedBlockNumber);
+ if (extraAreaHighlightFoldedBlockNumber >= 0) {
+ block = q->document()->findBlockByNumber(extraAreaHighlightFoldedBlockNumber);
if (block.isValid()
&& block.next().isValid()
&& BaseTextDocumentLayout::foldingIndent(block.next())
@@ -5259,36 +5593,36 @@ void BaseTextEditorWidget::_q_highlightBlocks()
&& BaseTextDocumentLayout::foldingIndent(closeBlock.next()) >= foldingIndent )
closeBlock = closeBlock.next();
highlightBlocksInfo.close.append(closeBlock.blockNumber());
- int visualIndent = qMin(d->visualIndent(block), d->visualIndent(closeBlock));
- highlightBlocksInfo.visualIndent.prepend(visualIndent);
+ int indent = qMin(visualIndent(block), visualIndent(closeBlock));
+ highlightBlocksInfo.visualIndent.prepend(indent);
}
#if 0
if (block.isValid()) {
QTextCursor cursor(block);
- if (d->extraAreaHighlightCollapseColumn >= 0)
- cursor.setPosition(cursor.position() + qMin(d->extraAreaHighlightCollapseColumn,
+ if (extraAreaHighlightCollapseColumn >= 0)
+ cursor.setPosition(cursor.position() + qMin(extraAreaHighlightCollapseColumn,
block.length()-1));
QTextCursor closeCursor;
bool firstRun = true;
while (TextBlockUserData::findPreviousBlockOpenParenthesis(&cursor, firstRun)) {
firstRun = false;
highlightBlocksInfo.open.prepend(cursor.blockNumber());
- int visualIndent = d->visualIndent(cursor.block());
+ int visualIndent = visualIndent(cursor.block());
if (closeCursor.isNull())
closeCursor = cursor;
if (TextBlockUserData::findNextBlockClosingParenthesis(&closeCursor)) {
highlightBlocksInfo.close.append(closeCursor.blockNumber());
- visualIndent = qMin(visualIndent, d->visualIndent(closeCursor.block()));
+ visualIndent = qMin(visualIndent, visualIndent(closeCursor.block()));
}
highlightBlocksInfo.visualIndent.prepend(visualIndent);
}
}
#endif
- if (d->m_highlightBlocksInfo != highlightBlocksInfo) {
- d->m_highlightBlocksInfo = highlightBlocksInfo;
- viewport()->update();
- d->m_extraArea->update();
+ if (m_highlightBlocksInfo != highlightBlocksInfo) {
+ m_highlightBlocksInfo = highlightBlocksInfo;
+ q->viewport()->update();
+ m_extraArea->update();
}
}
@@ -5301,7 +5635,7 @@ void BaseTextEditorWidget::changeEvent(QEvent *e)
QFont f = d->m_extraArea->font();
f.setPointSizeF(font().pointSizeF());
d->m_extraArea->setFont(f);
- slotUpdateExtraAreaWidth();
+ d->slotUpdateExtraAreaWidth();
d->m_extraArea->update();
}
}
@@ -5310,7 +5644,7 @@ void BaseTextEditorWidget::changeEvent(QEvent *e)
void BaseTextEditorWidget::focusInEvent(QFocusEvent *e)
{
QPlainTextEdit::focusInEvent(e);
- updateHighlights();
+ d->updateHighlights();
}
void BaseTextEditorWidget::focusOutEvent(QFocusEvent *e)
@@ -5321,9 +5655,9 @@ void BaseTextEditorWidget::focusOutEvent(QFocusEvent *e)
}
-void BaseTextEditorWidget::maybeSelectLine()
+void BaseTextEditorWidgetPrivate::maybeSelectLine()
{
- QTextCursor cursor = textCursor();
+ QTextCursor cursor = q->textCursor();
if (!cursor.hasSelection()) {
const QTextBlock &block = cursor.block();
if (block.next().isValid()) {
@@ -5334,14 +5668,14 @@ void BaseTextEditorWidget::maybeSelectLine()
cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
}
- setTextCursor(cursor);
+ q->setTextCursor(cursor);
}
}
// shift+del
void BaseTextEditorWidget::cutLine()
{
- maybeSelectLine();
+ d->maybeSelectLine();
cut();
}
@@ -5349,7 +5683,7 @@ void BaseTextEditorWidget::cutLine()
void BaseTextEditorWidget::copyLine()
{
QTextCursor prevCursor = textCursor();
- maybeSelectLine();
+ d->maybeSelectLine();
copy();
if (!prevCursor.hasSelection())
prevCursor.movePosition(QTextCursor::StartOfBlock);
@@ -5358,7 +5692,7 @@ void BaseTextEditorWidget::copyLine()
void BaseTextEditorWidget::deleteLine()
{
- maybeSelectLine();
+ d->maybeSelectLine();
textCursor().removeSelectedText();
}
@@ -5372,7 +5706,7 @@ void BaseTextEditorWidget::deleteEndOfWord()
void BaseTextEditorWidget::deleteEndOfWordCamelCase()
{
QTextCursor c = textCursor();
- camelCaseRight(c, QTextCursor::KeepAnchor);
+ d->camelCaseRight(c, QTextCursor::KeepAnchor);
c.removeSelectedText();
setTextCursor(c);
}
@@ -5387,7 +5721,7 @@ void BaseTextEditorWidget::deleteStartOfWord()
void BaseTextEditorWidget::deleteStartOfWordCamelCase()
{
QTextCursor c = textCursor();
- camelCaseLeft(c, QTextCursor::KeepAnchor);
+ d->camelCaseLeft(c, QTextCursor::KeepAnchor);
c.removeSelectedText();
setTextCursor(c);
}
@@ -5636,6 +5970,7 @@ void BaseTextEditorWidget::rewrapParagraph()
void BaseTextEditorWidget::unCommentSelection()
{
+ Utils::unCommentSelection(this, editor()->commentDefinition());
}
void BaseTextEditorWidget::showEvent(QShowEvent* e)
@@ -5645,24 +5980,24 @@ void BaseTextEditorWidget::showEvent(QShowEvent* e)
}
-void BaseTextEditorWidget::applyFontSettingsDelayed()
+void BaseTextEditorWidgetPrivate::applyFontSettingsDelayed()
{
- d->m_fontSettingsNeedsApply = true;
- if (isVisible())
- triggerPendingUpdates();
+ m_fontSettingsNeedsApply = true;
+ if (q->isVisible())
+ q->triggerPendingUpdates();
}
void BaseTextEditorWidget::triggerPendingUpdates()
{
if (d->m_fontSettingsNeedsApply)
applyFontSettings();
- baseTextDocument()->triggerPendingUpdates();
+ textDocument()->triggerPendingUpdates();
}
void BaseTextEditorWidget::applyFontSettings()
{
d->m_fontSettingsNeedsApply = false;
- const FontSettings &fs = baseTextDocument()->fontSettings();
+ const FontSettings &fs = textDocument()->fontSettings();
const QTextCharFormat textFormat = fs.toTextCharFormat(C_TEXT);
const QTextCharFormat selectionFormat = fs.toTextCharFormat(C_SELECTION);
const QTextCharFormat lineNumberFormat = fs.toTextCharFormat(C_LINE_NUMBER);
@@ -5684,7 +6019,7 @@ void BaseTextEditorWidget::applyFontSettings()
p.setBrush(QPalette::Inactive, QPalette::HighlightedText, p.highlightedText());
setPalette(p);
setFont(font);
- updateTabStops(); // update tab stops, they depend on the font
+ d->updateTabStops(); // update tab stops, they depend on the font
// Line numbers
QPalette ep;
@@ -5693,8 +6028,8 @@ void BaseTextEditorWidget::applyFontSettings()
lineNumberFormat.background().color() : background);
d->m_extraArea->setPalette(ep);
- slotUpdateExtraAreaWidth(); // Adjust to new font width
- updateHighlights();
+ d->slotUpdateExtraAreaWidth(); // Adjust to new font width
+ d->updateHighlights();
}
void BaseTextEditorWidget::setDisplaySettings(const DisplaySettings &ds)
@@ -5704,10 +6039,10 @@ void BaseTextEditorWidget::setDisplaySettings(const DisplaySettings &ds)
setHighlightCurrentLine(ds.m_highlightCurrentLine);
setRevisionsVisible(ds.m_markTextChanges);
setCenterOnScroll(ds.m_centerCursorOnScroll);
- editor()->setFileEncodingLabelVisible(ds.m_displayFileEncoding);
+ d->m_fileEncodingLabelAction->setVisible(ds.m_displayFileEncoding);
if (d->m_displaySettings.m_visualizeWhitespace != ds.m_visualizeWhitespace) {
- if (SyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter())
+ if (SyntaxHighlighter *highlighter = textDocument()->syntaxHighlighter())
highlighter->rehighlight();
QTextOption option = document()->defaultTextOption();
if (ds.m_visualizeWhitespace)
@@ -5724,8 +6059,8 @@ void BaseTextEditorWidget::setDisplaySettings(const DisplaySettings &ds)
d->m_highlightBlocksInfo = BaseTextEditorPrivateHighlightBlocks();
}
- updateCodeFoldingVisible();
- updateHighlights();
+ d->updateCodeFoldingVisible();
+ d->updateHighlights();
viewport()->update();
extraArea()->update();
}
@@ -5756,8 +6091,8 @@ void BaseTextEditorWidget::setStorageSettings(const StorageSettings &storageSett
void BaseTextEditorWidget::setCompletionSettings(const TextEditor::CompletionSettings &completionSettings)
{
- d->m_autoCompleter->setAutoParenthesesEnabled(completionSettings.m_autoInsertBrackets);
- d->m_autoCompleter->setSurroundWithEnabled(completionSettings.m_autoInsertBrackets
+ dd()->m_autoCompleter->setAutoParenthesesEnabled(completionSettings.m_autoInsertBrackets);
+ dd()->m_autoCompleter->setSurroundWithEnabled(completionSettings.m_autoInsertBrackets
&& completionSettings.m_surroundingAutoBrackets);
}
@@ -5846,7 +6181,7 @@ void BaseTextEditorWidget::cut()
return;
}
QPlainTextEdit::cut();
- collectToCircularClipboard();
+ d->collectToCircularClipboard();
}
void BaseTextEditorWidget::selectAll()
@@ -5863,7 +6198,7 @@ void BaseTextEditorWidget::copy()
}
QPlainTextEdit::copy();
- collectToCircularClipboard();
+ d->collectToCircularClipboard();
}
void BaseTextEditorWidget::paste()
@@ -5871,7 +6206,7 @@ void BaseTextEditorWidget::paste()
QPlainTextEdit::paste();
}
-void BaseTextEditorWidget::collectToCircularClipboard()
+void BaseTextEditorWidgetPrivate::collectToCircularClipboard()
{
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
if (!mimeData)
@@ -5901,7 +6236,7 @@ void BaseTextEditorWidget::circularPaste()
void BaseTextEditorWidget::switchUtf8bom()
{
- baseTextDocument()->switchUtf8Bom();
+ textDocument()->switchUtf8Bom();
}
QMimeData *BaseTextEditorWidget::createMimeDataFromSelection() const
@@ -6132,6 +6467,15 @@ QColor BaseTextEditorWidget::replacementPenColor(int blockNumber) const
return QColor();
}
+BaseTextEditor *BaseTextEditorWidget::createEditor()
+{
+ auto editor = new BaseTextEditor(this);
+ editor->setContext(Core::Context(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
+ TextEditor::Constants::C_TEXTEDITOR));
+ editor->setDuplicateSupported(true);
+ return editor;
+}
+
void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
{
menu->addSeparator();
@@ -6149,7 +6493,7 @@ void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
if (a && a->isEnabled())
menu->addAction(a);
- BaseTextDocument *doc = baseTextDocument();
+ BaseTextDocument *doc = textDocument();
if (doc->codec()->name() == QByteArray("UTF-8") && doc->supportsUtf8Bom()) {
a = Core::ActionManager::command(Constants::SWITCH_UTF8BOM)->action();
if (a && a->isEnabled()) {
@@ -6162,188 +6506,184 @@ void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
}
-BaseTextEditor::BaseTextEditor(BaseTextEditorWidget *editor)
- : m_editorWidget(editor)
+BaseTextEditor::BaseTextEditor(BaseTextEditorWidget *widget)
+ : d(new BaseTextEditorPrivate)
{
- setWidget(m_editorWidget);
- Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
- BaseTextFind *baseTextFind = new BaseTextFind(editor);
- connect(baseTextFind, SIGNAL(highlightAll(QString,Core::FindFlags)),
- editor, SLOT(highlightSearchResults(QString,Core::FindFlags)));
- connect(baseTextFind, SIGNAL(findScopeChanged(QTextCursor,QTextCursor,int,int)),
- editor, SLOT(setFindScope(QTextCursor,QTextCursor,int,int)));
- aggregate->add(baseTextFind);
- aggregate->add(editor);
+ setWidget(widget);
+ d->m_editorWidget = widget;
- m_cursorPositionLabel = new Utils::LineColumnLabel;
- const int spacing = editor->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2;
- m_cursorPositionLabel->setContentsMargins(spacing, 0, spacing, 0);
-
- m_fileEncodingLabel = new Utils::LineColumnLabel;
- m_fileEncodingLabel->setContentsMargins(spacing, 0, spacing, 0);
-
- m_stretchWidget = new QWidget;
- m_stretchWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ d->m_completionAssistProvider = [] () -> CompletionAssistProvider * { return 0; };
+}
- m_toolBar = new QToolBar;
- m_toolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
- m_toolBar->addWidget(m_stretchWidget);
- m_cursorPositionLabelAction = m_toolBar->addWidget(m_cursorPositionLabel);
- m_fileEncodingLabelAction = m_toolBar->addWidget(m_fileEncodingLabel);
+BaseTextEditor::~BaseTextEditor()
+{
+ delete d->m_editorWidget;
+ delete d;
+}
- setFileEncodingLabelVisible(editor->displaySettings().m_displayFileEncoding);
- connect(editor, SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition()));
- connect(m_cursorPositionLabel, SIGNAL(clicked()), this, SLOT(openGotoLocator()));
+BaseTextDocument *BaseTextEditor::textDocument()
+{
+ return d->m_editorWidget->textDocument();
}
-BaseTextEditor::~BaseTextEditor()
+IDocument *BaseTextEditor::document()
{
- delete m_toolBar;
- delete m_editorWidget;
+ return d->m_editorWidget->textDocument();
}
QWidget *BaseTextEditor::toolBar()
{
- return m_toolBar;
+ return d->m_editorWidget->d->m_toolBar;
}
-void BaseTextEditor::insertExtraToolBarWidget(BaseTextEditor::Side side,
+void BaseTextEditorWidget::insertExtraToolBarWidget(BaseTextEditorWidget::Side side,
QWidget *widget)
{
if (widget->sizePolicy().horizontalPolicy() & QSizePolicy::ExpandFlag) {
- if (m_stretchWidget)
- m_stretchWidget->deleteLater();
- m_stretchWidget = 0;
+ if (d->m_stretchWidget)
+ d->m_stretchWidget->deleteLater();
+ d->m_stretchWidget = 0;
}
if (side == Right)
- m_toolBar->insertWidget(m_cursorPositionLabelAction, widget);
+ d->m_toolBar->insertWidget(d->m_cursorPositionLabelAction, widget);
else
- m_toolBar->insertWidget(m_toolBar->actions().first(), widget);
+ d->m_toolBar->insertWidget(d->m_toolBar->actions().first(), widget);
}
int BaseTextEditor::currentLine() const
{
- return m_editorWidget->textCursor().blockNumber() + 1;
+ return d->m_editorWidget->textCursor().blockNumber() + 1;
}
int BaseTextEditor::currentColumn() const
{
- QTextCursor cursor = m_editorWidget->textCursor();
+ QTextCursor cursor = d->m_editorWidget->textCursor();
return cursor.position() - cursor.block().position() + 1;
}
+void BaseTextEditor::gotoLine(int line, int column, bool centerLine)
+{
+ d->m_editorWidget->gotoLine(line, column, centerLine);
+}
+
int BaseTextEditor::columnCount() const
{
- return m_editorWidget->columnCount();
+ return d->m_editorWidget->columnCount();
}
int BaseTextEditor::rowCount() const
{
- return m_editorWidget->rowCount();
+ return d->m_editorWidget->rowCount();
+}
+
+int BaseTextEditor::position(BaseTextEditor::PositionOperation posOp, int at) const
+{
+ return d->m_editorWidget->position(posOp, at);
+}
+
+void BaseTextEditor::convertPosition(int pos, int *line, int *column) const
+{
+ d->m_editorWidget->convertPosition(pos, line, column);
}
QRect BaseTextEditor::cursorRect(int pos) const
{
- QTextCursor tc = m_editorWidget->textCursor();
+ QTextCursor tc = d->m_editorWidget->textCursor();
if (pos >= 0)
tc.setPosition(pos);
- QRect result = m_editorWidget->cursorRect(tc);
- result.moveTo(m_editorWidget->viewport()->mapToGlobal(result.topLeft()));
+ QRect result = d->m_editorWidget->cursorRect(tc);
+ result.moveTo(d->m_editorWidget->viewport()->mapToGlobal(result.topLeft()));
return result;
}
QString BaseTextEditor::selectedText() const
{
- return m_editorWidget->selectedText();
+ return d->m_editorWidget->selectedText();
}
void BaseTextEditor::remove(int length)
{
- QTextCursor tc = m_editorWidget->textCursor();
+ QTextCursor tc = d->m_editorWidget->textCursor();
tc.setPosition(tc.position() + length, QTextCursor::KeepAnchor);
tc.removeSelectedText();
}
void BaseTextEditor::insert(const QString &string)
{
- m_editorWidget->insertPlainText(string);
+ d->m_editorWidget->insertPlainText(string);
}
void BaseTextEditor::replace(int length, const QString &string)
{
- QTextCursor tc = m_editorWidget->textCursor();
+ QTextCursor tc = d->m_editorWidget->textCursor();
tc.setPosition(tc.position() + length, QTextCursor::KeepAnchor);
tc.insertText(string);
}
void BaseTextEditor::setCursorPosition(int pos)
{
- m_editorWidget->setBlockSelection(false);
- QTextCursor tc = m_editorWidget->textCursor();
+ d->m_editorWidget->setBlockSelection(false);
+ QTextCursor tc = d->m_editorWidget->textCursor();
tc.setPosition(pos);
- m_editorWidget->setTextCursor(tc);
+ d->m_editorWidget->setTextCursor(tc);
}
void BaseTextEditor::select(int toPos)
{
- m_editorWidget->setBlockSelection(false);
- QTextCursor tc = m_editorWidget->textCursor();
+ d->m_editorWidget->setBlockSelection(false);
+ QTextCursor tc = d->m_editorWidget->textCursor();
tc.setPosition(toPos, QTextCursor::KeepAnchor);
- m_editorWidget->setTextCursor(tc);
+ d->m_editorWidget->setTextCursor(tc);
}
-const CommentDefinition *BaseTextEditor::commentDefinition() const
+CommentDefinition &BaseTextEditor::commentDefinition() const
{
- return 0;
+ return d->m_commentDefinition;
}
-CompletionAssistProvider *BaseTextEditor::completionAssistProvider()
+void BaseTextEditor::setCommentStyle(CommentDefinition::Style style)
{
- return 0;
+ d->m_commentDefinition.setStyle(style);
}
-void BaseTextEditor::updateCursorPosition()
+CompletionAssistProvider *BaseTextEditor::completionAssistProvider()
{
- const QTextCursor cursor = m_editorWidget->textCursor();
- const QTextBlock block = cursor.block();
- const int line = block.blockNumber() + 1;
- const int column = cursor.position() - block.position();
- m_cursorPositionLabel->setText(tr("Line: %1, Col: %2").arg(line)
- .arg(baseTextDocument()->tabSettings().columnAt(block.text(),
- column)+1),
- tr("Line: 9999, Col: 999"));
- m_contextHelpId.clear();
-
- if (!block.isVisible())
- m_editorWidget->ensureCursorVisible();
-
+ return d->m_completionAssistProvider();
}
-void BaseTextEditor::openGotoLocator()
+void BaseTextEditor::setCompletionAssistProvider(CompletionAssistProvider *provider)
{
- Core::EditorManager::activateEditor(this, Core::EditorManager::IgnoreNavigationHistory);
- if (Core::Command *cmd = Core::ActionManager::command(Core::Constants::GOTO)) {
- if (QAction *act = cmd->action())
- act->trigger();
- }
+ d->m_completionAssistProvider = [provider] () -> CompletionAssistProvider * { return provider; };
}
-void BaseTextEditor::setFileEncodingLabelVisible(bool visible)
+void BaseTextEditor::setCompletionAssistProvider(const std::function<CompletionAssistProvider *()> &provider)
{
- m_fileEncodingLabelAction->setVisible(visible);
+ d->m_completionAssistProvider = provider;
}
-void BaseTextEditor::setFileEncodingLabelText(const QString &text)
+void BaseTextEditorWidgetPrivate::updateCursorPosition()
{
- m_fileEncodingLabel->setText(text, text);
+ const QTextCursor cursor = q->textCursor();
+ const QTextBlock block = cursor.block();
+ const int line = block.blockNumber() + 1;
+ const int column = cursor.position() - block.position();
+ m_cursorPositionLabel->show();
+ m_cursorPositionLabel->setText(tr("Line: %1, Col: %2").arg(line)
+ .arg(q->textDocument()->tabSettings().columnAt(block.text(),
+ column)+1),
+ tr("Line: 9999, Col: 999"));
+ q->editor()->m_contextHelpId.clear();
+
+ if (!block.isVisible())
+ q->ensureCursorVisible();
}
QString BaseTextEditor::contextHelpId() const
{
if (m_contextHelpId.isEmpty())
emit const_cast<BaseTextEditor*>(this)->contextHelpIdRequested(const_cast<BaseTextEditor*>(this),
- m_editorWidget->textCursor().position());
+ d->m_editorWidget->textCursor().position());
return m_contextHelpId;
}
@@ -6361,7 +6701,8 @@ void BaseTextEditorWidget::setRefactorMarkers(const RefactorMarkers &markers)
requestBlockUpdate(marker.cursor.block());
}
-void BaseTextEditorWidget::doFoo() {
+void BaseTextEditorWidget::doFoo()
+{
#ifdef DO_FOO
qDebug() << Q_FUNC_INFO;
RefactorMarkers markers = d->m_refactorOverlay->markers();
@@ -6373,6 +6714,11 @@ void BaseTextEditorWidget::doFoo() {
#endif
}
+BaseTextEditorPrivate *BaseTextEditorWidget::dd() const
+{
+ return editor()->d;
+}
+
BaseTextBlockSelection::BaseTextBlockSelection(const BaseTextBlockSelection &other)
{
positionBlock = other.positionBlock;
@@ -6443,30 +6789,30 @@ void BaseTextBlockSelection::fromPostition(int positionBlock, int positionColumn
this->anchorColumn = anchorColumn;
}
-bool BaseTextEditorWidget::inFindScope(const QTextCursor &cursor)
+bool BaseTextEditorWidgetPrivate::inFindScope(const QTextCursor &cursor)
{
if (cursor.isNull())
return false;
return inFindScope(cursor.selectionStart(), cursor.selectionEnd());
}
-bool BaseTextEditorWidget::inFindScope(int selectionStart, int selectionEnd)
+bool BaseTextEditorWidgetPrivate::inFindScope(int selectionStart, int selectionEnd)
{
- if (d->m_findScopeStart.isNull())
+ if (m_findScopeStart.isNull())
return true; // no scope, everything is included
- if (selectionStart < d->m_findScopeStart.position())
+ if (selectionStart < m_findScopeStart.position())
return false;
- if (selectionEnd > d->m_findScopeEnd.position())
+ if (selectionEnd > m_findScopeEnd.position())
return false;
- if (d->m_findScopeVerticalBlockSelectionFirstColumn < 0)
+ if (m_findScopeVerticalBlockSelectionFirstColumn < 0)
return true;
- QTextBlock block = document()->findBlock(selectionStart);
- if (block != document()->findBlock(selectionEnd))
+ QTextBlock block = q->document()->findBlock(selectionStart);
+ if (block != q->document()->findBlock(selectionEnd))
return false;
QString text = block.text();
- const TabSettings &ts = d->m_document->tabSettings();
- int startPosition = ts.positionAtColumn(text, d->m_findScopeVerticalBlockSelectionFirstColumn);
- int endPosition = ts.positionAtColumn(text, d->m_findScopeVerticalBlockSelectionLastColumn);
+ const TabSettings &ts = m_document->tabSettings();
+ int startPosition = ts.positionAtColumn(text, m_findScopeVerticalBlockSelectionFirstColumn);
+ int endPosition = ts.positionAtColumn(text, m_findScopeVerticalBlockSelectionLastColumn);
if (selectionStart - block.position() < startPosition)
return false;
if (selectionEnd - block.position() > endPosition)
@@ -6506,14 +6852,14 @@ bool BaseTextEditorWidget::hasBlockSelection() const
return d->m_inBlockSelectionMode;
}
-void BaseTextEditorWidget::updateTabStops()
+void BaseTextEditorWidgetPrivate::updateTabStops()
{
// Although the tab stop is stored as qreal the API from QPlainTextEdit only allows it
// to be set as an int. A work around is to access directly the QTextOption.
- qreal charWidth = QFontMetricsF(font()).width(QLatin1Char(' '));
- QTextOption option = document()->defaultTextOption();
- option.setTabStop(charWidth * d->m_document->tabSettings().m_tabSize);
- document()->setDefaultTextOption(option);
+ qreal charWidth = QFontMetricsF(q->font()).width(QLatin1Char(' '));
+ QTextOption option = q->document()->defaultTextOption();
+ option.setTabStop(charWidth * m_document->tabSettings().m_tabSize);
+ q->document()->setDefaultTextOption(option);
}
int BaseTextEditorWidget::columnCount() const
@@ -6537,14 +6883,14 @@ int BaseTextEditorWidget::rowCount() const
@see uppercaseSelection, lowercaseSelection
*/
-void BaseTextEditorWidget::transformSelection(TransformationMethod method)
+void BaseTextEditorWidgetPrivate::transformSelection(TransformationMethod method)
{
- if (hasBlockSelection()) {
+ if (q->hasBlockSelection()) {
transformBlockSelection(method);
return;
}
- QTextCursor cursor = textCursor();
+ QTextCursor cursor = q->textCursor();
int pos = cursor.position();
int anchor = cursor.anchor();
@@ -6554,7 +6900,7 @@ void BaseTextEditorWidget::transformSelection(TransformationMethod method)
}
QString text = cursor.selectedText();
- QString transformedText = (text.*method)();
+ QString transformedText = method(text);
if (transformedText == text) {
// if the transformation does not do anything to the selection, do no create an undo step
@@ -6567,39 +6913,39 @@ void BaseTextEditorWidget::transformSelection(TransformationMethod method)
// Note: this assumes the transformation did not change the length,
cursor.setPosition(anchor);
cursor.setPosition(pos, QTextCursor::KeepAnchor);
- setTextCursor(cursor);
+ q->setTextCursor(cursor);
}
-void BaseTextEditorWidget::transformBlockSelection(TransformationMethod method)
+void BaseTextEditorWidgetPrivate::transformBlockSelection(TransformationMethod method)
{
- QTextCursor cursor = textCursor();
- const TabSettings &ts = d->m_document->tabSettings();
+ QTextCursor cursor = q->textCursor();
+ const TabSettings &ts = m_document->tabSettings();
// saved to restore the blockselection
- const int positionColumn = d->m_blockSelection.positionColumn;
- const int positionBlock = d->m_blockSelection.positionBlock;
- const int anchorColumn = d->m_blockSelection.anchorColumn;
- const int anchorBlock = d->m_blockSelection.anchorBlock;
+ const int positionColumn = m_blockSelection.positionColumn;
+ const int positionBlock = m_blockSelection.positionBlock;
+ const int anchorColumn = m_blockSelection.anchorColumn;
+ const int anchorBlock = m_blockSelection.anchorBlock;
- QTextBlock block = d->m_document->document()->findBlockByNumber(
- d->m_blockSelection.firstBlockNumber());
- const QTextBlock &lastBlock = d->m_document->document()->findBlockByNumber(
- d->m_blockSelection.lastBlockNumber());
+ QTextBlock block = m_document->document()->findBlockByNumber(
+ m_blockSelection.firstBlockNumber());
+ const QTextBlock &lastBlock = m_document->document()->findBlockByNumber(
+ m_blockSelection.lastBlockNumber());
cursor.beginEditBlock();
for (;;) {
// get position of the selection
const QString &blockText = block.text();
const int startPos = block.position()
- + ts.positionAtColumn(blockText, d->m_blockSelection.firstVisualColumn());
+ + ts.positionAtColumn(blockText, m_blockSelection.firstVisualColumn());
const int endPos = block.position()
- + ts.positionAtColumn(blockText, d->m_blockSelection.lastVisualColumn());
+ + ts.positionAtColumn(blockText, m_blockSelection.lastVisualColumn());
// check if the selection is inside the text block
if (startPos < endPos) {
cursor.setPosition(startPos);
cursor.setPosition(endPos, QTextCursor::KeepAnchor);
- const QString &transformedText = (d->m_document->textAt(startPos, endPos - startPos).*method)();
+ const QString &transformedText = method(m_document->textAt(startPos, endPos - startPos));
if (transformedText != cursor.selectedText())
cursor.insertText(transformedText);
}
@@ -6610,7 +6956,7 @@ void BaseTextEditorWidget::transformBlockSelection(TransformationMethod method)
cursor.endEditBlock();
// restore former block selection
- d->enableBlockSelection(positionBlock, anchorColumn, anchorBlock, positionColumn);
+ enableBlockSelection(positionBlock, anchorColumn, anchorBlock, positionColumn);
}
void BaseTextEditorWidget::inSnippetMode(bool *active)
@@ -6634,14 +6980,131 @@ IAssistInterface *BaseTextEditorWidget::createAssistInterface(AssistKind kind,
return new DefaultAssistInterface(document(), position(), d->m_document->filePath(), reason);
}
-QString TextEditor::BaseTextEditorWidget::foldReplacementText(const QTextBlock &) const
+QString BaseTextEditorWidget::foldReplacementText(const QTextBlock &) const
{
return QLatin1String("...");
}
bool BaseTextEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
- return m_editorWidget->open(errorString, fileName, realFileName);
+ return d->m_editorWidget->open(errorString, fileName, realFileName);
+}
+
+QByteArray BaseTextEditor::saveState() const
+{
+ return d->m_editorWidget->saveState();
+}
+
+bool BaseTextEditor::restoreState(const QByteArray &state)
+{
+ return d->m_editorWidget->restoreState(state);
+}
+
+BaseTextEditor *BaseTextEditor::currentTextEditor()
+{
+ return qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor());
+}
+
+BaseTextEditorWidget *BaseTextEditor::editorWidget() const
+{
+ return d->m_editorWidget;
+}
+
+void BaseTextEditorWidget::configureMimeType(const QString &mimeType)
+{
+ configureMimeType(MimeDatabase::findByType(mimeType));
+}
+
+void BaseTextEditorWidget::configureMimeType(const MimeType &mimeType)
+{
+ Highlighter *highlighter = new Highlighter();
+ highlighter->setTabSettings(textDocument()->tabSettings());
+ textDocument()->setSyntaxHighlighter(highlighter);
+
+ setCodeFoldingSupported(false);
+
+ if (!mimeType.isNull()) {
+ d->m_isMissingSyntaxDefinition = true;
+
+ setMimeTypeForHighlighter(highlighter, mimeType);
+ const QString &type = mimeType.type();
+ textDocument()->setMimeType(type);
+
+ QString definitionId = Manager::instance()->definitionIdByMimeType(type);
+ if (definitionId.isEmpty())
+ definitionId = findDefinitionId(mimeType, true);
+
+ if (!definitionId.isEmpty()) {
+ d->m_isMissingSyntaxDefinition = false;
+ const QSharedPointer<HighlightDefinition> &definition =
+ Manager::instance()->definition(definitionId);
+ if (!definition.isNull() && definition->isValid()) {
+ CommentDefinition &cd = editor()->commentDefinition();
+ cd.isAfterWhiteSpaces = definition->isCommentAfterWhiteSpaces();
+ cd.singleLine = definition->singleLineComment();
+ cd.multiLineStart = definition->multiLineCommentStart();
+ cd.multiLineEnd = definition->multiLineCommentEnd();
+
+ setCodeFoldingSupported(true);
+ }
+ } else {
+ const QString &fileName = textDocument()->filePath();
+ if (TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName))
+ d->m_isMissingSyntaxDefinition = false;
+ }
+ }
+
+ textDocument()->setFontSettings(TextEditorSettings::fontSettings());
+
+ emit configured(editor());
+}
+
+bool BaseTextEditorWidget::isMissingSyntaxDefinition() const
+{
+ return d->m_isMissingSyntaxDefinition;
+}
+
+void BaseTextEditorWidget::acceptMissingSyntaxDefinitionInfo()
+{
+ ICore::showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
+ Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS,
+ this);
+}
+
+void BaseTextEditorWidget::configureMimeType()
+{
+ MimeType mimeType;
+ if (textDocument())
+ mimeType = MimeDatabase::findByFile(textDocument()->filePath());
+ configureMimeType(mimeType);
+}
+
+// The remnants of PlainTextEditor.
+void BaseTextEditorWidget::setupAsPlainEditor()
+{
+ setRevisionsVisible(true);
+ setMarksVisible(true);
+ setLineSeparatorsAllowed(true);
+
+ textDocument()->setMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
+
+ connect(textDocument(), SIGNAL(filePathChanged(QString,QString)),
+ this, SLOT(configureMimeType()));
+ connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configureMimeType()));
+}
+
+IEditor *BaseTextEditor::duplicate()
+{
+ auto newWidget = new BaseTextEditorWidget(editorWidget());
+ newWidget->setupAsPlainEditor();
+ TextEditorSettings::initializeEditor(newWidget);
+ auto editor = newWidget->editor();
+ editor->setContext(Core::Context(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
+ TextEditor::Constants::C_TEXTEDITOR));
+ editor->setDuplicateSupported(true);
+ return editor;
}
} // namespace TextEditor
+
+#include "basetexteditor.moc"
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 0fe282b03b..10108e2b8e 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -31,26 +31,33 @@
#define BASETEXTEDITOR_H
#include "basetextdocument.h"
-#include "itexteditor.h"
#include "codeassist/assistenums.h"
+#include "texteditor_global.h"
+#include <coreplugin/textdocument.h>
#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/find/ifindsupport.h>
+#include <utils/uncommentselection.h>
+
#include <QPlainTextEdit>
-#include <QSharedPointer>
+#include <functional>
QT_BEGIN_NAMESPACE
class QToolBar;
-class QTimeLine;
class QPrinter;
+class QMenu;
+class QPainter;
+class QPoint;
+class QRect;
+class QTextBlock;
QT_END_NAMESPACE
-namespace Utils {
- class LineColumnLabel;
-}
+namespace Core { class MimeType; }
namespace TextEditor {
+
class TabSettings;
class RefactorOverlay;
struct RefactorMarker;
@@ -62,14 +69,12 @@ class CompletionAssistProvider;
typedef QList<RefactorMarker> RefactorMarkers;
namespace Internal {
+ class BaseTextEditorPrivate;
class BaseTextEditorWidgetPrivate;
class TextEditorOverlay;
- typedef QString (QString::*TransformationMethod)() const;
}
-class ITextMarkable;
-
-class BaseTextEditor;
+class BaseTextEditorWidget;
class FontSettings;
class BehaviorSettings;
class CompletionSettings;
@@ -81,44 +86,122 @@ class Indenter;
class AutoCompleter;
class ExtraEncodingSettings;
-class TEXTEDITOR_EXPORT BaseTextEditorAnimator : public QObject
+class TEXTEDITOR_EXPORT BlockRange
+{
+public:
+ BlockRange() : _first(0), _last(-1) {}
+ BlockRange(int firstPosition, int lastPosition)
+ : _first(firstPosition), _last(lastPosition)
+ {}
+
+ inline bool isNull() const { return _last < _first; }
+
+ int first() const { return _first; }
+ int last() const { return _last; }
+
+private:
+ int _first;
+ int _last;
+};
+
+class TEXTEDITOR_EXPORT BaseTextEditor : public Core::IEditor
{
Q_OBJECT
public:
- BaseTextEditorAnimator(QObject *parent);
+ enum PositionOperation {
+ Current = 1,
+ EndOfLine = 2,
+ StartOfLine = 3,
+ Anchor = 4,
+ EndOfDoc = 5
+ };
+
+ BaseTextEditor(BaseTextEditorWidget *editorWidget);
+ ~BaseTextEditor();
- inline void setPosition(int position) { m_position = position; }
- inline int position() const { return m_position; }
+ enum MarkRequestKind {
+ BreakpointRequest,
+ BookmarkRequest,
+ TaskMarkRequest
+ };
- void setData(const QFont &f, const QPalette &pal, const QString &text);
+ static BaseTextEditor *currentTextEditor();
- void draw(QPainter *p, const QPointF &pos);
- QRectF rect() const;
+ BaseTextEditorWidget *editorWidget() const;
+ BaseTextDocument *textDocument();
- inline qreal value() const { return m_value; }
- inline QPointF lastDrawPos() const { return m_lastDrawPos; }
+ // IEditor
+ Core::IDocument *document();
+ bool open(QString *errorString, const QString &fileName, const QString &realFileName);
- void finish();
+ IEditor *duplicate();
- bool isRunning() const;
+ QByteArray saveState() const;
+ bool restoreState(const QByteArray &state);
+ QWidget *toolBar();
-signals:
- void updateRequest(int position, QPointF lastPos, QRectF rect);
+ QString contextHelpId() const; // from IContext
+
+ int currentLine() const;
+ int currentColumn() const;
+ void gotoLine(int line, int column = 0, bool centerLine = true);
+
+ /*! Returns the amount of visible columns (in characters) in the editor */
+ int columnCount() const;
+
+ /*! Returns the amount of visible lines (in characters) in the editor */
+ int rowCount() const;
+ /*! Returns the position at \a posOp in characters from the beginning of the document */
+ virtual int position(PositionOperation posOp = Current, int at = -1) const;
-private slots:
- void step(qreal v);
+ /*! Converts the \a pos in characters from beginning of document to \a line and \a column */
+ virtual void convertPosition(int pos, int *line, int *column) const;
+
+ /*! Returns the cursor rectangle in pixels at \a pos, or current position if \a pos = -1 */
+ virtual QRect cursorRect(int pos = -1) const;
+
+ virtual QString selectedText() const;
+
+ /*! Removes \a length characters to the right of the cursor. */
+ virtual void remove(int length);
+ /*! Inserts the given string to the right of the cursor. */
+ virtual void insert(const QString &string);
+ /*! Replaces \a length characters to the right of the cursor with the given string. */
+ virtual void replace(int length, const QString &string);
+ /*! Sets current cursor position to \a pos. */
+ virtual void setCursorPosition(int pos);
+ /*! Selects text between current cursor position and \a toPos. */
+ virtual void select(int toPos);
+
+ /*! Full access to comment definition, */
+ Utils::CommentDefinition &commentDefinition() const;
+ /*! Convenience style setter. */
+ void setCommentStyle(Utils::CommentDefinition::Style style);
+
+ CompletionAssistProvider *completionAssistProvider();
+ void setCompletionAssistProvider(CompletionAssistProvider *provider); // Not owned.
+
+ // FIXME: Only used to delay initialization from CppEditor.
+ // There should be something simpler.
+ void setCompletionAssistProvider(const std::function<CompletionAssistProvider *()> &provider);
+
+ void setAutoCompleter(AutoCompleter *autoCompleter);
+ AutoCompleter *autoCompleter() const;
+
+signals:
+ void markRequested(TextEditor::BaseTextEditor *editor, int line, TextEditor::BaseTextEditor::MarkRequestKind kind);
+ void markContextMenuRequested(TextEditor::BaseTextEditor *editor, int line, QMenu *menu);
+ void tooltipOverrideRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int position, bool *handled);
+ void tooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int position);
+ void markTooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int line);
+ void contextHelpIdRequested(TextEditor::BaseTextEditor *editor, int position);
private:
- QTimeLine *m_timeline;
- qreal m_value;
- int m_position;
- QPointF m_lastDrawPos;
- QFont m_font;
- QPalette m_palette;
- QString m_text;
- QSizeF m_size;
+ friend class Internal::BaseTextEditorWidgetPrivate;
+ friend class BaseTextEditorWidget;
+ Internal::BaseTextEditorPrivate *d;
};
@@ -129,19 +212,18 @@ class TEXTEDITOR_EXPORT BaseTextEditorWidget : public QPlainTextEdit
Q_PROPERTY(int verticalBlockSelectionLastColumn READ verticalBlockSelectionLastColumn)
public:
- BaseTextEditorWidget(QWidget *parent = 0);
- BaseTextEditorWidget(BaseTextDocument *doc, QWidget *parent = 0);
+ BaseTextEditorWidget(BaseTextDocument *doc, QWidget *parent);
BaseTextEditorWidget(BaseTextEditorWidget *other);
~BaseTextEditorWidget();
- BaseTextDocument *baseTextDocument() const;
+ BaseTextDocument *textDocument() const;
// IEditor
virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName);
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
void gotoLine(int line, int column = 0, bool centerLine = true);
- int position(ITextEditor::PositionOperation posOp = ITextEditor::Current,
+ int position(BaseTextEditor::PositionOperation posOp = BaseTextEditor::Current,
int at = -1) const;
void convertPosition(int pos, int *line, int *column) const;
@@ -174,7 +256,6 @@ public:
void setLineSeparatorsAllowed(bool b);
bool lineSeparatorsAllowed() const;
- void updateCodeFoldingVisible();
bool codeFoldingVisible() const;
void setCodeFoldingSupported(bool b);
@@ -223,9 +304,6 @@ public:
QRegion translatedLineRegion(int lineStart, int lineEnd) const;
- void setAutoCompleter(AutoCompleter *autoCompleter);
- AutoCompleter *autoCompleter() const;
-
QPoint toolTipPosition(const QTextCursor &c) const;
void invokeAssist(AssistKind assistKind, IAssistProvider *provider = 0);
@@ -237,7 +315,52 @@ public:
static QString msgTextTooLarge(quint64 size);
void insertPlainText(const QString &text);
- QString selectedText() const;
+
+ QWidget *extraArea() const;
+ virtual int extraAreaWidth(int *markWidthPtr = 0) const;
+ virtual void extraAreaPaintEvent(QPaintEvent *);
+ virtual void extraAreaLeaveEvent(QEvent *);
+ virtual void extraAreaContextMenuEvent(QContextMenuEvent *);
+ virtual void extraAreaMouseEvent(QMouseEvent *);
+ void updateFoldingHighlight(const QPoint &pos);
+
+ void setLanguageSettingsId(Core::Id settingsId);
+ Core::Id languageSettingsId() const;
+
+ void setCodeStyle(ICodeStylePreferences *settings);
+
+ const DisplaySettings &displaySettings() const;
+ const MarginSettings &marginSettings() const;
+
+ void ensureCursorVisible();
+
+ enum ExtraSelectionKind {
+ CurrentLineSelection,
+ ParenthesesMatchingSelection,
+ CodeWarningsSelection,
+ CodeSemanticsSelection,
+ UndefinedSymbolSelection,
+ UnusedSymbolSelection,
+ FakeVimSelection,
+ OtherSelection,
+ SnippetPlaceholderSelection,
+ ObjCSelection,
+ DebuggerExceptionSelection,
+ NExtraSelectionKinds
+ };
+ void setExtraSelections(ExtraSelectionKind kind, const QList<QTextEdit::ExtraSelection> &selections);
+ QList<QTextEdit::ExtraSelection> extraSelections(ExtraSelectionKind kind) const;
+ QString extraSelectionTooltip(int pos) const;
+
+ RefactorMarkers refactorMarkers() const;
+ void setRefactorMarkers(const RefactorMarkers &markers);
+
+ // the blocks list must be sorted
+ void setIfdefedOutBlocks(const QList<BlockRange> &blocks);
+ bool isMissingSyntaxDefinition() const;
+
+ enum Side { Left, Right };
+ void insertExtraToolBarWidget(Side side, QWidget *widget);
public slots:
virtual void copy();
@@ -245,6 +368,17 @@ public slots:
virtual void cut();
virtual void selectAll();
+ virtual void format();
+ virtual void rewrapParagraph();
+ virtual void unCommentSelection();
+ virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
+ virtual void setMarginSettings(const TextEditor::MarginSettings &);
+ virtual void setBehaviorSettings(const TextEditor::BehaviorSettings &);
+ virtual void setTypingSettings(const TextEditor::TypingSettings &);
+ virtual void setStorageSettings(const TextEditor::StorageSettings &);
+ virtual void setCompletionSettings(const TextEditor::CompletionSettings &);
+ virtual void setExtraEncodingSettings(const TextEditor::ExtraEncodingSettings &);
+
void circularPaste();
void switchUtf8bom();
@@ -327,9 +461,22 @@ public slots:
/// Abort code assistant if it is running.
void abortAssist();
+ void acceptMissingSyntaxDefinitionInfo();
+
+ void configureMimeType(const QString &mimeType);
+ void configureMimeType(const Core::MimeType &mimeType);
+ void inSnippetMode(bool *active);
+
signals:
void assistFinished();
void readOnlyChanged();
+ void refactorMarkerClicked(const TextEditor::RefactorMarker &marker);
+
+ void requestFontZoom(int zoom);
+ void requestZoomReset();
+ void requestBlockUpdate(const QTextBlock &);
+
+ void configured(Core::IEditor *editor);
protected:
bool event(QEvent *e);
@@ -339,8 +486,18 @@ protected:
void changeEvent(QEvent *e);
void focusInEvent(QFocusEvent *e);
void focusOutEvent(QFocusEvent *e);
-
void showEvent(QShowEvent *);
+ bool viewportEvent(QEvent *event);
+ void resizeEvent(QResizeEvent *);
+ void paintEvent(QPaintEvent *);
+ void timerEvent(QTimerEvent *);
+ void mouseMoveEvent(QMouseEvent *);
+ void mousePressEvent(QMouseEvent *);
+ void mouseReleaseEvent(QMouseEvent *);
+ void mouseDoubleClickEvent(QMouseEvent *);
+ void leaveEvent(QEvent *);
+ void keyReleaseEvent(QKeyEvent *);
+ void dragEnterEvent(QDragEnterEvent *e);
QMimeData *createMimeDataFromSelection() const;
bool canInsertFromMimeData(const QMimeData *source) const;
@@ -355,105 +512,10 @@ protected:
virtual bool replacementVisible(int blockNumber) const;
virtual QColor replacementPenColor(int blockNumber) const;
-private:
- void maybeSelectLine();
- void updateCannotDecodeInfo();
- void collectToCircularClipboard();
-
-protected:
- virtual BaseTextEditor *createEditor() = 0;
+ virtual BaseTextEditor *createEditor();
virtual void triggerPendingUpdates();
virtual void applyFontSettings();
-private slots:
- void editorContentsChange(int position, int charsRemoved, int charsAdded);
- void documentAboutToBeReloaded();
- void documentReloadFinished(bool success);
- void highlightSearchResults(const QString &txt, Core::FindFlags findFlags);
- void setFindScope(const QTextCursor &start, const QTextCursor &end, int, int);
- bool inFindScope(const QTextCursor &cursor);
- bool inFindScope(int selectionStart, int selectionEnd);
- void inSnippetMode(bool *active);
-
-private:
- Internal::BaseTextEditorWidgetPrivate *d;
- friend class Internal::BaseTextEditorWidgetPrivate;
- friend class Internal::TextEditorOverlay;
- friend class RefactorOverlay;
-
-public:
- QWidget *extraArea() const;
- virtual int extraAreaWidth(int *markWidthPtr = 0) const;
- virtual void extraAreaPaintEvent(QPaintEvent *);
- virtual void extraAreaLeaveEvent(QEvent *);
- virtual void extraAreaContextMenuEvent(QContextMenuEvent *);
- virtual void extraAreaMouseEvent(QMouseEvent *);
- void updateFoldingHighlight(const QPoint &pos);
-
- void setLanguageSettingsId(Core::Id settingsId);
- Core::Id languageSettingsId() const;
-
- void setCodeStyle(ICodeStylePreferences *settings);
-
- const DisplaySettings &displaySettings() const;
- const MarginSettings &marginSettings() const;
-
- void ensureCursorVisible();
-
- enum ExtraSelectionKind {
- CurrentLineSelection,
- ParenthesesMatchingSelection,
- CodeWarningsSelection,
- CodeSemanticsSelection,
- UndefinedSymbolSelection,
- UnusedSymbolSelection,
- FakeVimSelection,
- OtherSelection,
- SnippetPlaceholderSelection,
- ObjCSelection,
- DebuggerExceptionSelection,
- NExtraSelectionKinds
- };
- void setExtraSelections(ExtraSelectionKind kind, const QList<QTextEdit::ExtraSelection> &selections);
- QList<QTextEdit::ExtraSelection> extraSelections(ExtraSelectionKind kind) const;
- QString extraSelectionTooltip(int pos) const;
-
- RefactorMarkers refactorMarkers() const;
- void setRefactorMarkers(const RefactorMarkers &markers);
-signals:
- void refactorMarkerClicked(const TextEditor::RefactorMarker &marker);
-
-public:
- // the blocks list must be sorted
- void setIfdefedOutBlocks(const QList<BlockRange> &blocks);
-
-public slots:
- virtual void format();
- virtual void rewrapParagraph();
- virtual void unCommentSelection();
- virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
- virtual void setMarginSettings(const TextEditor::MarginSettings &);
- virtual void setBehaviorSettings(const TextEditor::BehaviorSettings &);
- virtual void setTypingSettings(const TextEditor::TypingSettings &);
- virtual void setStorageSettings(const TextEditor::StorageSettings &);
- virtual void setCompletionSettings(const TextEditor::CompletionSettings &);
- virtual void setExtraEncodingSettings(const TextEditor::ExtraEncodingSettings &);
-
-protected:
- bool viewportEvent(QEvent *event);
-
- void resizeEvent(QResizeEvent *);
- void paintEvent(QPaintEvent *);
- void timerEvent(QTimerEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void mouseDoubleClickEvent(QMouseEvent *);
- void leaveEvent(QEvent *);
- void keyReleaseEvent(QKeyEvent *);
-
- void dragEnterEvent(QDragEnterEvent *e);
-
void showDefaultContextMenu(QContextMenuEvent *e, Core::Id menuContextId);
public:
@@ -484,6 +546,10 @@ public:
int targetColumn;
};
+ QString selectedText() const;
+
+ void setupAsPlainEditor();
+
protected:
/*!
Reimplement this function to enable code navigation.
@@ -512,133 +578,19 @@ protected:
protected slots:
- virtual void slotUpdateExtraArea();
- virtual void slotUpdateExtraAreaWidth();
- virtual void slotUpdateRequest(const QRect &r, int dy);
- virtual void slotCursorPositionChanged();
- virtual void slotUpdateBlockNotify(const QTextBlock &);
- virtual void slotCodeStyleSettingsChanged(const QVariant &);
-
-signals:
- void requestFontZoom(int zoom);
- void requestZoomReset();
- void requestBlockUpdate(const QTextBlock &);
+ virtual void slotCursorPositionChanged(); // Used in VcsBase
+ virtual void slotCodeStyleSettingsChanged(const QVariant &); // Used in CppEditor
-private:
- void ctor(const QSharedPointer<BaseTextDocument> &doc);
- void handleHomeKey(bool anchor);
- void handleBackspaceKey();
- void moveLineUpDown(bool up);
- void copyLineUpDown(bool up);
- void saveCurrentCursorPositionForNavigation();
- void updateHighlights();
- void updateCurrentLineHighlight();
-
- void drawFoldingMarker(QPainter *painter, const QPalette &pal,
- const QRect &rect,
- bool expanded,
- bool active,
- bool hovered) const;
-
- void toggleBlockVisible(const QTextBlock &block);
- QRect foldBox();
-
- QTextBlock foldedBlockAt(const QPoint &pos, QRect *box = 0) const;
-
- void updateLink(QMouseEvent *e);
- void showLink(const Link &);
- void clearLink();
-
- void universalHelper(); // test function for development
-
- bool cursorMoveKeyEvent(QKeyEvent *e);
- bool camelCaseRight(QTextCursor &cursor, QTextCursor::MoveMode mode);
- bool camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveMode mode);
-
- void processTooltipRequest(const QTextCursor &c);
-
- void transformSelection(Internal::TransformationMethod method);
- void transformBlockSelection(Internal::TransformationMethod method);
-
-private slots:
- void updateTabStops();
- void applyFontSettingsDelayed();
-
- // parentheses matcher
- void _q_matchParentheses();
- void _q_highlightBlocks();
- void slotSelectionChanged();
- void _q_animateUpdate(int position, QPointF lastPos, QRectF rect);
+ void configureMimeType();
void doFoo();
-};
-
-
-class TEXTEDITOR_EXPORT BaseTextEditor : public ITextEditor
-{
- Q_OBJECT
-
-public:
- BaseTextEditor(BaseTextEditorWidget *editorWidget);
- ~BaseTextEditor();
-
- friend class BaseTextEditorWidget;
- BaseTextEditorWidget *editorWidget() const { return m_editorWidget; }
- BaseTextDocument *baseTextDocument() { return m_editorWidget->baseTextDocument(); }
-
- // IEditor
- Core::IDocument *document() { return m_editorWidget->baseTextDocument(); }
- bool open(QString *errorString, const QString &fileName, const QString &realFileName);
-
- QByteArray saveState() const { return m_editorWidget->saveState(); }
- bool restoreState(const QByteArray &state) { return m_editorWidget->restoreState(state); }
- QWidget *toolBar();
-
- enum Side { Left, Right };
- void insertExtraToolBarWidget(Side side, QWidget *widget);
-
- // ITextEditor
- int currentLine() const;
- int currentColumn() const;
- void gotoLine(int line, int column = 0, bool centerLine = true) { m_editorWidget->gotoLine(line, column, centerLine); }
- int columnCount() const;
- int rowCount() const;
-
- int position(PositionOperation posOp = Current, int at = -1) const
- { return m_editorWidget->position(posOp, at); }
- void convertPosition(int pos, int *line, int *column) const
- { m_editorWidget->convertPosition(pos, line, column); }
- QRect cursorRect(int pos = -1) const;
-
- QString selectedText() const;
-
- QString contextHelpId() const; // from IContext
-
- // ITextEditor
- void remove(int length);
- void insert(const QString &string);
- void replace(int length, const QString &string);
- void setCursorPosition(int pos);
- void select(int toPos);
- const Utils::CommentDefinition *commentDefinition() const;
-
- virtual CompletionAssistProvider *completionAssistProvider();
-
-private slots:
- void updateCursorPosition();
- void openGotoLocator();
- void setFileEncodingLabelVisible(bool visible);
- void setFileEncodingLabelText(const QString &text);
private:
- // Note: This is always a copy of IContext::m_widget.
- BaseTextEditorWidget *m_editorWidget;
-
- QToolBar *m_toolBar;
- QWidget *m_stretchWidget;
- QAction *m_cursorPositionLabelAction;
- Utils::LineColumnLabel *m_cursorPositionLabel;
- QAction *m_fileEncodingLabelAction;
- Utils::LineColumnLabel *m_fileEncodingLabel;
+ Internal::BaseTextEditorWidgetPrivate *d;
+ Internal::BaseTextEditorPrivate *dd() const;
+ friend class BaseTextEditor;
+ friend class Internal::BaseTextEditorWidgetPrivate;
+ friend class Internal::TextEditorOverlay;
+ friend class RefactorOverlay;
};
} // namespace TextEditor
diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h
index 1e69b3525e..f5f4fe7f90 100644
--- a/src/plugins/texteditor/basetexteditor_p.h
+++ b/src/plugins/texteditor/basetexteditor_p.h
@@ -105,136 +105,6 @@ struct BaseTextEditorPrivateHighlightBlocks
};
-class BaseTextEditorWidgetPrivate
-{
- BaseTextEditorWidgetPrivate(const BaseTextEditorWidgetPrivate &);
- BaseTextEditorWidgetPrivate &operator=(const BaseTextEditorWidgetPrivate &);
-
-public:
- BaseTextEditorWidgetPrivate();
- ~BaseTextEditorWidgetPrivate();
-
- void setupDocumentSignals();
- void updateLineSelectionColor();
-
- void print(QPrinter *printer);
-
- BaseTextEditorWidget *q;
- bool m_contentsChanged;
- bool m_lastCursorChangeWasInteresting;
-
- QSharedPointer<BaseTextDocument> m_document;
- QByteArray m_tempState;
- QByteArray m_tempNavigationState;
-
- bool m_parenthesesMatchingEnabled;
-
- // parentheses matcher
- bool m_formatRange;
- QTextCharFormat m_mismatchFormat;
- QTimer m_parenthesesMatchingTimer;
- // end parentheses matcher
-
- QWidget *m_extraArea;
-
- Core::Id m_tabSettingsId;
- ICodeStylePreferences *m_codeStylePreferences;
- DisplaySettings m_displaySettings;
- MarginSettings m_marginSettings;
- bool m_fontSettingsNeedsApply;
- BehaviorSettings m_behaviorSettings;
-
- int extraAreaSelectionAnchorBlockNumber;
- int extraAreaToggleMarkBlockNumber;
- int extraAreaHighlightFoldedBlockNumber;
-
- TextEditorOverlay *m_overlay;
- TextEditorOverlay *m_snippetOverlay;
- TextEditorOverlay *m_searchResultOverlay;
- bool snippetCheckCursor(const QTextCursor &cursor);
- void snippetTabOrBacktab(bool forward);
-
- RefactorOverlay *m_refactorOverlay;
-
- QBasicTimer foldedBlockTimer;
- int visibleFoldedBlockNumber;
- int suggestedVisibleFoldedBlockNumber;
- void clearVisibleFoldedBlock();
- bool m_mouseOnFoldedMarker;
- void foldLicenseHeader();
-
- QBasicTimer autoScrollTimer;
- uint m_marksVisible : 1;
- uint m_codeFoldingVisible : 1;
- uint m_codeFoldingSupported : 1;
- uint m_revisionsVisible : 1;
- uint m_lineNumbersVisible : 1;
- uint m_highlightCurrentLine : 1;
- uint m_requestMarkEnabled : 1;
- uint m_lineSeparatorsAllowed : 1;
- uint autoParenthesisOverwriteBackup : 1;
- uint surroundWithEnabledOverwriteBackup : 1;
- uint m_maybeFakeTooltipEvent : 1;
- int m_visibleWrapColumn;
-
- BaseTextEditorWidget::Link m_currentLink;
- bool m_linkPressed;
-
- QRegExp m_searchExpr;
- Core::FindFlags m_findFlags;
- void highlightSearchResults(const QTextBlock &block, TextEditorOverlay *overlay);
- QTimer m_delayedUpdateTimer;
-
- BaseTextEditor *m_editor;
-
- QList<QTextEdit::ExtraSelection> m_extraSelections[BaseTextEditorWidget::NExtraSelectionKinds];
-
- // block selection mode
- bool m_inBlockSelectionMode;
- QString copyBlockSelection();
- void insertIntoBlockSelection(const QString &text = QString());
- void setCursorToColumn(QTextCursor &cursor, int column,
- QTextCursor::MoveMode moveMode = QTextCursor::MoveAnchor);
- void removeBlockSelection();
- void enableBlockSelection(const QTextCursor &cursor);
- void enableBlockSelection(int positionBlock, int positionColumn,
- int anchorBlock, int anchorColumn);
- void disableBlockSelection(bool keepSelection = true);
- void resetCursorFlashTimer();
- QBasicTimer m_cursorFlashTimer;
- bool m_cursorVisible;
- bool m_moveLineUndoHack;
-
- QTextCursor m_findScopeStart;
- QTextCursor m_findScopeEnd;
- int m_findScopeVerticalBlockSelectionFirstColumn;
- int m_findScopeVerticalBlockSelectionLastColumn;
-
- QTextCursor m_selectBlockAnchor;
-
- Internal::BaseTextBlockSelection m_blockSelection;
-
- void moveCursorVisible(bool ensureVisible = true);
-
- int visualIndent(const QTextBlock &block) const;
- BaseTextEditorPrivateHighlightBlocks m_highlightBlocksInfo;
- QTimer m_highlightBlocksTimer;
-
- QScopedPointer<CodeAssistant> m_codeAssistant;
- bool m_assistRelevantContentAdded;
-
- QPointer<BaseTextEditorAnimator> m_animator;
- int m_cursorBlockNumber;
- int m_blockCount;
-
- QPoint m_markDragStart;
- bool m_markDragging;
-
- QScopedPointer<AutoCompleter> m_autoCompleter;
-
- QScopedPointer<Internal::ClipboardAssistProvider> m_clipboardAssistProvider;
-};
-
} // namespace Internal
} // namespace TextEditor
diff --git a/src/plugins/texteditor/basetexteditor_test.cpp b/src/plugins/texteditor/basetexteditor_test.cpp
index 4339e674e1..bfb0fc2b73 100644
--- a/src/plugins/texteditor/basetexteditor_test.cpp
+++ b/src/plugins/texteditor/basetexteditor_test.cpp
@@ -147,7 +147,7 @@ void Internal::TextEditorPlugin::testBlockSelectionTransformation()
editorWidget->lowercaseSelection();
break;
}
- QCOMPARE(textEditor->baseTextDocument()->plainText(), transformedText);
+ QCOMPARE(textEditor->textDocument()->plainText(), transformedText);
}
Core::EditorManager::closeEditor(editor, false);
}
@@ -362,7 +362,7 @@ void Internal::TextEditorPlugin::testBlockSelectionInsert()
editorWidget->update();
editorWidget->insertPlainText(insertText);
- QCOMPARE(textEditor->baseTextDocument()->plainText(), transformedText);
+ QCOMPARE(textEditor->textDocument()->plainText(), transformedText);
}
Core::EditorManager::closeEditor(editor, false);
}
@@ -440,7 +440,7 @@ void Internal::TextEditorPlugin::testBlockSelectionRemove()
editorWidget->update();
editorWidget->insertPlainText(QString());
- QCOMPARE(textEditor->baseTextDocument()->plainText(), transformedText);
+ QCOMPARE(textEditor->textDocument()->plainText(), transformedText);
}
Core::EditorManager::closeEditor(editor, false);
}
diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp
deleted file mode 100644
index 45eba8de4b..0000000000
--- a/src/plugins/texteditor/basetextmark.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "basetextmarkregistry.h"
-#include "basetextmark.h"
-#include "itexteditor.h"
-#include "basetextdocument.h"
-#include "texteditorplugin.h"
-
-#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/documentmanager.h>
-#include <extensionsystem/pluginmanager.h>
-#include <utils/qtcassert.h>
-
-using namespace Core;
-using namespace Utils;
-
-namespace TextEditor {
-namespace Internal {
-
-BaseTextMarkRegistry::BaseTextMarkRegistry(QObject *parent)
- : QObject(parent)
-{
- connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
- SLOT(editorOpened(Core::IEditor*)));
-
- connect(DocumentManager::instance(), SIGNAL(allDocumentsRenamed(QString,QString)),
- this, SLOT(allDocumentsRenamed(QString,QString)));
- connect(DocumentManager::instance(), SIGNAL(documentRenamed(Core::IDocument*,QString,QString)),
- this, SLOT(documentRenamed(Core::IDocument*,QString,QString)));
-}
-
-void BaseTextMarkRegistry::add(BaseTextMark *mark)
-{
- m_marks[FileName::fromString(mark->fileName())].insert(mark);
- ITextEditorDocument *document
- = qobject_cast<ITextEditorDocument*>(DocumentModel::documentForFilePath(mark->fileName()));
- if (!document)
- return;
- document->markableInterface()->addMark(mark);
-}
-
-bool BaseTextMarkRegistry::remove(BaseTextMark *mark)
-{
- return m_marks[FileName::fromString(mark->fileName())].remove(mark);
-}
-
-void BaseTextMarkRegistry::editorOpened(Core::IEditor *editor)
-{
- ITextEditorDocument *document = qobject_cast<ITextEditorDocument *>(editor ? editor->document() : 0);
- if (!document)
- return;
- if (!m_marks.contains(FileName::fromString(document->filePath())))
- return;
-
- foreach (BaseTextMark *mark, m_marks.value(FileName::fromString(document->filePath())))
- document->markableInterface()->addMark(mark);
-}
-
-void BaseTextMarkRegistry::documentRenamed(IDocument *document, const
- QString &oldName, const QString &newName)
-{
- TextEditor::BaseTextDocument *baseTextDocument
- = qobject_cast<TextEditor::BaseTextDocument *>(document);
- if (!document)
- return;
- FileName oldFileName = FileName::fromString(oldName);
- FileName newFileName = FileName::fromString(newName);
- if (!m_marks.contains(oldFileName))
- return;
-
- QSet<BaseTextMark *> toBeMoved;
- foreach (ITextMark *mark, baseTextDocument->markableInterface()->marks())
- if (BaseTextMark *baseTextMark = dynamic_cast<BaseTextMark *>(mark))
- toBeMoved.insert(baseTextMark);
-
- m_marks[oldFileName].subtract(toBeMoved);
- m_marks[newFileName].unite(toBeMoved);
-
- foreach (BaseTextMark *mark, toBeMoved)
- mark->updateFileName(newName);
-}
-
-void BaseTextMarkRegistry::allDocumentsRenamed(const QString &oldName, const QString &newName)
-{
- FileName oldFileName = FileName::fromString(oldName);
- FileName newFileName = FileName::fromString(newName);
- if (!m_marks.contains(oldFileName))
- return;
-
- QSet<BaseTextMark *> oldFileNameMarks = m_marks.value(oldFileName);
-
- m_marks[newFileName].unite(oldFileNameMarks);
- m_marks[oldFileName].clear();
-
- foreach (BaseTextMark *mark, oldFileNameMarks)
- mark->updateFileName(newName);
-}
-
-} // namespace Internal
-
-BaseTextMark::BaseTextMark(const QString &fileName, int lineNumber)
- : ITextMark(lineNumber), m_fileName(fileName)
-{
-}
-
-// we need two phase initialization, since we are calling virtual functions
-// of BaseTextMark in add() and also accessing widthFactor
-// which might be set in the derived constructor
-void BaseTextMark::init()
-{
- Internal::TextEditorPlugin::baseTextMarkRegistry()->add(this);
-}
-
-BaseTextMark::~BaseTextMark()
-{
- // oha we are deleted
- bool b = Internal::TextEditorPlugin::baseTextMarkRegistry()->remove(this);
- // If you get a assertion in this line, init() was never called
- QTC_CHECK(b);
-}
-
-void BaseTextMark::updateFileName(const QString &fileName)
-{
- m_fileName = fileName;
-}
-
-} // namespace TextEditor
diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp
index a7c9d1b21d..d369638369 100644
--- a/src/plugins/texteditor/codeassist/codeassistant.cpp
+++ b/src/plugins/texteditor/codeassist/codeassistant.cpp
@@ -185,7 +185,7 @@ void CodeAssistantPrivate::configure(BaseTextEditor *textEditor)
filterEditorSpecificProviders(&m_quickFixProviders, m_textEditor->document()->id());
m_textEditor->editorWidget()->installEventFilter(this);
- connect(m_textEditor->baseTextDocument(),SIGNAL(mimeTypeChanged()),
+ connect(m_textEditor->textDocument(),SIGNAL(mimeTypeChanged()),
m_q, SLOT(reconfigure()));
}
diff --git a/src/plugins/texteditor/codestyleeditor.cpp b/src/plugins/texteditor/codestyleeditor.cpp
index 4cf58323b2..ebd5f493b5 100644
--- a/src/plugins/texteditor/codestyleeditor.cpp
+++ b/src/plugins/texteditor/codestyleeditor.cpp
@@ -54,7 +54,7 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory,
CodeStyleSelectorWidget *selector = new CodeStyleSelectorWidget(factory, this);
selector->setCodeStyle(codeStyle);
m_preview = new SnippetEditorWidget(this);
- m_preview->baseTextDocument()->setFontSettings(TextEditorSettings::fontSettings());
+ m_preview->textDocument()->setFontSettings(TextEditorSettings::fontSettings());
DisplaySettings displaySettings = m_preview->displaySettings();
displaySettings.m_visualizeWhitespace = true;
m_preview->setDisplaySettings(displaySettings);
@@ -93,13 +93,13 @@ void CodeStyleEditor::updatePreview()
{
QTextDocument *doc = m_preview->document();
- m_preview->baseTextDocument()->indenter()->invalidateCache(doc);
+ m_preview->textDocument()->indenter()->invalidateCache(doc);
QTextBlock block = doc->firstBlock();
QTextCursor tc = m_preview->textCursor();
tc.beginEditBlock();
while (block.isValid()) {
- m_preview->baseTextDocument()->indenter()
+ m_preview->textDocument()->indenter()
->indentBlock(doc, block, QChar::Null, m_codeStyle->currentTabSettings());
block = block.next();
}
diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp
index 6a8a3a0716..b4a916f29b 100644
--- a/src/plugins/texteditor/findincurrentfile.cpp
+++ b/src/plugins/texteditor/findincurrentfile.cpp
@@ -28,7 +28,7 @@
****************************************************************************/
#include "findincurrentfile.h"
-#include "itexteditor.h"
+#include "basetexteditor.h"
#include <utils/filesearch.h>
#include <coreplugin/icore.h>
@@ -63,8 +63,7 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters,
{
Q_UNUSED(nameFilters)
QString fileName = additionalParameters.toString();
- QMap<QString, QTextCodec *> openEditorEncodings
- = ITextEditorDocument::openedTextDocumentEncodings();
+ QMap<QString, QTextCodec *> openEditorEncodings = BaseTextDocument::openedTextDocumentEncodings();
QTextCodec *codec = openEditorEncodings.value(fileName);
if (!codec)
codec = Core::EditorManager::defaultTextCodec();
diff --git a/src/plugins/texteditor/findinopenfiles.cpp b/src/plugins/texteditor/findinopenfiles.cpp
index c444e8b0e3..e3e33beda3 100644
--- a/src/plugins/texteditor/findinopenfiles.cpp
+++ b/src/plugins/texteditor/findinopenfiles.cpp
@@ -28,7 +28,8 @@
****************************************************************************/
#include "findinopenfiles.h"
-#include "itexteditor.h"
+#include "basetextdocument.h"
+#include "basetexteditor.h"
#include <utils/filesearch.h>
#include <coreplugin/icore.h>
@@ -64,7 +65,7 @@ Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters,
Q_UNUSED(nameFilters)
Q_UNUSED(additionalParameters)
QMap<QString, QTextCodec *> openEditorEncodings
- = ITextEditorDocument::openedTextDocumentEncodings();
+ = BaseTextDocument::openedTextDocumentEncodings();
QStringList fileNames;
QList<QTextCodec *> codecs;
foreach (Core::DocumentModel::Entry *entry,
diff --git a/src/plugins/texteditor/itexteditor.cpp b/src/plugins/texteditor/itexteditor.cpp
deleted file mode 100644
index 51ec0a6b84..0000000000
--- a/src/plugins/texteditor/itexteditor.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "itexteditor.h"
-#include <coreplugin/editormanager/editormanager.h>
-
-#include <QTextCodec>
-
-namespace TextEditor {
-
-/*!
- \class TextEditor::ITextEditorDocument
- \brief The ITextEditorDocument class is an abstract base for documents of text editors.
-
- It is the base class for documents used by implementations of the ITextEditor class,
- and contains basic functions for retrieving text content and markers (like bookmarks).
-*/
-
-/*!
- \class TextEditor::ITextEditor
- \brief The ITextEditor class is an abstract base class for text editors.
-
- It contains the basic functions for retrieving and setting cursor position and selections,
- and operations on them, like removing or inserting. It uses implementations of
- ITextEditorDocument as the underlying document.
-*/
-
-ITextEditorDocument::ITextEditorDocument(QObject *parent)
- : Core::TextDocument(parent)
-{
-}
-
-QMap<QString, QString> ITextEditorDocument::openedTextDocumentContents()
-{
- QMap<QString, QString> workingCopy;
- foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) {
- ITextEditorDocument *textEditorDocument = qobject_cast<ITextEditorDocument *>(document);
- if (!textEditorDocument)
- continue;
- QString fileName = textEditorDocument->filePath();
- workingCopy[fileName] = textEditorDocument->plainText();
- }
- return workingCopy;
-}
-
-QMap<QString, QTextCodec *> ITextEditorDocument::openedTextDocumentEncodings()
-{
- QMap<QString, QTextCodec *> workingCopy;
- foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) {
- ITextEditorDocument *textEditorDocument = qobject_cast<ITextEditorDocument *>(document);
- if (!textEditorDocument)
- continue;
- QString fileName = textEditorDocument->filePath();
- workingCopy[fileName] = const_cast<QTextCodec *>(textEditorDocument->codec());
- }
- return workingCopy;
-}
-
-ITextEditorDocument *ITextEditor::textDocument()
-{
- return qobject_cast<ITextEditorDocument *>(document());
-}
-
-
-ITextEditor *ITextEditor::currentTextEditor()
-{
- return qobject_cast<ITextEditor *>(Core::EditorManager::currentEditor());
-}
-
-} // namespace TextEditor
diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h
deleted file mode 100644
index c028362e00..0000000000
--- a/src/plugins/texteditor/itexteditor.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef ITEXTEDITOR_H
-#define ITEXTEDITOR_H
-
-#include "texteditor_global.h"
-
-#include "itextmark.h"
-
-#include <coreplugin/textdocument.h>
-#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/editormanager/ieditor.h>
-
-#include <QMap>
-#include <QIcon>
-
-QT_BEGIN_NAMESPACE
-class QIcon;
-class QMenu;
-class QPainter;
-class QPoint;
-class QRect;
-class QTextBlock;
-QT_END_NAMESPACE
-
-namespace Utils { class CommentDefinition; }
-
-namespace TextEditor {
-
-class TEXTEDITOR_EXPORT BlockRange
-{
-public:
- BlockRange() : _first(0), _last(-1) {}
- BlockRange(int firstPosition, int lastPosition)
- : _first(firstPosition), _last(lastPosition)
- {}
-
- inline bool isNull() const { return _last < _first; }
-
- int first() const { return _first; }
- int last() const { return _last; }
-
-private:
- int _first;
- int _last;
-};
-
-
-class TEXTEDITOR_EXPORT ITextEditorDocument : public Core::TextDocument
-{
- Q_OBJECT
-public:
- explicit ITextEditorDocument(QObject *parent = 0);
-
- virtual QString plainText() const = 0;
- virtual QString textAt(int pos, int length) const = 0;
- virtual QChar characterAt(int pos) const = 0;
-
- virtual ITextMarkable *markableInterface() const = 0;
-
- static QMap<QString, QString> openedTextDocumentContents();
- static QMap<QString, QTextCodec *> openedTextDocumentEncodings();
-
-signals:
- void contentsChanged();
-};
-
-class TEXTEDITOR_EXPORT ITextEditor : public Core::IEditor
-{
- Q_OBJECT
-public:
- enum PositionOperation {
- Current = 1,
- EndOfLine = 2,
- StartOfLine = 3,
- Anchor = 4,
- EndOfDoc = 5
- };
-
- ITextEditor() {}
-
- virtual ITextEditorDocument *textDocument();
-
- /*! Returns the position at \a posOp in characters from the beginning of the document */
- virtual int position(PositionOperation posOp = Current, int at = -1) const = 0;
- /*! Converts the \a pos in characters from beginning of document to \a line and \a column */
- virtual void convertPosition(int pos, int *line, int *column) const = 0;
- /*! Returns the cursor rectangle in pixels at \a pos, or current position if \a pos = -1 */
- virtual QRect cursorRect(int pos = -1) const = 0;
- /*! Returns the amount of visible columns (in characters) in the editor */
- virtual int columnCount() const = 0;
- /*! Returns the amount of visible lines (in characters) in the editor */
- virtual int rowCount() const = 0;
-
- virtual QString selectedText() const = 0;
-
- /*! Removes \a length characters to the right of the cursor. */
- virtual void remove(int length) = 0;
- /*! Inserts the given string to the right of the cursor. */
- virtual void insert(const QString &string) = 0;
- /*! Replaces \a length characters to the right of the cursor with the given string. */
- virtual void replace(int length, const QString &string) = 0;
- /*! Sets current cursor position to \a pos. */
- virtual void setCursorPosition(int pos) = 0;
- /*! Selects text between current cursor position and \a toPos. */
- virtual void select(int toPos) = 0;
-
- virtual const Utils::CommentDefinition* commentDefinition() const = 0;
-
- enum MarkRequestKind {
- BreakpointRequest,
- BookmarkRequest,
- TaskMarkRequest
- };
-
- static ITextEditor *currentTextEditor();
-
-signals:
- void markRequested(TextEditor::ITextEditor *editor, int line, TextEditor::ITextEditor::MarkRequestKind kind);
- void markContextMenuRequested(TextEditor::ITextEditor *editor, int line, QMenu *menu);
- void tooltipOverrideRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position, bool *handled);
- void tooltipRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position);
- void markTooltipRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int line);
- void contextHelpIdRequested(TextEditor::ITextEditor *editor, int position);
-};
-
-} // namespace TextEditor
-
-#endif // ITEXTEDITOR_H
diff --git a/src/plugins/texteditor/itextmark.cpp b/src/plugins/texteditor/itextmark.cpp
deleted file mode 100644
index d6c8b76edb..0000000000
--- a/src/plugins/texteditor/itextmark.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "itextmark.h"
-
-using namespace TextEditor;
-
-ITextMark::~ITextMark()
-{
- if (m_markableInterface)
- m_markableInterface->removeMark(this);
- m_markableInterface = 0;
-}
-
-int ITextMark::lineNumber() const
-{
- return m_lineNumber;
-}
-
-void ITextMark::paint(QPainter *painter, const QRect &rect) const
-{
- m_icon.paint(painter, rect, Qt::AlignCenter);
-}
-
-void ITextMark::updateLineNumber(int lineNumber)
-{
- m_lineNumber = lineNumber;
-}
-
-void ITextMark::move(int line)
-{
- if (line == m_lineNumber)
- return;
- const int previousLine = m_lineNumber;
- m_lineNumber = line;
- if (m_markableInterface)
- m_markableInterface->moveMark(this, previousLine);
-}
-
-void ITextMark::updateBlock(const QTextBlock &)
-{}
-
-void ITextMark::removedFromEditor()
-{}
-
-void ITextMark::setIcon(const QIcon &icon)
-{
- m_icon = icon;
-}
-
-void ITextMark::updateMarker()
-{
- if (m_markableInterface)
- m_markableInterface->updateMark(this);
-}
-
-void ITextMark::setPriority(Priority priority)
-{
- m_priority = priority;
-}
-
-ITextMark::Priority ITextMark::priority() const
-{
- return m_priority;
-}
-
-bool ITextMark::isVisible() const
-{
- return m_visible;
-}
-
-void ITextMark::setVisible(bool visible)
-{
- m_visible = visible;
- if (m_markableInterface)
- m_markableInterface->updateMark(this);
-}
-
-double ITextMark::widthFactor() const
-{
- return m_widthFactor;
-}
-
-void ITextMark::setWidthFactor(double factor)
-{
- m_widthFactor = factor;
-}
-
-bool ITextMark::isClickable() const
-{
- return false;
-}
-
-void ITextMark::clicked()
-{}
-
-bool ITextMark::isDraggable() const
-{
- return false;
-}
-
-void ITextMark::dragToLine(int lineNumber)
-{
- Q_UNUSED(lineNumber);
-}
-
-ITextMarkable *ITextMark::markableInterface() const
-{
- return m_markableInterface;
-}
-
-void ITextMark::setMarkableInterface(ITextMarkable *markableInterface)
-{
- m_markableInterface = markableInterface;
-}
-
diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp
index 3764bbedc7..4be1ef5efd 100644
--- a/src/plugins/texteditor/linenumberfilter.cpp
+++ b/src/plugins/texteditor/linenumberfilter.cpp
@@ -28,7 +28,7 @@
****************************************************************************/
#include "linenumberfilter.h"
-#include "itexteditor.h"
+#include "basetexteditor.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp
index 3fc3d2b1db..cbe749a1ea 100644
--- a/src/plugins/texteditor/outlinefactory.cpp
+++ b/src/plugins/texteditor/outlinefactory.cpp
@@ -175,6 +175,13 @@ void OutlineWidgetStack::updateCurrentEditor(Core::IEditor *editor)
}
}
+OutlineFactory::OutlineFactory()
+{
+ setDisplayName(tr("Outline"));
+ setId("Outline");
+ setPriority(600);
+}
+
QList<IOutlineWidgetFactory*> OutlineFactory::widgetFactories() const
{
return m_factories;
@@ -185,26 +192,6 @@ void OutlineFactory::setWidgetFactories(QList<IOutlineWidgetFactory*> factories)
m_factories = factories;
}
-QString OutlineFactory::displayName() const
-{
- return tr("Outline");
-}
-
-int OutlineFactory::priority() const
-{
- return 600;
-}
-
-Core::Id OutlineFactory::id() const
-{
- return "Outline";
-}
-
-QKeySequence OutlineFactory::activationSequence() const
-{
- return QKeySequence();
-}
-
Core::NavigationView OutlineFactory::createWidget()
{
Core::NavigationView n;
diff --git a/src/plugins/texteditor/outlinefactory.h b/src/plugins/texteditor/outlinefactory.h
index ea001520b3..5b0d6f97fc 100644
--- a/src/plugins/texteditor/outlinefactory.h
+++ b/src/plugins/texteditor/outlinefactory.h
@@ -78,16 +78,12 @@ class OutlineFactory : public Core::INavigationWidgetFactory
{
Q_OBJECT
public:
- OutlineFactory() {}
+ OutlineFactory();
QList<IOutlineWidgetFactory*> widgetFactories() const;
void setWidgetFactories(QList<IOutlineWidgetFactory*> factories);
// from INavigationWidgetFactory
- virtual QString displayName() const;
- virtual int priority() const;
- virtual Core::Id id() const;
- virtual QKeySequence activationSequence() const;
virtual Core::NavigationView createWidget();
virtual void saveSettings(int position, QWidget *widget);
virtual void restoreSettings(int position, QWidget *widget);
diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp
deleted file mode 100644
index 16a3e45abd..0000000000
--- a/src/plugins/texteditor/plaintexteditor.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "plaintexteditor.h"
-#include "tabsettings.h"
-#include "texteditorplugin.h"
-#include "texteditorsettings.h"
-#include "basetextdocument.h"
-#include "normalindenter.h"
-#include "highlighterutils.h"
-#include <texteditor/generichighlighter/context.h>
-#include <texteditor/generichighlighter/highlightdefinition.h>
-#include <texteditor/generichighlighter/highlighter.h>
-#include <texteditor/generichighlighter/highlightersettings.h>
-#include <texteditor/generichighlighter/manager.h>
-
-#include <coreplugin/coreconstants.h>
-#include <coreplugin/icore.h>
-
-#include <QSharedPointer>
-
-using namespace Core;
-using namespace TextEditor::Internal;
-
-/*!
- \class TextEditor::PlainTextEditor
- \brief The PlainTextEditor class is a text editor implementation that adds highlighting
- by using the Kate text highlighting definitions, and some basic auto indentation.
-
- It is the default editor for text files used by \QC, if no other editor implementation
- matches the MIME type. The corresponding document is implemented in PlainTextDocument,
- the corresponding widget is implemented in PlainTextEditorWidget.
-*/
-
-namespace TextEditor {
-
-PlainTextEditor::PlainTextEditor(PlainTextEditorWidget *editor)
- : BaseTextEditor(editor)
-{
- setContext(Core::Context(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
- TextEditor::Constants::C_TEXTEDITOR));
- setDuplicateSupported(true);
-}
-
-PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent)
- : BaseTextEditorWidget(new PlainTextDocument(), parent)
-{
- // Currently only "normal" indentation is supported.
- baseTextDocument()->setIndenter(new NormalIndenter);
- ctor();
-}
-
-PlainTextEditorWidget::PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent)
- : BaseTextEditorWidget(doc, parent)
-{
- ctor();
-}
-
-PlainTextEditorWidget::PlainTextEditorWidget(PlainTextEditorWidget *other)
- : BaseTextEditorWidget(other)
-{
- ctor();
-}
-
-void PlainTextEditorWidget::ctor()
-{
- m_isMissingSyntaxDefinition = false;
- setRevisionsVisible(true);
- setMarksVisible(true);
- setLineSeparatorsAllowed(true);
-
- baseTextDocument()->setMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
-
- m_commentDefinition.clearCommentStyles();
-
- connect(baseTextDocument(), SIGNAL(filePathChanged(QString,QString)),
- this, SLOT(configure()));
- connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure()));
-}
-
-IEditor *PlainTextEditor::duplicate()
-{
- PlainTextEditorWidget *newWidget = new PlainTextEditorWidget(
- qobject_cast<PlainTextEditorWidget *>(editorWidget()));
- TextEditorSettings::initializeEditor(newWidget);
- return newWidget->editor();
-}
-
-void PlainTextEditorWidget::unCommentSelection()
-{
- Utils::unCommentSelection(this, m_commentDefinition);
-}
-
-void PlainTextEditorWidget::configure()
-{
- MimeType mimeType;
- if (baseTextDocument())
- mimeType = MimeDatabase::findByFile(baseTextDocument()->filePath());
- configure(mimeType);
-}
-
-void PlainTextEditorWidget::configure(const QString &mimeType)
-{
- configure(MimeDatabase::findByType(mimeType));
-}
-
-void PlainTextEditorWidget::configure(const MimeType &mimeType)
-{
- Highlighter *highlighter = new Highlighter();
- highlighter->setTabSettings(baseTextDocument()->tabSettings());
- baseTextDocument()->setSyntaxHighlighter(highlighter);
-
- setCodeFoldingSupported(false);
-
- if (!mimeType.isNull()) {
- m_isMissingSyntaxDefinition = true;
-
- setMimeTypeForHighlighter(highlighter, mimeType);
- const QString &type = mimeType.type();
- baseTextDocument()->setMimeType(type);
-
- QString definitionId = Manager::instance()->definitionIdByMimeType(type);
- if (definitionId.isEmpty())
- definitionId = findDefinitionId(mimeType, true);
-
- if (!definitionId.isEmpty()) {
- m_isMissingSyntaxDefinition = false;
- const QSharedPointer<HighlightDefinition> &definition =
- Manager::instance()->definition(definitionId);
- if (!definition.isNull() && definition->isValid()) {
- m_commentDefinition.isAfterWhiteSpaces = definition->isCommentAfterWhiteSpaces();
- m_commentDefinition.singleLine = definition->singleLineComment();
- m_commentDefinition.multiLineStart = definition->multiLineCommentStart();
- m_commentDefinition.multiLineEnd = definition->multiLineCommentEnd();
-
- setCodeFoldingSupported(true);
- }
- } else {
- const QString &fileName = baseTextDocument()->filePath();
- if (TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName))
- m_isMissingSyntaxDefinition = false;
- }
- }
-
- baseTextDocument()->setFontSettings(TextEditorSettings::fontSettings());
-
- emit configured(editor());
-}
-
-bool PlainTextEditorWidget::isMissingSyntaxDefinition() const
-{
- return m_isMissingSyntaxDefinition;
-}
-
-void PlainTextEditorWidget::acceptMissingSyntaxDefinitionInfo()
-{
- ICore::showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
- Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS,
- this);
-}
-
-PlainTextDocument::PlainTextDocument()
-{
- setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
- connect(this, SIGNAL(tabSettingsChanged()), this, SLOT(updateTabSettings()));
-}
-
-void PlainTextDocument::updateTabSettings()
-{
- if (Highlighter *highlighter = qobject_cast<Highlighter *>(syntaxHighlighter()))
- highlighter->setTabSettings(tabSettings());
-}
-
-} // namespace TextEditor
diff --git a/src/plugins/texteditor/plaintexteditor.h b/src/plugins/texteditor/plaintexteditor.h
deleted file mode 100644
index 99471cbc5e..0000000000
--- a/src/plugins/texteditor/plaintexteditor.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef PLAINTEXTEDITOR_H
-#define PLAINTEXTEDITOR_H
-
-#include "basetexteditor.h"
-
-#include <utils/uncommentselection.h>
-
-namespace Core { class MimeType; }
-
-namespace TextEditor {
-
-class PlainTextEditorWidget;
-class Indenter;
-
-class TEXTEDITOR_EXPORT PlainTextEditor : public BaseTextEditor
-{
- Q_OBJECT
-public:
- PlainTextEditor(PlainTextEditorWidget *);
-
- Core::IEditor *duplicate();
-};
-
-class TEXTEDITOR_EXPORT PlainTextDocument : public BaseTextDocument
-{
- Q_OBJECT
-public:
- PlainTextDocument();
-private slots:
- void updateTabSettings();
-};
-
-class TEXTEDITOR_EXPORT PlainTextEditorWidget : public BaseTextEditorWidget
-{
- Q_OBJECT
-
-public:
- PlainTextEditorWidget(QWidget *parent = 0);
- PlainTextEditorWidget(PlainTextDocument *doc, QWidget *parent = 0);
- PlainTextEditorWidget(PlainTextEditorWidget *other);
-
- void configure(const QString& mimeType);
- void configure(const Core::MimeType &mimeType);
- bool isMissingSyntaxDefinition() const;
-
-public slots:
- virtual void unCommentSelection();
-
-private slots:
- void configure();
- void acceptMissingSyntaxDefinitionInfo();
-
-signals:
- void configured(Core::IEditor *editor);
-
-protected:
- virtual BaseTextEditor *createEditor() { return new PlainTextEditor(this); }
-
-private:
- PlainTextEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
- PlainTextEditorWidget(BaseTextDocument *, QWidget *); //avoid stupidity
- void ctor();
-
- bool m_isMissingSyntaxDefinition;
- Utils::CommentDefinition m_commentDefinition;
-};
-
-} // namespace TextEditor
-
-#endif // PLAINTEXTEDITOR_H
diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp
index c8af5fbcf5..6266e75db8 100644
--- a/src/plugins/texteditor/plaintexteditorfactory.cpp
+++ b/src/plugins/texteditor/plaintexteditorfactory.cpp
@@ -28,8 +28,9 @@
****************************************************************************/
#include "plaintexteditorfactory.h"
-#include "plaintexteditor.h"
+#include "basetexteditor.h"
#include "basetextdocument.h"
+#include "normalindenter.h"
#include "texteditoractionhandler.h"
#include "texteditorconstants.h"
#include "texteditorplugin.h"
@@ -60,12 +61,16 @@ PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
Core::IEditor *PlainTextEditorFactory::createEditor()
{
- PlainTextEditorWidget *rc = new PlainTextEditorWidget();
- TextEditorSettings::initializeEditor(rc);
- connect(rc, SIGNAL(configured(Core::IEditor*)),
+ auto doc = new BaseTextDocument;
+ doc->setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
+ doc->setIndenter(new NormalIndenter);
+ auto widget = new BaseTextEditorWidget(doc, 0);
+ widget->setupAsPlainEditor();
+ TextEditorSettings::initializeEditor(widget);
+ connect(widget, SIGNAL(configured(Core::IEditor*)),
this, SLOT(updateEditorInfoBar(Core::IEditor*)));
- updateEditorInfoBar(rc->editor());
- return rc->editor();
+ updateEditorInfoBar(widget->editor());
+ return widget->editor();
}
/*!
@@ -74,15 +79,15 @@ Core::IEditor *PlainTextEditorFactory::createEditor()
*/
void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
{
- PlainTextEditor *editorEditable = qobject_cast<PlainTextEditor *>(editor);
- if (editorEditable) {
- BaseTextDocument *file = qobject_cast<BaseTextDocument *>(editor->document());
+ BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(editor);
+ if (textEditor) {
+ Core::IDocument *file = editor->document();
if (!file)
return;
- PlainTextEditorWidget *textEditor = static_cast<PlainTextEditorWidget *>(editorEditable->editorWidget());
+ BaseTextEditorWidget *widget = textEditor->editorWidget();
Core::Id infoSyntaxDefinition(Constants::INFO_SYNTAX_DEFINITION);
Core::InfoBar *infoBar = file->infoBar();
- if (!textEditor->isMissingSyntaxDefinition()) {
+ if (!widget->isMissingSyntaxDefinition()) {
infoBar->removeInfo(infoSyntaxDefinition);
} else if (infoBar->canInfoBeAdded(infoSyntaxDefinition)) {
Core::InfoBarEntry info(infoSyntaxDefinition,
@@ -90,7 +95,7 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
"Would you like to try to find one?"),
Core::InfoBarEntry::GlobalSuppressionEnabled);
info.setCustomButtonInfo(tr("Show Highlighter Options..."),
- textEditor, SLOT(acceptMissingSyntaxDefinitionInfo()));
+ widget, SLOT(acceptMissingSyntaxDefinitionInfo()));
infoBar->addInfo(info);
}
}
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index 1ba237d71e..0dab146b70 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -158,7 +158,7 @@ RefactoringFile::RefactoringFile(QTextDocument *document, const QString &fileNam
{ }
RefactoringFile::RefactoringFile(BaseTextEditorWidget *editor)
- : m_fileName(editor->baseTextDocument()->filePath())
+ : m_fileName(editor->textDocument()->filePath())
, m_document(0)
, m_editor(editor)
, m_openEditor(false)
@@ -393,7 +393,7 @@ void RefactoringFile::indentOrReindent(void (RefactoringChangesData::*mf)(const
QTextCursor selection(p.first.document());
selection.setPosition(p.first.position());
selection.setPosition(p.second.position(), QTextCursor::KeepAnchor);
- ((*m_data).*(mf))(selection, m_fileName, m_editor ? m_editor->baseTextDocument() : 0);
+ ((*m_data).*(mf))(selection, m_fileName, m_editor ? m_editor->textDocument() : 0);
}
}
diff --git a/src/plugins/texteditor/snippets/snippeteditor.cpp b/src/plugins/texteditor/snippets/snippeteditor.cpp
index 72e7665f30..08ff2a88f2 100644
--- a/src/plugins/texteditor/snippets/snippeteditor.cpp
+++ b/src/plugins/texteditor/snippets/snippeteditor.cpp
@@ -49,9 +49,10 @@ SnippetEditor::SnippetEditor(SnippetEditorWidget *editor)
setContext(Core::Context(Constants::SNIPPET_EDITOR_ID, Constants::C_TEXTEDITOR));
}
-SnippetEditorWidget::SnippetEditorWidget(QWidget *parent) : BaseTextEditorWidget(parent)
+SnippetEditorWidget::SnippetEditorWidget(QWidget *parent)
+ : BaseTextEditorWidget(new BaseTextDocument, parent)
{
- baseTextDocument()->setId(Constants::SNIPPET_EDITOR_ID);
+ textDocument()->setId(Constants::SNIPPET_EDITOR_ID);
setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
setHighlightCurrentLine(false);
setLineNumbersVisible(false);
@@ -60,7 +61,7 @@ SnippetEditorWidget::SnippetEditorWidget(QWidget *parent) : BaseTextEditorWidget
void SnippetEditorWidget::setSyntaxHighlighter(TextEditor::SyntaxHighlighter *highlighter)
{
- baseTextDocument()->setSyntaxHighlighter(highlighter);
+ textDocument()->setSyntaxHighlighter(highlighter);
}
void SnippetEditorWidget::focusOutEvent(QFocusEvent *event)
diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
index 32e9c70f5f..b9f3d47eca 100644
--- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp
+++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
@@ -336,7 +336,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
foreach (ISnippetProvider *provider, providers) {
m_ui.groupCombo->addItem(provider->displayName(), provider->groupId());
SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w);
- snippetEditor->baseTextDocument()->setFontSettings(TextEditorSettings::fontSettings());
+ snippetEditor->textDocument()->setFontSettings(TextEditorSettings::fontSettings());
provider->decorateEditor(snippetEditor);
m_ui.snippetsEditorStack->insertWidget(m_ui.groupCombo->count() - 1, snippetEditor);
connect(snippetEditor, SIGNAL(snippetContentChanged()), this, SLOT(setSnippetContent()));
@@ -537,7 +537,7 @@ void SnippetsSettingsPagePrivate::decorateEditors(const TextEditor::FontSettings
ExtensionSystem::PluginManager::getObjects<ISnippetProvider>();
for (int i = 0; i < m_ui.groupCombo->count(); ++i) {
SnippetEditorWidget *snippetEditor = editorAt(i);
- snippetEditor->baseTextDocument()->setFontSettings(fontSettings);
+ snippetEditor->textDocument()->setFontSettings(fontSettings);
const QString &id = m_ui.groupCombo->itemData(i).toString();
// This list should be quite short... Re-iterating over it is ok.
foreach (const ISnippetProvider *provider, providers) {
diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro
index 8e226aec20..51d37f673d 100644
--- a/src/plugins/texteditor/texteditor.pro
+++ b/src/plugins/texteditor/texteditor.pro
@@ -6,7 +6,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
include(../../qtcreatorplugin.pri)
SOURCES += texteditorplugin.cpp \
textfilewizard.cpp \
- plaintexteditor.cpp \
plaintexteditorfactory.cpp \
basetextdocument.cpp \
basetexteditor.cpp \
@@ -21,7 +20,6 @@ SOURCES += texteditorplugin.cpp \
displaysettingspage.cpp \
fontsettings.cpp \
linenumberfilter.cpp \
- basetextmark.cpp \
findinfiles.cpp \
basefilefind.cpp \
texteditorsettings.cpp \
@@ -30,7 +28,6 @@ SOURCES += texteditorplugin.cpp \
findinopenfiles.cpp \
colorscheme.cpp \
colorschemeedit.cpp \
- itexteditor.cpp \
texteditoroverlay.cpp \
texteditoroptionspage.cpp \
basetextdocumentlayout.cpp \
@@ -106,13 +103,12 @@ SOURCES += texteditorplugin.cpp \
codestyleeditor.cpp \
circularclipboard.cpp \
circularclipboardassist.cpp \
- itextmark.cpp \
+ textmark.cpp \
codeassist/keywordscompletionassist.cpp \
marginsettings.cpp
HEADERS += texteditorplugin.h \
textfilewizard.h \
- plaintexteditor.h \
plaintexteditorfactory.h \
basetexteditor_p.h \
basetextdocument.h \
@@ -127,10 +123,8 @@ HEADERS += texteditorplugin.h \
displaysettings.h \
displaysettingspage.h \
fontsettings.h \
- itexteditor.h \
linenumberfilter.h \
texteditor_global.h \
- basetextmark.h \
findinfiles.h \
basefilefind.h \
texteditorsettings.h \
@@ -223,9 +217,9 @@ HEADERS += texteditorplugin.h \
basefilefind_p.h \
circularclipboard.h \
circularclipboardassist.h \
- itextmark.h \
+ textmark.h \
codeassist/keywordscompletionassist.h \
- basetextmarkregistry.h \
+ textmarkregistry.h \
marginsettings.h
FORMS += \
diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs
index c630ae0715..a1455800c9 100644
--- a/src/plugins/texteditor/texteditor.qbs
+++ b/src/plugins/texteditor/texteditor.qbs
@@ -28,9 +28,6 @@ QtcPlugin {
"basetexteditor.cpp",
"basetexteditor.h",
"basetexteditor_p.h",
- "basetextmark.cpp",
- "basetextmark.h",
- "basetextmarkregistry.h",
"behaviorsettings.cpp",
"behaviorsettings.h",
"behaviorsettingspage.cpp",
@@ -91,10 +88,6 @@ QtcPlugin {
"indenter.cpp",
"indenter.h",
"ioutlinewidget.h",
- "itexteditor.cpp",
- "itexteditor.h",
- "itextmark.cpp",
- "itextmark.h",
"linenumberfilter.cpp",
"linenumberfilter.h",
"marginsettings.cpp",
@@ -103,8 +96,6 @@ QtcPlugin {
"normalindenter.h",
"outlinefactory.cpp",
"outlinefactory.h",
- "plaintexteditor.cpp",
- "plaintexteditor.h",
"plaintexteditorfactory.cpp",
"plaintexteditorfactory.h",
"quickfix.cpp",
@@ -144,6 +135,9 @@ QtcPlugin {
"texteditorsettings.h",
"textfilewizard.cpp",
"textfilewizard.h",
+ "textmark.cpp",
+ "textmark.h",
+ "textmarkregistry.h",
"typingsettings.cpp",
"typingsettings.h",
]
diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp
index ab4fb99389..4dc946e3b4 100644
--- a/src/plugins/texteditor/texteditorplugin.cpp
+++ b/src/plugins/texteditor/texteditorplugin.cpp
@@ -37,10 +37,10 @@
#include "texteditorsettings.h"
#include "textfilewizard.h"
#include "plaintexteditorfactory.h"
-#include "plaintexteditor.h"
+#include "basetexteditor.h"
#include "outlinefactory.h"
#include "snippets/plaintextsnippetprovider.h"
-#include "basetextmarkregistry.h"
+#include "textmarkregistry.h"
#include <texteditor/generichighlighter/manager.h>
#include <coreplugin/icore.h>
@@ -190,7 +190,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
m_outlineFactory = new OutlineFactory;
addAutoReleasedObject(m_outlineFactory);
- m_baseTextMarkRegistry = new BaseTextMarkRegistry(this);
+ m_baseTextMarkRegistry = new TextMarkRegistry(this);
return true;
}
@@ -214,7 +214,7 @@ void TextEditorPlugin::extensionsInitialized()
tr("Selected text within the current document."),
[]() -> QString {
QString value;
- if (ITextEditor *editor = ITextEditor::currentTextEditor()) {
+ if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) {
value = editor->selectedText();
value.replace(QChar::ParagraphSeparator, QLatin1String("\n"));
}
@@ -224,35 +224,35 @@ void TextEditorPlugin::extensionsInitialized()
Core::VariableManager::registerIntVariable(kCurrentDocumentRow,
tr("Line number of the text cursor position in current document (starts with 1)."),
[]() -> int {
- ITextEditor *editor = ITextEditor::currentTextEditor();
+ BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->currentLine() : 0;
});
Core::VariableManager::registerIntVariable(kCurrentDocumentColumn,
tr("Column number of the text cursor position in current document (starts with 0)."),
[]() -> int {
- ITextEditor *editor = ITextEditor::currentTextEditor();
+ BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->currentColumn() : 0;
});
Core::VariableManager::registerIntVariable(kCurrentDocumentRowCount,
tr("Number of lines visible in current document."),
[]() -> int {
- ITextEditor *editor = ITextEditor::currentTextEditor();
+ BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->rowCount() : 0;
});
Core::VariableManager::registerIntVariable(kCurrentDocumentColumnCount,
tr("Number of columns visible in current document."),
[]() -> int {
- ITextEditor *editor = ITextEditor::currentTextEditor();
+ BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->columnCount() : 0;
});
Core::VariableManager::registerIntVariable(kCurrentDocumentFontSize,
tr("Current document's font size in points."),
[]() -> int {
- ITextEditor *editor = ITextEditor::currentTextEditor();
+ BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->widget()->font().pointSize() : 0;
});
@@ -271,7 +271,7 @@ LineNumberFilter *TextEditorPlugin::lineNumberFilter()
return m_instance->m_lineNumberFilter;
}
-BaseTextMarkRegistry *TextEditorPlugin::baseTextMarkRegistry()
+TextMarkRegistry *TextEditorPlugin::baseTextMarkRegistry()
{
return m_instance->m_baseTextMarkRegistry;
}
@@ -304,9 +304,9 @@ void TextEditorPlugin::updateSearchResultsFont(const FontSettings &settings)
void TextEditorPlugin::updateCurrentSelection(const QString &text)
{
- if (ITextEditor *editor = qobject_cast<ITextEditor *>(Core::EditorManager::currentEditor())) {
+ if (BaseTextEditor *editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor())) {
const int pos = editor->position();
- int anchor = editor->position(ITextEditor::Anchor);
+ int anchor = editor->position(BaseTextEditor::Anchor);
if (anchor < 0) // no selection
anchor = pos;
int selectionLength = pos - anchor;
diff --git a/src/plugins/texteditor/texteditorplugin.h b/src/plugins/texteditor/texteditorplugin.h
index 82075b989c..853b8d8b07 100644
--- a/src/plugins/texteditor/texteditorplugin.h
+++ b/src/plugins/texteditor/texteditorplugin.h
@@ -37,7 +37,6 @@ namespace Core { class SearchResultWindow; }
namespace TextEditor {
class FontSettings;
-class PlainTextEditorWidget;
class TextEditorSettings;
namespace Internal {
@@ -45,7 +44,7 @@ namespace Internal {
class LineNumberFilter;
class PlainTextEditorFactory;
class OutlineFactory;
-class BaseTextMarkRegistry;
+class TextMarkRegistry;
class TextEditorPlugin : public ExtensionSystem::IPlugin
{
@@ -62,7 +61,7 @@ public:
static PlainTextEditorFactory *editorFactory();
static LineNumberFilter *lineNumberFilter();
- static BaseTextMarkRegistry *baseTextMarkRegistry();
+ static TextMarkRegistry *baseTextMarkRegistry();
private slots:
void invokeCompletion();
@@ -76,7 +75,7 @@ private:
LineNumberFilter *m_lineNumberFilter;
Core::SearchResultWindow *m_searchResultWindow;
OutlineFactory *m_outlineFactory;
- BaseTextMarkRegistry *m_baseTextMarkRegistry;
+ TextMarkRegistry *m_baseTextMarkRegistry;
#ifdef WITH_TESTS
diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp
index 37b9aad28e..274a63a11a 100644
--- a/src/plugins/texteditor/texteditorsettings.cpp
+++ b/src/plugins/texteditor/texteditorsettings.cpp
@@ -337,7 +337,7 @@ void TextEditorSettings::initializeEditor(BaseTextEditorWidget *editor)
{
// Connect to settings change signals
connect(m_instance, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
- editor->baseTextDocument(), SLOT(setFontSettings(TextEditor::FontSettings)));
+ editor->textDocument(), SLOT(setFontSettings(TextEditor::FontSettings)));
connect(m_instance, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
editor, SLOT(setTypingSettings(TextEditor::TypingSettings)));
connect(m_instance, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
@@ -359,8 +359,8 @@ void TextEditorSettings::initializeEditor(BaseTextEditorWidget *editor)
m_instance, SLOT(zoomResetRequested()));
// Apply current settings
- editor->baseTextDocument()->setFontSettings(fontSettings());
- editor->baseTextDocument()->setTabSettings(codeStyle()->tabSettings()); // also set through code style ???
+ editor->textDocument()->setFontSettings(fontSettings());
+ editor->textDocument()->setTabSettings(codeStyle()->tabSettings()); // also set through code style ???
editor->setTypingSettings(typingSettings());
editor->setStorageSettings(storageSettings());
editor->setBehaviorSettings(behaviorSettings());
diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp
new file mode 100644
index 0000000000..033b88b3fa
--- /dev/null
+++ b/src/plugins/texteditor/textmark.cpp
@@ -0,0 +1,261 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "textmark.h"
+#include "basetextdocument.h"
+#include "textmarkregistry.h"
+#include "basetexteditor.h"
+#include "texteditorplugin.h"
+
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/documentmanager.h>
+#include <utils/qtcassert.h>
+
+using namespace Core;
+using namespace Utils;
+using namespace TextEditor::Internal;
+
+namespace TextEditor {
+
+TextMark::TextMark(const QString &fileName, int lineNumber)
+ : m_baseTextDocument(0),
+ m_fileName(fileName),
+ m_lineNumber(lineNumber),
+ m_priority(NormalPriority),
+ m_visible(true),
+ m_widthFactor(1.0)
+{
+ if (!m_fileName.isEmpty())
+ TextEditorPlugin::baseTextMarkRegistry()->add(this);
+}
+
+TextMark::~TextMark()
+{
+ TextEditorPlugin::baseTextMarkRegistry()->remove(this);
+ if (m_baseTextDocument)
+ m_baseTextDocument->removeMark(this);
+ m_baseTextDocument = 0;
+}
+
+QString TextMark::fileName() const
+{
+ return m_fileName;
+}
+
+void TextMark::updateFileName(const QString &fileName)
+{
+ if (fileName == m_fileName)
+ return;
+ if (!m_fileName.isEmpty())
+ TextEditorPlugin::baseTextMarkRegistry()->remove(this);
+ m_fileName = fileName;
+ if (!m_fileName.isEmpty())
+ TextEditorPlugin::baseTextMarkRegistry()->add(this);
+}
+
+int TextMark::lineNumber() const
+{
+ return m_lineNumber;
+}
+
+void TextMark::paint(QPainter *painter, const QRect &rect) const
+{
+ m_icon.paint(painter, rect, Qt::AlignCenter);
+}
+
+void TextMark::updateLineNumber(int lineNumber)
+{
+ m_lineNumber = lineNumber;
+}
+
+void TextMark::move(int line)
+{
+ if (line == m_lineNumber)
+ return;
+ const int previousLine = m_lineNumber;
+ m_lineNumber = line;
+ if (m_baseTextDocument)
+ m_baseTextDocument->moveMark(this, previousLine);
+}
+
+void TextMark::updateBlock(const QTextBlock &)
+{}
+
+void TextMark::removedFromEditor()
+{}
+
+void TextMark::setIcon(const QIcon &icon)
+{
+ m_icon = icon;
+}
+
+void TextMark::updateMarker()
+{
+ if (m_baseTextDocument)
+ m_baseTextDocument->updateMark(this);
+}
+
+void TextMark::setPriority(Priority priority)
+{
+ m_priority = priority;
+}
+
+TextMark::Priority TextMark::priority() const
+{
+ return m_priority;
+}
+
+bool TextMark::isVisible() const
+{
+ return m_visible;
+}
+
+void TextMark::setVisible(bool visible)
+{
+ m_visible = visible;
+ if (m_baseTextDocument)
+ m_baseTextDocument->updateMark(this);
+}
+
+double TextMark::widthFactor() const
+{
+ return m_widthFactor;
+}
+
+void TextMark::setWidthFactor(double factor)
+{
+ m_widthFactor = factor;
+}
+
+bool TextMark::isClickable() const
+{
+ return false;
+}
+
+void TextMark::clicked()
+{}
+
+bool TextMark::isDraggable() const
+{
+ return false;
+}
+
+void TextMark::dragToLine(int lineNumber)
+{
+ Q_UNUSED(lineNumber);
+}
+
+BaseTextDocument *TextMark::baseTextDocument() const
+{
+ return m_baseTextDocument;
+}
+
+void TextMark::setBaseTextDocument(BaseTextDocument *baseTextDocument)
+{
+ m_baseTextDocument = baseTextDocument;
+}
+
+
+TextMarkRegistry::TextMarkRegistry(QObject *parent)
+ : QObject(parent)
+{
+ connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
+ SLOT(editorOpened(Core::IEditor*)));
+
+ connect(DocumentManager::instance(), SIGNAL(allDocumentsRenamed(QString,QString)),
+ this, SLOT(allDocumentsRenamed(QString,QString)));
+ connect(DocumentManager::instance(), SIGNAL(documentRenamed(Core::IDocument*,QString,QString)),
+ this, SLOT(documentRenamed(Core::IDocument*,QString,QString)));
+}
+
+void TextMarkRegistry::add(TextMark *mark)
+{
+ m_marks[FileName::fromString(mark->fileName())].insert(mark);
+ auto document = qobject_cast<BaseTextDocument*>(DocumentModel::documentForFilePath(mark->fileName()));
+ if (!document)
+ return;
+ document->addMark(mark);
+}
+
+bool TextMarkRegistry::remove(TextMark *mark)
+{
+ return m_marks[FileName::fromString(mark->fileName())].remove(mark);
+}
+
+void TextMarkRegistry::editorOpened(Core::IEditor *editor)
+{
+ auto document = qobject_cast<BaseTextDocument *>(editor ? editor->document() : 0);
+ if (!document)
+ return;
+ if (!m_marks.contains(FileName::fromString(document->filePath())))
+ return;
+
+ foreach (TextMark *mark, m_marks.value(FileName::fromString(document->filePath())))
+ document->addMark(mark);
+}
+
+void TextMarkRegistry::documentRenamed(IDocument *document, const
+ QString &oldName, const QString &newName)
+{
+ BaseTextDocument *baseTextDocument = qobject_cast<BaseTextDocument *>(document);
+ if (!document)
+ return;
+ FileName oldFileName = FileName::fromString(oldName);
+ FileName newFileName = FileName::fromString(newName);
+ if (!m_marks.contains(oldFileName))
+ return;
+
+ QSet<TextMark *> toBeMoved;
+ foreach (TextMark *mark, baseTextDocument->marks())
+ toBeMoved.insert(mark);
+
+ m_marks[oldFileName].subtract(toBeMoved);
+ m_marks[newFileName].unite(toBeMoved);
+
+ foreach (TextMark *mark, toBeMoved)
+ mark->updateFileName(newName);
+}
+
+void TextMarkRegistry::allDocumentsRenamed(const QString &oldName, const QString &newName)
+{
+ FileName oldFileName = FileName::fromString(oldName);
+ FileName newFileName = FileName::fromString(newName);
+ if (!m_marks.contains(oldFileName))
+ return;
+
+ QSet<TextMark *> oldFileNameMarks = m_marks.value(oldFileName);
+
+ m_marks[newFileName].unite(oldFileNameMarks);
+ m_marks[oldFileName].clear();
+
+ foreach (TextMark *mark, oldFileNameMarks)
+ mark->updateFileName(newName);
+}
+
+} // namespace TextEditor
diff --git a/src/plugins/texteditor/itextmark.h b/src/plugins/texteditor/textmark.h
index 755696275f..8532aea82b 100644
--- a/src/plugins/texteditor/itextmark.h
+++ b/src/plugins/texteditor/textmark.h
@@ -27,17 +27,15 @@
**
****************************************************************************/
-#ifndef ITEXTMARK_H
-#define ITEXTMARK_H
+#ifndef TextMark_H
+#define TextMark_H
#include "texteditor_global.h"
#include <QObject>
-#include <QList>
#include <QIcon>
QT_BEGIN_NAMESPACE
-class QIcon;
class QPainter;
class QRect;
class QTextBlock;
@@ -45,20 +43,16 @@ QT_END_NAMESPACE
namespace TextEditor {
-class ITextEditor;
-class ITextMarkable;
+class BaseTextEditor;
+class BaseTextDocument;
-class TEXTEDITOR_EXPORT ITextMark
+namespace Internal { class TextMarkRegistry; }
+
+class TEXTEDITOR_EXPORT TextMark
{
public:
- ITextMark(int line)
- : m_markableInterface(0),
- m_lineNumber(line),
- m_priority(NormalPriority),
- m_visible(true),
- m_widthFactor(1.0)
- {}
- virtual ~ITextMark();
+ TextMark(const QString &fileName, int lineNumber);
+ virtual ~TextMark();
// determine order on markers on the same line.
enum Priority
@@ -68,8 +62,12 @@ public:
HighPriority // shown on top.
};
+ QString fileName() const;
int lineNumber() const;
+
virtual void paint(QPainter *painter, const QRect &rect) const;
+ /// called if the filename of the document changed
+ virtual void updateFileName(const QString &fileName);
virtual void updateLineNumber(int lineNumber);
virtual void updateBlock(const QTextBlock &block);
virtual void move(int line);
@@ -89,11 +87,15 @@ public:
double widthFactor() const;
void setWidthFactor(double factor);
- ITextMarkable *markableInterface() const;
- void setMarkableInterface(ITextMarkable *markableInterface);
+ BaseTextDocument *baseTextDocument() const;
+ void setBaseTextDocument(BaseTextDocument *baseTextDocument);
+
private:
- Q_DISABLE_COPY(ITextMark)
- ITextMarkable *m_markableInterface;
+ Q_DISABLE_COPY(TextMark)
+ friend class Internal::TextMarkRegistry;
+
+ BaseTextDocument *m_baseTextDocument;
+ QString m_fileName;
int m_lineNumber;
Priority m_priority;
bool m_visible;
@@ -101,23 +103,6 @@ private:
double m_widthFactor;
};
-typedef QList<ITextMark *> TextMarks;
-
-
-class TEXTEDITOR_EXPORT ITextMarkable : public QObject
-{
- Q_OBJECT
-public:
- ITextMarkable(QObject *parent = 0) : QObject(parent) {}
-
- virtual TextMarks marks() const = 0;
- virtual bool addMark(ITextMark *mark) = 0;
- virtual TextMarks marksAt(int line) const = 0;
- virtual void removeMark(ITextMark *mark) = 0;
- virtual void updateMark(ITextMark *mark) = 0;
- virtual void moveMark(ITextMark *mark, int previousLine) = 0;
-};
-
} // namespace TextEditor
-#endif // ITEXTMARK_H
+#endif // TextMark_H
diff --git a/src/plugins/texteditor/basetextmarkregistry.h b/src/plugins/texteditor/textmarkregistry.h
index ad1174fb63..8e1bb02877 100644
--- a/src/plugins/texteditor/basetextmarkregistry.h
+++ b/src/plugins/texteditor/textmarkregistry.h
@@ -42,23 +42,23 @@ class IDocument;
}
namespace TextEditor {
-class BaseTextMark;
+class TextMark;
namespace Internal {
-class BaseTextMarkRegistry : public QObject
+class TextMarkRegistry : public QObject
{
Q_OBJECT
public:
- BaseTextMarkRegistry(QObject *parent);
+ TextMarkRegistry(QObject *parent);
- void add(BaseTextMark *mark);
- bool remove(BaseTextMark *mark);
+ void add(TextMark *mark);
+ bool remove(TextMark *mark);
private slots:
void editorOpened(Core::IEditor *editor);
void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName);
void allDocumentsRenamed(const QString &oldName, const QString &newName);
private:
- QHash<Utils::FileName, QSet<BaseTextMark *> > m_marks;
+ QHash<Utils::FileName, QSet<TextMark *> > m_marks;
};
} // namespace Internal
diff --git a/src/plugins/valgrind/callgrindtextmark.cpp b/src/plugins/valgrind/callgrindtextmark.cpp
index 8470d50327..389792e496 100644
--- a/src/plugins/valgrind/callgrindtextmark.cpp
+++ b/src/plugins/valgrind/callgrindtextmark.cpp
@@ -44,9 +44,9 @@ using namespace Valgrind::Callgrind;
CallgrindTextMark::CallgrindTextMark(const QPersistentModelIndex &index,
const QString &fileName, int lineNumber)
- : TextEditor::BaseTextMark(fileName, lineNumber), m_modelIndex(index)
+ : TextEditor::TextMark(fileName, lineNumber), m_modelIndex(index)
{
- setPriority(TextEditor::ITextMark::HighPriority);
+ setPriority(TextEditor::TextMark::HighPriority);
setWidthFactor(4.0);
}
diff --git a/src/plugins/valgrind/callgrindtextmark.h b/src/plugins/valgrind/callgrindtextmark.h
index 14f2467a9c..f522040238 100644
--- a/src/plugins/valgrind/callgrindtextmark.h
+++ b/src/plugins/valgrind/callgrindtextmark.h
@@ -30,7 +30,7 @@
#ifndef CALLGRINDTEXTMARK_H
#define CALLGRINDTEXTMARK_H
-#include <texteditor/basetextmark.h>
+#include <texteditor/textmark.h>
#include <QPersistentModelIndex>
@@ -40,7 +40,7 @@ namespace Callgrind { class Function; }
namespace Internal {
-class CallgrindTextMark : public TextEditor::BaseTextMark
+class CallgrindTextMark : public TextEditor::TextMark
{
public:
/**
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index 6c04735e93..81f6036a26 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -57,7 +57,7 @@
#include <cplusplus/LookupContext.h>
#include <cplusplus/Overview.h>
#include <extensionsystem/iplugin.h>
-#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
#include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
@@ -167,7 +167,7 @@ public slots:
void engineFinished();
void editorOpened(Core::IEditor *);
- void requestContextMenu(TextEditor::ITextEditor *editor, int line, QMenu *menu);
+ void requestContextMenu(TextEditor::BaseTextEditor *editor, int line, QMenu *menu);
public:
CallgrindTool *q;
@@ -275,7 +275,7 @@ void CallgrindToolPrivate::doClear(bool clearParseData)
m_filterProjectCosts->setChecked(false);
m_proxyModel->setFilterBaseDir(QString());
if (m_searchFilter)
- m_searchFilter->setText(QString());
+ m_searchFilter->clear();
m_proxyModel->setFilterFixedString(QString());
}
@@ -498,6 +498,8 @@ CallgrindTool::CallgrindTool(QObject *parent)
{
d = new CallgrindToolPrivate(this);
setObjectName(QLatin1String("CallgrindTool"));
+ setRunMode(CallgrindRunMode);
+ setToolMode(ReleaseMode);
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
d, SLOT(editorOpened(Core::IEditor*)));
@@ -508,16 +510,6 @@ CallgrindTool::~CallgrindTool()
delete d;
}
-RunMode CallgrindTool::runMode() const
-{
- return CallgrindRunMode;
-}
-
-IAnalyzerTool::ToolMode CallgrindTool::toolMode() const
-{
- return ReleaseMode;
-}
-
AnalyzerRunControl *CallgrindTool::createRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
{
@@ -872,16 +864,16 @@ void CallgrindToolPrivate::showParserResults(const ParseData *data)
void CallgrindToolPrivate::editorOpened(IEditor *editor)
{
- TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
+ TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
if (!textEditor)
return;
connect(textEditor,
- SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
- SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+ SIGNAL(markContextMenuRequested(TextEditor::BaseTextEditor*,int,QMenu*)),
+ SLOT(requestContextMenu(TextEditor::BaseTextEditor*,int,QMenu*)));
}
-void CallgrindToolPrivate::requestContextMenu(TextEditor::ITextEditor *editor, int line, QMenu *menu)
+void CallgrindToolPrivate::requestContextMenu(TextEditor::BaseTextEditor *editor, int line, QMenu *menu)
{
// find callgrind text mark that corresponds to this editor's file and line number
const Function *func = 0;
@@ -1012,9 +1004,7 @@ void CallgrindToolPrivate::createTextMarks()
continue;
locations << location;
- CallgrindTextMark *mark = new CallgrindTextMark(index, fileName, lineNumber);
- mark->init();
- m_textMarks.append(mark);
+ m_textMarks.append(new CallgrindTextMark(index, fileName, lineNumber));
}
}
diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h
index 8aa5b85972..e0c8829868 100644
--- a/src/plugins/valgrind/callgrindtool.h
+++ b/src/plugins/valgrind/callgrindtool.h
@@ -45,9 +45,6 @@ public:
CallgrindTool(QObject *parent);
~CallgrindTool();
- ProjectExplorer::RunMode runMode() const;
- ToolMode toolMode() const;
-
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
QWidget *createWidgets();
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index d83b1cb826..67a40c38f3 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -193,7 +193,10 @@ MemcheckTool::MemcheckTool(QObject *parent)
m_errorProxyModel = 0;
m_errorView = 0;
m_filterMenu = 0;
+
setObjectName(QLatin1String("MemcheckTool"));
+ setRunMode(MemcheckRunMode);
+ setToolMode(DebugMode);
m_filterProjectAction = new QAction(tr("External Errors"), this);
m_filterProjectAction->setToolTip(
@@ -284,16 +287,6 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
updateFromSettings();
}
-RunMode MemcheckTool::runMode() const
-{
- return MemcheckRunMode;
-}
-
-IAnalyzerTool::ToolMode MemcheckTool::toolMode() const
-{
- return DebugMode;
-}
-
class FrameFinder : public ErrorListModel::RelevantFrameFinder
{
public:
diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h
index 615e9b9515..904073befb 100644
--- a/src/plugins/valgrind/memchecktool.h
+++ b/src/plugins/valgrind/memchecktool.h
@@ -81,8 +81,6 @@ class MemcheckTool : public ValgrindTool
public:
MemcheckTool(QObject *parent);
- ProjectExplorer::RunMode runMode() const;
-
private slots:
void settingsDestroyed(QObject *settings);
void maybeActiveRunConfigurationChanged();
@@ -99,7 +97,6 @@ private slots:
void loadExternalXmlLogFile();
private:
- ToolMode toolMode() const;
QWidget *createWidgets();
void setBusyCursor(bool busy);
diff --git a/src/plugins/vcsbase/basevcseditorfactory.cpp b/src/plugins/vcsbase/basevcseditorfactory.cpp
index baca25d3cc..39c1d0a43c 100644
--- a/src/plugins/vcsbase/basevcseditorfactory.cpp
+++ b/src/plugins/vcsbase/basevcseditorfactory.cpp
@@ -88,7 +88,7 @@ Core::IEditor *BaseVcsEditorFactory::createEditor()
connect(vcsEditor, SIGNAL(describeRequested(QString,QString)), d->m_describeReceiver, d->m_describeSlot);
if (!mimeTypes().isEmpty())
- vcsEditor->baseTextDocument()->setMimeType(mimeTypes().front());
+ vcsEditor->textDocument()->setMimeType(mimeTypes().front());
TextEditor::TextEditorSettings::initializeEditor(vcsEditor);
return vcsEditor->editor();
diff --git a/src/plugins/vcsbase/command.cpp b/src/plugins/vcsbase/command.cpp
index e2cb27f468..39161a2baf 100644
--- a/src/plugins/vcsbase/command.cpp
+++ b/src/plugins/vcsbase/command.cpp
@@ -86,12 +86,12 @@ public:
Utils::ExitCodeInterpreter *exitCodeInterpreter;
};
- CommandPrivate(const QString &binary,
+ CommandPrivate(const Utils::FileName &binary,
const QString &workingDirectory,
const QProcessEnvironment &environment);
~CommandPrivate();
- const QString m_binaryPath;
+ const Utils::FileName m_binaryPath;
const QString m_workingDirectory;
const QProcessEnvironment m_environment;
QVariant m_cookie;
@@ -113,7 +113,7 @@ public:
int m_lastExecExitCode;
};
-CommandPrivate::CommandPrivate(const QString &binary,
+CommandPrivate::CommandPrivate(const Utils::FileName &binary,
const QString &workingDirectory,
const QProcessEnvironment &environment) :
m_binaryPath(binary),
@@ -151,7 +151,7 @@ CommandPrivate::Job::Job(const QStringList &a, int t, Utils::ExitCodeInterpreter
} // namespace Internal
-Command::Command(const QString &binary,
+Command::Command(const Utils::FileName &binary,
const QString &workingDirectory,
const QProcessEnvironment &environment) :
d(new Internal::CommandPrivate(binary, workingDirectory, environment))
@@ -165,7 +165,7 @@ Command::~Command()
delete d;
}
-const QString &Command::binaryPath() const
+const Utils::FileName &Command::binaryPath() const
{
return d->m_binaryPath;
}
@@ -222,7 +222,7 @@ void Command::execute()
QFuture<void> task = QtConcurrent::run(&Command::run, this);
d->m_watcher.setFuture(task);
connect(&d->m_watcher, SIGNAL(canceled()), this, SLOT(cancel()));
- QString binary = QFileInfo(d->m_binaryPath).baseName();
+ QString binary = d->m_binaryPath.toFileInfo().baseName();
if (!binary.isEmpty())
binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter
const QString taskName = binary + QLatin1Char(' ') + d->m_jobs.front().arguments.at(0);
@@ -255,7 +255,7 @@ int Command::lastExecutionExitCode() const
void Command::run(QFutureInterface<void> &future)
{
// Check that the binary path is not empty
- if (binaryPath().trimmed().isEmpty()) {
+ if (binaryPath().isEmpty()) {
emit errorText(tr("Unable to start process, binary is empty"));
return;
}
@@ -319,8 +319,8 @@ public:
connect(this, SIGNAL(append(QString)), outputWindow, SLOT(append(QString)));
connect(this, SIGNAL(appendSilently(QString)), outputWindow, SLOT(appendSilently(QString)));
connect(this, SIGNAL(appendError(QString)), outputWindow, SLOT(appendError(QString)));
- connect(this, SIGNAL(appendCommand(QString,QString,QStringList)),
- outputWindow, SLOT(appendCommand(QString,QString,QStringList)));
+ connect(this, SIGNAL(appendCommand(QString,Utils::FileName,QStringList)),
+ outputWindow, SLOT(appendCommand(QString,Utils::FileName,QStringList)));
connect(this, SIGNAL(appendMessage(QString)), outputWindow, SLOT(appendMessage(QString)));
}
@@ -329,7 +329,7 @@ signals:
void appendSilently(const QString &text);
void appendError(const QString &text);
void appendCommand(const QString &workingDirectory,
- const QString &binary,
+ const Utils::FileName &binary,
const QStringList &args);
void appendMessage(const QString &text);
};
@@ -420,16 +420,19 @@ Utils::SynchronousProcessResponse Command::runVcs(const QStringList &arguments,
process.setTimeOutMessageBoxEnabled(true);
// Run!
- response = process.run(d->m_binaryPath, arguments);
+ response = process.run(d->m_binaryPath.toString(), arguments);
}
if (!d->m_aborted) {
// Success/Fail message in appropriate window?
if (response.result == Utils::SynchronousProcessResponse::Finished) {
- if (d->m_flags & VcsBasePlugin::ShowSuccessMessage)
- emit outputProxy.appendMessage(response.exitMessage(d->m_binaryPath, timeoutMS));
+ if (d->m_flags & VcsBasePlugin::ShowSuccessMessage) {
+ emit outputProxy.appendMessage(response.exitMessage(d->m_binaryPath.toUserOutput(),
+ timeoutMS));
+ }
} else if (!(d->m_flags & VcsBasePlugin::SuppressFailMessageInLogWindow)) {
- emit outputProxy.appendError(response.exitMessage(d->m_binaryPath, timeoutMS));
+ emit outputProxy.appendError(response.exitMessage(d->m_binaryPath.toUserOutput(),
+ timeoutMS));
}
}
emitRepositoryChanged();
@@ -458,7 +461,7 @@ Utils::SynchronousProcessResponse Command::runSynchronous(const QStringList &arg
process->setProcessChannelMode(QProcess::MergedChannels);
// Start
- process->start(d->m_binaryPath, arguments, QIODevice::ReadOnly);
+ process->start(d->m_binaryPath.toString(), arguments, QIODevice::ReadOnly);
process->closeWriteChannel();
if (!process->waitForStarted()) {
response.result = Utils::SynchronousProcessResponse::StartFailed;
@@ -531,12 +534,12 @@ bool Command::runFullySynchronous(const QStringList &arguments, int timeoutMS,
process.setWorkingDirectory(d->m_workingDirectory);
process.setProcessEnvironment(d->m_environment);
- process.start(d->m_binaryPath, arguments);
+ process.start(d->m_binaryPath.toString(), arguments);
process.closeWriteChannel();
if (!process.waitForStarted()) {
if (errorData) {
const QString msg = QString::fromLatin1("Unable to execute \"%1\": %2:")
- .arg(d->m_binaryPath, process.errorString());
+ .arg(d->m_binaryPath.toUserOutput(), process.errorString());
*errorData = msg.toLocal8Bit();
}
return false;
diff --git a/src/plugins/vcsbase/command.h b/src/plugins/vcsbase/command.h
index ae4c6be560..cde50a7b62 100644
--- a/src/plugins/vcsbase/command.h
+++ b/src/plugins/vcsbase/command.h
@@ -32,6 +32,7 @@
#include "vcsbase_global.h"
+#include <utils/fileutils.h>
#include <utils/synchronousprocess.h>
#include <QObject>
@@ -72,7 +73,7 @@ class VCSBASE_EXPORT Command : public QObject
Q_OBJECT
public:
- Command(const QString &binary,
+ Command(const Utils::FileName &binary,
const QString &workingDirectory,
const QProcessEnvironment &environment);
~Command();
@@ -84,7 +85,7 @@ public:
bool lastExecutionSuccess() const;
int lastExecutionExitCode() const;
- const QString &binaryPath() const;
+ const Utils::FileName &binaryPath() const;
const QString &workingDirectory() const;
const QProcessEnvironment &processEnvironment() const;
diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp
index 60d0d625b0..8ca2a27780 100644
--- a/src/plugins/vcsbase/vcsbaseclient.cpp
+++ b/src/plugins/vcsbase/vcsbaseclient.cpp
@@ -283,15 +283,15 @@ bool VcsBaseClient::vcsFullySynchronousExec(const QString &workingDir,
vcsProcess.setWorkingDirectory(workingDir);
vcsProcess.setProcessEnvironment(processEnvironment());
- const QString binary = settings()->binaryPath();
+ const Utils::FileName binary = settings()->binaryPath();
::vcsOutputWindow()->appendCommand(workingDir, binary, args);
- vcsProcess.start(binary, args);
+ vcsProcess.start(binary.toString(), args);
if (!vcsProcess.waitForStarted()) {
::vcsOutputWindow()->appendError(tr("Unable to start process \"%1\": %2")
- .arg(QDir::toNativeSeparators(binary), vcsProcess.errorString()));
+ .arg(binary.toUserOutput(), vcsProcess.errorString()));
return false;
}
@@ -303,7 +303,7 @@ bool VcsBaseClient::vcsFullySynchronousExec(const QString &workingDir,
output, &stdErr, true)) {
Utils::SynchronousProcess::stopProcess(vcsProcess);
::vcsOutputWindow()->appendError(tr("Timed out after %1s waiting for the process %2 to finish.")
- .arg(timeoutSec).arg(binary));
+ .arg(timeoutSec).arg(binary.toUserOutput()));
return false;
}
if (!stdErr.isEmpty())
@@ -318,10 +318,10 @@ Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec(
unsigned flags,
QTextCodec *outputCodec) const
{
- const QString binary = settings()->binaryPath();
+ const Utils::FileName binary = settings()->binaryPath();
const int timeoutSec = settings()->intValue(VcsBaseClientSettings::timeoutKey);
- return VcsBase::VcsBasePlugin::runVcs(workingDirectory, binary, args, timeoutSec * 1000,
- flags, outputCodec);
+ return VcsBase::VcsBasePlugin::runVcs(workingDirectory, binary, args,
+ timeoutSec * 1000, flags, outputCodec);
}
void VcsBaseClient::annotate(const QString &workingDir, const QString &file,
@@ -555,8 +555,8 @@ VcsBaseEditorParameterWidget *VcsBaseClient::createLogEditor(const QString &work
QString VcsBaseClient::vcsEditorTitle(const QString &vcsCmd, const QString &sourceId) const
{
- const QString binary = settings()->binaryPath();
- return QFileInfo(binary).baseName() +
+ const Utils::FileName binary = settings()->binaryPath();
+ return binary.toFileInfo().baseName() +
QLatin1Char(' ') + vcsCmd + QLatin1Char(' ') +
QFileInfo(sourceId).fileName();
}
@@ -602,8 +602,8 @@ Command *VcsBaseClient::createCommand(const QString &workingDirectory,
VcsBase::VcsBaseEditorWidget *editor,
JobOutputBindMode mode) const
{
- Command *cmd = new Command(d->m_clientSettings->binaryPath(),
- workingDirectory, processEnvironment());
+ Command *cmd = new Command(d->m_clientSettings->binaryPath(), workingDirectory,
+ processEnvironment());
cmd->setDefaultTimeout(d->m_clientSettings->intValue(VcsBaseClientSettings::timeoutKey));
if (editor)
d->bindCommandToEditor(cmd, editor);
diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.cpp b/src/plugins/vcsbase/vcsbaseclientsettings.cpp
index 377e288d39..6260971299 100644
--- a/src/plugins/vcsbase/vcsbaseclientsettings.cpp
+++ b/src/plugins/vcsbase/vcsbaseclientsettings.cpp
@@ -30,6 +30,7 @@
#include "vcsbaseclientsettings.h"
#include <utils/environment.h>
+#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
@@ -177,7 +178,7 @@ public:
QHash<QString, SettingValue> m_valueHash;
QVariantHash m_defaultValueHash;
QString m_settingsGroup;
- mutable QString m_binaryFullPath;
+ mutable Utils::FileName m_binaryFullPath;
};
} // namespace Internal
@@ -353,7 +354,7 @@ QVariant::Type VcsBaseClientSettings::valueType(const QString &key) const
return QVariant::Invalid;
}
-QString VcsBaseClientSettings::binaryPath() const
+Utils::FileName VcsBaseClientSettings::binaryPath() const
{
if (d->m_binaryFullPath.isEmpty()) {
d->m_binaryFullPath = Utils::Environment::systemEnvironment().searchInPath(
diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.h b/src/plugins/vcsbase/vcsbaseclientsettings.h
index d87fd8004b..dc9c45eec6 100644
--- a/src/plugins/vcsbase/vcsbaseclientsettings.h
+++ b/src/plugins/vcsbase/vcsbaseclientsettings.h
@@ -32,6 +32,8 @@
#include "vcsbase_global.h"
+#include <utils/fileutils.h>
+
#include <QStringList>
#include <QVariant>
#include <QSharedDataPointer>
@@ -81,7 +83,7 @@ public:
void setValue(const QString &key, const QVariant &v);
QVariant::Type valueType(const QString &key) const;
- QString binaryPath() const;
+ Utils::FileName binaryPath() const;
QStringList searchPathList() const;
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index 0616329a0e..54d5a87a13 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -614,7 +614,8 @@ QComboBox *VcsBaseEditorWidgetPrivate::entriesComboBox()
policy.setHorizontalPolicy(QSizePolicy::Expanding);
m_entriesComboBox->setSizePolicy(policy);
- m_editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_entriesComboBox);
+ m_editor->editorWidget()->insertExtraToolBarWidget
+ (TextEditor::BaseTextEditorWidget::Left, m_entriesComboBox);
return m_entriesComboBox;
}
@@ -648,12 +649,12 @@ QComboBox *VcsBaseEditorWidgetPrivate::entriesComboBox()
*/
VcsBaseEditorWidget::VcsBaseEditorWidget(const VcsBaseEditorParameters *type, QWidget *parent)
- : BaseTextEditorWidget(parent),
+ : BaseTextEditorWidget(new TextEditor::BaseTextDocument, parent),
d(new Internal::VcsBaseEditorWidgetPrivate(this, type))
{
viewport()->setMouseTracking(true);
- baseTextDocument()->setId(type->id);
- baseTextDocument()->setMimeType(QLatin1String(d->m_parameters->mimeType));
+ textDocument()->setId(type->id);
+ textDocument()->setMimeType(QLatin1String(d->m_parameters->mimeType));
}
void VcsBaseEditorWidget::setDiffFilePattern(const QRegExp &pattern)
@@ -710,7 +711,7 @@ void VcsBaseEditorWidget::init()
if (hasDiff()) {
DiffHighlighter *dh = new DiffHighlighter(d->m_diffFilePattern);
setCodeFoldingSupported(true);
- baseTextDocument()->setSyntaxHighlighter(dh);
+ textDocument()->setSyntaxHighlighter(dh);
}
TextEditor::TextEditorSettings::initializeEditor(this);
// override revisions display (green or red bar on the left, marking changes):
@@ -733,12 +734,12 @@ void VcsBaseEditorWidget::setForceReadOnly(bool b)
QString VcsBaseEditorWidget::source() const
{
- return VcsBasePlugin::source(baseTextDocument());
+ return VcsBasePlugin::source(textDocument());
}
void VcsBaseEditorWidget::setSource(const QString &source)
{
- VcsBasePlugin::setSource(baseTextDocument(), source);
+ VcsBasePlugin::setSource(textDocument(), source);
}
QString VcsBaseEditorWidget::annotateRevisionTextFormat() const
@@ -793,13 +794,13 @@ void VcsBaseEditorWidget::setWorkingDirectory(const QString &wd)
QTextCodec *VcsBaseEditorWidget::codec() const
{
- return const_cast<QTextCodec *>(baseTextDocument()->codec());
+ return const_cast<QTextCodec *>(textDocument()->codec());
}
void VcsBaseEditorWidget::setCodec(QTextCodec *c)
{
if (c)
- baseTextDocument()->setCodec(c);
+ textDocument()->setCodec(c);
else
qWarning("%s: Attempt to set 0 codec.", Q_FUNC_INFO);
}
@@ -1053,11 +1054,11 @@ void VcsBaseEditorWidget::slotActivateAnnotation()
disconnect(this, SIGNAL(textChanged()), this, SLOT(slotActivateAnnotation()));
- if (BaseAnnotationHighlighter *ah = qobject_cast<BaseAnnotationHighlighter *>(baseTextDocument()->syntaxHighlighter())) {
+ if (BaseAnnotationHighlighter *ah = qobject_cast<BaseAnnotationHighlighter *>(textDocument()->syntaxHighlighter())) {
ah->setChangeNumbers(changes);
ah->rehighlight();
} else {
- baseTextDocument()->setSyntaxHighlighter(createAnnotationHighlighter(changes));
+ textDocument()->setSyntaxHighlighter(createAnnotationHighlighter(changes));
}
}
@@ -1135,7 +1136,7 @@ void VcsBaseEditorWidget::jumpToChangeFromDiff(QTextCursor cursor)
return;
Core::IEditor *ed = Core::EditorManager::openEditor(fileName);
- if (TextEditor::ITextEditor *editor = qobject_cast<TextEditor::ITextEditor *>(ed))
+ if (TextEditor::BaseTextEditor *editor = qobject_cast<TextEditor::BaseTextEditor *>(ed))
editor->gotoLine(chunkStart + lineCount);
}
@@ -1174,7 +1175,7 @@ DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const
unicode += QLatin1Char('\n');
}
}
- const QTextCodec *cd = baseTextDocument()->codec();
+ const QTextCodec *cd = textDocument()->codec();
rc.chunk = cd ? cd->fromUnicode(unicode) : unicode.toLocal8Bit();
rc.header = cd ? cd->fromUnicode(header) : header.toLocal8Bit();
return rc;
@@ -1186,7 +1187,7 @@ void VcsBaseEditorWidget::reportCommandFinished(bool ok, int exitCode, const QVa
Q_UNUSED(data);
if (!ok)
- baseTextDocument()->setPlainText(tr("Failed to retrieve data."));
+ textDocument()->setPlainText(tr("Failed to retrieve data."));
}
const VcsBaseEditorParameters *VcsBaseEditorWidget::findType(const VcsBaseEditorParameters *array,
@@ -1337,7 +1338,7 @@ bool VcsBaseEditorWidget::setConfigurationWidget(VcsBaseEditorParameterWidget *w
return false;
d->m_configurationWidget = w;
- d->m_editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Right, w);
+ d->m_editor->editorWidget()->insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Right, w);
return true;
}
@@ -1583,7 +1584,7 @@ void VcsBase::VcsBaseEditorWidget::testLogResolving(QByteArray &data,
const QByteArray &entry2)
{
init();
- baseTextDocument()->setPlainText(QLatin1String(data));
+ textDocument()->setPlainText(QLatin1String(data));
QCOMPARE(d->entriesComboBox()->itemText(0), QString::fromLatin1(entry1));
QCOMPARE(d->entriesComboBox()->itemText(1), QString::fromLatin1(entry2));
}
diff --git a/src/plugins/vcsbase/vcsbaseoutputwindow.cpp b/src/plugins/vcsbase/vcsbaseoutputwindow.cpp
index be9413f694..935e22c5b9 100644
--- a/src/plugins/vcsbase/vcsbaseoutputwindow.cpp
+++ b/src/plugins/vcsbase/vcsbaseoutputwindow.cpp
@@ -31,6 +31,7 @@
#include <coreplugin/editormanager/editormanager.h>
+#include <utils/fileutils.h>
#include <utils/outputformatter.h>
#include <QPlainTextEdit>
@@ -453,11 +454,11 @@ static inline QString formatArguments(const QStringList &args)
}
QString VcsBaseOutputWindow::msgExecutionLogEntry(const QString &workingDir,
- const QString &executable,
+ const Utils::FileName &executable,
const QStringList &arguments)
{
const QString args = formatArguments(arguments);
- const QString nativeExecutable = QDir::toNativeSeparators(executable);
+ const QString nativeExecutable = executable.toUserOutput();
if (workingDir.isEmpty())
return tr("Executing: %1 %2").arg(nativeExecutable, args) + QLatin1Char('\n');
return tr("Executing in %1: %2 %3").
@@ -470,7 +471,7 @@ void VcsBaseOutputWindow::appendCommand(const QString &text)
}
void VcsBaseOutputWindow::appendCommand(const QString &workingDirectory,
- const QString &binary,
+ const Utils::FileName &binary,
const QStringList &args)
{
appendCommand(msgExecutionLogEntry(workingDirectory, binary, args));
diff --git a/src/plugins/vcsbase/vcsbaseoutputwindow.h b/src/plugins/vcsbase/vcsbaseoutputwindow.h
index 84fa6999bb..0f52426a76 100644
--- a/src/plugins/vcsbase/vcsbaseoutputwindow.h
+++ b/src/plugins/vcsbase/vcsbaseoutputwindow.h
@@ -34,6 +34,8 @@
#include <coreplugin/ioutputpane.h>
+#include <utils/fileutils.h>
+
namespace VcsBase {
class VcsBaseOutputWindowPrivate;
@@ -73,7 +75,7 @@ public:
// 'Executing <dir>: <cmd> <args>'. Hides well-known password option
// arguments.
static QString msgExecutionLogEntry(const QString &workingDir,
- const QString &executable,
+ const Utils::FileName &executable,
const QStringList &arguments);
enum MessageStyle {
@@ -112,7 +114,7 @@ public slots:
// Append a standard-formatted entry for command execution
// (see msgExecutionLogEntry).
void appendCommand(const QString &workingDirectory,
- const QString &binary,
+ const Utils::FileName &binary,
const QStringList &args);
// Append a blue message text and pop up.
diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp
index 479e5823b5..5db0cf47a8 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.cpp
+++ b/src/plugins/vcsbase/vcsbaseplugin.cpp
@@ -770,7 +770,7 @@ void VcsBasePlugin::setProcessEnvironment(QProcessEnvironment *e,
// Run a process synchronously, returning Utils::SynchronousProcessResponse
// response struct and using the VcsBasePlugin flags as applicable
SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir,
- const QString &binary,
+ const Utils::FileName &binary,
const QStringList &arguments,
int timeOutMS,
unsigned flags,
diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h
index bd5c241da0..99ca9eca4f 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.h
+++ b/src/plugins/vcsbase/vcsbaseplugin.h
@@ -33,6 +33,7 @@
#include "vcsbase_global.h"
#include <extensionsystem/iplugin.h>
+#include <utils/fileutils.h>
#include <QSharedDataPointer>
#include <QList>
@@ -180,7 +181,7 @@ public:
};
static Utils::SynchronousProcessResponse runVcs(const QString &workingDir,
- const QString &binary,
+ const Utils::FileName &binary,
const QStringList &arguments,
int timeOutMS,
unsigned flags = 0,
diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.cpp b/src/plugins/winrt/winrtpackagedeploymentstep.cpp
index 409719d492..f5aa28c2e5 100644
--- a/src/plugins/winrt/winrtpackagedeploymentstep.cpp
+++ b/src/plugins/winrt/winrtpackagedeploymentstep.cpp
@@ -96,7 +96,7 @@ bool WinRtPackageDeploymentStep::init()
raiseError(tr("Cannot parse manifest file %1.").arg(fullManifestPath));
return false;
}
- foreach (QString icon, iconsToDeploy) {
+ foreach (const QString &icon, iconsToDeploy) {
m_mappingFileContent += QLatin1Char('"')
+ QDir::toNativeSeparators(targetDir + icon) + QLatin1String("\" \"")
+ QDir::toNativeSeparators(icon) + QLatin1String("\"\n");
diff --git a/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp b/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp
index 2f986a4bd5..2db66cf274 100644
--- a/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp
+++ b/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp
@@ -99,7 +99,7 @@ SystemPreprocessor::SystemPreprocessor(bool verbose)
QMapIterator<QString, QString> i(m_knownCompilers);
while (i.hasNext()) {
i.next();
- const QString executablePath
+ const Utils::FileName executablePath
= Utils::Environment::systemEnvironment().searchInPath(i.key());
if (!executablePath.isEmpty()) {
m_compiler = i.key();
diff --git a/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri b/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri
index 4982a84335..07ac4e645c 100644
--- a/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri
+++ b/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri
@@ -7,8 +7,16 @@ DEFINES += QTCREATOR_UTILS_STATIC_LIB
HEADERS += \
$$PWD/cplusplus-tools-utils.h \
- $$PWD/../../libs/utils/environment.h
+ $$PWD/../../libs/utils/environment.h \
+ $$PWD/../../libs/utils/fileutils.h \
+ $$PWD/../../libs/utils/qtcassert.h \
+ $$PWD/../../libs/utils/savefile.h
SOURCES += \
$$PWD/cplusplus-tools-utils.cpp \
- $$PWD/../../libs/utils/environment.cpp
+ $$PWD/../../libs/utils/environment.cpp \
+ $$PWD/../../libs/utils/fileutils.cpp \
+ $$PWD/../../libs/utils/qtcassert.cpp \
+ $$PWD/../../libs/utils/savefile.cpp
+
+win32:LIBS += -luser32 -lshell32
diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg
index 9f5e4f1fee..d9ae51a58e 100644
--- a/src/tools/icons/qtcreatoricons.svg
+++ b/src/tools/icons/qtcreatoricons.svg
@@ -19,6 +19,92 @@
<defs
id="defs4">
<linearGradient
+ id="linearGradient4115">
+ <stop
+ style="stop-color:#373737;stop-opacity:0.07843138;"
+ offset="0"
+ id="stop4117" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.27450982;"
+ offset="1"
+ id="stop4119" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4090">
+ <stop
+ style="stop-color:#070707;stop-opacity:0.30980393;"
+ offset="0"
+ id="stop4092" />
+ <stop
+ id="stop4099"
+ offset="0.875"
+ style="stop-color:#303030;stop-opacity:0.2;" />
+ <stop
+ style="stop-color:#2f2f2f;stop-opacity:0.25098041;"
+ offset="1"
+ id="stop4094" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4072">
+ <stop
+ id="stop4074"
+ offset="0"
+ style="stop-color:#7c7c7c;stop-opacity:1;" />
+ <stop
+ id="stop4076"
+ offset="1"
+ style="stop-color:#5b5b5b;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4096">
+ <stop
+ style="stop-color:#a5a5a5;stop-opacity:1;"
+ offset="0"
+ id="stop4098" />
+ <stop
+ id="stop4100"
+ offset="0.5"
+ style="stop-color:#b0b0b0;stop-opacity:1;" />
+ <stop
+ id="stop4102"
+ offset="0.5"
+ style="stop-color:#bababa;stop-opacity:1;" />
+ <stop
+ style="stop-color:#e2e2e2;stop-opacity:1;"
+ offset="1"
+ id="stop4104" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4144">
+ <stop
+ id="stop4146"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0.5"
+ id="stop4152" />
+ <stop
+ style="stop-color:#f3f3f3;stop-opacity:1;"
+ offset="0.5"
+ id="stop4150" />
+ <stop
+ id="stop4148"
+ offset="1"
+ style="stop-color:#e2e2e2;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4132">
+ <stop
+ style="stop-color:#8f8f8f;stop-opacity:1;"
+ offset="0"
+ id="stop4134" />
+ <stop
+ style="stop-color:#6f6f6f;stop-opacity:1;"
+ offset="1"
+ id="stop4136" />
+ </linearGradient>
+ <linearGradient
id="linearGradient3975">
<stop
id="stop3977"
@@ -52,17 +138,6 @@
id="stop3873" />
</linearGradient>
<linearGradient
- id="linearGradient4880">
- <stop
- style="stop-color:#000000;stop-opacity:0.19607843;"
- offset="0"
- id="stop4882" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop4884" />
- </linearGradient>
- <linearGradient
id="linearGradient4482">
<stop
style="stop-color:#fa3e3e;stop-opacity:1;"
@@ -279,15 +354,6 @@
fx="84"
fy="592"
r="6" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient4880"
- id="linearGradient4572"
- gradientUnits="userSpaceOnUse"
- x1="212"
- y1="590"
- x2="216"
- y2="590" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3975"
@@ -386,6 +452,135 @@
x="218"
y="568" />
</clipPath>
+ <filter
+ id="filter4057"
+ inkscape:label="Inner Shadow"
+ inkscape:menu="Shadows and Glows"
+ inkscape:menu-tooltip="Adds a colorizable drop shadow inside"
+ color-interpolation-filters="sRGB">
+ <feGaussianBlur
+ id="feGaussianBlur4059"
+ stdDeviation="1.5"
+ result="result8" />
+ <feOffset
+ id="feOffset4061"
+ dx="0"
+ dy="2"
+ result="result11" />
+ <feComposite
+ id="feComposite4063"
+ in2="result11"
+ result="result6"
+ in="SourceGraphic"
+ operator="in" />
+ <feFlood
+ id="feFlood4065"
+ result="result10"
+ in="result6"
+ flood-opacity="1"
+ flood-color="rgb(0,0,0)" />
+ <feBlend
+ id="feBlend4067"
+ in2="result10"
+ mode="normal"
+ in="result6"
+ result="result12" />
+ <feComposite
+ id="feComposite4069"
+ in2="SourceGraphic"
+ result="result2"
+ operator="atop" />
+ </filter>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath3231">
+ <rect
+ style="opacity:0.2;fill:#00ff00;fill-opacity:0.8;stroke:none"
+ id="rect3234"
+ width="16"
+ height="16"
+ x="211"
+ y="584" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4007">
+ <rect
+ style="fill:none"
+ id="rect4009"
+ width="16"
+ height="16"
+ x="0"
+ y="584" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4026">
+ <rect
+ y="568"
+ x="233"
+ height="16"
+ width="16"
+ id="rect4028"
+ style="fill:none" />
+ </clipPath>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4132"
+ id="linearGradient4138"
+ x1="74"
+ y1="502.5"
+ x2="74"
+ y2="517.5"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4144"
+ id="linearGradient4142"
+ gradientUnits="userSpaceOnUse"
+ x1="74"
+ y1="502.5"
+ x2="74"
+ y2="517.5"
+ gradientTransform="translate(8,0)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4096"
+ id="linearGradient4111"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(120,0)"
+ x1="74"
+ y1="502.5"
+ x2="74"
+ y2="517.5" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4072"
+ id="linearGradient4078"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.35294118,0,0,1,162.05882,0)"
+ x1="74"
+ y1="502.5"
+ x2="74"
+ y2="517.5" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4090"
+ id="linearGradient4128"
+ gradientUnits="userSpaceOnUse"
+ x1="181"
+ y1="589.5"
+ x2="181"
+ y2="597.5" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4115"
+ id="linearGradient4130"
+ gradientUnits="userSpaceOnUse"
+ x1="181"
+ y1="587"
+ x2="181"
+ y2="599" />
</defs>
<sodipodi:namedview
id="base"
@@ -394,11 +589,11 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="16"
- inkscape:cx="193.42734"
- inkscape:cy="26.302703"
+ inkscape:zoom="1"
+ inkscape:cx="381.31904"
+ inkscape:cy="185.84959"
inkscape:document-units="px"
- inkscape:current-layer="src/plugins/coreplugin/images/unlocked"
+ inkscape:current-layer="layer1"
showgrid="true"
showguides="true"
inkscape:guide-bbox="true"
@@ -460,35 +655,51 @@
</rdf:RDF>
</metadata>
<g
+ id="transparencyChecker"
+ transform="translate(-224,50)"
+ inkscape:label="#g4101">
+ <rect
+ y="418"
+ x="200"
+ height="32"
+ width="8"
+ id="rect3327"
+ style="fill:#ff0000;fill-opacity:1;stroke:none" />
+ <rect
+ style="fill:#0000ff;fill-opacity:1;stroke:none"
+ id="rect4099"
+ width="8"
+ height="32"
+ x="216"
+ y="418" />
+ <rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none"
+ id="rect4108"
+ width="8"
+ height="32"
+ x="192"
+ y="418" />
+ <rect
+ y="418"
+ x="184"
+ height="32"
+ width="8"
+ id="rect4110"
+ style="fill:#000000;fill-opacity:1;stroke:none" />
+ <rect
+ y="418"
+ x="208"
+ height="32"
+ width="8"
+ id="rect4112"
+ style="fill:#00ff00;fill-opacity:1;stroke:none" />
+ </g>
+ <g
inkscape:label="Other icons"
inkscape:groupmode="layer"
id="layer1"
style="display:inline">
<g
- id="src/plugins/coreplugin/images/arrowdown">
- <rect
- y="583.99994"
- x="0"
- height="16"
- width="16"
- id="rect3817"
- style="fill:none" />
- <path
- style="fill:none;stroke:#bdbdbd;stroke-width:1.42;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- d="M 2.5,588.5 8,594 13.5,588.5"
- id="path3970"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccc" />
- </g>
- <use
- x="0"
- y="0"
- xlink:href="#src/plugins/coreplugin/images/arrowdown"
- id="src/plugins/coreplugin/images/arrowup"
- transform="matrix(1,0,0,-1,16,1183.9999)"
- width="800"
- height="600" />
- <g
id="src/plugins/coreplugin/images/clear">
<rect
id="rect3855-7"
@@ -586,31 +797,31 @@
y="584" />
</g>
<g
- style="display:inline"
- id="src/plugins/coreplugin/images/sidebaricon"
- clip-path="url(#clipPath3237)"
- transform="translate(-142,16)">
- <use
- height="600"
- width="800"
- transform="matrix(0,-1,1,0,-351,785)"
- id="use3223"
- xlink:href="#rect3233"
- y="0"
- x="0" />
+ id="src/plugins/coreplugin/images/progressbar">
<rect
- style="fill:none;stroke:none"
- id="rect3216"
- width="16"
- height="16"
- x="218"
- y="568" />
- <path
- id="rect3241-1"
- style="fill:none;stroke:#292929;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
- d="m 225.5,572.5 4,0 0,7 -4,0 z m -6,-2 12,0 0,11 -12,0 z"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccccccccc" />
+ ry="1"
+ y="588.5"
+ x="178.5"
+ height="10"
+ width="5"
+ id="rect3320"
+ style="fill:none;stroke:#232323;stroke-width:1;stroke-miterlimit:4;stroke-opacity:0.68627451;stroke-dasharray:none" />
+ <rect
+ style="fill:url(#linearGradient4128);fill-opacity:1"
+ id="rect4101"
+ width="4"
+ height="9"
+ x="179"
+ y="589"
+ ry="0.5" />
+ <rect
+ style="fill:none;stroke:url(#linearGradient4130);stroke-width:1;stroke-miterlimit:4;stroke-opacity:0.68627450999999995;stroke-dasharray:none"
+ id="rect4103"
+ width="7"
+ height="12"
+ x="177.5"
+ y="587.5"
+ ry="2" />
</g>
</g>
<g
@@ -639,12 +850,12 @@
inkscape:connector-curvature="0"
id="path3973"
d="m 35,588 9,9"
- style="fill:none;stroke:#dbdbdb;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ style="fill:none;stroke:#dbdbdb;stroke-width:1.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
<path
inkscape:connector-curvature="0"
id="path3975"
d="m 35,597 9,-9"
- style="fill:none;stroke:#dbdbdb;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ style="fill:none;stroke:#dbdbdb;stroke-width:1.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
</g>
</g>
<g
@@ -943,6 +1154,25 @@
width="16"
id="rect3958"
style="fill:none;stroke:none" />
+ <g
+ id="g4285"
+ style="opacity:0.4">
+ <rect
+ ry="2"
+ transform="translate(300,16)"
+ y="574"
+ x="299"
+ height="9"
+ width="12"
+ id="rect3511"
+ style="fill:#ffffff;fill-opacity:1;stroke:none" />
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 601.5,591.5 0,-1.5 c 0,-3 2,-3.5 3.5,-3.5 1.5,0 3.5,0.5 3.5,3.5 l 0,1.5"
+ id="path4283"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cszsc" />
+ </g>
<path
style="fill:#585858;fill-opacity:1;stroke:none"
d="m 601,591 c -0.554,0 -1,0.446 -1,1 l 0,5 c 0,0.554 0.446,1 1,1 l 8,0 c 0.554,0 1,-0.446 1,-1 l 0,-5 c 0,-0.554 -0.446,-1 -1,-1 l -8,0 z m 4.15625,2 c 0.5,0 1.39285,1.12164 -0.125,1.5 0,0.74317 1,0.47785 1,1.46875 -1.02256,0.0161 -2.04255,-0.4686 -2.03125,-1.71875 0.008,-0.93759 0.65625,-1.25 1.15625,-1.25 z"
@@ -1037,6 +1267,46 @@
id="rect3219"
style="fill:none;stroke:none" />
</g>
+ <g
+ style="display:inline;filter:url(#1_pixel_shadow)"
+ id="src/plugins/coreplugin/images/arrowdown"
+ transform="translate(217,-16)"
+ clip-path="url(#clipPath4007)">
+ <path
+ style="fill:none;stroke:#dbdbdb;stroke-width:1.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="M 3,590 7.5,594.5 12,590"
+ id="path3970"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccc" />
+ <rect
+ y="584"
+ x="0"
+ height="16"
+ width="16"
+ id="rect3817"
+ style="fill:none" />
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/arrowup"
+ style="filter:url(#1_pixel_shadow)"
+ clip-path="url(#clipPath4026)">
+ <use
+ id="use3994"
+ xlink:href="#path3970"
+ y="0"
+ x="0"
+ width="800"
+ height="600"
+ transform="matrix(1,0,0,-1,233,1169)" />
+ <rect
+ transform="scale(1,-1)"
+ style="fill:none"
+ id="rect4000"
+ width="16"
+ height="16"
+ x="233"
+ y="-584" />
+ </g>
</g>
<g
inkscape:groupmode="layer"
@@ -1328,58 +1598,59 @@
style="display:inline">
<g
id="src/plugins/coreplugin/images/inputfield"
- transform="translate(-211,-80)">
- <rect
- ry="0"
- y="581"
- x="212"
- height="18"
- width="4"
- id="rect4870"
- style="fill:url(#linearGradient4572);fill-opacity:1;stroke:none" />
- <use
- height="600"
- width="800"
- transform="matrix(0,1,-6.1666667,0,3905.8334,369)"
- id="use4888"
- xlink:href="#rect4870"
- y="0"
- x="0" />
+ transform="translate(-211,-80)"
+ style="opacity:1;stroke:none">
+ <g
+ id="g4594"
+ style="opacity:0.2"
+ clip-path="url(#clipPath3231)">
+ <rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;filter:url(#filter4057)"
+ id="rect4866"
+ width="14"
+ height="14"
+ x="212"
+ y="585"
+ ry="1.5" />
+ </g>
<rect
- ry="2.5"
- y="580.5"
+ style="fill:none;stroke:#000000;stroke-opacity:0.8"
+ id="rect4581"
+ width="15"
+ height="15"
x="211.5"
- height="19"
- width="112"
- id="rect4866"
- style="fill:none;stroke:#3a3a3a;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ y="584.5"
+ ry="2" />
</g>
<g
id="src/plugins/coreplugin/images/inputfield_disabled"
- transform="translate(-211,-80)">
- <rect
- ry="1.25"
- y="581"
- x="325"
- height="18"
- width="111"
- id="rect4931"
- style="opacity:0.4;fill:#999999;stroke:none" />
+ transform="translate(-212,-80)">
<use
height="600"
width="800"
- transform="translate(324,80)"
+ transform="translate(228,80)"
id="use4910"
xlink:href="#src/plugins/coreplugin/images/inputfield"
y="0"
- x="0" />
+ x="0"
+ style="filter:url(#filter3230)" />
+ <rect
+ clip-path="url(#clipPath3231)"
+ ry="1.5"
+ y="584"
+ x="212"
+ height="15"
+ width="15"
+ id="rect3256"
+ style="fill:#000000;fill-opacity:0.07843137;stroke:none"
+ transform="translate(16.5,0.5)" />
</g>
<g
id="src/plugins/coreplugin/images/editclear"
style="opacity:0.6"
- transform="translate(55,-82)">
+ transform="translate(-139,-80)">
<path
- d="m 186,592 a 7,7 0 1 1 -14,0 7,7 0 1 1 14,0 z"
+ d="m 186,592 c 0,3.86599 -3.13401,7 -7,7 -3.86599,0 -7,-3.13401 -7,-7 0,-3.86599 3.13401,-7 7,-7 3.86599,0 7,3.13401 7,7 z"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="592"
@@ -1416,5 +1687,255 @@
x="171"
y="584" />
</g>
+ <g
+ style="display:inline"
+ id="src/plugins/coreplugin/images/sidebaricon"
+ clip-path="url(#clipPath3237)"
+ transform="translate(-170,-64)">
+ <use
+ height="600"
+ width="800"
+ transform="matrix(0,-1,1,0,-351,785)"
+ id="use3223"
+ xlink:href="#rect3233"
+ y="0"
+ x="0" />
+ <rect
+ style="fill:none;stroke:none"
+ id="rect3216"
+ width="16"
+ height="16"
+ x="218"
+ y="568" />
+ <path
+ id="rect3241-1"
+ style="fill:none;stroke:#292929;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
+ d="m 225.5,572.5 4,0 0,7 -4,0 z m -6,-2 12,0 0,11 -12,0 z"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccccccc" />
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/panel_button"
+ style="opacity:0.83"
+ inkscape:export-filename="panel_button.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <g
+ id="g4052">
+ <rect
+ style="fill:url(#linearGradient4138);fill-opacity:1;stroke:none"
+ id="rect4130"
+ width="17"
+ height="18"
+ x="65"
+ y="501" />
+ <rect
+ y="501"
+ x="83"
+ height="18"
+ width="4"
+ id="rect4140"
+ style="fill:url(#linearGradient4142);fill-opacity:1;stroke:none" />
+ <g
+ id="panelButtonFrame">
+ <rect
+ ry="2.5"
+ y="500.5"
+ x="64.5"
+ height="19"
+ width="23"
+ id="rect4114"
+ style="fill:none;stroke:#333333;stroke-opacity:1" />
+ <rect
+ ry="1.5"
+ y="501.5"
+ x="65.5"
+ height="17"
+ width="21"
+ id="rect4116"
+ style="fill:none;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-opacity:0.4;stroke-dasharray:none" />
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.39215686000000000"
+ d="m 81.5,502 0,16"
+ id="path4120"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="fill:#959595;fill-opacity:0.83137254999999999;stroke:#333333;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 82.5,501 0,18"
+ id="path4123"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ </g>
+ </g>
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/panel_button_hover"
+ style="opacity:0.82999998"
+ inkscape:export-filename="panel_button.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ transform="translate(-4,0)">
+ <use
+ height="600"
+ width="800"
+ transform="translate(28,0)"
+ id="use3268"
+ xlink:href="#g4052"
+ y="0"
+ x="0" />
+ <rect
+ ry="3"
+ y="500"
+ x="92"
+ height="20"
+ width="24"
+ id="panelButtonHoverRect"
+ style="fill:#ffffff;fill-opacity:0.1254902;stroke:none" />
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/panel_button_checked"
+ style="opacity:0.82999998"
+ inkscape:export-filename="panel_button.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ transform="translate(-8,0)">
+ <g
+ id="g4061">
+ <use
+ x="0"
+ y="0"
+ xlink:href="#rect4130"
+ id="use4047"
+ transform="matrix(1.2941176,0,0,1,36.882359,0)"
+ width="800"
+ height="600" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#panelButtonFrame"
+ id="use4044"
+ transform="translate(56,0)"
+ width="800"
+ height="600" />
+ </g>
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/panel_button_checked_hover"
+ style="opacity:0.82999998"
+ inkscape:export-filename="panel_button.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ transform="translate(-12,0)">
+ <use
+ height="600"
+ width="800"
+ transform="translate(28,0)"
+ id="use4070"
+ xlink:href="#g4061"
+ y="0"
+ x="0" />
+ <use
+ height="600"
+ width="800"
+ transform="translate(56,0)"
+ id="use4073"
+ xlink:href="#panelButtonHoverRect"
+ y="0"
+ x="0" />
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/panel_button_pressed"
+ style="opacity:0.82999998"
+ inkscape:export-filename="panel_button.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ transform="translate(-16,0)">
+ <rect
+ y="501"
+ x="195"
+ height="18"
+ width="4"
+ id="rect4090"
+ style="fill:url(#linearGradient4111);fill-opacity:1;stroke:none" />
+ <use
+ height="600"
+ width="800"
+ transform="matrix(1,0,0,-1,112,1020)"
+ id="use4084"
+ xlink:href="#rect4130"
+ y="0"
+ x="0" />
+ <use
+ height="600"
+ width="800"
+ transform="translate(112,0)"
+ id="use4080"
+ xlink:href="#panelButtonFrame"
+ y="0"
+ x="0" />
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/panel_manage_button"
+ style="opacity:0.82999998">
+ <g
+ id="panel_manage_button">
+ <rect
+ y="501"
+ x="185"
+ height="18"
+ width="6"
+ id="use4125"
+ style="fill:url(#linearGradient4078);fill-opacity:1;stroke:none" />
+ <rect
+ style="fill:none;stroke:#333333;stroke-opacity:1"
+ id="rect4115"
+ width="7"
+ height="19"
+ x="184.5"
+ y="500.5"
+ ry="2.5" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-opacity:0.4;stroke-dasharray:none"
+ id="rect4120"
+ width="5"
+ height="17"
+ x="185.5"
+ y="501.5"
+ ry="1.5" />
+ </g>
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/panel_manage_button_hover"
+ style="opacity:0.83">
+ <use
+ height="600"
+ width="800"
+ transform="translate(8,0)"
+ id="use4140"
+ xlink:href="#panel_manage_button"
+ y="0"
+ x="0" />
+ <rect
+ ry="3"
+ y="500"
+ x="192"
+ height="20"
+ width="8"
+ id="rect4143"
+ style="fill:#ffffff;fill-opacity:0.12549020000000000;stroke:none" />
+ </g>
+ <g
+ id="src/plugins/coreplugin/images/panel_manage_button_pressed"
+ style="opacity:0.82999998">
+ <use
+ x="0"
+ y="0"
+ xlink:href="#panel_manage_button"
+ id="use3293"
+ transform="matrix(1,0,0,-1,16,1020)"
+ width="800"
+ height="600" />
+ </g>
</g>
</svg>
diff --git a/src/tools/qtcreatorcrashhandler/crashhandler.cpp b/src/tools/qtcreatorcrashhandler/crashhandler.cpp
index 81f67b365f..e92082809c 100644
--- a/src/tools/qtcreatorcrashhandler/crashhandler.cpp
+++ b/src/tools/qtcreatorcrashhandler/crashhandler.cpp
@@ -33,6 +33,7 @@
#include "utils.h"
#include <utils/environment.h>
+#include <utils/fileutils.h>
#include <QApplication>
#include <QDebug>
@@ -94,7 +95,7 @@ public:
dialog(crashHandler, signalName) {}
const pid_t pid;
- const QString creatorInPath; // Backup debugger.
+ const Utils::FileName creatorInPath; // Backup debugger.
BacktraceCollector backtraceCollector;
CrashHandlerDialog dialog;
@@ -293,7 +294,7 @@ void CrashHandler::debugApplication()
}
// Prepare command.
- QString executable = d->creatorInPath;
+ QString executable = d->creatorInPath.toString();
if (!d->restartAppCommandLine.isEmpty())
executable = d->restartAppCommandLine.at(0);
const QStringList commandLine = QStringList()
diff --git a/src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro b/src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro
index 9494117135..967c3393c6 100644
--- a/src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro
+++ b/src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro
@@ -14,7 +14,9 @@ SOURCES += \
utils.cpp \
../../libs/utils/qtcassert.cpp \
../../libs/utils/checkablemessagebox.cpp \
- ../../libs/utils/environment.cpp
+ ../../libs/utils/environment.cpp \
+ ../../libs/utils/fileutils.cpp \
+ ../../libs/utils/savefile.cpp
HEADERS += \
@@ -24,7 +26,9 @@ HEADERS += \
utils.h \
../../libs/utils/qtcassert.h \
../../libs/utils/checkablemessagebox.h \
- ../../libs/utils/environment.h
+ ../../libs/utils/environment.h \
+ ../../libs/utils/fileutils.h \
+ ../../libs/utils/savefile.h
FORMS += \
crashhandlerdialog.ui
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp
index 412656a7fc..19a9c4d136 100644
--- a/tests/auto/debugger/tst_dumpers.cpp
+++ b/tests/auto/debugger/tst_dumpers.cpp
@@ -162,7 +162,7 @@ static void setupCdb(QString *makeBinary, QProcessEnvironment *environment)
const QByteArray cdbextPath = CDBEXT_PATH "\\qtcreatorcdbext64";
QVERIFY(QFile::exists(QString::fromLatin1(cdbextPath + QByteArray("\\qtcreatorcdbext.dll"))));
env.set(QLatin1String("_NT_DEBUGGER_EXTENSION_PATH"), QString::fromLatin1(cdbextPath));
- *makeBinary = env.searchInPath(QLatin1String("nmake.exe"));
+ *makeBinary = env.searchInPath(QLatin1String("nmake.exe")).toString();
*environment = env.toProcessEnvironment();
}
diff --git a/tests/auto/qml/codemodel/check/tst_check.cpp b/tests/auto/qml/codemodel/check/tst_check.cpp
index 920a768e5a..28d2fcf5ec 100644
--- a/tests/auto/qml/codemodel/check/tst_check.cpp
+++ b/tests/auto/qml/codemodel/check/tst_check.cpp
@@ -111,7 +111,7 @@ void tst_Check::test()
QFETCH(QString, path);
Snapshot snapshot;
- Document::MutablePtr doc = Document::create(path, Language::Qml);
+ Document::MutablePtr doc = Document::create(path, Dialect::Qml);
QFile file(doc->fileName());
file.open(QFile::ReadOnly | QFile::Text);
doc->setSource(file.readAll());
diff --git a/tests/auto/qml/codemodel/codemodel.pro b/tests/auto/qml/codemodel/codemodel.pro
index dde5bb0bdd..2e42b5cb7c 100644
--- a/tests/auto/qml/codemodel/codemodel.pro
+++ b/tests/auto/qml/codemodel/codemodel.pro
@@ -1,3 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS += check
+SUBDIRS += check \
+ importscheck
diff --git a/tests/auto/qml/codemodel/codemodel.qbs b/tests/auto/qml/codemodel/codemodel.qbs
index 63ad360bfd..c4d7e9d3cd 100644
--- a/tests/auto/qml/codemodel/codemodel.qbs
+++ b/tests/auto/qml/codemodel/codemodel.qbs
@@ -2,5 +2,5 @@ import qbs
Project {
name: "QML code model autotests"
- references: ["check/check.qbs"]
+ references: ["check/check.qbs", "importscheck/importscheck.qbs"]
}
diff --git a/tests/auto/qml/codemodel/importscheck/001_flatQmlOnly/GaussianDirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/001_flatQmlOnly/GaussianDirectionalBlur.qml
new file mode 100644
index 0000000000..c2af1f34e3
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/001_flatQmlOnly/GaussianDirectionalBlur.qml
@@ -0,0 +1,287 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real deviation: (radius + 1) / 3.3333
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property real horizontalStep: 0.0
+ property real verticalStep: 0.0
+ property bool transparentBorder: false
+ property bool cached: false
+
+ property bool enableColor: false
+ property color color: "white"
+ property real spread: 0.0
+
+ property bool enableMask: false
+ property variant maskSource
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: rootItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real deviation: Math.max(0.1, rootItem.deviation)
+ property real radius: rootItem.radius
+ property int maxRadius: rootItem.maximumRadius
+ property bool transparentBorder: rootItem.transparentBorder
+ property real gaussianSum: 0.0
+ property real startIndex: 0.0
+ property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1)
+ property real expandX: transparentBorder && rootItem.horizontalStep > 0 ? maxRadius / width : 0.0
+ property real expandY: transparentBorder && rootItem.verticalStep > 0 ? maxRadius / height : 0.0
+ property variant gwts: []
+ property variant delta: Qt.vector3d(rootItem.horizontalStep * deltaFactor, rootItem.verticalStep * deltaFactor, startIndex);
+ property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]);
+ property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]);
+ property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]);
+ property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]);
+ property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]);
+ property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]);
+ property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]);
+ property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]);
+ property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]);
+ property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]);
+ property variant factor_30_32: Qt.vector3d(gwts[30], gwts[31], gwts[32]);
+
+ property color color: rootItem.color
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property variant maskSource: maskSourceProxy.output
+
+ anchors.fill: rootItem
+
+ function gausFunc(x){
+ //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2)));
+ return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2)))));
+ }
+
+ function updateGaussianWeights() {
+ gaussianSum = 0.0;
+ startIndex = -maxRadius + 0.5
+
+ var n = new Array(32);
+ for (var j = 0; j < 32; j++)
+ n[j] = 0;
+
+ var max = maxRadius * 2
+ var delta = (2 * radius - 1) / (max - 1);
+ for (var i = 0; i < max; i++) {
+ n[i] = gausFunc(-radius + 0.5 + i * delta);
+ gaussianSum += n[i];
+ }
+
+ gwts = n;
+ }
+
+ function buildFragmentShader() {
+
+ var shaderSteps = [
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z; texCoord += shift;"
+ ]
+
+ var shader = fragmentShaderBegin
+ var samples = maxRadius * 2
+ if (samples > 32) {
+ console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!")
+ samples = 32
+ }
+
+ for (var i = 0; i < samples; i++) {
+ shader += shaderSteps[i]
+ }
+
+ shader += fragmentShaderEnd
+
+ var colorizeSteps = ""
+ var colorizeUniforms = ""
+
+ var maskSteps = ""
+ var maskUniforms = ""
+
+ if (enableColor) {
+ colorizeSteps += "gl_FragColor = mix(vec4(0), color, clamp((gl_FragColor.a - 0.0) / (spread - 0.0), 0.0, 1.0));\n"
+ colorizeUniforms += "uniform highp vec4 color;\n"
+ colorizeUniforms += "uniform highp float spread;\n"
+ }
+
+ if (enableMask) {
+ maskSteps += "shift *= texture2D(maskSource, qt_TexCoord0).a;\n"
+ maskUniforms += "uniform sampler2D maskSource;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_COLORIZE_STEPS", colorizeSteps)
+ shader = shader.replace("PLACEHOLDER_COLORIZE_UNIFORMS", colorizeUniforms)
+ shader = shader.replace("PLACEHOLDER_MASK_STEPS", maskSteps)
+ shader = shader.replace("PLACEHOLDER_MASK_UNIFORMS", maskUniforms)
+
+ fragmentShader = shader
+ }
+
+ onDeviationChanged: updateGaussianWeights()
+
+ onRadiusChanged: updateGaussianWeights()
+
+ onTransparentBorderChanged: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ onMaxRadiusChanged: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ Component.onCompleted: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ property string fragmentShaderBegin: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp vec3 delta;
+ uniform highp vec3 factor_0_2;
+ uniform highp vec3 factor_3_5;
+ uniform highp vec3 factor_6_8;
+ uniform highp vec3 factor_9_11;
+ uniform highp vec3 factor_12_14;
+ uniform highp vec3 factor_15_17;
+ uniform highp vec3 factor_18_20;
+ uniform highp vec3 factor_21_23;
+ uniform highp vec3 factor_24_26;
+ uniform highp vec3 factor_27_29;
+ uniform highp vec3 factor_30_32;
+ uniform highp float gaussianSum;
+ uniform highp float expandX;
+ uniform highp float expandY;
+ PLACEHOLDER_MASK_UNIFORMS
+ PLACEHOLDER_COLORIZE_UNIFORMS
+
+ void main() {
+ highp vec2 shift = vec2(delta.x, delta.y);
+
+ PLACEHOLDER_MASK_STEPS
+
+ highp float index = delta.z;
+ mediump vec2 texCoord = qt_TexCoord0;
+ texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
+ texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
+ texCoord += (shift * index);
+
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+ "
+
+ property string fragmentShaderEnd: "
+
+ gl_FragColor /= gaussianSum;
+
+ PLACEHOLDER_COLORIZE_STEPS
+
+ gl_FragColor *= qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Blend.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Blend.qml
new file mode 100644
index 0000000000..59d8646047
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Blend.qml
@@ -0,0 +1,478 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Blend
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blend
+ \brief Merges two source items by using a blend mode.
+
+ Blend mode can be selected with the \l{Blend::mode}{mode} property.
+
+ \table
+ \header
+ \li source
+ \li foregroundSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image Original_butterfly.png
+ \li \image Blend_bug_and_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Blend-example.qml example
+
+*/
+
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be the base when
+ \l{Blend::foregroundSource}{foregroundSource} is blended over it.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is going to be blended over the
+ \l{Blend::source}{source}.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting foregroundSource to the effect's parent.
+ */
+ property variant foregroundSource
+
+ /*!
+ This property defines the mode which is used when foregroundSource is
+ blended over source. Values are case insensitive.
+
+ \table
+ \header
+ \li mode
+ \li description
+ \row
+ \li normal
+ \li The pixel component values from foregroundSource are written
+ over source by using alpha blending.
+ \row
+ \li addition
+ \li The pixel component values from source and foregroundSource are
+ added together and written.
+ \row
+ \li average
+ \li The pixel component values from source and foregroundSource are
+ averaged and written.
+ \row
+ \li color
+ \li The lightness value from source is combined with hue and
+ saturation from foregroundSource and written.
+ \row
+ \li colorBurn
+ \li The darker pixels from source are darkened more, if both source
+ and foregroundSource pixels are light the result is light.
+ \row
+ \li colorDodge
+ \li The lighter pixels from source are lightened more, if both
+ source and foregroundSource pixels are dark the result is dark.
+ \row
+ \li darken
+ \li The darker pixel component value from source and
+ foregroundSource is written.
+ \row
+ \li darkerColor
+ \li The lower luminance pixel rgb-value from source and
+ foregroundSource is written.
+ \row
+ \li difference
+ \li The absolute pixel component value difference between source and
+ foregroundSource is written.
+ \row
+ \li divide
+ \li The pixel component values from source is divided by the value
+ from foregroundSource and written.
+ \row
+ \li exclusion
+ \li The pixel component value difference with reduced contrast
+ between source and foregroundSource is written.
+ \row
+ \li hardLight
+ \li The pixel component values from source are lightened or darkened
+ according to foregroundSource values and written.
+ \row
+ \li hue
+ \li The hue value from foregroundSource is combined with saturation
+ and lightness from source and written.
+ \row
+ \li lighten
+ \li The lightest pixel component value from source and
+ foregroundSource is written.
+ \row
+ \li lighterColor
+ \li The higher luminance pixel rgb-value from source and
+ foregroundSource is written.
+ \row
+ \li lightness
+ \li The lightness value from foregroundSource is combined with hue
+ and saturation from source and written.
+ \row
+ \li multiply
+ \li The pixel component values from source and foregroundSource are
+ multiplied together and written.
+ \row
+ \li negation
+ \li The inverted absolute pixel component value difference between
+ source and foregroundSource is written.
+ \row
+ \li saturation
+ \li The saturation value from foregroundSource is combined with hue
+ and lightness from source and written.
+ \row
+ \li screen
+ \li The pixel values from source and foregroundSource are negated,
+ then multiplied, negated again, and written.
+ \row
+ \li subtract
+ \li Pixel value from foregroundSource is subracted from source and
+ written.
+ \row
+ \li softLight
+ \li The pixel component values from source are lightened or darkened
+ slightly according to foregroundSource values and written.
+
+ \endtable
+
+ \table
+ \header
+ \li Example source
+ \li Example foregroundSource
+ \row
+ \li \image Original_bug.png
+ \li \image Original_butterfly.png
+ \endtable
+
+ \table
+ \header
+ \li Output examples with different mode values
+ \li
+ \li
+ \row
+ \li \image Blend_mode1.png
+ \li \image Blend_mode2.png
+ \li \image Blend_mode3.png
+ \row
+ \li \b { mode: normal }
+ \li \b { mode: addition }
+ \li \b { mode: average }
+ \row
+ \li \image Blend_mode4.png
+ \li \image Blend_mode5.png
+ \li \image Blend_mode6.png
+ \row
+ \li \b { mode: color }
+ \li \b { mode: colorBurn }
+ \li \b { mode: colorDodge }
+ \row
+ \li \image Blend_mode7.png
+ \li \image Blend_mode8.png
+ \li \image Blend_mode9.png
+ \row
+ \li \b { mode: darken }
+ \li \b { mode: darkerColor }
+ \li \b { mode: difference }
+ \row
+ \li \image Blend_mode10.png
+ \li \image Blend_mode11.png
+ \li \image Blend_mode12.png
+ \row
+ \li \b { mode: divide }
+ \li \b { mode: exclusion }
+ \li \b { mode: hardlight }
+ \row
+ \li \image Blend_mode13.png
+ \li \image Blend_mode14.png
+ \li \image Blend_mode15.png
+ \row
+ \li \b { mode: hue }
+ \li \b { mode: lighten }
+ \li \b { mode: lighterColor }
+ \row
+ \li \image Blend_mode16.png
+ \li \image Blend_mode17.png
+ \li \image Blend_mode18.png
+ \row
+ \li \b { mode: lightness }
+ \li \b { mode: negation }
+ \li \b { mode: multiply }
+ \row
+ \li \image Blend_mode19.png
+ \li \image Blend_mode20.png
+ \li \image Blend_mode21.png
+ \row
+ \li \b { mode: saturation }
+ \li \b { mode: screen }
+ \li \b { mode: subtract }
+ \row
+ \li \image Blend_mode22.png
+ \row
+ \li \b { mode: softLight }
+ \endtable
+ */
+ property string mode: "normal"
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in the
+ cache must be updated. Memory consumption is increased, because an extra
+ buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: backgroundSourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: foregroundSourceProxy
+ input: rootItem.foregroundSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant backgroundSource: backgroundSourceProxy.output
+ property variant foregroundSource: foregroundSourceProxy.output
+ property string mode: rootItem.mode
+ anchors.fill: parent
+
+ fragmentShader: fragmentShaderBegin + blendModeNormal + fragmentShaderEnd
+
+ function buildFragmentShader() {
+ var shader = fragmentShaderBegin
+
+ switch (mode.toLowerCase()) {
+ case "addition" : shader += blendModeAddition; break;
+ case "average" : shader += blendModeAverage; break;
+ case "color" : shader += blendModeColor; break;
+ case "colorburn" : shader += blendModeColorBurn; break;
+ case "colordodge" : shader += blendModeColorDodge; break;
+ case "darken" : shader += blendModeDarken; break;
+ case "darkercolor" : shader += blendModeDarkerColor; break;
+ case "difference" : shader += blendModeDifference; break;
+ case "divide" : shader += blendModeDivide; break;
+ case "exclusion" : shader += blendModeExclusion; break;
+ case "hardlight" : shader += blendModeHardLight; break;
+ case "hue" : shader += blendModeHue; break;
+ case "lighten" : shader += blendModeLighten; break;
+ case "lightercolor" : shader += blendModeLighterColor; break;
+ case "lightness" : shader += blendModeLightness; break;
+ case "negation" : shader += blendModeNegation; break;
+ case "normal" : shader += blendModeNormal; break;
+ case "multiply" : shader += blendModeMultiply; break;
+ case "saturation" : shader += blendModeSaturation; break;
+ case "screen" : shader += blendModeScreen; break;
+ case "subtract" : shader += blendModeSubtract; break;
+ case "softlight" : shader += blendModeSoftLight; break;
+ default: shader += "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);"; break;
+ }
+
+ shader += fragmentShaderEnd
+ fragmentShader = shader
+
+ // Workaraound for a bug just to make sure display gets updated when the mode changes.
+ backgroundSourceChanged()
+ }
+
+ Component.onCompleted: {
+ buildFragmentShader()
+ }
+
+ onModeChanged: {
+ buildFragmentShader()
+ }
+
+ property string blendModeAddition: "result.rgb = min(rgb1 + rgb2, 1.0);"
+ property string blendModeAverage: "result.rgb = 0.5 * (rgb1 + rgb2);"
+ property string blendModeColor: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).xy, RGBtoL(rgb1)));"
+ property string blendModeColorBurn: "result.rgb = clamp(1.0 - ((1.0 - rgb1) / max(vec3(1.0 / 256.0), rgb2)), vec3(0.0), vec3(1.0));"
+ property string blendModeColorDodge: "result.rgb = clamp(rgb1 / max(vec3(1.0 / 256.0), (1.0 - rgb2)), vec3(0.0), vec3(1.0));"
+ property string blendModeDarken: "result.rgb = min(rgb1, rgb2);"
+ property string blendModeDarkerColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb2 : rgb1;"
+ property string blendModeDifference: "result.rgb = abs(rgb1 - rgb2);"
+ property string blendModeDivide: "result.rgb = clamp(rgb1 / rgb2, 0.0, 1.0);"
+ property string blendModeExclusion: "result.rgb = rgb1 + rgb2 - 2.0 * rgb1 * rgb2;"
+ property string blendModeHardLight: "result.rgb = vec3(channelBlendHardLight(rgb1.r, rgb2.r), channelBlendHardLight(rgb1.g, rgb2.g), channelBlendHardLight(rgb1.b, rgb2.b));"
+ property string blendModeHue: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).x, RGBtoHSL(rgb1).yz));"
+ property string blendModeLighten: "result.rgb = max(rgb1, rgb2);"
+ property string blendModeLighterColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb1 : rgb2;"
+ property string blendModeLightness: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb1).xy, RGBtoL(rgb2)));"
+ property string blendModeMultiply: "result.rgb = rgb1 * rgb2;"
+ property string blendModeNegation: "result.rgb = 1.0 - abs(1.0 - rgb1 - rgb2);"
+ property string blendModeNormal: "result.rgb = rgb2; a = max(color1.a, color2.a);"
+ property string blendModeSaturation: "lowp vec3 hsl1 = RGBtoHSL(rgb1); result.rgb = HSLtoRGB(vec3(hsl1.x, RGBtoHSL(rgb2).y, hsl1.z));"
+ property string blendModeScreen: "result.rgb = 1.0 - (vec3(1.0) - rgb1) * (vec3(1.0) - rgb2);"
+ property string blendModeSubtract: "result.rgb = max(rgb1 - rgb2, vec3(0.0));"
+ property string blendModeSoftLight: "result.rgb = rgb1 * ((1.0 - rgb1) * rgb2 + (1.0 - (1.0 - rgb1) * (1.0 - rgb2)));"
+
+ property string fragmentShaderBegin: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D backgroundSource;
+ uniform lowp sampler2D foregroundSource;
+
+ highp float RGBtoL(highp vec3 color) {
+ highp float cmin = min(color.r, min(color.g, color.b));
+ highp float cmax = max(color.r, max(color.g, color.b));
+ highp float l = (cmin + cmax) / 2.0;
+ return l;
+ }
+
+ highp vec3 RGBtoHSL(highp vec3 color) {
+ highp float cmin = min(color.r, min(color.g, color.b));
+ highp float cmax = max(color.r, max(color.g, color.b));
+ highp float h = 0.0;
+ highp float s = 0.0;
+ highp float l = (cmin + cmax) / 2.0;
+ highp float diff = cmax - cmin;
+
+ if (diff > 1.0 / 256.0) {
+ if (l < 0.5)
+ s = diff / (cmin + cmax);
+ else
+ s = diff / (2.0 - (cmin + cmax));
+
+ if (color.r == cmax)
+ h = (color.g - color.b) / diff;
+ else if (color.g == cmax)
+ h = 2.0 + (color.b - color.r) / diff;
+ else
+ h = 4.0 + (color.r - color.g) / diff;
+
+ h /= 6.0;
+ }
+ return vec3(h, s, l);
+ }
+
+ highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
+ h = fract(h);
+ if (h < 1.0 / 6.0)
+ return v1 + (v2 - v1) * 6.0 * h;
+ else if (h < 1.0 / 2.0)
+ return v2;
+ else if (h < 2.0 / 3.0)
+ return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
+
+ return v1;
+ }
+
+ highp vec3 HSLtoRGB(highp vec3 color) {
+ highp float h = color.x;
+ highp float l = color.z;
+ highp float s = color.y;
+
+ if (s < 1.0 / 256.0)
+ return vec3(l, l, l);
+
+ highp float v1;
+ highp float v2;
+ if (l < 0.5)
+ v2 = l * (1.0 + s);
+ else
+ v2 = (l + s) - (s * l);
+
+ v1 = 2.0 * l - v2;
+
+ highp float d = 1.0 / 3.0;
+ highp float r = hueToIntensity(v1, v2, h + d);
+ highp float g = hueToIntensity(v1, v2, h);
+ highp float b = hueToIntensity(v1, v2, h - d);
+ return vec3(r, g, b);
+ }
+
+ lowp float channelBlendHardLight(lowp float c1, lowp float c2) {
+ return c2 > 0.5 ? (1.0 - (1.0 - 2.0 * (c2 - 0.5)) * (1.0 - c1)) : (2.0 * c1 * c2);
+ }
+
+ void main() {
+ lowp vec4 result = vec4(0.0);
+ lowp vec4 color1 = texture2D(backgroundSource, qt_TexCoord0);
+ lowp vec4 color2 = texture2D(foregroundSource, qt_TexCoord0);
+ lowp vec3 rgb1 = color1.rgb / max(1.0/256.0, color1.a);
+ lowp vec3 rgb2 = color2.rgb / max(1.0/256.0, color2.a);
+ highp float a = max(color1.a, color1.a * color2.a);
+ "
+
+ property string fragmentShaderEnd: "
+ gl_FragColor.rgb = mix(rgb1, result.rgb, color2.a);
+ gl_FragColor.rbg *= a;
+ gl_FragColor.a = a;
+ gl_FragColor *= qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/BrightnessContrast.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/BrightnessContrast.qml
new file mode 100644
index 0000000000..db53acbad4
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/BrightnessContrast.qml
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype BrightnessContrast
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Adjusts brightness and contrast.
+
+ This effect adjusts the source item colors.
+ Brightness adjustment changes the perceived luminance of the source item.
+ Contrast adjustment increases or decreases the color
+ and brightness variations.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image BrightnessContrast_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet BrightnessContrast-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines how much the source brightness is increased or
+ decreased.
+
+ The value ranges from -1.0 to 1.0. By default, the property is set to \c
+ 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different brightness values
+ \li
+ \li
+ \row
+ \li \image BrightnessContrast_brightness1.png
+ \li \image BrightnessContrast_brightness2.png
+ \li \image BrightnessContrast_brightness3.png
+ \row
+ \li \b { brightness: -0.25 }
+ \li \b { brightness: 0 }
+ \li \b { brightness: 0.5 }
+ \row
+ \li \l contrast: 0
+ \li \l contrast: 0
+ \li \l contrast: 0
+ \endtable
+
+ */
+ property real brightness: 0.0
+
+ /*!
+ This property defines how much the source contrast is increased or
+ decreased. The decrease of the contrast is linear, but the increase is
+ applied with a non-linear curve to allow very high contrast adjustment at
+ the high end of the value range.
+
+ \table
+ \header
+ \li Contrast adjustment curve
+ \row
+ \li \image BrightnessContrast_contrast_graph.png
+ \endtable
+
+ The value ranges from -1.0 to 1.0. By default, the property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different contrast values
+ \li
+ \li
+ \row
+ \li \image BrightnessContrast_contrast1.png
+ \li \image BrightnessContrast_contrast2.png
+ \li \image BrightnessContrast_contrast3.png
+ \row
+ \li \b { contrast: -0.5 }
+ \li \b { contrast: 0 }
+ \li \b { contrast: 0.5 }
+ \row
+ \li \l brightness: 0
+ \li \l brightness: 0
+ \li \l brightness: 0
+ \endtable
+
+ */
+ property real contrast: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real brightness: rootItem.brightness
+ property real contrast: rootItem.contrast
+
+ anchors.fill: parent
+ blending: !rootItem.cached
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float brightness;
+ uniform highp float contrast;
+ void main() {
+ highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
+ pixelColor.rgb /= max(1.0/256.0, pixelColor.a);
+ highp float c = 1.0 + contrast;
+ highp float contrastGainFactor = 1.0 + c * c * c * c * step(0.0, contrast);
+ pixelColor.rgb = ((pixelColor.rgb - 0.5) * (contrastGainFactor * contrast + 1.0)) + 0.5;
+ pixelColor.rgb = mix(pixelColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
+ gl_FragColor = vec4(pixelColor.rgb * pixelColor.a, pixelColor.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ColorOverlay.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ColorOverlay.qml
new file mode 100644
index 0000000000..fedc0500df
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ColorOverlay.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype ColorOverlay
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Alters the colors of the source item by applying an overlay color.
+
+ The effect is similar to what happens when a colorized glass is put on top
+ of a grayscale image. The color for the overlay is given in the RGBA format.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly.png
+ \li \image ColorOverlay_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet ColorOverlay-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the RGBA color value which is used to colorize the
+ source.
+
+ By default, the property is set to \c "transparent".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image ColorOverlay_color1.png
+ \li \image ColorOverlay_color2.png
+ \li \image ColorOverlay_color3.png
+ \row
+ \li \b { color: #80ff0000 }
+ \li \b { color: #8000ff00 }
+ \li \b { color: #800000ff }
+ \endtable
+
+ */
+ property color color: "transparent"
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property color color: rootItem.color
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp vec4 color;
+ void main() {
+ highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
+ gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Colorize.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Colorize.qml
new file mode 100644
index 0000000000..62e1312940
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Colorize.qml
@@ -0,0 +1,294 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Colorize
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Sets the color in the HSL color space.
+
+ The effect is similar to what happens when a colorized glass is put on top
+ of a grayscale image. Colorize uses the hue, saturation, and lightness (HSL)
+ color space. You can specify a desired value for each property. You can
+ shift all HSL values with the
+ \l{QtGraphicalEffects1::HueSaturation}{HueSaturation} effect.
+
+ Alternatively, you can use the
+ \l{QtGraphicalEffects1::ColorOverlay}{ColorOverlay} effect to colorize the
+ source item in the RGBA color space.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image Colorize_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Colorize-example.qml example
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the hue value which is used to colorize the
+ source.
+
+ The value ranges from 0.0 to 1.0. By default, the property is set to \c
+ 0.0, which produces a slightly red color.
+
+ \table
+ \header
+ \li Allowed hue values
+ \row
+ \li \image Colorize_hue_scale.png
+ \endtable
+
+ \table
+ \header
+ \li Output examples with different hue values
+ \li
+ \li
+ \row
+ \li \image Colorize_hue1.png
+ \li \image Colorize_hue2.png
+ \li \image Colorize_hue3.png
+ \row
+ \li \b { hue: 0.2 }
+ \li \b { hue: 0.5 }
+ \li \b { hue: 0.8 }
+ \row
+ \li \l saturation: 1
+ \li \l saturation: 1
+ \li \l saturation: 1
+ \row
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \endtable
+ */
+ property real hue: 0.0
+
+ /*!
+ This property defines the saturation value which is used to colorize the
+ source.
+
+ The value ranges from 0.0 (desaturated) to 1.0 (saturated). By default,
+ the property is set to \c 1.0 (saturated).
+
+ \table
+ \header
+ \li Output examples with different saturation values
+ \li
+ \li
+ \row
+ \li \image Colorize_saturation1.png
+ \li \image Colorize_saturation2.png
+ \li \image Colorize_saturation3.png
+ \row
+ \li \b { saturation: 0 }
+ \li \b { saturation: 0.5 }
+ \li \b { saturation: 1 }
+ \row
+ \li \l hue: 0
+ \li \l hue: 0
+ \li \l hue: 0
+ \row
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \endtable
+ */
+ property real saturation: 1.0
+
+ /*!
+ This property defines how much the source lightness value is increased
+ or decreased.
+
+ Unlike hue and saturation properties, lightness does not set the used
+ value, but it shifts the existing source pixel lightness value.
+
+ The value ranges from -1.0 (decreased) to 1.0 (increased). By default,
+ the property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different lightness values
+ \li
+ \li
+ \row
+ \li \image Colorize_lightness1.png
+ \li \image Colorize_lightness2.png
+ \li \image Colorize_lightness3.png
+ \row
+ \li \b { lightness: -0.75 }
+ \li \b { lightness: 0 }
+ \li \b { lightness: 0.75 }
+ \row
+ \li \l hue: 0
+ \li \l hue: 0
+ \li \l hue: 0
+ \row
+ \li \l saturation: 1
+ \li \l saturation: 1
+ \li \l saturation: 1
+ \endtable
+ */
+ property real lightness: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real hue: rootItem.hue
+ property real saturation: rootItem.saturation
+ property real lightness: rootItem.lightness
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float hue;
+ uniform highp float saturation;
+ uniform highp float lightness;
+
+ highp float RGBtoL(highp vec3 color) {
+ highp float cmin = min(color.r, min(color.g, color.b));
+ highp float cmax = max(color.r, max(color.g, color.b));
+ highp float l = (cmin + cmax) / 2.0;
+ return l;
+ }
+
+ highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
+ h = fract(h);
+ if (h < 1.0 / 6.0)
+ return v1 + (v2 - v1) * 6.0 * h;
+ else if (h < 1.0 / 2.0)
+ return v2;
+ else if (h < 2.0 / 3.0)
+ return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
+
+ return v1;
+ }
+
+ highp vec3 HSLtoRGB(highp vec3 color) {
+ highp float h = color.x;
+ highp float l = color.z;
+ highp float s = color.y;
+
+ if (s < 1.0 / 256.0)
+ return vec3(l, l, l);
+
+ highp float v1;
+ highp float v2;
+ if (l < 0.5)
+ v2 = l * (1.0 + s);
+ else
+ v2 = (l + s) - (s * l);
+
+ v1 = 2.0 * l - v2;
+
+ highp float d = 1.0 / 3.0;
+ highp float r = hueToIntensity(v1, v2, h + d);
+ highp float g = hueToIntensity(v1, v2, h);
+ highp float b = hueToIntensity(v1, v2, h - d);
+ return vec3(r, g, b);
+ }
+
+ void main() {
+ lowp vec4 sample = texture2D(source, qt_TexCoord0);
+ sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a);
+ highp float light = RGBtoL(sample.rgb);
+ highp float c = step(0.0, lightness);
+ sample.rgb = HSLtoRGB(vec3(hue, saturation, mix(light, c, abs(lightness))));
+ gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ConicalGradient.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ConicalGradient.qml
new file mode 100644
index 0000000000..c2492f405a
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ConicalGradient.qml
@@ -0,0 +1,342 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype ConicalGradient
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-gradient
+ \brief Draws a conical gradient.
+
+ A gradient is defined by two or more colors, which are blended seamlessly.
+ The colors start from the specified angle and end at 360 degrees larger
+ angle value.
+
+ \table
+ \header
+ \li Effect applied
+ \row
+ \li \image ConicalGradient.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet ConicalGradient-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ /*!
+ This property defines the starting angle where the color at the gradient
+ position of 0.0 is rendered. Colors at larger position values are
+ rendered into larger angle values and blended seamlessly. Angle values
+ increase clockwise.
+
+ \table
+ \header
+ \li Output examples with different angle values
+ \li
+ \li
+ \row
+ \li \image ConicalGradient_angle1.png
+ \li \image ConicalGradient_angle2.png
+ \li \image ConicalGradient_angle3.png
+ \row
+ \li \b { angle: 0 }
+ \li \b { angle: 45 }
+ \li \b { angle: 185 }
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+ */
+ property real angle: 0.0
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::ConicalGradient::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::ConicalGradient::verticalOffset
+
+ The horizontalOffset and verticalOffset properties define the offset in
+ pixels for the center point of the gradient compared to the item center.
+
+ The value ranges from -inf to inf. By default, the properties are set to \c
+ 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image ConicalGradient_horizontalOffset1.png
+ \li \image ConicalGradient_horizontalOffset2.png
+ \li \image ConicalGradient_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: -50 }
+ \li \b { horizontalOffset: 0 }
+ \li \b { horizontalOffset: 50 }
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ This property defines the item that is going to be filled with gradient.
+ Source item gets rendered into an intermediate pixel buffer and the
+ alpha values from the result are used to determine the gradient's pixels
+ visibility in the display. The default value for source is undefined and
+ in that case whole effect area is filled with gradient.
+
+ \table
+ \header
+ \li Output examples with different source values
+ \li
+ \row
+ \li \image ConicalGradient_maskSource1.png
+ \li \image ConicalGradient_maskSource2.png
+ \row
+ \li \b { source: undefined }
+ \li \b { source: }
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+/*!
+ A gradient is defined by two or more colors, which are blended seamlessly.
+ The colors are specified as a set of GradientStop child items, each of which
+ defines a position on the gradient (from 0.0 to 1.0), and a color.
+ The position of each GradientStop is defined by the position property.
+ The color is defined by the color property.
+
+ \table
+ \header
+ \li Output examples with different gradient values
+ \li
+ \li
+ \row
+ \li \image ConicalGradient_gradient1.png
+ \li \image ConicalGradient_gradient2.png
+ \li \image ConicalGradient_gradient3.png
+ \row
+ \li \b {gradient:} \code
+Gradient {
+ GradientStop { position: 0.000
+ color: Qt.rgba(1, 0, 0, 1) }
+ GradientStop { position: 0.167;
+ color: Qt.rgba(1, 1, 0, 1) }
+ GradientStop { position: 0.333;
+ color: Qt.rgba(0, 1, 0, 1) }
+ GradientStop { position: 0.500;
+ color: Qt.rgba(0, 1, 1, 1) }
+ GradientStop { position: 0.667;
+ color: Qt.rgba(0, 0, 1, 1) }
+ GradientStop { position: 0.833;
+ color: Qt.rgba(1, 0, 1, 1) }
+ GradientStop { position: 1.000;
+ color: Qt.rgba(1, 0, 0, 1) }
+}
+ \endcode
+ \li \b {gradient:} \code
+Gradient {
+ GradientStop { position: 0.0
+ color: "#F0F0F0"
+ }
+ GradientStop { position: 0.5
+ color: "#000000"
+ }
+ GradientStop { position: 1.0
+ color: "#F0F0F0"
+ }
+}
+ \endcode
+ \li \b {gradient:} \code
+Gradient {
+ GradientStop { position: 0.0
+ color: "#00000000"
+ }
+ GradientStop { position: 1.0
+ color: "#FF000000"
+ }
+}
+ \endcode
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+*/
+ property Gradient gradient: Gradient {
+ GradientStop { position: 0.0; color: "white" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.source
+ }
+
+ Rectangle {
+ id: gradientRect
+ width: 16
+ height: 256
+ gradient: rootItem.gradient
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ rotation: shaderItem.rotation
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant gradientSource: ShaderEffectSource {
+ sourceItem: gradientRect
+ smooth: true
+ hideSource: true
+ visible: false
+ }
+ property variant maskSource: maskSourceProxy.output
+ property real startAngle: (rootItem.angle - 90) * Math.PI/180
+ property variant center: Qt.point(0.5 + horizontalOffset / width, 0.5 + verticalOffset / height)
+
+ anchors.fill: parent
+
+ fragmentShader: maskSource == undefined ? noMaskShader : maskShader
+
+ onFragmentShaderChanged: startAngleChanged()
+
+ property string noMaskShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform lowp sampler2D gradientSource;
+ uniform highp float qt_Opacity;
+ uniform highp float startAngle;
+ uniform highp vec2 center;
+
+ void main() {
+ const highp float PI = 3.14159265;
+ const highp float PIx2inv = 0.1591549;
+ highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
+ gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * qt_Opacity;
+ }
+ "
+
+ property string maskShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform lowp sampler2D gradientSource;
+ uniform lowp sampler2D maskSource;
+ uniform highp float qt_Opacity;
+ uniform highp float startAngle;
+ uniform highp vec2 center;
+
+ void main() {
+ lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
+ const highp float PI = 3.14159265;
+ const highp float PIx2inv = 0.1591549;
+ highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
+ gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * maskAlpha * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Desaturate.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Desaturate.qml
new file mode 100644
index 0000000000..a05cb59c32
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Desaturate.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Desaturate
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Reduces the saturation of the colors.
+
+ Desaturated pixel values are calculated as averages of the original RGB
+ component values of the source item.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image Desaturate_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Desaturate-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels to
+ the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines how much the source colors are desaturated.
+
+ The value ranges from 0.0 (no change) to 1.0 (desaturated). By default,
+ the property is set to \c 0.0 (no chnage).
+
+ \table
+ \header
+ \li Output examples with different desaturation values
+ \li
+ \li
+ \row
+ \li \image Desaturate_desaturation1.png
+ \li \image Desaturate_desaturation2.png
+ \li \image Desaturate_desaturation3.png
+ \row
+ \li \b { desaturation: 0.0 }
+ \li \b { desaturation: 0.5 }
+ \li \b { desaturation: 1.0 }
+ \endtable
+ */
+ property real desaturation: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real desaturation: rootItem.desaturation
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float desaturation;
+ void main(void) {
+ lowp vec4 textureColor = texture2D(source, qt_TexCoord0.st);
+ lowp float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0;
+ gl_FragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DirectionalBlur.qml
new file mode 100644
index 0000000000..248e0c5bfc
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DirectionalBlur.qml
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype DirectionalBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-motion-blur
+ \brief Applies blur effect to the specified direction.
+
+ Effect creates perceived impression that the source item appears to be
+ moving in the direction of the blur. Blur is applied to both sides of
+ each pixel, therefore setting the direction to 0 and 180 provides the
+ same result.
+
+ Other available motionblur effects are \l{QtGraphicalEffects1::ZoomBlur}{ZoomBlur} and
+ \l{QtGraphicalEffects1::RadialBlur}{RadialBlur}.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image DirectionalBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet DirectionalBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the percieved amount of movement for each pixel.
+ The movement is divided evenly to both sides of each pixel.
+
+ The quality of the blur depends on \l{DirectionalBlur::samples}{samples}
+ property. If length value is large, more samples are needed to keep the
+ visual quality at high level.
+
+ The value ranges from 0.0 to inf.
+ By default the property is set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different length values
+ \li
+ \li
+ \row
+ \li \image DirectionalBlur_length1.png
+ \li \image DirectionalBlur_length2.png
+ \li \image DirectionalBlur_length3.png
+ \row
+ \li \b { length: 0.0 }
+ \li \b { length: 32.0 }
+ \li \b { length: 48.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \endtable
+
+ */
+ property real length: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ Allowed values are between 0 and inf (practical maximum depends on GPU).
+ By default the property is set to \c 0 (no samples).
+
+ */
+ property int samples: 0
+
+ /*!
+ This property defines the direction for the blur. Blur is applied to
+ both sides of each pixel, therefore setting the direction to 0 and 180
+ produces the same result.
+
+ The value ranges from -180.0 to 180.0.
+ By default the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different angle values
+ \li
+ \li
+ \row
+ \li \image DirectionalBlur_angle1.png
+ \li \image DirectionalBlur_angle2.png
+ \li \image DirectionalBlur_angle3.png
+ \row
+ \li \b { angle: 0.0 }
+ \li \b { angle: 45.0 }
+ \li \b { angle: 90.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l length: 32
+ \li \l length: 32
+ \li \l length: 32
+ \endtable
+
+ */
+ property real angle: 0.0
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real len: rootItem.length
+ property bool transparentBorder: rootItem.transparentBorder
+ property real samples: rootItem.samples
+ property real weight: 1.0 / Math.max(1.0, rootItem.samples)
+ property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0)
+ property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
+ property variant delta: Qt.size(1.0 / rootItem.width * Math.cos((rootItem.angle + 90) * Math.PI/180), 1.0 / rootItem.height * Math.sin((rootItem.angle + 90) * Math.PI/180))
+
+ x: transparentBorder ? -expandPixels.width - 1: 0
+ y: transparentBorder ? -expandPixels.height - 1 : 0
+ width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width
+ height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height
+
+ property string fragmentShaderSkeleton: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float len;
+ uniform highp float samples;
+ uniform highp float weight;
+ uniform highp vec2 expand;
+ uniform highp vec2 delta;
+
+ void main(void) {
+ highp vec2 shift = delta * len / max(1.0, samples - 1.0);
+ mediump vec2 texCoord = qt_TexCoord0;
+ gl_FragColor = vec4(0.0);
+
+ PLACEHOLDER_EXPAND_STEPS
+
+ texCoord -= shift * max(0.0, samples - 1.0) * 0.5;
+
+ PLACEHOLDER_UNROLLED_LOOP
+
+ gl_FragColor *= weight * qt_Opacity;
+ }
+ "
+
+ function buildFragmentShader() {
+ var shader = fragmentShaderSkeleton
+ var expandSteps = ""
+
+ if (transparentBorder) {
+ expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
+ }
+
+ var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
+
+ if (rootItem.samples > 1) {
+ unrolledLoop = ""
+ for (var i = 0; i < rootItem.samples; i++)
+ unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
+ fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
+ }
+
+ onFragmentShaderChanged: sourceChanged()
+ onSamplesChanged: buildFragmentShader()
+ onTransparentBorderChanged: buildFragmentShader()
+ Component.onCompleted: buildFragmentShader()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Displace.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Displace.qml
new file mode 100644
index 0000000000..142ae10a03
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Displace.qml
@@ -0,0 +1,217 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Displace
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-distortion
+ \brief Moves the pixels of the source item according to the given
+ displacement map.
+
+ \table
+ \header
+ \li Source
+ \li DisplacementSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image Displace_map.png
+ \li \image Displace_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Displace-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item for the pixels that are going to
+ be displaced according to the data from
+ \l{Displace::displacementSource}{displacementSource}.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is going to be used as the
+ displacement map. The displacementSource item gets rendered into the
+ intermediate pixel buffer. The red and green component values from the
+ result determine the displacement of the pixels from the source item.
+
+ The format for the displacement map is similar to the tangent space
+ normal maps, which can be created with most 3D-modeling tools. Many
+ image processing tools include the support for generating normal maps.
+ Alternatively, the displacement map for this effect can also be a QML
+ element which is colored appropriately. Like any QML element, it can be
+ animated. It is recommended that the size of the diplacement map matches
+ the size of the \l{Displace::source}{source}.
+
+ The displace data is interpreted in the RGBA format. For every pixel:
+ the red channel stores the x-axis displacement, and the green channel
+ stores the y-axis displacement. Blue and alpha channels are ignored for
+ this effect.
+
+ Assuming that red channel value 1.0 is fully red (0.0 having no red at
+ all), this effect considers pixel component value 0.5 to cause no
+ displacement at all. Values above 0.5 shift pixels to the left, values
+ below 0.5 do the shift to the right. In a similar way, green channel
+ values above 0.5 displace the pixels upwards, and values below 0.5 shift
+ the pixels downwards. The actual amount of displacement in pixels
+ depends on the \l displacement property.
+
+ */
+ property variant displacementSource
+
+ /*!
+ This property defines the scale for the displacement. The bigger scale,
+ the bigger the displacement of the pixels. The value set to 0.0 causes
+ no displacement.
+
+ The value ranges from -1.0 (inverted maximum shift, according to
+ displacementSource) to 1.0 (maximum shift, according to
+ displacementSource). By default, the property is set to \c 0.0 (no
+ displacement).
+
+ \table
+ \header
+ \li Output examples with different displacement values
+ \li
+ \li
+ \row
+ \li \image Displace_displacement1.png
+ \li \image Displace_displacement2.png
+ \li \image Displace_displacement3.png
+ \row
+ \li \b { displacement: -0.2 }
+ \li \b { displacement: 0.0 }
+ \li \b { displacement: 0.2 }
+ \endtable
+
+ */
+ property real displacement: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: displacementSourceProxy
+ input: rootItem.displacementSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant displacementSource: displacementSourceProxy.output
+ property real displacement: rootItem.displacement
+ property real xPixel: 1.0/width
+ property real yPixel: 1.0/height
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D displacementSource;
+ uniform highp float displacement;
+ uniform highp float xPixel;
+ uniform highp float yPixel;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp vec4 offset = texture2D(displacementSource, qt_TexCoord0);
+ offset.xy -= vec2(0.5, 0.5);
+ offset.xy = offset.xy * step(vec2(1.0/256.0), abs(offset.xy));
+ highp vec2 tx = qt_TexCoord0 + (vec2(-offset.x, offset.y) * displacement);
+
+ lowp float e1 = linearstep(0.0, xPixel, tx.x);
+ lowp float e2 = linearstep(0.0, yPixel, tx.y);
+ lowp float e3 = 1.0 - linearstep(1.0, 1.0 + xPixel, tx.x);
+ lowp float e4 = 1.0 - linearstep(1.0, 1.0 + yPixel, tx.y);
+
+ lowp vec4 sample = texture2D(source, tx);
+ sample.rgb *= e1 * e2 * e3 * e4;
+ gl_FragColor = sample * qt_Opacity * offset.a;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DropShadow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DropShadow.qml
new file mode 100644
index 0000000000..b73e244cbc
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DropShadow.qml
@@ -0,0 +1,403 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype DropShadow
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-drop-shadow
+ \brief Generates a colorized and blurred shadow image of the
+ source and places it behind the original, giving the impression that
+ source item is raised from the background.
+
+ By default the effect produces a high quality shadow image, thus the
+ rendering speed of the shadow might not be the highest possible. The
+ rendering speed is reduced especially if the shadow edges are heavily
+ softened.
+
+ For use cases that require faster rendering speed and for which the highest
+ possible visual quality is not necessary, property
+ \l{DropShadow::fast}{fast} can be set to true.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly.png
+ \li \image DropShadow_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet DropShadow-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be used as the
+ source for the generated shadow.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ Radius defines the softness of the shadow. A larger radius causes the
+ edges of the shadow to appear more blurry.
+
+ Depending on the radius value, value of the
+ \l{DropShadow::samples}{samples} should be set to sufficiently large to
+ ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image DropShadow_radius1.png
+ \li \image DropShadow_radius2.png
+ \li \image DropShadow_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 6 }
+ \li \b { radius: 12 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when edge
+ softening blur calculation is done. Larger value produces better
+ quality, but is slower to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ When \l{DropShadow::fast}{fast} property is set to true, this property
+ has no effect.
+
+ */
+ property int samples: 0
+
+ /*!
+ This property defines the RGBA color value which is used for the shadow.
+
+ By default, the property is set to \c "black".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image DropShadow_color1.png
+ \li \image DropShadow_color2.png
+ \li \image DropShadow_color3.png
+ \row
+ \li \b { color: #000000 }
+ \li \b { color: #0000ff }
+ \li \b { color: #aa000000 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property color color: "black"
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::DropShadow::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::DropShadow::verticalOffset
+
+ HorizontalOffset and verticalOffset properties define the offset for the
+ rendered shadow compared to the DropShadow item position. Often, the
+ DropShadow item is anchored so that it fills the source element. In this
+ case, if the HorizontalOffset and verticalOffset properties are set to
+ 0, the shadow is rendered exactly under the source item. By changing the
+ offset properties, the shadow can be positioned relatively to the source
+ item.
+
+ The values range from -inf to inf. By default, the properties are set to
+ \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image DropShadow_horizontalOffset1.png
+ \li \image DropShadow_horizontalOffset2.png
+ \li \image DropShadow_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: -20 }
+ \li \b { horizontalOffset: 0 }
+ \li \b { horizontalOffset: 20 }
+ \row
+ \li \l radius: 4
+ \li \l radius: 4
+ \li \l radius: 4
+ \row
+ \li \l samples: 8
+ \li \l samples: 8
+ \li \l samples: 8
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ This property defines how large part of the shadow color is strenghtened
+ near the source edges.
+
+ The value ranges from 0.0 to 1.0. By default, the property is set to \c
+ 0.5.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image DropShadow_spread1.png
+ \li \image DropShadow_spread2.png
+ \li \image DropShadow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.5 }
+ \li \b { spread: 1.0 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \endtable
+
+ */
+ property real spread: 0.0
+
+ /*!
+ This property selects the blurring algorithm that is used to produce the
+ softness for the effect. Setting this to true enables fast algorithm,
+ setting value to false produces higher quality result.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different fast values
+ \li
+ \li
+ \row
+ \li \image DropShadow_fast1.png
+ \li \image DropShadow_fast2.png
+ \row
+ \li \b { fast: false }
+ \li \b { fast: true }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property bool fast: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance. Every time the source or effect
+ properties are changed, the pixels in the cache must be updated. Memory
+ consumption is increased, because an extra buffer of memory is required
+ for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ property bool transparentBorder: false
+
+ Loader {
+ x: rootItem.horizontalOffset
+ y: rootItem.verticalOffset
+ width: parent.width
+ height: parent.height
+ sourceComponent: rootItem.fast ? fastGlow : gaussianGlow
+ }
+
+ Component {
+ id: gaussianGlow
+ GaussianGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ Component {
+ id: fastGlow
+ FastGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+ ShaderEffect {
+ anchors.fill: parent
+ property variant source: sourceProxy.output
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/FastBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/FastBlur.qml
new file mode 100644
index 0000000000..ca38ad2fbf
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/FastBlur.qml
@@ -0,0 +1,496 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype FastBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blur
+ \brief Applies a fast blur effect to one or more source items.
+
+ FastBlur offers lower blur quality than
+ \l{QtGraphicalEffects1::GaussianBlur}{GaussianBlur}, but it is faster to
+ render. The FastBlur effect softens the source content by blurring it with
+ algorithm which uses the source content downscaling and bilinear filtering.
+ Use this effect in situations where the source content is rapidly changing
+ and the highest possible blur quality is not
+ needed.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image FastBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet FastBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the distance of the neighboring pixels which affect
+ the blurring of an individual pixel. A larger radius increases the blur
+ effect. FastBlur algorithm may internally reduce the accuracy of the radius in order to
+ provide good rendering performance.
+
+ The value ranges from 0.0 (no blur) to inf. Visual quality of the blur is reduced when
+ radius exceeds value 64. By default, the property is set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different blur values
+ \li
+ \li
+ \row
+ \li \image FastBlur_radius1.png
+ \li \image FastBlur_radius2.png
+ \li \image FastBlur_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 32 }
+ \li \b { radius: 64 }
+ \endtable
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different transparentBorder values
+ \li
+ \li
+ \row
+ \li \image FastBlur_transparentBorder1.png
+ \li \image FastBlur_transparentBorder2.png
+ \row
+ \li \b { transparentBorder: false }
+ \li \b { transparentBorder: true }
+ \row
+ \li \l radius: 64
+ \li \l radius: 64
+ \endtable
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ smooth: rootItem.radius > 0
+ }
+
+ /*! \internal */
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ /*! \internal */
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
+ visible: false
+ smooth: rootItem.radius > 0
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ Item {
+ id: dummysource
+ width: 1
+ height: 1
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: dummy
+ width: 1
+ height: 1
+ sourceItem: dummysource
+ visible: false
+ smooth: false
+ live: false
+ }
+
+ ShaderEffect {
+ id: shaderItem
+
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: Math.sqrt(rootItem.radius / 64.0) * 1.2 - 0.2
+ property real weight1
+ property real weight2
+ property real weight3
+ property real weight4
+ property real weight5
+ property real weight6
+
+ x: transparentBorder ? -64 : 0
+ y: transparentBorder ? -64 : 0
+ width: transparentBorder ? parent.width + 128 : parent.width
+ height: transparentBorder ? parent.height + 128 : parent.height
+
+ function weight(v) {
+ if (v <= 0.0)
+ return 1.0
+ if (v >= 0.5)
+ return 0.0
+
+ return 1.0 - v * 2.0
+ }
+
+ function calculateWeights() {
+
+ var w1 = weight(Math.abs(lod - 0.100))
+ var w2 = weight(Math.abs(lod - 0.300))
+ var w3 = weight(Math.abs(lod - 0.500))
+ var w4 = weight(Math.abs(lod - 0.700))
+ var w5 = weight(Math.abs(lod - 0.900))
+ var w6 = weight(Math.abs(lod - 1.100))
+
+ var sum = w1 + w2 + w3 + w4 + w5 + w6;
+ weight1 = w1 / sum;
+ weight2 = w2 / sum;
+ weight3 = w3 / sum;
+ weight4 = w4 / sum;
+ weight5 = w5 / sum;
+ weight6 = w6 / sum;
+
+ upateSources()
+ }
+
+ function upateSources() {
+ var sources = new Array();
+ var weights = new Array();
+
+ if (weight1 > 0) {
+ sources.push(level1)
+ weights.push(weight1)
+ }
+
+ if (weight2 > 0) {
+ sources.push(level2)
+ weights.push(weight2)
+ }
+
+ if (weight3 > 0) {
+ sources.push(level3)
+ weights.push(weight3)
+ }
+
+ if (weight4 > 0) {
+ sources.push(level4)
+ weights.push(weight4)
+ }
+
+ if (weight5 > 0) {
+ sources.push(level5)
+ weights.push(weight5)
+ }
+
+ if (weight6 > 0) {
+ sources.push(level6)
+ weights.push(weight6)
+ }
+
+ for (var j = sources.length; j < 6; j++) {
+ sources.push(dummy)
+ weights.push(0.0)
+ }
+
+ source1 = sources[0]
+ source2 = sources[1]
+ source3 = sources[2]
+ source4 = sources[3]
+ source5 = sources[4]
+ source6 = sources[5]
+
+ weight1 = weights[0]
+ weight2 = weights[1]
+ weight3 = weights[2]
+ weight4 = weights[3]
+ weight5 = weights[4]
+ weight6 = weights[5]
+ }
+
+ Component.onCompleted: calculateWeights()
+
+ onLodChanged: calculateWeights()
+
+ fragmentShader: "
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform mediump float weight1;
+ uniform mediump float weight2;
+ uniform mediump float weight3;
+ uniform mediump float weight4;
+ uniform mediump float weight5;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ void main() {
+ lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GammaAdjust.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GammaAdjust.qml
new file mode 100644
index 0000000000..7a597dd05e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GammaAdjust.qml
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype GammaAdjust
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Alters the luminance of the source item.
+
+ GammaAdjust is applied to each pixel according to the curve which is
+ pre-defined as a power-law expression, where the property gamma is used as the
+ reciprocal scaling exponent. Refer to the property documentation of \l{GammaAdjust::gamma}{gamma}
+ for more details.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image GammaAdjust_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet GammaAdjust-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item for which the luminance is going to be
+ adjusted.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the change factor for how the luminance of each pixel
+ is altered according to the equation:
+
+ \code
+luminance = pow(original_luminance, 1.0 / gamma); // The luminance is assumed to be between 0.0 and 1.0
+ \endcode
+
+ Setting the gamma values under 1.0 makes the image darker, the values
+ above 1.0 lighten it.
+
+ The value ranges from 0.0 (darkest) to inf (lightest). By default, the
+ property is set to \c 1.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different gamma values
+ \li
+ \li
+ \row
+ \li \image GammaAdjust_gamma1.png
+ \li \image GammaAdjust_gamma2.png
+ \li \image GammaAdjust_gamma3.png
+ \row
+ \li \b { gamma: 0.5 }
+ \li \b { gamma: 1.0 }
+ \li \b { gamma: 2.0 }
+ \endtable
+
+ \table
+ \header
+ \li Pixel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image GammaAdjust_gamma1_graph.png
+ \li \image GammaAdjust_gamma2_graph.png
+ \li \image GammaAdjust_gamma3_graph.png
+ \row
+ \li Red curve: default gamma (1.0)
+ \li
+ \li
+ \row
+ \li Yellow curve: effect applied
+ \li
+ \li
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: pixel luminance with effect applied
+ \li
+ \li
+ \endtable
+
+ */
+ property real gamma: 1.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real gamma: 1.0 / Math.max(rootItem.gamma, 0.0001)
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float gamma;
+ void main(void) {
+ highp vec4 originalColor = texture2D(source, qt_TexCoord0.st);
+ originalColor.rgb = originalColor.rgb / max(1.0/256.0, originalColor.a);
+ highp vec3 adjustedColor = pow(originalColor.rgb, vec3(gamma));
+ gl_FragColor = vec4(adjustedColor * originalColor.a, originalColor.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GaussianBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GaussianBlur.qml
new file mode 100644
index 0000000000..4000179ef7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GaussianBlur.qml
@@ -0,0 +1,295 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype GaussianBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blur
+ \brief Applies a higher quality blur effect.
+
+ GaussianBlur effect softens the image by blurring it with an algorithm that
+ uses the Gaussian function to calculate the effect. The effect produces
+ higher quality than \l{QtGraphicalEffects1::FastBlur}{FastBlur}, but is
+ slower to render.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image GaussianBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet GaussianBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the distance of the neighboring pixels which
+ affect the blurring of an individual pixel. A larger radius increases
+ the blur effect.
+
+ Depending on the radius value, value of the
+ \l{GaussianBlur::samples}{samples} should be set to sufficiently large
+ to ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image GaussianBlur_radius1.png
+ \li \image GaussianBlur_radius2.png
+ \li \image GaussianBlur_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 4 }
+ \li \b { radius: 8 }
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l deviation: 3
+ \li \l deviation: 3
+ \li \l deviation: 3
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ */
+ property int samples: 0
+
+ /*!
+ This property is a parameter to the gaussian function that is used when
+ calculating neighboring pixel weights for the blurring. A larger
+ deviation causes image to appear more blurry, but it also reduces the
+ quality of the blur. A very large deviation value causes the effect to
+ look a bit similar to what, for exmple, a box blur algorithm produces. A
+ too small deviation values makes the effect insignificant for the pixels
+ near the radius.
+
+ \inlineimage GaussianBlur_deviation_graph.png
+ \caption The image above shows the Gaussian function with two different
+ deviation values, yellow (1) and cyan (2.7). The y-axis shows the
+ weights, the x-axis shows the pixel distance.
+
+ The value ranges from 0.0 (no deviation) to inf (maximum deviation). By
+ default, devaition is binded to radius. When radius increases, deviation
+ is automatically increased linearly. With the radius value of 8, the
+ deviation default value becomes approximately 2.7034. This value
+ produces a compromise between the blur quality and overall blurriness.
+
+ \table
+ \header
+ \li Output examples with different deviation values
+ \li
+ \li
+ \row
+ \li \image GaussianBlur_deviation1.png
+ \li \image GaussianBlur_deviation2.png
+ \li \image GaussianBlur_deviation3.png
+ \row
+ \li \b { deviation: 1 }
+ \li \b { deviation: 2 }
+ \li \b { deviation: 4 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \endtable
+
+ */
+ property real deviation: (radius + 1) / 3.3333
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different transparentBorder values
+ \li
+ \li
+ \row
+ \li \image GaussianBlur_transparentBorder1.png
+ \li \image GaussianBlur_transparentBorder2.png
+ \row
+ \li \b { transparentBorder: false }
+ \li \b { transparentBorder: true }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l deviation: 2.7
+ \li \l deviation: 2.7
+ \endtable
+
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: verticalBlur
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: verticalBlur
+ live: true
+ hideSource: visible
+ }
+
+ GaussianDirectionalBlur {
+ id: verticalBlur
+ x: transparentBorder ? -maximumRadius - 1 : 0
+ y: transparentBorder ? -maximumRadius - 1 : 0
+ width: horizontalBlur.width
+ height: horizontalBlur.height
+
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+
+ source: ShaderEffectSource {
+ id: horizontalBlurSource
+ sourceItem: horizontalBlur
+ hideSource: true
+ visible: false
+ smooth: true
+ }
+
+ deviation: rootItem.deviation
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ transparentBorder: rootItem.transparentBorder
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
+ height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
+
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+
+ source: sourceProxy.output
+ deviation: rootItem.deviation
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples / 2.0
+ transparentBorder: rootItem.transparentBorder
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Glow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Glow.qml
new file mode 100644
index 0000000000..c5a82c6f1e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Glow.qml
@@ -0,0 +1,307 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Glow
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-glow
+ \brief Generates a blurred and colorized image of the source and places it
+ behind the original, giving impression that the source is glowing.
+
+ By default effect produces a high quality glow image, thus the rendering
+ speed of the effect may not be the highest possible. The rendering speed is
+ reduced especially if the glow edges are heavily softened. For use cases
+ that require faster rendering speed and the highest possible visual quality
+ is not necessary, property \l{Glow::fast}{fast} can be set to true.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly_black.png
+ \li \image Glow_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Glow-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be used as source
+ for the generated glow.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ Radius defines the softness of the glow. A larger radius causes the
+ edges of the glow to appear more blurry.
+
+ Depending on the radius value, value of the \l{Glow::samples}{samples}
+ should be set to sufficiently large to ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image Glow_radius1.png
+ \li \image Glow_radius2.png
+ \li \image Glow_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 6 }
+ \li \b { radius: 12 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when edge
+ softening blur calculation is done. Larger value produces better
+ quality, but is slower to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ When \l fast property is set to true, this property has no effect.
+
+ */
+ property int samples: 0
+
+ /*!
+ This property defines how large part of the glow color is strenghtened
+ near the source edges.
+
+ The values range from 0.0 to 1.0. By default, the property is set to \c
+ 0.5.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image Glow_spread1.png
+ \li \image Glow_spread2.png
+ \li \image Glow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.5 }
+ \li \b { spread: 1.0 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \endtable
+ */
+ property real spread: 0.0
+
+ /*!
+ This property defines the RGBA color value which is used for the glow.
+
+ By default, the property is set to \c "white".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image Glow_color1.png
+ \li \image Glow_color2.png
+ \li \image Glow_color3.png
+ \row
+ \li \b { color: #ffffff }
+ \li \b { color: #00ff00 }
+ \li \b { color: #aa00ff00 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l spread: 0.5
+ \li \l spread: 0.5
+ \li \l spread: 0.5
+ \endtable
+
+ */
+ property color color: "white"
+
+ /*!
+ This property selects the blurring algorithm that is used to produce the
+ softness for the effect. Setting this to true enables fast algorithm,
+ setting value to false produces higher quality result.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different fast values
+ \li
+ \li
+ \row
+ \li \image Glow_fast1.png
+ \li \image Glow_fast2.png
+ \row
+ \li \b { fast: false }
+ \li \b { fast: true }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l spread: 0.3
+ \li \l spread: 0.3
+ \endtable
+ */
+ property bool fast: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+ property bool transparentBorder: false
+
+ Loader {
+ anchors.fill: parent
+ sourceComponent: rootItem.fast ? fastGlow : gaussianGlow
+ }
+
+ Component {
+ id: gaussianGlow
+ GaussianGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ Component {
+ id: fastGlow
+ FastGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+ ShaderEffect {
+ anchors.fill: parent
+ property variant source: sourceProxy.output
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/HueSaturation.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/HueSaturation.qml
new file mode 100644
index 0000000000..fb1d895959
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/HueSaturation.qml
@@ -0,0 +1,300 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype HueSaturation
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Alters the source item colors in the HSL color space.
+
+ HueSaturation is similar to the \l{QtGraphicalEffects1::Colorize}{Colorize}
+ effect, but the hue and saturation property values are handled differently.
+ The HueSaturation effect always shifts the hue, saturation, and lightness
+ from the original, instead of setting them.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image HueSaturation_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet HueSaturation-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source: 0
+
+ /*!
+ This property defines the hue value which is added to the source hue
+ value.
+
+ The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
+ property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different hue values
+ \li
+ \li
+ \row
+ \li \image HueSaturation_hue1.png
+ \li \image HueSaturation_hue2.png
+ \li \image HueSaturation_hue3.png
+ \row
+ \li \b { hue: -0.3 }
+ \li \b { hue: 0.0 }
+ \li \b { hue: 0.3 }
+ \row
+ \li \l saturation: 0
+ \li \l saturation: 0
+ \li \l saturation: 0
+ \row
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \endtable
+
+ */
+ property real hue: 0.0
+
+ /*!
+ This property defines the saturation value value which is added to the
+ source saturation value.
+
+ The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
+ property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different saturation values
+ \li
+ \li
+ \row
+ \li \image HueSaturation_saturation1.png
+ \li \image HueSaturation_saturation2.png
+ \li \image HueSaturation_saturation3.png
+ \row
+ \li \b { saturation: -0.8 }
+ \li \b { saturation: 0.0 }
+ \li \b { saturation: 1.0 }
+ \row
+ \li \l hue: 0
+ \li \l hue: 0
+ \li \l hue: 0
+ \row
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \endtable
+
+ */
+ property real saturation: 0.0
+
+ /*!
+ This property defines the lightness value which is added to the source
+ saturation value.
+
+ The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
+ property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different lightness values
+ \li
+ \li
+ \row
+ \li \image HueSaturation_lightness1.png
+ \li \image HueSaturation_lightness2.png
+ \li \image HueSaturation_lightness3.png
+ \row
+ \li \b { lightness: -0.5 }
+ \li \b { lightness: 0.0 }
+ \li \b { lightness: 0.5 }
+ \row
+ \li \l hue: 0
+ \li \l hue: 0
+ \li \l hue: 0
+ \row
+ \li \l saturation: 0
+ \li \l saturation: 0
+ \li \l saturation: 0
+ \endtable
+
+ */
+ property real lightness: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant hsl: Qt.vector3d(rootItem.hue, rootItem.saturation, rootItem.lightness)
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform highp sampler2D source;
+ uniform highp vec3 hsl;
+
+ highp vec3 RGBtoHSL(highp vec3 color) {
+ highp float cmin = min(color.r, min(color.g, color.b));
+ highp float cmax = max(color.r, max(color.g, color.b));
+ highp float h = 0.0;
+ highp float s = 0.0;
+ highp float l = (cmin + cmax) / 2.0;
+ highp float diff = cmax - cmin;
+
+ if (diff > 1.0 / 256.0) {
+ if (l < 0.5)
+ s = diff / (cmin + cmax);
+ else
+ s = diff / (2.0 - (cmin + cmax));
+
+ if (color.r == cmax)
+ h = (color.g - color.b) / diff;
+ else if (color.g == cmax)
+ h = 2.0 + (color.b - color.r) / diff;
+ else
+ h = 4.0 + (color.r - color.g) / diff;
+
+ h /= 6.0;
+ }
+ return vec3(h, s, l);
+ }
+
+ highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
+ h = fract(h);
+ if (h < 1.0 / 6.0)
+ return v1 + (v2 - v1) * 6.0 * h;
+ else if (h < 1.0 / 2.0)
+ return v2;
+ else if (h < 2.0 / 3.0)
+ return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
+
+ return v1;
+ }
+
+ highp vec3 HSLtoRGB(highp vec3 color) {
+ highp float h = color.x;
+ highp float l = color.z;
+ highp float s = color.y;
+
+ if (s < 1.0 / 256.0)
+ return vec3(l);
+
+ highp float v1;
+ highp float v2;
+ if (l < 0.5)
+ v2 = l * (1.0 + s);
+ else
+ v2 = (l + s) - (s * l);
+
+ v1 = 2.0 * l - v2;
+
+ highp float d = 1.0 / 3.0;
+ highp float r = hueToIntensity(v1, v2, h + d);
+ highp float g = hueToIntensity(v1, v2, h);
+ highp float b = hueToIntensity(v1, v2, h - d);
+ return vec3(r, g, b);
+ }
+
+ void main() {
+ lowp vec4 sample = texture2D(source, qt_TexCoord0);
+ sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a);
+ sample.rgb = mix(vec3(dot(sample.rgb, vec3(0.2125, 0.7154, 0.0721))), sample.rgb, 1.0 + hsl.y);
+ sample.xyz = RGBtoHSL(sample.rgb);
+ sample.rgb = HSLtoRGB(vec3(sample.x + hsl.x, sample.y, sample.z));
+ highp float c = step(0.0, hsl.z);
+ sample.rgb = mix(sample.rgb, vec3(c), abs(hsl.z));
+ gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/InnerShadow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/InnerShadow.qml
new file mode 100644
index 0000000000..5eebc6fa3b
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/InnerShadow.qml
@@ -0,0 +1,385 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype InnerShadow
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-drop-shadow
+ \brief Generates a colorized and blurred shadow inside the
+ source.
+
+ By default the effect produces a high quality shadow image, thus the
+ rendering speed of the shadow might not be the highest possible. The
+ rendering speed is reduced especially if the shadow edges are heavily
+ softened. For use cases that require faster rendering speed and for which
+ the highest possible visual quality is not necessary, property
+ \l{InnerShadow::fast}{fast} can be set to true.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly.png
+ \li \image InnerShadow_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet InnerShadow-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be used as the
+ source for the generated shadow.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ Radius defines the softness of the shadow. A larger radius causes the
+ edges of the shadow to appear more blurry.
+
+ Depending on the radius value, value of the
+ \l{InnerShadow::samples}{samples} should be set to sufficiently large to
+ ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_radius1.png
+ \li \image InnerShadow_radius2.png
+ \li \image InnerShadow_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 6 }
+ \li \b { radius: 12 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when edge
+ softening blur calculation is done. Larger value produces better
+ quality, but is slower to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ When \l{InnerShadow::fast}{fast} property is set to true, this property
+ has no effect.
+
+ */
+ property int samples: 0
+
+ /*!
+ This property defines how large part of the shadow color is strenghtened
+ near the source edges.
+
+ The value ranges from 0.0 to 1.0. By default, the property is set to \c
+ 0.5.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_spread1.png
+ \li \image InnerShadow_spread2.png
+ \li \image InnerShadow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.3 }
+ \li \b { spread: 0.5 }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+ */
+ property real spread: 0.0
+
+ /*!
+ This property defines the RGBA color value which is used for the shadow.
+
+ By default, the property is set to \c "black".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_color1.png
+ \li \image InnerShadow_color2.png
+ \li \image InnerShadow_color3.png
+ \row
+ \li \b { color: #000000 }
+ \li \b { color: #ffffff }
+ \li \b { color: #ff0000 }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \endtable
+ */
+ property color color: "black"
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::InnerShadow::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::InnerShadow::verticalOffset
+
+ HorizontalOffset and verticalOffset properties define the offset for the
+ rendered shadow compared to the InnerShadow item position. Often, the
+ InnerShadow item is anchored so that it fills the source element. In
+ this case, if the HorizontalOffset and verticalOffset properties are set
+ to 0, the shadow is rendered fully inside the source item. By changing
+ the offset properties, the shadow can be positioned relatively to the
+ source item.
+
+ The values range from -inf to inf. By default, the properties are set to
+ \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_horizontalOffset1.png
+ \li \image InnerShadow_horizontalOffset2.png
+ \li \image InnerShadow_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: -20 }
+ \li \b { horizontalOffset: 0 }
+ \li \b { horizontalOffset: 20 }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property real horizontalOffset: 0
+ property real verticalOffset: 0
+
+ /*!
+ This property selects the blurring algorithm that is used to produce the
+ softness for the effect. Setting this to true enables fast algorithm,
+ setting value to false produces higher quality result.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different fast values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_fast1.png
+ \li \image InnerShadow_fast2.png
+ \row
+ \li \b { fast: false }
+ \li \b { fast: true }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \endtable
+ */
+ property bool fast: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance. Every time the source or effect
+ properties are changed, the pixels in the cache must be updated. Memory
+ consumption is increased, because an extra buffer of memory is required
+ for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ Loader {
+ anchors.fill: parent
+ sourceComponent: rootItem.fast ? innerShadow : gaussianInnerShadow
+ }
+
+ Component {
+ id: gaussianInnerShadow
+ GaussianInnerShadow {
+ anchors.fill: parent
+ source: rootItem.source
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ horizontalOffset: rootItem.horizontalOffset
+ verticalOffset: rootItem.verticalOffset
+ }
+ }
+
+ Component {
+ id: innerShadow
+ FastInnerShadow {
+ anchors.fill: parent
+ source: rootItem.source
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ horizontalOffset: rootItem.horizontalOffset
+ verticalOffset: rootItem.verticalOffset
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LevelAdjust.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LevelAdjust.qml
new file mode 100644
index 0000000000..5d739fb941
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LevelAdjust.qml
@@ -0,0 +1,472 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Add-On Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype LevelAdjust
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Adjusts color levels in the RGBA color space.
+
+ This effect adjusts the source item colors separately for each color
+ channel. Source item contrast can be adjusted and color balance altered.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly.png
+ \li \image LevelAdjust_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet LevelAdjust-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the change factor for how the value of each pixel
+ color channel is altered according to the equation:
+
+ \code result.rgb = pow(original.rgb, 1.0 / gamma.rgb); \endcode
+
+ Setting the gamma values under QtVector3d(1.0, 1.0, 1.0) makes the image
+ darker, the values above QtVector3d(1.0, 1.0, 1.0) lighten it.
+
+ The value ranges from QtVector3d(0.0, 0.0, 0.0) (darkest) to inf
+ (lightest). By default, the property is set to \c QtVector3d(1.0, 1.0,
+ 1.0) (no change).
+
+ \table
+ \header
+ \li Output examples with different gamma values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_gamma1.png
+ \li \image LevelAdjust_gamma2.png
+ \li \image LevelAdjust_gamma3.png
+ \row
+ \li \b { gamma: Qt.vector3d(1.0, 1.0, 1.0) }
+ \li \b { gamma: Qt.vector3d(1.0, 0.4, 2.0) }
+ \li \b { gamma: Qt.vector3d(1.0, 0.1, 4.0) }
+ \row
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \row
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \row
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \row
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_gamma2_curve.png
+ \li \image LevelAdjust_gamma3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+ */
+ property variant gamma: Qt.vector3d(1.0, 1.0, 1.0)
+
+ /*!
+ This property defines the minimum input level for each color channel. It
+ sets the black-point, all pixels having lower value than this property
+ are rendered as black (per color channel). Increasing the value darkens
+ the dark areas.
+
+ The value ranges from "#00000000" to "#ffffffff". By default, the
+ property is set to \c "#00000000" (no change).
+
+ \table
+ \header
+ \li Output examples with different minimumInput values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_minimumInput1.png
+ \li \image LevelAdjust_minimumInput2.png
+ \li \image LevelAdjust_minimumInput3.png
+ \row
+ \li \b { minimumInput: #00000000 }
+ \li \b { minimumInput: #00000040 }
+ \li \b { minimumInput: #00000070 }
+ \row
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \row
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \row
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \row
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_minimumInput2_curve.png
+ \li \image LevelAdjust_minimumInput3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+
+ */
+ property color minimumInput: Qt.rgba(0.0, 0.0, 0.0, 0.0)
+
+ /*!
+ This property defines the maximum input level for each color channel.
+ It sets the white-point, all pixels having higher value than this
+ property are rendered as white (per color channel).
+ Decreasing the value lightens the light areas.
+
+ The value ranges from "#ffffffff" to "#00000000". By default, the
+ property is set to \c "#ffffffff" (no change).
+
+ \table
+ \header
+ \li Output examples with different maximumInput values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_maximumInput1.png
+ \li \image LevelAdjust_maximumInput2.png
+ \li \image LevelAdjust_maximumInput3.png
+ \row
+ \li \b { maximumInput: #FFFFFFFF }
+ \li \b { maximumInput: #FFFFFF80 }
+ \li \b { maximumInput: #FFFFFF30 }
+ \row
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \row
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \row
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \row
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_maximumInput2_curve.png
+ \li \image LevelAdjust_maximumInput3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+
+ */
+ property color maximumInput: Qt.rgba(1.0, 1.0, 1.0, 1.0)
+
+ /*!
+ This property defines the minimum output level for each color channel.
+ Increasing the value lightens the dark areas, reducing the contrast.
+
+ The value ranges from "#00000000" to "#ffffffff". By default, the
+ property is set to \c "#00000000" (no change).
+
+ \table
+ \header
+ \li Output examples with different minimumOutput values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_minimumOutput1.png
+ \li \image LevelAdjust_minimumOutput2.png
+ \li \image LevelAdjust_minimumOutput3.png
+ \row
+ \li \b { minimumOutput: #00000000 }
+ \li \b { minimumOutput: #00000070 }
+ \li \b { minimumOutput: #000000A0 }
+ \row
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \row
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \row
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \row
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_minimumOutput2_curve.png
+ \li \image LevelAdjust_minimumOutput3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+
+ */
+ property color minimumOutput: Qt.rgba(0.0, 0.0, 0.0, 0.0)
+
+ /*!
+ This property defines the maximum output level for each color channel.
+ Decreasing the value darkens the light areas, reducing the contrast.
+
+ The value ranges from "#ffffffff" to "#00000000". By default, the
+ property is set to \c "#ffffffff" (no change).
+
+ \table
+ \header
+ \li Output examples with different maximumOutput values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_maximumOutput1.png
+ \li \image LevelAdjust_maximumOutput2.png
+ \li \image LevelAdjust_maximumOutput3.png
+ \row
+ \li \b { maximumOutput: #FFFFFFFF }
+ \li \b { maximumOutput: #FFFFFF80 }
+ \li \b { maximumOutput: #FFFFFF30 }
+ \row
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \row
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \row
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \row
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_maximumOutput2_curve.png
+ \li \image LevelAdjust_maximumOutput3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+ */
+ property color maximumOutput: Qt.rgba(1.0, 1.0, 1.0, 1.0)
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant minimumInputRGB: Qt.vector3d(rootItem.minimumInput.r, rootItem.minimumInput.g, rootItem.minimumInput.b)
+ property variant maximumInputRGB: Qt.vector3d(rootItem.maximumInput.r, rootItem.maximumInput.g, rootItem.maximumInput.b)
+ property real minimumInputAlpha: rootItem.minimumInput.a
+ property real maximumInputAlpha: rootItem.maximumInput.a
+ property variant minimumOutputRGB: Qt.vector3d(rootItem.minimumOutput.r, rootItem.minimumOutput.g, rootItem.minimumOutput.b)
+ property variant maximumOutputRGB: Qt.vector3d(rootItem.maximumOutput.r, rootItem.maximumOutput.g, rootItem.maximumOutput.b)
+ property real minimumOutputAlpha: rootItem.minimumOutput.a
+ property real maximumOutputAlpha: rootItem.maximumOutput.a
+ property variant gamma: Qt.vector3d(1.0 / Math.max(rootItem.gamma.x, 0.0001), 1.0 / Math.max(rootItem.gamma.y, 0.0001), 1.0 / Math.max(rootItem.gamma.z, 0.0001))
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp vec3 minimumInputRGB;
+ uniform highp vec3 maximumInputRGB;
+ uniform highp float minimumInputAlpha;
+ uniform highp float maximumInputAlpha;
+ uniform highp vec3 minimumOutputRGB;
+ uniform highp vec3 maximumOutputRGB;
+ uniform highp float minimumOutputAlpha;
+ uniform highp float maximumOutputAlpha;
+ uniform highp vec3 gamma;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main(void) {
+ highp vec4 textureColor = texture2D(source, qt_TexCoord0.st);
+ highp vec4 color = vec4(textureColor.rgb / max(1.0/256.0, textureColor.a), textureColor.a);
+
+ color.r = linearstep(minimumInputRGB.r, maximumInputRGB.r, color.r);
+ color.g = linearstep(minimumInputRGB.g, maximumInputRGB.g, color.g);
+ color.b = linearstep(minimumInputRGB.b, maximumInputRGB.b, color.b);
+ color.a = linearstep(minimumInputAlpha, maximumInputAlpha, color.a);
+
+ color.rgb = pow(color.rgb, gamma);
+
+ color.r = minimumOutputRGB.r + color.r * (maximumOutputRGB.r - minimumOutputRGB.r);
+ color.g = minimumOutputRGB.g + color.g * (maximumOutputRGB.g - minimumOutputRGB.g);
+ color.b = minimumOutputRGB.b + color.b * (maximumOutputRGB.b - minimumOutputRGB.b);
+ color.a = minimumOutputAlpha + color.a * (maximumOutputAlpha - minimumOutputAlpha);
+
+ gl_FragColor = vec4(color.rgb * color.a, color.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LinearGradient.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LinearGradient.qml
new file mode 100644
index 0000000000..b5845ea9d8
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LinearGradient.qml
@@ -0,0 +1,346 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype LinearGradient
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-gradient
+ \brief Draws a linear gradient.
+
+ A gradient is defined by two or more colors, which are blended seamlessly.
+ The colors start from the given start point and end to the given end point.
+
+ \table
+ \header
+ \li Effect applied
+ \row
+ \li \image LinearGradient.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet LinearGradient-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the starting point where the color at gradient
+ position of 0.0 is rendered. Colors at larger position values are
+ rendered linearly towards the end point. The point is given in pixels
+ and the default value is Qt.point(0, 0). Setting the default values for
+ the start and \l{LinearGradient::end}{end} results in a full height
+ linear gradient on the y-axis.
+
+ \table
+ \header
+ \li Output examples with different start values
+ \li
+ \li
+ \row
+ \li \image LinearGradient_start1.png
+ \li \image LinearGradient_start2.png
+ \li \image LinearGradient_start3.png
+ \row
+ \li \b { start: QPoint(0, 0) }
+ \li \b { start: QPoint(150, 150) }
+ \li \b { start: QPoint(300, 0) }
+ \row
+ \li \l end: QPoint(300, 300)
+ \li \l end: QPoint(300, 300)
+ \li \l end: QPoint(300, 300)
+ \endtable
+
+ */
+ property variant start: Qt.point(0, 0)
+
+ /*!
+ This property defines the ending point where the color at gradient
+ position of 1.0 is rendered. Colors at smaller position values are
+ rendered linearly towards the start point. The point is given in pixels
+ and the default value is Qt.point(0, height). Setting the default values
+ for the \l{LinearGradient::start}{start} and end results in a full
+ height linear gradient on the y-axis.
+
+ \table
+ \header
+ \li Output examples with different end values
+ \li
+ \li
+ \row
+ \li \image LinearGradient_end1.png
+ \li \image LinearGradient_end2.png
+ \li \image LinearGradient_end3.png
+ \row
+ \li \b { end: Qt.point(300, 300) }
+ \li \b { end: Qt.point(150, 150) }
+ \li \b { end: Qt.point(300, 0) }
+ \row
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \endtable
+
+ */
+ property variant end: Qt.point(0, height)
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ /*!
+ This property defines the item that is going to be filled with gradient.
+ Source item gets rendered into an intermediate pixel buffer and the
+ alpha values from the result are used to determine the gradient's pixels
+ visibility in the display. The default value for source is undefined and
+ in that case whole effect area is filled with gradient.
+
+ \table
+ \header
+ \li Output examples with different source values
+ \li
+ \li
+ \row
+ \li \image LinearGradient_maskSource1.png
+ \li \image LinearGradient_maskSource2.png
+ \row
+ \li \b { source: undefined }
+ \li \b { source: Image { source: images/butterfly.png } }
+ \row
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \row
+ \li \l end: Qt.point(300, 300)
+ \li \l end: Qt.point(300, 300)
+ \endtable
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+
+ /*!
+ A gradient is defined by two or more colors, which are blended
+ seamlessly. The colors are specified as a set of GradientStop child
+ items, each of which defines a position on the gradient from 0.0 to 1.0
+ and a color. The position of each GradientStop is defined by the
+ position property, and the color is definded by the color property.
+
+ \table
+ \header
+ \li Output examples with different gradient values
+ \li
+ \li
+ \row
+ \li \image LinearGradient_gradient1.png
+ \li \image LinearGradient_gradient2.png
+ \li \image LinearGradient_gradient3.png
+ \row
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.000
+ color: Qt.rgba(1, 0, 0, 1) }
+ GradientStop { position: 0.167;
+ color: Qt.rgba(1, 1, 0, 1) }
+ GradientStop { position: 0.333;
+ color: Qt.rgba(0, 1, 0, 1) }
+ GradientStop { position: 0.500;
+ color: Qt.rgba(0, 1, 1, 1) }
+ GradientStop { position: 0.667;
+ color: Qt.rgba(0, 0, 1, 1) }
+ GradientStop { position: 0.833;
+ color: Qt.rgba(1, 0, 1, 1) }
+ GradientStop { position: 1.000;
+ color: Qt.rgba(1, 0, 0, 1) }
+ }
+ \endcode
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.0
+ color: "#F0F0F0"
+ }
+ GradientStop { position: 0.5
+ color: "#000000"
+ }
+ GradientStop { position: 1.0
+ color: "#F0F0F0"
+ }
+ }
+ \endcode
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.0
+ color: "#00000000"
+ }
+ GradientStop { position: 1.0
+ color: "#FF000000"
+ }
+ }
+ \endcode
+ \row
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \row
+ \li \l end: Qt.point(300, 300)
+ \li \l end: Qt.point(300, 300)
+ \li \l end: Qt.point(300, 300)
+ \endtable
+
+ */
+ property Gradient gradient: Gradient {
+ GradientStop { position: 0.0; color: "white" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: gradientSource
+ sourceItem: Rectangle {
+ width: 16
+ height: 256
+ gradient: rootItem.gradient
+ smooth: true
+ }
+ smooth: true
+ hideSource: true
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+
+ anchors.fill: parent
+
+ property variant source: gradientSource
+ property variant maskSource: maskSourceProxy.output
+ property variant startPoint: Qt.point(start.x / width, start.y / height)
+ property real dx: end.x - start.x
+ property real dy: end.y - start.y
+ property real l: 1.0 / Math.sqrt(Math.pow(dx / width, 2.0) + Math.pow(dy / height, 2.0))
+ property real angle: Math.atan2(dx, dy)
+ property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle))
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ uniform highp vec2 startPoint;
+ uniform highp float l;
+ uniform highp vec2 matrixData;
+
+ void main() {
+ highp mat2 rot = mat2(matrixData.y, -matrixData.x,
+ matrixData.x, matrixData.y);
+
+ qt_TexCoord0 = qt_MultiTexCoord0;
+
+ qt_TexCoord1 = qt_MultiTexCoord0 * l;
+ qt_TexCoord1 -= startPoint * l;
+ qt_TexCoord1 *= rot;
+
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ fragmentShader: maskSource == undefined ? noMaskShader : maskShader
+
+ onFragmentShaderChanged: lChanged()
+
+ property string maskShader: "
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D maskSource;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+
+ void main() {
+ lowp vec4 gradientColor = texture2D(source, qt_TexCoord1);
+ lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
+ gl_FragColor = gradientColor * maskAlpha * qt_Opacity;
+ }
+ "
+
+ property string noMaskShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord1;
+
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord1) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/MaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/MaskedBlur.qml
new file mode 100644
index 0000000000..4744d9fb98
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/MaskedBlur.qml
@@ -0,0 +1,282 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype MaskedBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blur
+ \brief Applies a blur effect with a varying intesity.
+
+ MaskedBlur effect softens the image by blurring it. The intensity of the
+ blur can be controlled for each pixel using maskSource so that some parts of
+ the source are blurred more than others. By default the effect produces a
+ high quality result, thus the rendering speed may not be the highest
+ possible. The rendering speed is reduced especially if the
+ \l{MaskedBlur::samples}{samples} is large. For use cases that require faster
+ rendering speed and the highest possible visual quality is not necessary,
+ property \l{MaskedBlur::fast}{fast} can be set to true.
+
+ \table
+ \header
+ \li Source
+ \li MaskSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image MaskedBlur_mask.png
+ \li \image MaskedBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet MaskedBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is controlling the final intensity
+ of the blur. The pixel alpha channel value from maskSource defines the
+ actual blur radius that is going to be used for blurring the
+ corresponding source pixel.
+
+ Opaque maskSource pixels produce blur with specified
+ \l{MaskedBlur::radius}{radius}, while transparent pixels suppress the
+ blur completely. Semitransparent maskSource pixels produce blur with a
+ radius that is interpolated according to the pixel transparency level.
+ */
+ property variant maskSource
+
+ /*!
+ This property defines the distance of the neighboring pixels which
+ affect the blurring of an individual pixel. A larger radius increases
+ the blur effect.
+
+ Depending on the radius value, value of the
+ \l{MaskedBlur::samples}{samples} should be set to sufficiently large to
+ ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image MaskedBlur_radius1.png
+ \li \image MaskedBlur_radius2.png
+ \li \image MaskedBlur_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 8 }
+ \li \b { radius: 16 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l transparentBorder: false
+ \li \l transparentBorder: false
+ \li \l transparentBorder: false
+ \row
+ \li \l fast: false
+ \li \l fast: false
+ \li \l fast: false
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ When \l{MaskedBlur::fast}{fast} property is set to true, this property
+ has no effect.
+ */
+ property int samples: 0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance. Every time the source or effect
+ properties are changed, the pixels in the cache must be updated. Memory
+ consumption is increased, because an extra buffer of memory is required
+ for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ /*!
+ This property selects the blurring algorithm that is used to produce the
+ blur. Setting this to true enables fast algorithm, setting value to
+ false produces higher quality result.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different fast values
+ \li
+ \li
+ \row
+ \li \image MaskedBlur_fast1.png
+ \li \image MaskedBlur_fast2.png
+ \row
+ \li \b { fast: false }
+ \li \b { fast: true }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l transparentBorder: false
+ \li \l transparentBorder: false
+ \endtable
+
+ */
+ property bool fast: false
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different transparentBorder values
+ \li
+ \li
+ \row
+ \li \image MaskedBlur_transparentBorder1.png
+ \li \image MaskedBlur_transparentBorder2.png
+ \row
+ \li \b { transparentBorder: false }
+ \li \b { transparentBorder: true }
+ \row
+ \li \l radius: 64
+ \li \l radius: 64
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l fast: true
+ \li \l fast: true
+ \endtable
+
+ */
+ property bool transparentBorder: false
+
+ Loader {
+ id: loaderItem
+ anchors.fill: parent
+ sourceComponent: rootItem.fast ? fastBlur : gaussianBlur
+ }
+
+ Component {
+ id: gaussianBlur
+ GaussianMaskedBlur {
+ anchors.fill: parent
+ source: rootItem.source
+ maskSource: rootItem.maskSource
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ transparentBorder: rootItem.transparentBorder
+ cached: rootItem.cached
+ }
+ }
+
+ Component {
+ id: fastBlur
+ FastMaskedBlur {
+ anchors.fill: parent
+ source:rootItem. source
+ maskSource: rootItem.maskSource
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ transparentBorder: rootItem.transparentBorder
+ cached: rootItem.cached
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/OpacityMask.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/OpacityMask.qml
new file mode 100644
index 0000000000..3a6e25ab0d
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/OpacityMask.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype OpacityMask
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-mask
+ \brief Masks the source item with another item.
+
+ \table
+ \header
+ \li Source
+ \li MaskSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image OpacityMask_mask.png
+ \li \image OpacityMask_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet OpacityMask-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be masked.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is going to be used as the mask. The
+ mask item gets rendered into an intermediate pixel buffer and the alpha
+ values from the result are used to determine the source item's pixels
+ visibility in the display.
+
+ \table
+ \header
+ \li Original
+ \li Mask
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image OpacityMask_mask.png
+ \li \image OpacityMask_bug.png
+ \endtable
+ */
+ property variant maskSource
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting maskSource to the effect's parent.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant maskSource: maskSourceProxy.output
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D maskSource;
+ void main(void) {
+ gl_FragColor = texture2D(source, qt_TexCoord0.st) * (texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialBlur.qml
new file mode 100644
index 0000000000..26315aab5c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialBlur.qml
@@ -0,0 +1,312 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype RadialBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-motion-blur
+ \brief Applies directional blur in a circular direction around the items
+ center point.
+
+ Effect creates perceived impression that the source item appears to be
+ rotating to the direction of the blur.
+
+ Other available motionblur effects are
+ \l{QtGraphicalEffects1::ZoomBlur}{ZoomBlur} and
+ \l{QtGraphicalEffects1::DirectionalBlur}{DirectionalBlur}.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image RadialBlur_bug.png
+ \endtable
+
+ \section1 Example Usage
+
+ The following example shows how to apply the effect.
+ \snippet RadialBlur-example.qml example
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the direction for the blur and at the same time
+ the level of blurring. The larger the angle, the more the result becomes
+ blurred. The quality of the blur depends on
+ \l{RadialBlur::samples}{samples} property. If angle value is large, more
+ samples are needed to keep the visual quality at high level.
+
+ Allowed values are between 0.0 and 360.0. By default the property is set
+ to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different angle values
+ \li
+ \li
+ \row
+ \li \image RadialBlur_angle1.png
+ \li \image RadialBlur_angle2.png
+ \li \image RadialBlur_angle3.png
+ \row
+ \li \b { angle: 0.0 }
+ \li \b { angle: 15.0 }
+ \li \b { angle: 30.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+ */
+ property real angle: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ Allowed values are between 0 and inf (practical maximum depends on GPU).
+ By default the property is set to \c 0 (no samples).
+
+ */
+ property int samples: 0
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::RadialBlur::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::RadialBlur::verticalOffset
+
+ These properties define the offset in pixels for the perceived center
+ point of the rotation.
+
+ Allowed values are between -inf and inf.
+ By default these properties are set to \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image RadialBlur_horizontalOffset1.png
+ \li \image RadialBlur_horizontalOffset2.png
+ \li \image RadialBlur_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: 75.0 }
+ \li \b { horizontalOffset: 0.0 }
+ \li \b { horizontalOffset: -75.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l angle: 20
+ \li \l angle: 20
+ \li \l angle: 20
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: shaderItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant center: Qt.point(0.5 + rootItem.horizontalOffset / parent.width, 0.5 + rootItem.verticalOffset / parent.height)
+ property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1
+ property int samples: rootItem.samples
+ property real weight: 1.0 / Math.max(1.0, rootItem.samples)
+ property real angleSin: Math.sin(rootItem.angle/2 * Math.PI/180)
+ property real angleCos: Math.cos(rootItem.angle/2 * Math.PI/180)
+ property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
+ property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
+ property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0)
+ property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
+ property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height)
+ property real w: parent.width
+ property real h: parent.height
+
+ x: transparentBorder ? -expandPixels.width - 1 : 0
+ y: transparentBorder ? -expandPixels.height - 1 : 0
+ width: transparentBorder ? parent.width + expandPixels.width * 2.0 + 2 : parent.width
+ height: transparentBorder ? parent.height + expandPixels.height * 2.0 + 2 : parent.height
+
+ property string fragmentShaderSkeleton: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float angleSin;
+ uniform highp float angleCos;
+ uniform highp float angleSinStep;
+ uniform highp float angleCosStep;
+ uniform highp float weight;
+ uniform highp vec2 expand;
+ uniform highp vec2 center;
+ uniform highp vec2 delta;
+ uniform highp float w;
+ uniform highp float h;
+
+ void main(void) {
+ highp mat2 m;
+ gl_FragColor = vec4(0.0);
+ mediump vec2 texCoord = qt_TexCoord0;
+
+ PLACEHOLDER_EXPAND_STEPS
+
+ highp vec2 dir = vec2(texCoord.s * w - w * center.x, texCoord.t * h - h * center.y);
+ m[0] = vec2(angleCos, -angleSin);
+ m[1] = vec2(angleSin, angleCos);
+ dir *= m;
+
+ m[0] = vec2(angleCosStep, -angleSinStep);
+ m[1] = vec2(angleSinStep, angleCosStep);
+
+ PLACEHOLDER_UNROLLED_LOOP
+
+ gl_FragColor *= weight * qt_Opacity;
+ }
+ "
+
+ function buildFragmentShader() {
+ var shader = fragmentShaderSkeleton
+ var expandSteps = ""
+
+ if (transparentBorder) {
+ expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
+ }
+
+ var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
+
+ if (rootItem.samples > 1) {
+ unrolledLoop = ""
+ for (var i = 0; i < rootItem.samples; i++)
+ unrolledLoop += "gl_FragColor += texture2D(source, center + dir * delta); dir *= m;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
+ fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
+ }
+
+ onFragmentShaderChanged: sourceChanged()
+ onSamplesChanged: buildFragmentShader()
+ onTransparentBorderChanged: buildFragmentShader()
+ Component.onCompleted: buildFragmentShader()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialGradient.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialGradient.qml
new file mode 100644
index 0000000000..66c2cd6e1e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialGradient.qml
@@ -0,0 +1,439 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype RadialGradient
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-gradient
+ \brief Draws a radial gradient.
+
+ A gradient is defined by two or more colors, which are blended seamlessly.
+ The colors start from the middle of the item and end at the borders.
+
+ \table
+ \header
+ \li Effect applied
+ \row
+ \li \image RadialGradient.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet RadialGradient-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ /*!
+ The HorizontalOffset and verticalOffset properties define the offset in
+ pixels for the center point of the gradient compared to the item center.
+
+ The values range from -inf to inf. By default, these properties are set
+ to \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_horizontalOffset1.png
+ \li \image RadialGradient_horizontalOffset2.png
+ \li \image RadialGradient_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: -150 }
+ \li \b { horizontalOffset: 0 }
+ \li \b { horizontalOffset: 150 }
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \endtable
+
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ The HorizontalRadius and verticalRadius properties define the shape and
+ size of the radial gradient. If the radiuses are equal, the shape of the
+ gradient is a circle. If the horizontal and vertical radiuses differ,
+ the shape is elliptical. The radiuses are given in pixels.
+
+ The value ranges from -inf to inf. By default, horizontalRadius is bound
+ to width and verticalRadius is bound to height.
+
+ \table
+ \header
+ \li Output examples with different horizontalRadius values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_horizontalRadius1.png
+ \li \image RadialGradient_horizontalRadius2.png
+ \row
+ \li \b { horizontalRadius: 300 }
+ \li \b { horizontalRadius: 100 }
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \row
+ \li \l gradient: QQuickGradient(0xa05fb10)
+ \li \l gradient: QQuickGradient(0xa05fb10)
+ \endtable
+
+ */
+ property real horizontalRadius: width
+ property real verticalRadius: height
+
+ /*!
+ This property defines the rotation of the gradient around its center
+ point. The rotation is only visible when the
+ \l{RadialGradient::horizontalRadius}{horizontalRadius} and
+ \l{RadialGradient::verticalRadius}{verticalRadius} properties are not
+ equal. The angle is given in degrees and the default value is \c 0.
+
+ \table
+ \header
+ \li Output examples with different angle values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_angle1.png
+ \li \image RadialGradient_angle2.png
+ \li \image RadialGradient_angle3.png
+ \row
+ \li \b { angle: 0 }
+ \li \b { angle: 45 }
+ \li \b { angle: 90 }
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l horizontalRadius: 100
+ \li \l horizontalRadius: 100
+ \li \l horizontalRadius: 100
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \endtable
+ */
+ property real angle: 0.0
+
+ /*!
+ This property defines the item that is going to be filled with gradient.
+ Source item gets rendered into an intermediate pixel buffer and the
+ alpha values from the result are used to determine the gradient's pixels
+ visibility in the display. The default value for source is undefined and
+ in that case whole effect area is filled with gradient.
+
+ \table
+ \header
+ \li Output examples with different source values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_maskSource1.png
+ \li \image RadialGradient_maskSource2.png
+ \row
+ \li \b { source: undefined }
+ \li \b { source: Image { source: images/butterfly.png } }
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \endtable
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ A gradient is defined by two or more colors, which are blended
+ seamlessly. The colors are specified as a set of GradientStop child
+ items, each of which defines a position on the gradient from 0.0 to 1.0
+ and a color. The position of each GradientStop is defined by setting the
+ position property. The color is defined by setting the color property.
+
+ \table
+ \header
+ \li Output examples with different gradient values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_gradient1.png
+ \li \image RadialGradient_gradient2.png
+ \li \image RadialGradient_gradient3.png
+ \row
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.000
+ color: Qt.rgba(1, 0, 0, 1) }
+ GradientStop { position: 0.167;
+ color: Qt.rgba(1, 1, 0, 1) }
+ GradientStop { position: 0.333;
+ color: Qt.rgba(0, 1, 0, 1) }
+ GradientStop { position: 0.500;
+ color: Qt.rgba(0, 1, 1, 1) }
+ GradientStop { position: 0.667;
+ color: Qt.rgba(0, 0, 1, 1) }
+ GradientStop { position: 0.833;
+ color: Qt.rgba(1, 0, 1, 1) }
+ GradientStop { position: 1.000;
+ color: Qt.rgba(1, 0, 0, 1) }
+ }
+ \endcode
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.0
+ color: "#F0F0F0"
+ }
+ GradientStop { position: 0.5
+ color: "#000000"
+ }
+ GradientStop { position: 1.0
+ color: "#F0F0F0"
+ }
+ }
+ \endcode
+ \li \b {gradient:}
+ \code
+ Gradient {
+ GradientStop { position: 0.0
+ color: "#00000000"
+ }
+ GradientStop { position: 1.0
+ color: "#FF000000"
+ }
+ }
+ \endcode
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \endtable
+ */
+ property Gradient gradient: Gradient {
+ GradientStop { position: 0.0; color: "white" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: gradientSource
+ sourceItem: Rectangle {
+ width: 16
+ height: 256
+ gradient: rootItem.gradient
+ smooth: true
+ }
+ smooth: true
+ hideSource: true
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant gradientImage: gradientSource
+ property variant maskSource: maskSourceProxy.output
+ property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height)
+ property real horizontalRatio: rootItem.horizontalRadius > 0 ? width / (2 * rootItem.horizontalRadius) : width * 16384
+ property real verticalRatio: rootItem.verticalRadius > 0 ? height / (2 * rootItem.verticalRadius) : height * 16384
+ property real angle: -rootItem.angle / 360 * 2 * Math.PI
+ property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle))
+
+ anchors.fill: parent
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp vec2 matrixData;
+ uniform highp float horizontalRatio;
+ uniform highp float verticalRatio;
+ uniform highp vec2 center;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 centerPoint;
+
+ void main() {
+ highp vec2 ratio = vec2(horizontalRatio, verticalRatio);
+
+ // Rotation matrix
+ highp mat2 rot = mat2(matrixData.y, -matrixData.x,
+ matrixData.x, matrixData.y);
+
+ qt_TexCoord0 = qt_MultiTexCoord0;
+
+ qt_TexCoord1 = qt_MultiTexCoord0;
+ qt_TexCoord1 -= center;
+ qt_TexCoord1 *= rot;
+ qt_TexCoord1 += center;
+ qt_TexCoord1 *= ratio;
+
+ centerPoint = center * ratio;
+
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ fragmentShader: maskSource == undefined ? noMaskShader : maskShader
+
+ onFragmentShaderChanged: horizontalRatioChanged()
+
+ property string maskShader: "
+ uniform lowp sampler2D gradientImage;
+ uniform lowp sampler2D maskSource;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 centerPoint;
+
+ void main() {
+ lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
+ lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
+ gl_FragColor = gradientColor * maskAlpha * qt_Opacity;
+ }
+ "
+
+ property string noMaskShader: "
+ uniform lowp sampler2D gradientImage;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 centerPoint;
+
+ void main() {
+ lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
+ gl_FragColor = gradientColor * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RectangularGlow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RectangularGlow.qml
new file mode 100644
index 0000000000..df0d52ff72
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RectangularGlow.qml
@@ -0,0 +1,288 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype RectangularGlow
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-glow
+ \brief Generates a blurred and colorized rectangle, which gives
+ the impression that the source is glowing.
+
+ This effect is intended to have good performance. The shape of the glow is
+ limited to a rectangle with a custom corner radius. For situations where
+ custom shapes are required, consider \l {QtGraphicalEffects1::Glow} {Glow}
+ effect.
+
+ \table
+ \header
+ \li Effect applied
+ \row
+ \li \image RectangularGlow_applied.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet RectangularGlow-example.qml example
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines how many pixels outside the item area are reached
+ by the glow.
+
+ The value ranges from 0.0 (no glow) to inf (infinite glow). By default,
+ the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different glowRadius values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_glowRadius1.png
+ \li \image RectangularGlow_glowRadius2.png
+ \li \image RectangularGlow_glowRadius3.png
+ \row
+ \li \b { glowRadius: 10 }
+ \li \b { glowRadius: 20 }
+ \li \b { glowRadius: 40 }
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+
+ */
+ property real glowRadius: 0.0
+
+ /*!
+ This property defines how large part of the glow color is strenghtened
+ near the source edges.
+
+ The value ranges from 0.0 (no strenght increase) to 1.0 (maximum
+ strenght increase). By default, the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_spread1.png
+ \li \image RectangularGlow_spread2.png
+ \li \image RectangularGlow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.5 }
+ \li \b { spread: 1.0 }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+ */
+ property real spread: 0.0
+
+ /*!
+ This property defines the RGBA color value which is used for the glow.
+
+ By default, the property is set to \c "white".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_color1.png
+ \li \image RectangularGlow_color2.png
+ \li \image RectangularGlow_color3.png
+ \row
+ \li \b { color: #ffffff }
+ \li \b { color: #55ff55 }
+ \li \b { color: #5555ff }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+ */
+ property color color: "white"
+
+ /*!
+ This property defines the corner radius that is used to draw a glow with
+ rounded corners.
+
+ The value ranges from 0.0 to half of the effective width or height of
+ the glow, whichever is smaller. This can be calculated with: \c{
+ min(width, height) / 2.0 + glowRadius}
+
+ By default, the property is bound to glowRadius property. The glow
+ behaves as if the rectangle was blurred when adjusting the glowRadius
+ property.
+
+ \table
+ \header
+ \li Output examples with different cornerRadius values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_cornerRadius1.png
+ \li \image RectangularGlow_cornerRadius2.png
+ \li \image RectangularGlow_cornerRadius3.png
+ \row
+ \li \b { cornerRadius: 0 }
+ \li \b { cornerRadius: 25 }
+ \li \b { cornerRadius: 50 }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \endtable
+ */
+ property real cornerRadius: glowRadius
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+
+ x: (parent.width - width) / 2.0
+ y: (parent.height - height) / 2.0
+ width: parent.width + rootItem.glowRadius * 2 + cornerRadius * 2
+ height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2
+
+ function clampedCornerRadius() {
+ var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius;
+ return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius))
+ }
+
+ property color color: rootItem.color
+ property real inverseSpread: 1.0 - rootItem.spread
+ property real relativeSizeX: ((inverseSpread * inverseSpread) * rootItem.glowRadius + cornerRadius * 2.0) / width
+ property real relativeSizeY: relativeSizeX * (width / height)
+ property real spread: rootItem.spread / 2.0
+ property real cornerRadius: clampedCornerRadius()
+
+ fragmentShader: "
+ uniform highp float qt_Opacity;
+ uniform mediump float relativeSizeX;
+ uniform mediump float relativeSizeY;
+ uniform mediump float spread;
+ uniform lowp vec4 color;
+ varying highp vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp float alpha =
+ smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
+ smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
+
+ highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
+ gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RecursiveBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RecursiveBlur.qml
new file mode 100644
index 0000000000..fa59281291
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RecursiveBlur.qml
@@ -0,0 +1,350 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype RecursiveBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blur
+ \brief Blurs repeatedly, providing a strong blur effect.
+
+ The RecursiveBlur effect softens the image by blurring it with an algorithm
+ that uses a recursive feedback loop to blur the source multiple times. The
+ effect may give more blurry results than
+ \l{QtGraphicalEffects1::GaussianBlur}{GaussianBlur} or
+ \l{QtGraphicalEffects1::FastBlur}{FastBlur}, but the result is produced
+ asynchronously and takes more time.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image RecursiveBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet RecursiveBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the distance of neighboring pixels which influence
+ the blurring of individual pixels. A larger radius provides better
+ quality, but is slower to render.
+
+ \b Note: The radius value in this effect is not intended to be changed
+ or animated frequently. The correct way to use it is to set the correct
+ value and keep it unchanged for the whole duration of the iterative blur
+ sequence.
+
+ The value ranges from (no blur) to 16.0 (maximum blur step). By default,
+ the property is set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image RecursiveBlur_radius1.png
+ \li \image RecursiveBlur_radius2.png
+ \li \image RecursiveBlur_radius3.png
+ \row
+ \li \b { radius: 2.5 }
+ \li \b { radius: 4.5 }
+ \li \b { radius: 7.5 }
+ \row
+ \li \l loops: 20
+ \li \l loops: 20
+ \li \l loops: 20
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different transparentBorder values
+ \li
+ \li
+ \row
+ \li \image RecursiveBlur_transparentBorder1.png
+ \li \image RecursiveBlur_transparentBorder2.png
+ \row
+ \li \b { transparentBorder: false }
+ \li \b { transparentBorder: true }
+ \row
+ \li \l loops: 20
+ \li \l loops: 20
+ \row
+ \li \l radius: 7.5
+ \li \l radius: 7.5
+ \endtable
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property defines the amount of blur iterations that are going to be
+ performed for the source. When the property changes, the iterative
+ blurring process starts. If the value is decreased or if the value
+ changes from zero to non-zero, a snapshot is taken from the source. The
+ snapshot is used as a starting point for the process.
+
+ The iteration loop tries to run as fast as possible. The speed might be
+ limited by the VSYNC or the time needed for one blur step, or both.
+ Sometimes it may be desirable to perform the blurring with a slower
+ pace. In that case, it may be convenient to control the property with
+ Animation which increases the value.
+
+ The value ranges from 0 to inf. By default, the property is set to \c 0.
+
+ \table
+ \header
+ \li Output examples with different loops values
+ \li
+ \li
+ \row
+ \li \image RecursiveBlur_loops1.png
+ \li \image RecursiveBlur_loops2.png
+ \li \image RecursiveBlur_loops3.png
+ \row
+ \li \b { loops: 4 }
+ \li \b { loops: 20 }
+ \li \b { loops: 70 }
+ \row
+ \li \l radius: 7.5
+ \li \l radius: 7.5
+ \li \l radius: 7.5
+ \endtable
+
+ */
+ property int loops: 0
+
+ /*!
+ This property holds the progress of asynchronous source blurring
+ process, from 0.0 (nothing blurred) to 1.0 (finished).
+ */
+ property real progress: loops > 0.0 ? Math.min(1.0, recursionTimer.counter / loops) : 0.0
+
+ onLoopsChanged: recursiveSource.scheduleUpdate()
+ onSourceChanged: recursionTimer.reset()
+ onRadiusChanged: recursionTimer.reset()
+ onTransparentBorderChanged: recursionTimer.reset()
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2, parent.height + 2) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: verticalBlur
+ smooth: true
+ visible: rootItem.cached
+ hideSource: visible
+ live: true
+ sourceItem: inputItem.visible ? inputItem : verticalBlur
+ }
+
+ Item {
+ id: recursionTimer
+ property int counter: 0
+
+ function reset() {
+ counter = 0
+ recursiveSource.scheduleUpdate()
+ }
+
+ function nextFrame() {
+ if (loops < counter)
+ recursionTimer.counter = 0
+
+ if (counter > 0)
+ recursiveSource.sourceItem = verticalBlur
+ else
+ recursiveSource.sourceItem = inputItem
+
+ if (counter < loops) {
+ recursiveSource.scheduleUpdate()
+ counter++
+ }
+ }
+ }
+
+ ShaderEffect {
+ id: inputItem
+ property variant source: sourceProxy.output
+ property real expandX: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.width : 0.0
+ property real expandY: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.height : 0.0
+
+ anchors.fill: verticalBlur
+ visible: !verticalBlur.visible
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float expandX;
+ uniform highp float expandY;
+ varying highp vec2 qt_TexCoord0;
+
+ void main() {
+ mediump vec2 texCoord = qt_MultiTexCoord0;
+ texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
+ texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
+ qt_TexCoord0 = texCoord;
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;
+ }
+ "
+ }
+
+ ShaderEffectSource {
+ id: recursiveSource
+ visible: false
+ smooth: true
+ hideSource: false
+ live: false
+ sourceItem: inputItem
+ recursive: true
+ onSourceItemChanged: scheduleUpdate()
+ onScheduledUpdateCompleted: recursionTimer.nextFrame()
+ }
+
+ GaussianDirectionalBlur {
+ id: verticalBlur
+ x: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0
+ y: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0
+ width: horizontalBlur.width + 2
+ height: horizontalBlur.height + 2
+
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+
+ source: ShaderEffectSource {
+ sourceItem: horizontalBlur
+ hideSource: true
+ visible: false
+ smooth: true
+ }
+
+ deviation: (radius + 1) / 2.3333
+ radius: rootItem.radius
+ maximumRadius: Math.ceil(rootItem.radius)
+ transparentBorder: false
+ visible: loops > 0
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: rootItem.transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
+ height: rootItem.transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
+
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+
+ source: recursiveSource
+ deviation: (radius + 1) / 2.3333
+ radius: rootItem.radius
+ maximumRadius: Math.ceil(rootItem.radius)
+ transparentBorder: false
+ visible: false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ThresholdMask.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ThresholdMask.qml
new file mode 100644
index 0000000000..e789a49293
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ThresholdMask.qml
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype ThresholdMask
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-mask
+ \brief Masks the source item with another item and applies a threshold
+ value.
+
+ The masking behavior can be controlled with the \l threshold value for the
+ mask pixels.
+
+ \table
+ \header
+ \li Source
+ \li MaskSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image ThresholdMask_mask.png
+ \li \image ThresholdMask_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet ThresholdMask-example.qml example
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be masked.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is going to be used as the mask.
+ Mask item gets rendered into an intermediate pixel buffer and the alpha
+ values from the result are used to determine the source item's pixels
+ visibility in the display.
+
+ \table
+ \header
+ \li Original
+ \li Mask
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image ThresholdMask_mask.png
+ \li \image ThresholdMask_bug.png
+ \endtable
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting maskSource to the effect's parent.
+ */
+ property variant maskSource
+
+ /*!
+ This property defines a threshold value for the mask pixels. The mask
+ pixels that have an alpha value below this property are used to
+ completely mask away the corresponding pixels from the source item. The
+ mask pixels that have a higher alpha value are used to alphablend the
+ source item to the display.
+
+ The value ranges from 0.0 (alpha value 0) to 1.0 (alpha value 255). By
+ default, the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different threshold values
+ \li
+ \li
+ \row
+ \li \image ThresholdMask_threshold1.png
+ \li \image ThresholdMask_threshold2.png
+ \li \image ThresholdMask_threshold3.png
+ \row
+ \li \b { threshold: 0.0 }
+ \li \b { threshold: 0.5 }
+ \li \b { threshold: 0.7 }
+ \row
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \endtable
+ */
+ property real threshold: 0.0
+
+ /*!
+ This property defines the smoothness of the mask edges near the
+ \l{ThresholdMask::threshold}{threshold} alpha value. Setting spread to
+ 0.0 uses mask normally with the specified threshold. Setting higher
+ spread values softens the transition from the transparent mask pixels
+ towards opaque mask pixels by adding interpolated values between them.
+
+ The value ranges from 0.0 (sharp mask edge) to 1.0 (smooth mask edge).
+ By default, the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image ThresholdMask_spread1.png
+ \li \image ThresholdMask_spread2.png
+ \li \image ThresholdMask_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.2 }
+ \li \b { spread: 0.8 }
+ \row
+ \li \l threshold: 0.4
+ \li \l threshold: 0.4
+ \li \l threshold: 0.4
+ \endtable
+
+ */
+ property real spread: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant maskSource: maskSourceProxy.output
+ property real threshold: rootItem.threshold
+ property real spread: rootItem.spread
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D maskSource;
+ uniform highp float threshold;
+ uniform highp float spread;
+ void main(void) {
+ lowp vec4 colorFragment = texture2D(source, qt_TexCoord0.st);
+ lowp vec4 maskFragment = texture2D(maskSource, qt_TexCoord0.st);
+ gl_FragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ZoomBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ZoomBlur.qml
new file mode 100644
index 0000000000..74a5940123
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ZoomBlur.qml
@@ -0,0 +1,302 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype ZoomBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-motion-blur
+ \brief Applies directional blur effect towards source items center point.
+
+ Effect creates perceived impression that the source item appears to be
+ moving towards the center point in Z-direction or that the camera appears
+ to be zooming rapidly. Other available motion blur effects are
+ \l{QtGraphicalEffects1::DirectionalBlur}{DirectionalBlur}
+ and \l{QtGraphicalEffects1::RadialBlur}{RadialBlur}.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image ZoomBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet ZoomBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the maximum perceived amount of movement for each
+ pixel. The amount is smaller near the center and reaches the specified
+ value at the edges.
+
+ The quality of the blur depends on \l{ZoomBlur::samples}{samples}
+ property. If length value is large, more samples are needed to keep the
+ visual quality at high level.
+
+ The value ranges from 0.0 to inf. By default the property is set to \c
+ 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different length values
+ \li
+ \li
+ \row
+ \li \image ZoomBlur_length1.png
+ \li \image ZoomBlur_length2.png
+ \li \image ZoomBlur_length3.png
+ \row
+ \li \b { length: 0.0 }
+ \li \b { length: 32.0 }
+ \li \b { length: 48.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+ */
+ property real length: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ Allowed values are between 0 and inf (practical maximum depends on GPU).
+ By default the property is set to \c 0 (no samples).
+
+ */
+ property int samples: 0
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::ZoomBlur::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::ZoomBlur::verticalOffset
+
+ These properties define an offset in pixels for the blur direction
+ center point.
+
+ The values range from -inf to inf. By default these properties are set
+ to \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image ZoomBlur_horizontalOffset1.png
+ \li \image ZoomBlur_horizontalOffset2.png
+ \li \image ZoomBlur_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: 100.0 }
+ \li \b { horizontalOffset: 0.0 }
+ \li \b { horizontalOffset: -100.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l length: 32
+ \li \l length: 32
+ \li \l length: 32
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height)
+ property real len: rootItem.length
+ property bool transparentBorder: rootItem.transparentBorder
+ property real samples: rootItem.samples
+ property real weight: 1.0 / Math.max(1.0, rootItem.samples)
+ property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0)
+ property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
+ property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height)
+
+ x: transparentBorder ? -expandPixels.width - 1 : 0
+ y: transparentBorder ? -expandPixels.height - 1 : 0
+ width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width
+ height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height
+
+ property string fragmentShaderSkeleton: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float len;
+ uniform highp float weight;
+ uniform highp float samples;
+ uniform highp vec2 center;
+ uniform highp vec2 expand;
+ uniform highp vec2 delta;
+
+ void main(void) {
+ mediump vec2 texCoord = qt_TexCoord0;
+ mediump vec2 centerCoord = center;
+
+ PLACEHOLDER_EXPAND_STEPS
+
+ highp vec2 dir = vec2(centerCoord.x - texCoord.s, centerCoord.y - texCoord.t);
+ dir /= max(1.0, length(dir) * 2.0);
+ highp vec2 shift = delta * len * dir * 2.0 / max(1.0, samples - 1.0);
+ gl_FragColor = vec4(0.0);
+
+ PLACEHOLDER_UNROLLED_LOOP
+
+ gl_FragColor *= weight * qt_Opacity;
+ }
+ "
+
+ function buildFragmentShader() {
+ var shader = fragmentShaderSkeleton
+ var expandSteps = ""
+
+ if (transparentBorder) {
+ expandSteps += "centerCoord = (centerCoord - expand) / (1.0 - 2.0 * expand);"
+ expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
+ }
+
+ var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
+
+ if (rootItem.samples > 1) {
+ unrolledLoop = ""
+ for (var i = 0; i < rootItem.samples; i++)
+ unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
+ fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
+ }
+
+ onFragmentShaderChanged: sourceChanged()
+ onSamplesChanged: buildFragmentShader()
+ onTransparentBorderChanged: buildFragmentShader()
+ Component.onCompleted: buildFragmentShader()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastGlow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastGlow.qml
new file mode 100644
index 0000000000..f4bd2c7421
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastGlow.qml
@@ -0,0 +1,393 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real spread: 0.0
+ property real blur: 0.0
+ property color color: "white"
+ property bool transparentBorder: false
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0)
+ smooth: true
+ visible: false
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ Item {
+ id: dummysource
+ width: 1
+ height: 1
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: dummy
+ width: 1
+ height: 1
+ sourceItem: dummysource
+ visible: false
+ smooth: false
+ live: false
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ x: transparentBorder ? -64 : 0
+ y: transparentBorder ? -64 : 0
+ width: transparentBorder ? parent.width + 128 : parent.width
+ height: transparentBorder ? parent.height + 128 : parent.height
+
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: rootItem.blur
+
+ property real weight1;
+ property real weight2;
+ property real weight3;
+ property real weight4;
+ property real weight5;
+ property real weight6;
+
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property alias color: rootItem.color
+
+ function weight(v) {
+ if (v <= 0.0)
+ return 1
+ if (v >= 0.5)
+ return 0
+
+ return 1.0 - v / 0.5
+ }
+
+ function calculateWeights() {
+
+ var w1 = weight(Math.abs(lod - 0.100))
+ var w2 = weight(Math.abs(lod - 0.300))
+ var w3 = weight(Math.abs(lod - 0.500))
+ var w4 = weight(Math.abs(lod - 0.700))
+ var w5 = weight(Math.abs(lod - 0.900))
+ var w6 = weight(Math.abs(lod - 1.100))
+
+ var sum = w1 + w2 + w3 + w4 + w5 + w6;
+ weight1 = w1 / sum;
+ weight2 = w2 / sum;
+ weight3 = w3 / sum;
+ weight4 = w4 / sum;
+ weight5 = w5 / sum;
+ weight6 = w6 / sum;
+
+ upateSources()
+ }
+
+ function upateSources() {
+ var sources = new Array();
+ var weights = new Array();
+
+ if (weight1 > 0) {
+ sources.push(level1)
+ weights.push(weight1)
+ }
+
+ if (weight2 > 0) {
+ sources.push(level2)
+ weights.push(weight2)
+ }
+
+ if (weight3 > 0) {
+ sources.push(level3)
+ weights.push(weight3)
+ }
+
+ if (weight4 > 0) {
+ sources.push(level4)
+ weights.push(weight4)
+ }
+
+ if (weight5 > 0) {
+ sources.push(level5)
+ weights.push(weight5)
+ }
+
+ if (weight6 > 0) {
+ sources.push(level6)
+ weights.push(weight6)
+ }
+
+ for (var j = sources.length; j < 6; j++) {
+ sources.push(dummy)
+ weights.push(0.0)
+ }
+
+ source1 = sources[0]
+ source2 = sources[1]
+ source3 = sources[2]
+ source4 = sources[3]
+ source5 = sources[4]
+ source6 = sources[5]
+
+ weight1 = weights[0]
+ weight2 = weights[1]
+ weight3 = weights[2]
+ weight4 = weights[3]
+ weight5 = weights[4]
+ weight6 = weights[5]
+ }
+
+ Component.onCompleted: calculateWeights()
+
+ onLodChanged: calculateWeights()
+
+ fragmentShader: "
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform mediump float weight1;
+ uniform mediump float weight2;
+ uniform mediump float weight3;
+ uniform mediump float weight4;
+ uniform mediump float weight5;
+ uniform highp vec4 color;
+ uniform highp float spread;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
+ sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a));
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml
new file mode 100644
index 0000000000..95e645a939
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml
@@ -0,0 +1,413 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real blur: 0.0
+ property real horizontalOffset: 0
+ property real verticalOffset: 0
+ property real spread: 0.0
+ property color color: "black"
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ property real horizontalOffset: rootItem.horizontalOffset / rootItem.width
+ property real verticalOffset: rootItem.verticalOffset / rootItem.width
+ property color color: rootItem.color
+
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ uniform highp sampler2D source;
+ uniform lowp vec4 color;
+ uniform highp float horizontalOffset;
+ uniform highp float verticalOffset;
+
+ void main(void) {
+ highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset);
+ lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0);
+ lowp float eb = 1.0 - ea;
+ gl_FragColor = (eb * color + ea * color * (1.0 - texture2D(source, pos).a)) * qt_Opacity;
+ }
+ "
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ smooth: true
+ visible: false
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ Item {
+ id: dummysource
+ width: 1
+ height: 1
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: dummy
+ width: 1
+ height: 1
+ sourceItem: dummysource
+ visible: false
+ smooth: false
+ live: false
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ width: parent.width
+ height: parent.height
+
+ property variant original: sourceProxy.output
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: rootItem.blur
+
+ property real weight1;
+ property real weight2;
+ property real weight3;
+ property real weight4;
+ property real weight5;
+ property real weight6;
+
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property color color: rootItem.color
+
+ function weight(v) {
+ if (v <= 0.0)
+ return 1
+ if (v >= 0.5)
+ return 0
+
+ return 1.0 - v / 0.5
+ }
+
+ function calculateWeights() {
+
+ var w1 = weight(Math.abs(lod - 0.100))
+ var w2 = weight(Math.abs(lod - 0.300))
+ var w3 = weight(Math.abs(lod - 0.500))
+ var w4 = weight(Math.abs(lod - 0.700))
+ var w5 = weight(Math.abs(lod - 0.900))
+ var w6 = weight(Math.abs(lod - 1.100))
+
+ var sum = w1 + w2 + w3 + w4 + w5 + w6;
+ weight1 = w1 / sum;
+ weight2 = w2 / sum;
+ weight3 = w3 / sum;
+ weight4 = w4 / sum;
+ weight5 = w5 / sum;
+ weight6 = w6 / sum;
+
+ upateSources()
+ }
+
+ function upateSources() {
+ var sources = new Array();
+ var weights = new Array();
+
+ if (weight1 > 0) {
+ sources.push(level1)
+ weights.push(weight1)
+ }
+
+ if (weight2 > 0) {
+ sources.push(level2)
+ weights.push(weight2)
+ }
+
+ if (weight3 > 0) {
+ sources.push(level3)
+ weights.push(weight3)
+ }
+
+ if (weight4 > 0) {
+ sources.push(level4)
+ weights.push(weight4)
+ }
+
+ if (weight5 > 0) {
+ sources.push(level5)
+ weights.push(weight5)
+ }
+
+ if (weight6 > 0) {
+ sources.push(level6)
+ weights.push(weight6)
+ }
+
+ for (var j = sources.length; j < 6; j++) {
+ sources.push(dummy)
+ weights.push(0.0)
+ }
+
+ source1 = sources[0]
+ source2 = sources[1]
+ source3 = sources[2]
+ source4 = sources[3]
+ source5 = sources[4]
+ source6 = sources[5]
+
+ weight1 = weights[0]
+ weight2 = weights[1]
+ weight3 = weights[2]
+ weight4 = weights[3]
+ weight5 = weights[4]
+ weight6 = weights[5]
+ }
+
+ Component.onCompleted: calculateWeights()
+
+ onLodChanged: calculateWeights()
+
+ fragmentShader: "
+ uniform lowp sampler2D original;
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform mediump float weight1;
+ uniform mediump float weight2;
+ uniform mediump float weight3;
+ uniform mediump float weight4;
+ uniform mediump float weight5;
+ uniform highp vec4 color;
+ uniform highp float spread;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp vec4 shadowColor = texture2D(source1, qt_TexCoord0) * weight1;
+ shadowColor += texture2D(source2, qt_TexCoord0) * weight2;
+ shadowColor += texture2D(source3, qt_TexCoord0) * weight3;
+ shadowColor += texture2D(source4, qt_TexCoord0) * weight4;
+ shadowColor += texture2D(source5, qt_TexCoord0) * weight5;
+ lowp vec4 originalColor = texture2D(original, qt_TexCoord0);
+ shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a));
+ gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml
new file mode 100644
index 0000000000..ae49a6e9bb
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml
@@ -0,0 +1,332 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property variant maskSource
+ property real blur: 0.0
+ property bool transparentBorder: false
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ smooth: rootItem.blur > 0
+ }
+
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: mask0
+ property variant source: maskSourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: masklevel1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: mask0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
+ visible: false
+ smooth: rootItem.blur > 0
+ }
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
+ visible: false
+ smooth: rootItem.blur > 0
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant mask: masklevel1
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: Math.sqrt(rootItem.blur) * 1.2 - 0.2
+ property real weight1
+ property real weight2
+ property real weight3
+ property real weight4
+ property real weight5
+ property real weight6
+
+ x: transparentBorder ? -64 : 0
+ y: transparentBorder ? -64 : 0
+ width: transparentBorder ? parent.width + 128 : parent.width
+ height: transparentBorder ? parent.height + 128 : parent.height
+
+ fragmentShader: "
+ uniform lowp sampler2D mask;
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform lowp sampler2D source6;
+ uniform lowp float lod;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ mediump float weight(mediump float v) {
+ if (v <= 0.0)
+ return 1.0;
+
+ if (v >= 0.5)
+ return 0.0;
+
+ return 1.0 - v * 2.0;
+ }
+
+ void main() {
+
+ lowp vec4 maskColor = texture2D(mask, qt_TexCoord0);
+ mediump float l = lod * maskColor.a;
+
+ mediump float w1 = weight(abs(l - 0.100));
+ mediump float w2 = weight(abs(l - 0.300));
+ mediump float w3 = weight(abs(l - 0.500));
+ mediump float w4 = weight(abs(l - 0.700));
+ mediump float w5 = weight(abs(l - 0.900));
+ mediump float w6 = weight(abs(l - 1.100));
+
+ mediump float sum = w1 + w2 + w3 + w4 + w5 + w6;
+ mediump float weight1 = w1 / sum;
+ mediump float weight2 = w2 / sum;
+ mediump float weight3 = w3 / sum;
+ mediump float weight4 = w4 / sum;
+ mediump float weight5 = w5 / sum;
+ mediump float weight6 = w6 / sum;
+
+ lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
+ sourceColor += texture2D(source6, qt_TexCoord0) * weight6;
+
+ gl_FragColor = sourceColor * qt_Opacity;
+
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml
new file mode 100644
index 0000000000..c2af1f34e3
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml
@@ -0,0 +1,287 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real deviation: (radius + 1) / 3.3333
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property real horizontalStep: 0.0
+ property real verticalStep: 0.0
+ property bool transparentBorder: false
+ property bool cached: false
+
+ property bool enableColor: false
+ property color color: "white"
+ property real spread: 0.0
+
+ property bool enableMask: false
+ property variant maskSource
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: rootItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real deviation: Math.max(0.1, rootItem.deviation)
+ property real radius: rootItem.radius
+ property int maxRadius: rootItem.maximumRadius
+ property bool transparentBorder: rootItem.transparentBorder
+ property real gaussianSum: 0.0
+ property real startIndex: 0.0
+ property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1)
+ property real expandX: transparentBorder && rootItem.horizontalStep > 0 ? maxRadius / width : 0.0
+ property real expandY: transparentBorder && rootItem.verticalStep > 0 ? maxRadius / height : 0.0
+ property variant gwts: []
+ property variant delta: Qt.vector3d(rootItem.horizontalStep * deltaFactor, rootItem.verticalStep * deltaFactor, startIndex);
+ property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]);
+ property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]);
+ property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]);
+ property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]);
+ property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]);
+ property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]);
+ property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]);
+ property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]);
+ property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]);
+ property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]);
+ property variant factor_30_32: Qt.vector3d(gwts[30], gwts[31], gwts[32]);
+
+ property color color: rootItem.color
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property variant maskSource: maskSourceProxy.output
+
+ anchors.fill: rootItem
+
+ function gausFunc(x){
+ //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2)));
+ return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2)))));
+ }
+
+ function updateGaussianWeights() {
+ gaussianSum = 0.0;
+ startIndex = -maxRadius + 0.5
+
+ var n = new Array(32);
+ for (var j = 0; j < 32; j++)
+ n[j] = 0;
+
+ var max = maxRadius * 2
+ var delta = (2 * radius - 1) / (max - 1);
+ for (var i = 0; i < max; i++) {
+ n[i] = gausFunc(-radius + 0.5 + i * delta);
+ gaussianSum += n[i];
+ }
+
+ gwts = n;
+ }
+
+ function buildFragmentShader() {
+
+ var shaderSteps = [
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z; texCoord += shift;"
+ ]
+
+ var shader = fragmentShaderBegin
+ var samples = maxRadius * 2
+ if (samples > 32) {
+ console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!")
+ samples = 32
+ }
+
+ for (var i = 0; i < samples; i++) {
+ shader += shaderSteps[i]
+ }
+
+ shader += fragmentShaderEnd
+
+ var colorizeSteps = ""
+ var colorizeUniforms = ""
+
+ var maskSteps = ""
+ var maskUniforms = ""
+
+ if (enableColor) {
+ colorizeSteps += "gl_FragColor = mix(vec4(0), color, clamp((gl_FragColor.a - 0.0) / (spread - 0.0), 0.0, 1.0));\n"
+ colorizeUniforms += "uniform highp vec4 color;\n"
+ colorizeUniforms += "uniform highp float spread;\n"
+ }
+
+ if (enableMask) {
+ maskSteps += "shift *= texture2D(maskSource, qt_TexCoord0).a;\n"
+ maskUniforms += "uniform sampler2D maskSource;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_COLORIZE_STEPS", colorizeSteps)
+ shader = shader.replace("PLACEHOLDER_COLORIZE_UNIFORMS", colorizeUniforms)
+ shader = shader.replace("PLACEHOLDER_MASK_STEPS", maskSteps)
+ shader = shader.replace("PLACEHOLDER_MASK_UNIFORMS", maskUniforms)
+
+ fragmentShader = shader
+ }
+
+ onDeviationChanged: updateGaussianWeights()
+
+ onRadiusChanged: updateGaussianWeights()
+
+ onTransparentBorderChanged: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ onMaxRadiusChanged: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ Component.onCompleted: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ property string fragmentShaderBegin: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp vec3 delta;
+ uniform highp vec3 factor_0_2;
+ uniform highp vec3 factor_3_5;
+ uniform highp vec3 factor_6_8;
+ uniform highp vec3 factor_9_11;
+ uniform highp vec3 factor_12_14;
+ uniform highp vec3 factor_15_17;
+ uniform highp vec3 factor_18_20;
+ uniform highp vec3 factor_21_23;
+ uniform highp vec3 factor_24_26;
+ uniform highp vec3 factor_27_29;
+ uniform highp vec3 factor_30_32;
+ uniform highp float gaussianSum;
+ uniform highp float expandX;
+ uniform highp float expandY;
+ PLACEHOLDER_MASK_UNIFORMS
+ PLACEHOLDER_COLORIZE_UNIFORMS
+
+ void main() {
+ highp vec2 shift = vec2(delta.x, delta.y);
+
+ PLACEHOLDER_MASK_STEPS
+
+ highp float index = delta.z;
+ mediump vec2 texCoord = qt_TexCoord0;
+ texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
+ texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
+ texCoord += (shift * index);
+
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+ "
+
+ property string fragmentShaderEnd: "
+
+ gl_FragColor /= gaussianSum;
+
+ PLACEHOLDER_COLORIZE_STEPS
+
+ gl_FragColor *= qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml
new file mode 100644
index 0000000000..c7458561a5
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property real spread: 0.0
+ property color color: "white"
+ property bool cached: false
+ property bool transparentBorder: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ GaussianDirectionalBlur {
+ id: shaderItem
+ x: transparentBorder ? -maximumRadius - 1 : 0
+ y: transparentBorder ? -maximumRadius - 1 : 0
+ width: horizontalBlur.width
+ height: horizontalBlur.height
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+ source: horizontalBlur
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ transparentBorder: rootItem.transparentBorder
+ enableColor: true
+ color: rootItem.color
+ spread: rootItem.spread
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
+ height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+ source: sourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ transparentBorder: rootItem.transparentBorder
+ visible: false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml
new file mode 100644
index 0000000000..7621c6b05a
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property real horizontalOffset: 0
+ property real verticalOffset: 0
+ property real spread: 0
+ property color color: "black"
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect{
+ id: shadowItem
+ anchors.fill: parent
+
+ property variant original: sourceProxy.output
+ property color color: rootItem.color
+ property real horizontalOffset: rootItem.horizontalOffset / rootItem.width
+ property real verticalOffset: rootItem.verticalOffset / rootItem.height
+
+ visible: false
+ fragmentShader: "
+ uniform highp sampler2D original;
+ uniform lowp float qt_Opacity;
+ uniform lowp vec4 color;
+ uniform highp float horizontalOffset;
+ uniform highp float verticalOffset;
+ varying highp vec2 qt_TexCoord0;
+
+ void main(void) {
+ highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset);
+ lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0);
+ lowp float eb = 1.0 - ea;
+ gl_FragColor = eb * color + ea * color * (1.0 - texture2D(original, pos).a) * qt_Opacity;
+ }
+ "
+ }
+
+ GaussianDirectionalBlur {
+ id: blurItem
+ anchors.fill: parent
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+ source: horizontalBlur
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ visible: false
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: transparentBorder ? parent.width + 2 * maximumRadius : parent.width
+ height: parent.height
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+ source: shadowItem
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: blurredSource
+ sourceItem: blurItem
+ live: true
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ anchors.fill: parent
+
+ property variant original: sourceProxy.output
+ property variant shadow: blurredSource
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property color color: rootItem.color
+
+ fragmentShader: "
+ uniform highp sampler2D original;
+ uniform highp sampler2D shadow;
+ uniform lowp float qt_Opacity;
+ uniform highp float spread;
+ uniform lowp vec4 color;
+ varying highp vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main(void) {
+ lowp vec4 originalColor = texture2D(original, qt_TexCoord0);
+ lowp vec4 shadowColor = texture2D(shadow, qt_TexCoord0);
+ shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a));
+ gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml
new file mode 100644
index 0000000000..02009209c6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property variant maskSource
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property bool cached: false
+ property bool transparentBorder: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: blur
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: blur
+ live: true
+ hideSource: visible
+ }
+
+ GaussianDirectionalBlur {
+ id: blur
+ x: transparentBorder ? -maximumRadius - 1: 0
+ y: transparentBorder ? -maximumRadius - 1: 0
+ width: horizontalBlur.width
+ height: horizontalBlur.height
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+ source: horizontalBlur
+ enableMask: true
+ maskSource: maskSourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ transparentBorder: rootItem.transparentBorder
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
+ height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+ source: sourceProxy.output
+ enableMask: true
+ maskSource: maskSourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ transparentBorder: rootItem.transparentBorder
+ visible: false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/SourceProxy.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/SourceProxy.qml
new file mode 100644
index 0000000000..2561d70e45
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/SourceProxy.qml
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant input
+ property variant output
+ property variant sourceRect
+ visible: false
+
+ Component.onCompleted: evaluateInput()
+
+ onInputChanged: evaluateInput()
+
+ onSourceRectChanged: evaluateInput()
+
+ function evaluateInput() {
+ if (input == undefined) {
+ output = input
+ }
+ else if (sourceRect != undefined && sourceRect != Qt.rect(0, 0, 0, 0) && !isQQuickShaderEffectSource(input)) {
+ proxySource.sourceItem = input
+ output = proxySource
+ proxySource.sourceRect = sourceRect
+ }
+ else if (isQQuickItemLayerEnabled(input)) {
+ output = input
+ }
+ else if ((isQQuickImage(input) && !hasTileMode(input) && !hasChildren(input))) {
+ output = input
+ }
+ else if (isQQuickShaderEffectSource(input)) {
+ output = input
+ }
+ else {
+ proxySource.sourceItem = input
+ output = proxySource
+ proxySource.sourceRect = Qt.rect(0, 0, 0, 0)
+ }
+ }
+
+ function isQQuickItemLayerEnabled(item) {
+ if (item.hasOwnProperty("layer")) {
+ var l = item["layer"]
+ if (l.hasOwnProperty("enabled") && l["enabled"].toString() == "true")
+ return true
+ }
+ return false
+ }
+
+ function isQQuickImage(item) {
+ var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ]
+ return hasProperties(item, imageProperties)
+ }
+
+ function isQQuickShaderEffectSource(item) {
+ var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ]
+ return hasProperties(item, shaderEffectSourceProperties)
+ }
+
+ function hasProperties(item, properties) {
+ var counter = 0
+ for (var j = 0; j < properties.length; j++) {
+ if (item.hasOwnProperty(properties [j]))
+ counter++
+ }
+ return properties.length == counter
+ }
+
+ function hasChildren(item) {
+ if (item.hasOwnProperty("childrenRect")) {
+ if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)")
+ return true
+ else
+ return false
+ }
+ return false
+ }
+
+ function hasTileMode(item) {
+ if (item.hasOwnProperty("fillMode")) {
+ if (item["fillMode"].toString() != "0")
+ return true
+ else
+ return false
+ }
+ return false
+ }
+
+ ShaderEffectSource {
+ id: proxySource
+ live: rootItem.input != rootItem.output
+ hideSource: false
+ smooth: true
+ visible: false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Blend.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Blend.qml
new file mode 100644
index 0000000000..59d8646047
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Blend.qml
@@ -0,0 +1,478 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Blend
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blend
+ \brief Merges two source items by using a blend mode.
+
+ Blend mode can be selected with the \l{Blend::mode}{mode} property.
+
+ \table
+ \header
+ \li source
+ \li foregroundSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image Original_butterfly.png
+ \li \image Blend_bug_and_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Blend-example.qml example
+
+*/
+
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be the base when
+ \l{Blend::foregroundSource}{foregroundSource} is blended over it.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is going to be blended over the
+ \l{Blend::source}{source}.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting foregroundSource to the effect's parent.
+ */
+ property variant foregroundSource
+
+ /*!
+ This property defines the mode which is used when foregroundSource is
+ blended over source. Values are case insensitive.
+
+ \table
+ \header
+ \li mode
+ \li description
+ \row
+ \li normal
+ \li The pixel component values from foregroundSource are written
+ over source by using alpha blending.
+ \row
+ \li addition
+ \li The pixel component values from source and foregroundSource are
+ added together and written.
+ \row
+ \li average
+ \li The pixel component values from source and foregroundSource are
+ averaged and written.
+ \row
+ \li color
+ \li The lightness value from source is combined with hue and
+ saturation from foregroundSource and written.
+ \row
+ \li colorBurn
+ \li The darker pixels from source are darkened more, if both source
+ and foregroundSource pixels are light the result is light.
+ \row
+ \li colorDodge
+ \li The lighter pixels from source are lightened more, if both
+ source and foregroundSource pixels are dark the result is dark.
+ \row
+ \li darken
+ \li The darker pixel component value from source and
+ foregroundSource is written.
+ \row
+ \li darkerColor
+ \li The lower luminance pixel rgb-value from source and
+ foregroundSource is written.
+ \row
+ \li difference
+ \li The absolute pixel component value difference between source and
+ foregroundSource is written.
+ \row
+ \li divide
+ \li The pixel component values from source is divided by the value
+ from foregroundSource and written.
+ \row
+ \li exclusion
+ \li The pixel component value difference with reduced contrast
+ between source and foregroundSource is written.
+ \row
+ \li hardLight
+ \li The pixel component values from source are lightened or darkened
+ according to foregroundSource values and written.
+ \row
+ \li hue
+ \li The hue value from foregroundSource is combined with saturation
+ and lightness from source and written.
+ \row
+ \li lighten
+ \li The lightest pixel component value from source and
+ foregroundSource is written.
+ \row
+ \li lighterColor
+ \li The higher luminance pixel rgb-value from source and
+ foregroundSource is written.
+ \row
+ \li lightness
+ \li The lightness value from foregroundSource is combined with hue
+ and saturation from source and written.
+ \row
+ \li multiply
+ \li The pixel component values from source and foregroundSource are
+ multiplied together and written.
+ \row
+ \li negation
+ \li The inverted absolute pixel component value difference between
+ source and foregroundSource is written.
+ \row
+ \li saturation
+ \li The saturation value from foregroundSource is combined with hue
+ and lightness from source and written.
+ \row
+ \li screen
+ \li The pixel values from source and foregroundSource are negated,
+ then multiplied, negated again, and written.
+ \row
+ \li subtract
+ \li Pixel value from foregroundSource is subracted from source and
+ written.
+ \row
+ \li softLight
+ \li The pixel component values from source are lightened or darkened
+ slightly according to foregroundSource values and written.
+
+ \endtable
+
+ \table
+ \header
+ \li Example source
+ \li Example foregroundSource
+ \row
+ \li \image Original_bug.png
+ \li \image Original_butterfly.png
+ \endtable
+
+ \table
+ \header
+ \li Output examples with different mode values
+ \li
+ \li
+ \row
+ \li \image Blend_mode1.png
+ \li \image Blend_mode2.png
+ \li \image Blend_mode3.png
+ \row
+ \li \b { mode: normal }
+ \li \b { mode: addition }
+ \li \b { mode: average }
+ \row
+ \li \image Blend_mode4.png
+ \li \image Blend_mode5.png
+ \li \image Blend_mode6.png
+ \row
+ \li \b { mode: color }
+ \li \b { mode: colorBurn }
+ \li \b { mode: colorDodge }
+ \row
+ \li \image Blend_mode7.png
+ \li \image Blend_mode8.png
+ \li \image Blend_mode9.png
+ \row
+ \li \b { mode: darken }
+ \li \b { mode: darkerColor }
+ \li \b { mode: difference }
+ \row
+ \li \image Blend_mode10.png
+ \li \image Blend_mode11.png
+ \li \image Blend_mode12.png
+ \row
+ \li \b { mode: divide }
+ \li \b { mode: exclusion }
+ \li \b { mode: hardlight }
+ \row
+ \li \image Blend_mode13.png
+ \li \image Blend_mode14.png
+ \li \image Blend_mode15.png
+ \row
+ \li \b { mode: hue }
+ \li \b { mode: lighten }
+ \li \b { mode: lighterColor }
+ \row
+ \li \image Blend_mode16.png
+ \li \image Blend_mode17.png
+ \li \image Blend_mode18.png
+ \row
+ \li \b { mode: lightness }
+ \li \b { mode: negation }
+ \li \b { mode: multiply }
+ \row
+ \li \image Blend_mode19.png
+ \li \image Blend_mode20.png
+ \li \image Blend_mode21.png
+ \row
+ \li \b { mode: saturation }
+ \li \b { mode: screen }
+ \li \b { mode: subtract }
+ \row
+ \li \image Blend_mode22.png
+ \row
+ \li \b { mode: softLight }
+ \endtable
+ */
+ property string mode: "normal"
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in the
+ cache must be updated. Memory consumption is increased, because an extra
+ buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: backgroundSourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: foregroundSourceProxy
+ input: rootItem.foregroundSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant backgroundSource: backgroundSourceProxy.output
+ property variant foregroundSource: foregroundSourceProxy.output
+ property string mode: rootItem.mode
+ anchors.fill: parent
+
+ fragmentShader: fragmentShaderBegin + blendModeNormal + fragmentShaderEnd
+
+ function buildFragmentShader() {
+ var shader = fragmentShaderBegin
+
+ switch (mode.toLowerCase()) {
+ case "addition" : shader += blendModeAddition; break;
+ case "average" : shader += blendModeAverage; break;
+ case "color" : shader += blendModeColor; break;
+ case "colorburn" : shader += blendModeColorBurn; break;
+ case "colordodge" : shader += blendModeColorDodge; break;
+ case "darken" : shader += blendModeDarken; break;
+ case "darkercolor" : shader += blendModeDarkerColor; break;
+ case "difference" : shader += blendModeDifference; break;
+ case "divide" : shader += blendModeDivide; break;
+ case "exclusion" : shader += blendModeExclusion; break;
+ case "hardlight" : shader += blendModeHardLight; break;
+ case "hue" : shader += blendModeHue; break;
+ case "lighten" : shader += blendModeLighten; break;
+ case "lightercolor" : shader += blendModeLighterColor; break;
+ case "lightness" : shader += blendModeLightness; break;
+ case "negation" : shader += blendModeNegation; break;
+ case "normal" : shader += blendModeNormal; break;
+ case "multiply" : shader += blendModeMultiply; break;
+ case "saturation" : shader += blendModeSaturation; break;
+ case "screen" : shader += blendModeScreen; break;
+ case "subtract" : shader += blendModeSubtract; break;
+ case "softlight" : shader += blendModeSoftLight; break;
+ default: shader += "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);"; break;
+ }
+
+ shader += fragmentShaderEnd
+ fragmentShader = shader
+
+ // Workaraound for a bug just to make sure display gets updated when the mode changes.
+ backgroundSourceChanged()
+ }
+
+ Component.onCompleted: {
+ buildFragmentShader()
+ }
+
+ onModeChanged: {
+ buildFragmentShader()
+ }
+
+ property string blendModeAddition: "result.rgb = min(rgb1 + rgb2, 1.0);"
+ property string blendModeAverage: "result.rgb = 0.5 * (rgb1 + rgb2);"
+ property string blendModeColor: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).xy, RGBtoL(rgb1)));"
+ property string blendModeColorBurn: "result.rgb = clamp(1.0 - ((1.0 - rgb1) / max(vec3(1.0 / 256.0), rgb2)), vec3(0.0), vec3(1.0));"
+ property string blendModeColorDodge: "result.rgb = clamp(rgb1 / max(vec3(1.0 / 256.0), (1.0 - rgb2)), vec3(0.0), vec3(1.0));"
+ property string blendModeDarken: "result.rgb = min(rgb1, rgb2);"
+ property string blendModeDarkerColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb2 : rgb1;"
+ property string blendModeDifference: "result.rgb = abs(rgb1 - rgb2);"
+ property string blendModeDivide: "result.rgb = clamp(rgb1 / rgb2, 0.0, 1.0);"
+ property string blendModeExclusion: "result.rgb = rgb1 + rgb2 - 2.0 * rgb1 * rgb2;"
+ property string blendModeHardLight: "result.rgb = vec3(channelBlendHardLight(rgb1.r, rgb2.r), channelBlendHardLight(rgb1.g, rgb2.g), channelBlendHardLight(rgb1.b, rgb2.b));"
+ property string blendModeHue: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).x, RGBtoHSL(rgb1).yz));"
+ property string blendModeLighten: "result.rgb = max(rgb1, rgb2);"
+ property string blendModeLighterColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb1 : rgb2;"
+ property string blendModeLightness: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb1).xy, RGBtoL(rgb2)));"
+ property string blendModeMultiply: "result.rgb = rgb1 * rgb2;"
+ property string blendModeNegation: "result.rgb = 1.0 - abs(1.0 - rgb1 - rgb2);"
+ property string blendModeNormal: "result.rgb = rgb2; a = max(color1.a, color2.a);"
+ property string blendModeSaturation: "lowp vec3 hsl1 = RGBtoHSL(rgb1); result.rgb = HSLtoRGB(vec3(hsl1.x, RGBtoHSL(rgb2).y, hsl1.z));"
+ property string blendModeScreen: "result.rgb = 1.0 - (vec3(1.0) - rgb1) * (vec3(1.0) - rgb2);"
+ property string blendModeSubtract: "result.rgb = max(rgb1 - rgb2, vec3(0.0));"
+ property string blendModeSoftLight: "result.rgb = rgb1 * ((1.0 - rgb1) * rgb2 + (1.0 - (1.0 - rgb1) * (1.0 - rgb2)));"
+
+ property string fragmentShaderBegin: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D backgroundSource;
+ uniform lowp sampler2D foregroundSource;
+
+ highp float RGBtoL(highp vec3 color) {
+ highp float cmin = min(color.r, min(color.g, color.b));
+ highp float cmax = max(color.r, max(color.g, color.b));
+ highp float l = (cmin + cmax) / 2.0;
+ return l;
+ }
+
+ highp vec3 RGBtoHSL(highp vec3 color) {
+ highp float cmin = min(color.r, min(color.g, color.b));
+ highp float cmax = max(color.r, max(color.g, color.b));
+ highp float h = 0.0;
+ highp float s = 0.0;
+ highp float l = (cmin + cmax) / 2.0;
+ highp float diff = cmax - cmin;
+
+ if (diff > 1.0 / 256.0) {
+ if (l < 0.5)
+ s = diff / (cmin + cmax);
+ else
+ s = diff / (2.0 - (cmin + cmax));
+
+ if (color.r == cmax)
+ h = (color.g - color.b) / diff;
+ else if (color.g == cmax)
+ h = 2.0 + (color.b - color.r) / diff;
+ else
+ h = 4.0 + (color.r - color.g) / diff;
+
+ h /= 6.0;
+ }
+ return vec3(h, s, l);
+ }
+
+ highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
+ h = fract(h);
+ if (h < 1.0 / 6.0)
+ return v1 + (v2 - v1) * 6.0 * h;
+ else if (h < 1.0 / 2.0)
+ return v2;
+ else if (h < 2.0 / 3.0)
+ return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
+
+ return v1;
+ }
+
+ highp vec3 HSLtoRGB(highp vec3 color) {
+ highp float h = color.x;
+ highp float l = color.z;
+ highp float s = color.y;
+
+ if (s < 1.0 / 256.0)
+ return vec3(l, l, l);
+
+ highp float v1;
+ highp float v2;
+ if (l < 0.5)
+ v2 = l * (1.0 + s);
+ else
+ v2 = (l + s) - (s * l);
+
+ v1 = 2.0 * l - v2;
+
+ highp float d = 1.0 / 3.0;
+ highp float r = hueToIntensity(v1, v2, h + d);
+ highp float g = hueToIntensity(v1, v2, h);
+ highp float b = hueToIntensity(v1, v2, h - d);
+ return vec3(r, g, b);
+ }
+
+ lowp float channelBlendHardLight(lowp float c1, lowp float c2) {
+ return c2 > 0.5 ? (1.0 - (1.0 - 2.0 * (c2 - 0.5)) * (1.0 - c1)) : (2.0 * c1 * c2);
+ }
+
+ void main() {
+ lowp vec4 result = vec4(0.0);
+ lowp vec4 color1 = texture2D(backgroundSource, qt_TexCoord0);
+ lowp vec4 color2 = texture2D(foregroundSource, qt_TexCoord0);
+ lowp vec3 rgb1 = color1.rgb / max(1.0/256.0, color1.a);
+ lowp vec3 rgb2 = color2.rgb / max(1.0/256.0, color2.a);
+ highp float a = max(color1.a, color1.a * color2.a);
+ "
+
+ property string fragmentShaderEnd: "
+ gl_FragColor.rgb = mix(rgb1, result.rgb, color2.a);
+ gl_FragColor.rbg *= a;
+ gl_FragColor.a = a;
+ gl_FragColor *= qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml
new file mode 100644
index 0000000000..db53acbad4
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype BrightnessContrast
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Adjusts brightness and contrast.
+
+ This effect adjusts the source item colors.
+ Brightness adjustment changes the perceived luminance of the source item.
+ Contrast adjustment increases or decreases the color
+ and brightness variations.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image BrightnessContrast_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet BrightnessContrast-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines how much the source brightness is increased or
+ decreased.
+
+ The value ranges from -1.0 to 1.0. By default, the property is set to \c
+ 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different brightness values
+ \li
+ \li
+ \row
+ \li \image BrightnessContrast_brightness1.png
+ \li \image BrightnessContrast_brightness2.png
+ \li \image BrightnessContrast_brightness3.png
+ \row
+ \li \b { brightness: -0.25 }
+ \li \b { brightness: 0 }
+ \li \b { brightness: 0.5 }
+ \row
+ \li \l contrast: 0
+ \li \l contrast: 0
+ \li \l contrast: 0
+ \endtable
+
+ */
+ property real brightness: 0.0
+
+ /*!
+ This property defines how much the source contrast is increased or
+ decreased. The decrease of the contrast is linear, but the increase is
+ applied with a non-linear curve to allow very high contrast adjustment at
+ the high end of the value range.
+
+ \table
+ \header
+ \li Contrast adjustment curve
+ \row
+ \li \image BrightnessContrast_contrast_graph.png
+ \endtable
+
+ The value ranges from -1.0 to 1.0. By default, the property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different contrast values
+ \li
+ \li
+ \row
+ \li \image BrightnessContrast_contrast1.png
+ \li \image BrightnessContrast_contrast2.png
+ \li \image BrightnessContrast_contrast3.png
+ \row
+ \li \b { contrast: -0.5 }
+ \li \b { contrast: 0 }
+ \li \b { contrast: 0.5 }
+ \row
+ \li \l brightness: 0
+ \li \l brightness: 0
+ \li \l brightness: 0
+ \endtable
+
+ */
+ property real contrast: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real brightness: rootItem.brightness
+ property real contrast: rootItem.contrast
+
+ anchors.fill: parent
+ blending: !rootItem.cached
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float brightness;
+ uniform highp float contrast;
+ void main() {
+ highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
+ pixelColor.rgb /= max(1.0/256.0, pixelColor.a);
+ highp float c = 1.0 + contrast;
+ highp float contrastGainFactor = 1.0 + c * c * c * c * step(0.0, contrast);
+ pixelColor.rgb = ((pixelColor.rgb - 0.5) * (contrastGainFactor * contrast + 1.0)) + 0.5;
+ pixelColor.rgb = mix(pixelColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
+ gl_FragColor = vec4(pixelColor.rgb * pixelColor.a, pixelColor.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml
new file mode 100644
index 0000000000..fedc0500df
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype ColorOverlay
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Alters the colors of the source item by applying an overlay color.
+
+ The effect is similar to what happens when a colorized glass is put on top
+ of a grayscale image. The color for the overlay is given in the RGBA format.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly.png
+ \li \image ColorOverlay_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet ColorOverlay-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the RGBA color value which is used to colorize the
+ source.
+
+ By default, the property is set to \c "transparent".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image ColorOverlay_color1.png
+ \li \image ColorOverlay_color2.png
+ \li \image ColorOverlay_color3.png
+ \row
+ \li \b { color: #80ff0000 }
+ \li \b { color: #8000ff00 }
+ \li \b { color: #800000ff }
+ \endtable
+
+ */
+ property color color: "transparent"
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property color color: rootItem.color
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp vec4 color;
+ void main() {
+ highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
+ gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml
new file mode 100644
index 0000000000..62e1312940
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml
@@ -0,0 +1,294 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Colorize
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Sets the color in the HSL color space.
+
+ The effect is similar to what happens when a colorized glass is put on top
+ of a grayscale image. Colorize uses the hue, saturation, and lightness (HSL)
+ color space. You can specify a desired value for each property. You can
+ shift all HSL values with the
+ \l{QtGraphicalEffects1::HueSaturation}{HueSaturation} effect.
+
+ Alternatively, you can use the
+ \l{QtGraphicalEffects1::ColorOverlay}{ColorOverlay} effect to colorize the
+ source item in the RGBA color space.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image Colorize_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Colorize-example.qml example
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the hue value which is used to colorize the
+ source.
+
+ The value ranges from 0.0 to 1.0. By default, the property is set to \c
+ 0.0, which produces a slightly red color.
+
+ \table
+ \header
+ \li Allowed hue values
+ \row
+ \li \image Colorize_hue_scale.png
+ \endtable
+
+ \table
+ \header
+ \li Output examples with different hue values
+ \li
+ \li
+ \row
+ \li \image Colorize_hue1.png
+ \li \image Colorize_hue2.png
+ \li \image Colorize_hue3.png
+ \row
+ \li \b { hue: 0.2 }
+ \li \b { hue: 0.5 }
+ \li \b { hue: 0.8 }
+ \row
+ \li \l saturation: 1
+ \li \l saturation: 1
+ \li \l saturation: 1
+ \row
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \endtable
+ */
+ property real hue: 0.0
+
+ /*!
+ This property defines the saturation value which is used to colorize the
+ source.
+
+ The value ranges from 0.0 (desaturated) to 1.0 (saturated). By default,
+ the property is set to \c 1.0 (saturated).
+
+ \table
+ \header
+ \li Output examples with different saturation values
+ \li
+ \li
+ \row
+ \li \image Colorize_saturation1.png
+ \li \image Colorize_saturation2.png
+ \li \image Colorize_saturation3.png
+ \row
+ \li \b { saturation: 0 }
+ \li \b { saturation: 0.5 }
+ \li \b { saturation: 1 }
+ \row
+ \li \l hue: 0
+ \li \l hue: 0
+ \li \l hue: 0
+ \row
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \endtable
+ */
+ property real saturation: 1.0
+
+ /*!
+ This property defines how much the source lightness value is increased
+ or decreased.
+
+ Unlike hue and saturation properties, lightness does not set the used
+ value, but it shifts the existing source pixel lightness value.
+
+ The value ranges from -1.0 (decreased) to 1.0 (increased). By default,
+ the property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different lightness values
+ \li
+ \li
+ \row
+ \li \image Colorize_lightness1.png
+ \li \image Colorize_lightness2.png
+ \li \image Colorize_lightness3.png
+ \row
+ \li \b { lightness: -0.75 }
+ \li \b { lightness: 0 }
+ \li \b { lightness: 0.75 }
+ \row
+ \li \l hue: 0
+ \li \l hue: 0
+ \li \l hue: 0
+ \row
+ \li \l saturation: 1
+ \li \l saturation: 1
+ \li \l saturation: 1
+ \endtable
+ */
+ property real lightness: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real hue: rootItem.hue
+ property real saturation: rootItem.saturation
+ property real lightness: rootItem.lightness
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float hue;
+ uniform highp float saturation;
+ uniform highp float lightness;
+
+ highp float RGBtoL(highp vec3 color) {
+ highp float cmin = min(color.r, min(color.g, color.b));
+ highp float cmax = max(color.r, max(color.g, color.b));
+ highp float l = (cmin + cmax) / 2.0;
+ return l;
+ }
+
+ highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
+ h = fract(h);
+ if (h < 1.0 / 6.0)
+ return v1 + (v2 - v1) * 6.0 * h;
+ else if (h < 1.0 / 2.0)
+ return v2;
+ else if (h < 2.0 / 3.0)
+ return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
+
+ return v1;
+ }
+
+ highp vec3 HSLtoRGB(highp vec3 color) {
+ highp float h = color.x;
+ highp float l = color.z;
+ highp float s = color.y;
+
+ if (s < 1.0 / 256.0)
+ return vec3(l, l, l);
+
+ highp float v1;
+ highp float v2;
+ if (l < 0.5)
+ v2 = l * (1.0 + s);
+ else
+ v2 = (l + s) - (s * l);
+
+ v1 = 2.0 * l - v2;
+
+ highp float d = 1.0 / 3.0;
+ highp float r = hueToIntensity(v1, v2, h + d);
+ highp float g = hueToIntensity(v1, v2, h);
+ highp float b = hueToIntensity(v1, v2, h - d);
+ return vec3(r, g, b);
+ }
+
+ void main() {
+ lowp vec4 sample = texture2D(source, qt_TexCoord0);
+ sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a);
+ highp float light = RGBtoL(sample.rgb);
+ highp float c = step(0.0, lightness);
+ sample.rgb = HSLtoRGB(vec3(hue, saturation, mix(light, c, abs(lightness))));
+ gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml
new file mode 100644
index 0000000000..c2492f405a
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml
@@ -0,0 +1,342 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype ConicalGradient
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-gradient
+ \brief Draws a conical gradient.
+
+ A gradient is defined by two or more colors, which are blended seamlessly.
+ The colors start from the specified angle and end at 360 degrees larger
+ angle value.
+
+ \table
+ \header
+ \li Effect applied
+ \row
+ \li \image ConicalGradient.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet ConicalGradient-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ /*!
+ This property defines the starting angle where the color at the gradient
+ position of 0.0 is rendered. Colors at larger position values are
+ rendered into larger angle values and blended seamlessly. Angle values
+ increase clockwise.
+
+ \table
+ \header
+ \li Output examples with different angle values
+ \li
+ \li
+ \row
+ \li \image ConicalGradient_angle1.png
+ \li \image ConicalGradient_angle2.png
+ \li \image ConicalGradient_angle3.png
+ \row
+ \li \b { angle: 0 }
+ \li \b { angle: 45 }
+ \li \b { angle: 185 }
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+ */
+ property real angle: 0.0
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::ConicalGradient::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::ConicalGradient::verticalOffset
+
+ The horizontalOffset and verticalOffset properties define the offset in
+ pixels for the center point of the gradient compared to the item center.
+
+ The value ranges from -inf to inf. By default, the properties are set to \c
+ 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image ConicalGradient_horizontalOffset1.png
+ \li \image ConicalGradient_horizontalOffset2.png
+ \li \image ConicalGradient_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: -50 }
+ \li \b { horizontalOffset: 0 }
+ \li \b { horizontalOffset: 50 }
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ This property defines the item that is going to be filled with gradient.
+ Source item gets rendered into an intermediate pixel buffer and the
+ alpha values from the result are used to determine the gradient's pixels
+ visibility in the display. The default value for source is undefined and
+ in that case whole effect area is filled with gradient.
+
+ \table
+ \header
+ \li Output examples with different source values
+ \li
+ \row
+ \li \image ConicalGradient_maskSource1.png
+ \li \image ConicalGradient_maskSource2.png
+ \row
+ \li \b { source: undefined }
+ \li \b { source: }
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+/*!
+ A gradient is defined by two or more colors, which are blended seamlessly.
+ The colors are specified as a set of GradientStop child items, each of which
+ defines a position on the gradient (from 0.0 to 1.0), and a color.
+ The position of each GradientStop is defined by the position property.
+ The color is defined by the color property.
+
+ \table
+ \header
+ \li Output examples with different gradient values
+ \li
+ \li
+ \row
+ \li \image ConicalGradient_gradient1.png
+ \li \image ConicalGradient_gradient2.png
+ \li \image ConicalGradient_gradient3.png
+ \row
+ \li \b {gradient:} \code
+Gradient {
+ GradientStop { position: 0.000
+ color: Qt.rgba(1, 0, 0, 1) }
+ GradientStop { position: 0.167;
+ color: Qt.rgba(1, 1, 0, 1) }
+ GradientStop { position: 0.333;
+ color: Qt.rgba(0, 1, 0, 1) }
+ GradientStop { position: 0.500;
+ color: Qt.rgba(0, 1, 1, 1) }
+ GradientStop { position: 0.667;
+ color: Qt.rgba(0, 0, 1, 1) }
+ GradientStop { position: 0.833;
+ color: Qt.rgba(1, 0, 1, 1) }
+ GradientStop { position: 1.000;
+ color: Qt.rgba(1, 0, 0, 1) }
+}
+ \endcode
+ \li \b {gradient:} \code
+Gradient {
+ GradientStop { position: 0.0
+ color: "#F0F0F0"
+ }
+ GradientStop { position: 0.5
+ color: "#000000"
+ }
+ GradientStop { position: 1.0
+ color: "#F0F0F0"
+ }
+}
+ \endcode
+ \li \b {gradient:} \code
+Gradient {
+ GradientStop { position: 0.0
+ color: "#00000000"
+ }
+ GradientStop { position: 1.0
+ color: "#FF000000"
+ }
+}
+ \endcode
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+*/
+ property Gradient gradient: Gradient {
+ GradientStop { position: 0.0; color: "white" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.source
+ }
+
+ Rectangle {
+ id: gradientRect
+ width: 16
+ height: 256
+ gradient: rootItem.gradient
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ rotation: shaderItem.rotation
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant gradientSource: ShaderEffectSource {
+ sourceItem: gradientRect
+ smooth: true
+ hideSource: true
+ visible: false
+ }
+ property variant maskSource: maskSourceProxy.output
+ property real startAngle: (rootItem.angle - 90) * Math.PI/180
+ property variant center: Qt.point(0.5 + horizontalOffset / width, 0.5 + verticalOffset / height)
+
+ anchors.fill: parent
+
+ fragmentShader: maskSource == undefined ? noMaskShader : maskShader
+
+ onFragmentShaderChanged: startAngleChanged()
+
+ property string noMaskShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform lowp sampler2D gradientSource;
+ uniform highp float qt_Opacity;
+ uniform highp float startAngle;
+ uniform highp vec2 center;
+
+ void main() {
+ const highp float PI = 3.14159265;
+ const highp float PIx2inv = 0.1591549;
+ highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
+ gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * qt_Opacity;
+ }
+ "
+
+ property string maskShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform lowp sampler2D gradientSource;
+ uniform lowp sampler2D maskSource;
+ uniform highp float qt_Opacity;
+ uniform highp float startAngle;
+ uniform highp vec2 center;
+
+ void main() {
+ lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
+ const highp float PI = 3.14159265;
+ const highp float PIx2inv = 0.1591549;
+ highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
+ gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * maskAlpha * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml
new file mode 100644
index 0000000000..a05cb59c32
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Desaturate
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Reduces the saturation of the colors.
+
+ Desaturated pixel values are calculated as averages of the original RGB
+ component values of the source item.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image Desaturate_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Desaturate-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels to
+ the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines how much the source colors are desaturated.
+
+ The value ranges from 0.0 (no change) to 1.0 (desaturated). By default,
+ the property is set to \c 0.0 (no chnage).
+
+ \table
+ \header
+ \li Output examples with different desaturation values
+ \li
+ \li
+ \row
+ \li \image Desaturate_desaturation1.png
+ \li \image Desaturate_desaturation2.png
+ \li \image Desaturate_desaturation3.png
+ \row
+ \li \b { desaturation: 0.0 }
+ \li \b { desaturation: 0.5 }
+ \li \b { desaturation: 1.0 }
+ \endtable
+ */
+ property real desaturation: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real desaturation: rootItem.desaturation
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float desaturation;
+ void main(void) {
+ lowp vec4 textureColor = texture2D(source, qt_TexCoord0.st);
+ lowp float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0;
+ gl_FragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml
new file mode 100644
index 0000000000..248e0c5bfc
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype DirectionalBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-motion-blur
+ \brief Applies blur effect to the specified direction.
+
+ Effect creates perceived impression that the source item appears to be
+ moving in the direction of the blur. Blur is applied to both sides of
+ each pixel, therefore setting the direction to 0 and 180 provides the
+ same result.
+
+ Other available motionblur effects are \l{QtGraphicalEffects1::ZoomBlur}{ZoomBlur} and
+ \l{QtGraphicalEffects1::RadialBlur}{RadialBlur}.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image DirectionalBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet DirectionalBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the percieved amount of movement for each pixel.
+ The movement is divided evenly to both sides of each pixel.
+
+ The quality of the blur depends on \l{DirectionalBlur::samples}{samples}
+ property. If length value is large, more samples are needed to keep the
+ visual quality at high level.
+
+ The value ranges from 0.0 to inf.
+ By default the property is set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different length values
+ \li
+ \li
+ \row
+ \li \image DirectionalBlur_length1.png
+ \li \image DirectionalBlur_length2.png
+ \li \image DirectionalBlur_length3.png
+ \row
+ \li \b { length: 0.0 }
+ \li \b { length: 32.0 }
+ \li \b { length: 48.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \endtable
+
+ */
+ property real length: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ Allowed values are between 0 and inf (practical maximum depends on GPU).
+ By default the property is set to \c 0 (no samples).
+
+ */
+ property int samples: 0
+
+ /*!
+ This property defines the direction for the blur. Blur is applied to
+ both sides of each pixel, therefore setting the direction to 0 and 180
+ produces the same result.
+
+ The value ranges from -180.0 to 180.0.
+ By default the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different angle values
+ \li
+ \li
+ \row
+ \li \image DirectionalBlur_angle1.png
+ \li \image DirectionalBlur_angle2.png
+ \li \image DirectionalBlur_angle3.png
+ \row
+ \li \b { angle: 0.0 }
+ \li \b { angle: 45.0 }
+ \li \b { angle: 90.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l length: 32
+ \li \l length: 32
+ \li \l length: 32
+ \endtable
+
+ */
+ property real angle: 0.0
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real len: rootItem.length
+ property bool transparentBorder: rootItem.transparentBorder
+ property real samples: rootItem.samples
+ property real weight: 1.0 / Math.max(1.0, rootItem.samples)
+ property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0)
+ property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
+ property variant delta: Qt.size(1.0 / rootItem.width * Math.cos((rootItem.angle + 90) * Math.PI/180), 1.0 / rootItem.height * Math.sin((rootItem.angle + 90) * Math.PI/180))
+
+ x: transparentBorder ? -expandPixels.width - 1: 0
+ y: transparentBorder ? -expandPixels.height - 1 : 0
+ width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width
+ height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height
+
+ property string fragmentShaderSkeleton: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float len;
+ uniform highp float samples;
+ uniform highp float weight;
+ uniform highp vec2 expand;
+ uniform highp vec2 delta;
+
+ void main(void) {
+ highp vec2 shift = delta * len / max(1.0, samples - 1.0);
+ mediump vec2 texCoord = qt_TexCoord0;
+ gl_FragColor = vec4(0.0);
+
+ PLACEHOLDER_EXPAND_STEPS
+
+ texCoord -= shift * max(0.0, samples - 1.0) * 0.5;
+
+ PLACEHOLDER_UNROLLED_LOOP
+
+ gl_FragColor *= weight * qt_Opacity;
+ }
+ "
+
+ function buildFragmentShader() {
+ var shader = fragmentShaderSkeleton
+ var expandSteps = ""
+
+ if (transparentBorder) {
+ expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
+ }
+
+ var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
+
+ if (rootItem.samples > 1) {
+ unrolledLoop = ""
+ for (var i = 0; i < rootItem.samples; i++)
+ unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
+ fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
+ }
+
+ onFragmentShaderChanged: sourceChanged()
+ onSamplesChanged: buildFragmentShader()
+ onTransparentBorderChanged: buildFragmentShader()
+ Component.onCompleted: buildFragmentShader()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Displace.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Displace.qml
new file mode 100644
index 0000000000..142ae10a03
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Displace.qml
@@ -0,0 +1,217 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Displace
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-distortion
+ \brief Moves the pixels of the source item according to the given
+ displacement map.
+
+ \table
+ \header
+ \li Source
+ \li DisplacementSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image Displace_map.png
+ \li \image Displace_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Displace-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item for the pixels that are going to
+ be displaced according to the data from
+ \l{Displace::displacementSource}{displacementSource}.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is going to be used as the
+ displacement map. The displacementSource item gets rendered into the
+ intermediate pixel buffer. The red and green component values from the
+ result determine the displacement of the pixels from the source item.
+
+ The format for the displacement map is similar to the tangent space
+ normal maps, which can be created with most 3D-modeling tools. Many
+ image processing tools include the support for generating normal maps.
+ Alternatively, the displacement map for this effect can also be a QML
+ element which is colored appropriately. Like any QML element, it can be
+ animated. It is recommended that the size of the diplacement map matches
+ the size of the \l{Displace::source}{source}.
+
+ The displace data is interpreted in the RGBA format. For every pixel:
+ the red channel stores the x-axis displacement, and the green channel
+ stores the y-axis displacement. Blue and alpha channels are ignored for
+ this effect.
+
+ Assuming that red channel value 1.0 is fully red (0.0 having no red at
+ all), this effect considers pixel component value 0.5 to cause no
+ displacement at all. Values above 0.5 shift pixels to the left, values
+ below 0.5 do the shift to the right. In a similar way, green channel
+ values above 0.5 displace the pixels upwards, and values below 0.5 shift
+ the pixels downwards. The actual amount of displacement in pixels
+ depends on the \l displacement property.
+
+ */
+ property variant displacementSource
+
+ /*!
+ This property defines the scale for the displacement. The bigger scale,
+ the bigger the displacement of the pixels. The value set to 0.0 causes
+ no displacement.
+
+ The value ranges from -1.0 (inverted maximum shift, according to
+ displacementSource) to 1.0 (maximum shift, according to
+ displacementSource). By default, the property is set to \c 0.0 (no
+ displacement).
+
+ \table
+ \header
+ \li Output examples with different displacement values
+ \li
+ \li
+ \row
+ \li \image Displace_displacement1.png
+ \li \image Displace_displacement2.png
+ \li \image Displace_displacement3.png
+ \row
+ \li \b { displacement: -0.2 }
+ \li \b { displacement: 0.0 }
+ \li \b { displacement: 0.2 }
+ \endtable
+
+ */
+ property real displacement: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: displacementSourceProxy
+ input: rootItem.displacementSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant displacementSource: displacementSourceProxy.output
+ property real displacement: rootItem.displacement
+ property real xPixel: 1.0/width
+ property real yPixel: 1.0/height
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D displacementSource;
+ uniform highp float displacement;
+ uniform highp float xPixel;
+ uniform highp float yPixel;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp vec4 offset = texture2D(displacementSource, qt_TexCoord0);
+ offset.xy -= vec2(0.5, 0.5);
+ offset.xy = offset.xy * step(vec2(1.0/256.0), abs(offset.xy));
+ highp vec2 tx = qt_TexCoord0 + (vec2(-offset.x, offset.y) * displacement);
+
+ lowp float e1 = linearstep(0.0, xPixel, tx.x);
+ lowp float e2 = linearstep(0.0, yPixel, tx.y);
+ lowp float e3 = 1.0 - linearstep(1.0, 1.0 + xPixel, tx.x);
+ lowp float e4 = 1.0 - linearstep(1.0, 1.0 + yPixel, tx.y);
+
+ lowp vec4 sample = texture2D(source, tx);
+ sample.rgb *= e1 * e2 * e3 * e4;
+ gl_FragColor = sample * qt_Opacity * offset.a;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml
new file mode 100644
index 0000000000..b73e244cbc
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml
@@ -0,0 +1,403 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype DropShadow
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-drop-shadow
+ \brief Generates a colorized and blurred shadow image of the
+ source and places it behind the original, giving the impression that
+ source item is raised from the background.
+
+ By default the effect produces a high quality shadow image, thus the
+ rendering speed of the shadow might not be the highest possible. The
+ rendering speed is reduced especially if the shadow edges are heavily
+ softened.
+
+ For use cases that require faster rendering speed and for which the highest
+ possible visual quality is not necessary, property
+ \l{DropShadow::fast}{fast} can be set to true.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly.png
+ \li \image DropShadow_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet DropShadow-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be used as the
+ source for the generated shadow.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ Radius defines the softness of the shadow. A larger radius causes the
+ edges of the shadow to appear more blurry.
+
+ Depending on the radius value, value of the
+ \l{DropShadow::samples}{samples} should be set to sufficiently large to
+ ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image DropShadow_radius1.png
+ \li \image DropShadow_radius2.png
+ \li \image DropShadow_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 6 }
+ \li \b { radius: 12 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when edge
+ softening blur calculation is done. Larger value produces better
+ quality, but is slower to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ When \l{DropShadow::fast}{fast} property is set to true, this property
+ has no effect.
+
+ */
+ property int samples: 0
+
+ /*!
+ This property defines the RGBA color value which is used for the shadow.
+
+ By default, the property is set to \c "black".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image DropShadow_color1.png
+ \li \image DropShadow_color2.png
+ \li \image DropShadow_color3.png
+ \row
+ \li \b { color: #000000 }
+ \li \b { color: #0000ff }
+ \li \b { color: #aa000000 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property color color: "black"
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::DropShadow::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::DropShadow::verticalOffset
+
+ HorizontalOffset and verticalOffset properties define the offset for the
+ rendered shadow compared to the DropShadow item position. Often, the
+ DropShadow item is anchored so that it fills the source element. In this
+ case, if the HorizontalOffset and verticalOffset properties are set to
+ 0, the shadow is rendered exactly under the source item. By changing the
+ offset properties, the shadow can be positioned relatively to the source
+ item.
+
+ The values range from -inf to inf. By default, the properties are set to
+ \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image DropShadow_horizontalOffset1.png
+ \li \image DropShadow_horizontalOffset2.png
+ \li \image DropShadow_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: -20 }
+ \li \b { horizontalOffset: 0 }
+ \li \b { horizontalOffset: 20 }
+ \row
+ \li \l radius: 4
+ \li \l radius: 4
+ \li \l radius: 4
+ \row
+ \li \l samples: 8
+ \li \l samples: 8
+ \li \l samples: 8
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ This property defines how large part of the shadow color is strenghtened
+ near the source edges.
+
+ The value ranges from 0.0 to 1.0. By default, the property is set to \c
+ 0.5.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image DropShadow_spread1.png
+ \li \image DropShadow_spread2.png
+ \li \image DropShadow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.5 }
+ \li \b { spread: 1.0 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \endtable
+
+ */
+ property real spread: 0.0
+
+ /*!
+ This property selects the blurring algorithm that is used to produce the
+ softness for the effect. Setting this to true enables fast algorithm,
+ setting value to false produces higher quality result.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different fast values
+ \li
+ \li
+ \row
+ \li \image DropShadow_fast1.png
+ \li \image DropShadow_fast2.png
+ \row
+ \li \b { fast: false }
+ \li \b { fast: true }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 20
+ \li \l verticalOffset: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property bool fast: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance. Every time the source or effect
+ properties are changed, the pixels in the cache must be updated. Memory
+ consumption is increased, because an extra buffer of memory is required
+ for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ property bool transparentBorder: false
+
+ Loader {
+ x: rootItem.horizontalOffset
+ y: rootItem.verticalOffset
+ width: parent.width
+ height: parent.height
+ sourceComponent: rootItem.fast ? fastGlow : gaussianGlow
+ }
+
+ Component {
+ id: gaussianGlow
+ GaussianGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ Component {
+ id: fastGlow
+ FastGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+ ShaderEffect {
+ anchors.fill: parent
+ property variant source: sourceProxy.output
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml
new file mode 100644
index 0000000000..ca38ad2fbf
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml
@@ -0,0 +1,496 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype FastBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blur
+ \brief Applies a fast blur effect to one or more source items.
+
+ FastBlur offers lower blur quality than
+ \l{QtGraphicalEffects1::GaussianBlur}{GaussianBlur}, but it is faster to
+ render. The FastBlur effect softens the source content by blurring it with
+ algorithm which uses the source content downscaling and bilinear filtering.
+ Use this effect in situations where the source content is rapidly changing
+ and the highest possible blur quality is not
+ needed.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image FastBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet FastBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the distance of the neighboring pixels which affect
+ the blurring of an individual pixel. A larger radius increases the blur
+ effect. FastBlur algorithm may internally reduce the accuracy of the radius in order to
+ provide good rendering performance.
+
+ The value ranges from 0.0 (no blur) to inf. Visual quality of the blur is reduced when
+ radius exceeds value 64. By default, the property is set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different blur values
+ \li
+ \li
+ \row
+ \li \image FastBlur_radius1.png
+ \li \image FastBlur_radius2.png
+ \li \image FastBlur_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 32 }
+ \li \b { radius: 64 }
+ \endtable
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different transparentBorder values
+ \li
+ \li
+ \row
+ \li \image FastBlur_transparentBorder1.png
+ \li \image FastBlur_transparentBorder2.png
+ \row
+ \li \b { transparentBorder: false }
+ \li \b { transparentBorder: true }
+ \row
+ \li \l radius: 64
+ \li \l radius: 64
+ \endtable
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ smooth: rootItem.radius > 0
+ }
+
+ /*! \internal */
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ /*! \internal */
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
+ visible: false
+ smooth: rootItem.radius > 0
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ Item {
+ id: dummysource
+ width: 1
+ height: 1
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: dummy
+ width: 1
+ height: 1
+ sourceItem: dummysource
+ visible: false
+ smooth: false
+ live: false
+ }
+
+ ShaderEffect {
+ id: shaderItem
+
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: Math.sqrt(rootItem.radius / 64.0) * 1.2 - 0.2
+ property real weight1
+ property real weight2
+ property real weight3
+ property real weight4
+ property real weight5
+ property real weight6
+
+ x: transparentBorder ? -64 : 0
+ y: transparentBorder ? -64 : 0
+ width: transparentBorder ? parent.width + 128 : parent.width
+ height: transparentBorder ? parent.height + 128 : parent.height
+
+ function weight(v) {
+ if (v <= 0.0)
+ return 1.0
+ if (v >= 0.5)
+ return 0.0
+
+ return 1.0 - v * 2.0
+ }
+
+ function calculateWeights() {
+
+ var w1 = weight(Math.abs(lod - 0.100))
+ var w2 = weight(Math.abs(lod - 0.300))
+ var w3 = weight(Math.abs(lod - 0.500))
+ var w4 = weight(Math.abs(lod - 0.700))
+ var w5 = weight(Math.abs(lod - 0.900))
+ var w6 = weight(Math.abs(lod - 1.100))
+
+ var sum = w1 + w2 + w3 + w4 + w5 + w6;
+ weight1 = w1 / sum;
+ weight2 = w2 / sum;
+ weight3 = w3 / sum;
+ weight4 = w4 / sum;
+ weight5 = w5 / sum;
+ weight6 = w6 / sum;
+
+ upateSources()
+ }
+
+ function upateSources() {
+ var sources = new Array();
+ var weights = new Array();
+
+ if (weight1 > 0) {
+ sources.push(level1)
+ weights.push(weight1)
+ }
+
+ if (weight2 > 0) {
+ sources.push(level2)
+ weights.push(weight2)
+ }
+
+ if (weight3 > 0) {
+ sources.push(level3)
+ weights.push(weight3)
+ }
+
+ if (weight4 > 0) {
+ sources.push(level4)
+ weights.push(weight4)
+ }
+
+ if (weight5 > 0) {
+ sources.push(level5)
+ weights.push(weight5)
+ }
+
+ if (weight6 > 0) {
+ sources.push(level6)
+ weights.push(weight6)
+ }
+
+ for (var j = sources.length; j < 6; j++) {
+ sources.push(dummy)
+ weights.push(0.0)
+ }
+
+ source1 = sources[0]
+ source2 = sources[1]
+ source3 = sources[2]
+ source4 = sources[3]
+ source5 = sources[4]
+ source6 = sources[5]
+
+ weight1 = weights[0]
+ weight2 = weights[1]
+ weight3 = weights[2]
+ weight4 = weights[3]
+ weight5 = weights[4]
+ weight6 = weights[5]
+ }
+
+ Component.onCompleted: calculateWeights()
+
+ onLodChanged: calculateWeights()
+
+ fragmentShader: "
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform mediump float weight1;
+ uniform mediump float weight2;
+ uniform mediump float weight3;
+ uniform mediump float weight4;
+ uniform mediump float weight5;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ void main() {
+ lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml
new file mode 100644
index 0000000000..7a597dd05e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype GammaAdjust
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Alters the luminance of the source item.
+
+ GammaAdjust is applied to each pixel according to the curve which is
+ pre-defined as a power-law expression, where the property gamma is used as the
+ reciprocal scaling exponent. Refer to the property documentation of \l{GammaAdjust::gamma}{gamma}
+ for more details.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image GammaAdjust_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet GammaAdjust-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item for which the luminance is going to be
+ adjusted.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the change factor for how the luminance of each pixel
+ is altered according to the equation:
+
+ \code
+luminance = pow(original_luminance, 1.0 / gamma); // The luminance is assumed to be between 0.0 and 1.0
+ \endcode
+
+ Setting the gamma values under 1.0 makes the image darker, the values
+ above 1.0 lighten it.
+
+ The value ranges from 0.0 (darkest) to inf (lightest). By default, the
+ property is set to \c 1.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different gamma values
+ \li
+ \li
+ \row
+ \li \image GammaAdjust_gamma1.png
+ \li \image GammaAdjust_gamma2.png
+ \li \image GammaAdjust_gamma3.png
+ \row
+ \li \b { gamma: 0.5 }
+ \li \b { gamma: 1.0 }
+ \li \b { gamma: 2.0 }
+ \endtable
+
+ \table
+ \header
+ \li Pixel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image GammaAdjust_gamma1_graph.png
+ \li \image GammaAdjust_gamma2_graph.png
+ \li \image GammaAdjust_gamma3_graph.png
+ \row
+ \li Red curve: default gamma (1.0)
+ \li
+ \li
+ \row
+ \li Yellow curve: effect applied
+ \li
+ \li
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: pixel luminance with effect applied
+ \li
+ \li
+ \endtable
+
+ */
+ property real gamma: 1.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real gamma: 1.0 / Math.max(rootItem.gamma, 0.0001)
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float gamma;
+ void main(void) {
+ highp vec4 originalColor = texture2D(source, qt_TexCoord0.st);
+ originalColor.rgb = originalColor.rgb / max(1.0/256.0, originalColor.a);
+ highp vec3 adjustedColor = pow(originalColor.rgb, vec3(gamma));
+ gl_FragColor = vec4(adjustedColor * originalColor.a, originalColor.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml
new file mode 100644
index 0000000000..4000179ef7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml
@@ -0,0 +1,295 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype GaussianBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blur
+ \brief Applies a higher quality blur effect.
+
+ GaussianBlur effect softens the image by blurring it with an algorithm that
+ uses the Gaussian function to calculate the effect. The effect produces
+ higher quality than \l{QtGraphicalEffects1::FastBlur}{FastBlur}, but is
+ slower to render.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image GaussianBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet GaussianBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the distance of the neighboring pixels which
+ affect the blurring of an individual pixel. A larger radius increases
+ the blur effect.
+
+ Depending on the radius value, value of the
+ \l{GaussianBlur::samples}{samples} should be set to sufficiently large
+ to ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image GaussianBlur_radius1.png
+ \li \image GaussianBlur_radius2.png
+ \li \image GaussianBlur_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 4 }
+ \li \b { radius: 8 }
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l deviation: 3
+ \li \l deviation: 3
+ \li \l deviation: 3
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ */
+ property int samples: 0
+
+ /*!
+ This property is a parameter to the gaussian function that is used when
+ calculating neighboring pixel weights for the blurring. A larger
+ deviation causes image to appear more blurry, but it also reduces the
+ quality of the blur. A very large deviation value causes the effect to
+ look a bit similar to what, for exmple, a box blur algorithm produces. A
+ too small deviation values makes the effect insignificant for the pixels
+ near the radius.
+
+ \inlineimage GaussianBlur_deviation_graph.png
+ \caption The image above shows the Gaussian function with two different
+ deviation values, yellow (1) and cyan (2.7). The y-axis shows the
+ weights, the x-axis shows the pixel distance.
+
+ The value ranges from 0.0 (no deviation) to inf (maximum deviation). By
+ default, devaition is binded to radius. When radius increases, deviation
+ is automatically increased linearly. With the radius value of 8, the
+ deviation default value becomes approximately 2.7034. This value
+ produces a compromise between the blur quality and overall blurriness.
+
+ \table
+ \header
+ \li Output examples with different deviation values
+ \li
+ \li
+ \row
+ \li \image GaussianBlur_deviation1.png
+ \li \image GaussianBlur_deviation2.png
+ \li \image GaussianBlur_deviation3.png
+ \row
+ \li \b { deviation: 1 }
+ \li \b { deviation: 2 }
+ \li \b { deviation: 4 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \endtable
+
+ */
+ property real deviation: (radius + 1) / 3.3333
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different transparentBorder values
+ \li
+ \li
+ \row
+ \li \image GaussianBlur_transparentBorder1.png
+ \li \image GaussianBlur_transparentBorder2.png
+ \row
+ \li \b { transparentBorder: false }
+ \li \b { transparentBorder: true }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l deviation: 2.7
+ \li \l deviation: 2.7
+ \endtable
+
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: verticalBlur
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: verticalBlur
+ live: true
+ hideSource: visible
+ }
+
+ GaussianDirectionalBlur {
+ id: verticalBlur
+ x: transparentBorder ? -maximumRadius - 1 : 0
+ y: transparentBorder ? -maximumRadius - 1 : 0
+ width: horizontalBlur.width
+ height: horizontalBlur.height
+
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+
+ source: ShaderEffectSource {
+ id: horizontalBlurSource
+ sourceItem: horizontalBlur
+ hideSource: true
+ visible: false
+ smooth: true
+ }
+
+ deviation: rootItem.deviation
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ transparentBorder: rootItem.transparentBorder
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
+ height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
+
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+
+ source: sourceProxy.output
+ deviation: rootItem.deviation
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples / 2.0
+ transparentBorder: rootItem.transparentBorder
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Glow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Glow.qml
new file mode 100644
index 0000000000..c5a82c6f1e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Glow.qml
@@ -0,0 +1,307 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype Glow
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-glow
+ \brief Generates a blurred and colorized image of the source and places it
+ behind the original, giving impression that the source is glowing.
+
+ By default effect produces a high quality glow image, thus the rendering
+ speed of the effect may not be the highest possible. The rendering speed is
+ reduced especially if the glow edges are heavily softened. For use cases
+ that require faster rendering speed and the highest possible visual quality
+ is not necessary, property \l{Glow::fast}{fast} can be set to true.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly_black.png
+ \li \image Glow_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet Glow-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be used as source
+ for the generated glow.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ Radius defines the softness of the glow. A larger radius causes the
+ edges of the glow to appear more blurry.
+
+ Depending on the radius value, value of the \l{Glow::samples}{samples}
+ should be set to sufficiently large to ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image Glow_radius1.png
+ \li \image Glow_radius2.png
+ \li \image Glow_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 6 }
+ \li \b { radius: 12 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when edge
+ softening blur calculation is done. Larger value produces better
+ quality, but is slower to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ When \l fast property is set to true, this property has no effect.
+
+ */
+ property int samples: 0
+
+ /*!
+ This property defines how large part of the glow color is strenghtened
+ near the source edges.
+
+ The values range from 0.0 to 1.0. By default, the property is set to \c
+ 0.5.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image Glow_spread1.png
+ \li \image Glow_spread2.png
+ \li \image Glow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.5 }
+ \li \b { spread: 1.0 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \endtable
+ */
+ property real spread: 0.0
+
+ /*!
+ This property defines the RGBA color value which is used for the glow.
+
+ By default, the property is set to \c "white".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image Glow_color1.png
+ \li \image Glow_color2.png
+ \li \image Glow_color3.png
+ \row
+ \li \b { color: #ffffff }
+ \li \b { color: #00ff00 }
+ \li \b { color: #aa00ff00 }
+ \row
+ \li \l radius: 8
+ \li \l radius: 8
+ \li \l radius: 8
+ \row
+ \li \l samples: 16
+ \li \l samples: 16
+ \li \l samples: 16
+ \row
+ \li \l spread: 0.5
+ \li \l spread: 0.5
+ \li \l spread: 0.5
+ \endtable
+
+ */
+ property color color: "white"
+
+ /*!
+ This property selects the blurring algorithm that is used to produce the
+ softness for the effect. Setting this to true enables fast algorithm,
+ setting value to false produces higher quality result.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different fast values
+ \li
+ \li
+ \row
+ \li \image Glow_fast1.png
+ \li \image Glow_fast2.png
+ \row
+ \li \b { fast: false }
+ \li \b { fast: true }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l spread: 0.3
+ \li \l spread: 0.3
+ \endtable
+ */
+ property bool fast: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+ property bool transparentBorder: false
+
+ Loader {
+ anchors.fill: parent
+ sourceComponent: rootItem.fast ? fastGlow : gaussianGlow
+ }
+
+ Component {
+ id: gaussianGlow
+ GaussianGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ Component {
+ id: fastGlow
+ FastGlow {
+ anchors.fill: parent
+ source: sourceProxy.output
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ transparentBorder: rootItem.transparentBorder
+ }
+ }
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+ ShaderEffect {
+ anchors.fill: parent
+ property variant source: sourceProxy.output
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml
new file mode 100644
index 0000000000..fb1d895959
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml
@@ -0,0 +1,300 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype HueSaturation
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Alters the source item colors in the HSL color space.
+
+ HueSaturation is similar to the \l{QtGraphicalEffects1::Colorize}{Colorize}
+ effect, but the hue and saturation property values are handled differently.
+ The HueSaturation effect always shifts the hue, saturation, and lightness
+ from the original, instead of setting them.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image HueSaturation_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet HueSaturation-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source: 0
+
+ /*!
+ This property defines the hue value which is added to the source hue
+ value.
+
+ The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
+ property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different hue values
+ \li
+ \li
+ \row
+ \li \image HueSaturation_hue1.png
+ \li \image HueSaturation_hue2.png
+ \li \image HueSaturation_hue3.png
+ \row
+ \li \b { hue: -0.3 }
+ \li \b { hue: 0.0 }
+ \li \b { hue: 0.3 }
+ \row
+ \li \l saturation: 0
+ \li \l saturation: 0
+ \li \l saturation: 0
+ \row
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \endtable
+
+ */
+ property real hue: 0.0
+
+ /*!
+ This property defines the saturation value value which is added to the
+ source saturation value.
+
+ The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
+ property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different saturation values
+ \li
+ \li
+ \row
+ \li \image HueSaturation_saturation1.png
+ \li \image HueSaturation_saturation2.png
+ \li \image HueSaturation_saturation3.png
+ \row
+ \li \b { saturation: -0.8 }
+ \li \b { saturation: 0.0 }
+ \li \b { saturation: 1.0 }
+ \row
+ \li \l hue: 0
+ \li \l hue: 0
+ \li \l hue: 0
+ \row
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \li \l lightness: 0
+ \endtable
+
+ */
+ property real saturation: 0.0
+
+ /*!
+ This property defines the lightness value which is added to the source
+ saturation value.
+
+ The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
+ property is set to \c 0.0 (no change).
+
+ \table
+ \header
+ \li Output examples with different lightness values
+ \li
+ \li
+ \row
+ \li \image HueSaturation_lightness1.png
+ \li \image HueSaturation_lightness2.png
+ \li \image HueSaturation_lightness3.png
+ \row
+ \li \b { lightness: -0.5 }
+ \li \b { lightness: 0.0 }
+ \li \b { lightness: 0.5 }
+ \row
+ \li \l hue: 0
+ \li \l hue: 0
+ \li \l hue: 0
+ \row
+ \li \l saturation: 0
+ \li \l saturation: 0
+ \li \l saturation: 0
+ \endtable
+
+ */
+ property real lightness: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant hsl: Qt.vector3d(rootItem.hue, rootItem.saturation, rootItem.lightness)
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform highp sampler2D source;
+ uniform highp vec3 hsl;
+
+ highp vec3 RGBtoHSL(highp vec3 color) {
+ highp float cmin = min(color.r, min(color.g, color.b));
+ highp float cmax = max(color.r, max(color.g, color.b));
+ highp float h = 0.0;
+ highp float s = 0.0;
+ highp float l = (cmin + cmax) / 2.0;
+ highp float diff = cmax - cmin;
+
+ if (diff > 1.0 / 256.0) {
+ if (l < 0.5)
+ s = diff / (cmin + cmax);
+ else
+ s = diff / (2.0 - (cmin + cmax));
+
+ if (color.r == cmax)
+ h = (color.g - color.b) / diff;
+ else if (color.g == cmax)
+ h = 2.0 + (color.b - color.r) / diff;
+ else
+ h = 4.0 + (color.r - color.g) / diff;
+
+ h /= 6.0;
+ }
+ return vec3(h, s, l);
+ }
+
+ highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
+ h = fract(h);
+ if (h < 1.0 / 6.0)
+ return v1 + (v2 - v1) * 6.0 * h;
+ else if (h < 1.0 / 2.0)
+ return v2;
+ else if (h < 2.0 / 3.0)
+ return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
+
+ return v1;
+ }
+
+ highp vec3 HSLtoRGB(highp vec3 color) {
+ highp float h = color.x;
+ highp float l = color.z;
+ highp float s = color.y;
+
+ if (s < 1.0 / 256.0)
+ return vec3(l);
+
+ highp float v1;
+ highp float v2;
+ if (l < 0.5)
+ v2 = l * (1.0 + s);
+ else
+ v2 = (l + s) - (s * l);
+
+ v1 = 2.0 * l - v2;
+
+ highp float d = 1.0 / 3.0;
+ highp float r = hueToIntensity(v1, v2, h + d);
+ highp float g = hueToIntensity(v1, v2, h);
+ highp float b = hueToIntensity(v1, v2, h - d);
+ return vec3(r, g, b);
+ }
+
+ void main() {
+ lowp vec4 sample = texture2D(source, qt_TexCoord0);
+ sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a);
+ sample.rgb = mix(vec3(dot(sample.rgb, vec3(0.2125, 0.7154, 0.0721))), sample.rgb, 1.0 + hsl.y);
+ sample.xyz = RGBtoHSL(sample.rgb);
+ sample.rgb = HSLtoRGB(vec3(sample.x + hsl.x, sample.y, sample.z));
+ highp float c = step(0.0, hsl.z);
+ sample.rgb = mix(sample.rgb, vec3(c), abs(hsl.z));
+ gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml
new file mode 100644
index 0000000000..5eebc6fa3b
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml
@@ -0,0 +1,385 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype InnerShadow
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-drop-shadow
+ \brief Generates a colorized and blurred shadow inside the
+ source.
+
+ By default the effect produces a high quality shadow image, thus the
+ rendering speed of the shadow might not be the highest possible. The
+ rendering speed is reduced especially if the shadow edges are heavily
+ softened. For use cases that require faster rendering speed and for which
+ the highest possible visual quality is not necessary, property
+ \l{InnerShadow::fast}{fast} can be set to true.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly.png
+ \li \image InnerShadow_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet InnerShadow-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be used as the
+ source for the generated shadow.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ Radius defines the softness of the shadow. A larger radius causes the
+ edges of the shadow to appear more blurry.
+
+ Depending on the radius value, value of the
+ \l{InnerShadow::samples}{samples} should be set to sufficiently large to
+ ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_radius1.png
+ \li \image InnerShadow_radius2.png
+ \li \image InnerShadow_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 6 }
+ \li \b { radius: 12 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when edge
+ softening blur calculation is done. Larger value produces better
+ quality, but is slower to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ When \l{InnerShadow::fast}{fast} property is set to true, this property
+ has no effect.
+
+ */
+ property int samples: 0
+
+ /*!
+ This property defines how large part of the shadow color is strenghtened
+ near the source edges.
+
+ The value ranges from 0.0 to 1.0. By default, the property is set to \c
+ 0.5.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_spread1.png
+ \li \image InnerShadow_spread2.png
+ \li \image InnerShadow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.3 }
+ \li \b { spread: 0.5 }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+ */
+ property real spread: 0.0
+
+ /*!
+ This property defines the RGBA color value which is used for the shadow.
+
+ By default, the property is set to \c "black".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_color1.png
+ \li \image InnerShadow_color2.png
+ \li \image InnerShadow_color3.png
+ \row
+ \li \b { color: #000000 }
+ \li \b { color: #ffffff }
+ \li \b { color: #ff0000 }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \endtable
+ */
+ property color color: "black"
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::InnerShadow::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::InnerShadow::verticalOffset
+
+ HorizontalOffset and verticalOffset properties define the offset for the
+ rendered shadow compared to the InnerShadow item position. Often, the
+ InnerShadow item is anchored so that it fills the source element. In
+ this case, if the HorizontalOffset and verticalOffset properties are set
+ to 0, the shadow is rendered fully inside the source item. By changing
+ the offset properties, the shadow can be positioned relatively to the
+ source item.
+
+ The values range from -inf to inf. By default, the properties are set to
+ \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_horizontalOffset1.png
+ \li \image InnerShadow_horizontalOffset2.png
+ \li \image InnerShadow_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: -20 }
+ \li \b { horizontalOffset: 0 }
+ \li \b { horizontalOffset: 20 }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \endtable
+
+ */
+ property real horizontalOffset: 0
+ property real verticalOffset: 0
+
+ /*!
+ This property selects the blurring algorithm that is used to produce the
+ softness for the effect. Setting this to true enables fast algorithm,
+ setting value to false produces higher quality result.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different fast values
+ \li
+ \li
+ \row
+ \li \image InnerShadow_fast1.png
+ \li \image InnerShadow_fast2.png
+ \row
+ \li \b { fast: false }
+ \li \b { fast: true }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l color: #000000
+ \li \l color: #000000
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \endtable
+ */
+ property bool fast: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance. Every time the source or effect
+ properties are changed, the pixels in the cache must be updated. Memory
+ consumption is increased, because an extra buffer of memory is required
+ for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ Loader {
+ anchors.fill: parent
+ sourceComponent: rootItem.fast ? innerShadow : gaussianInnerShadow
+ }
+
+ Component {
+ id: gaussianInnerShadow
+ GaussianInnerShadow {
+ anchors.fill: parent
+ source: rootItem.source
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ horizontalOffset: rootItem.horizontalOffset
+ verticalOffset: rootItem.verticalOffset
+ }
+ }
+
+ Component {
+ id: innerShadow
+ FastInnerShadow {
+ anchors.fill: parent
+ source: rootItem.source
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ color: rootItem.color
+ cached: rootItem.cached
+ spread: rootItem.spread
+ horizontalOffset: rootItem.horizontalOffset
+ verticalOffset: rootItem.verticalOffset
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml
new file mode 100644
index 0000000000..5d739fb941
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml
@@ -0,0 +1,472 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Add-On Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype LevelAdjust
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-color
+ \brief Adjusts color levels in the RGBA color space.
+
+ This effect adjusts the source item colors separately for each color
+ channel. Source item contrast can be adjusted and color balance altered.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_butterfly.png
+ \li \image LevelAdjust_butterfly.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet LevelAdjust-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that provides the source pixels
+ for the effect.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the change factor for how the value of each pixel
+ color channel is altered according to the equation:
+
+ \code result.rgb = pow(original.rgb, 1.0 / gamma.rgb); \endcode
+
+ Setting the gamma values under QtVector3d(1.0, 1.0, 1.0) makes the image
+ darker, the values above QtVector3d(1.0, 1.0, 1.0) lighten it.
+
+ The value ranges from QtVector3d(0.0, 0.0, 0.0) (darkest) to inf
+ (lightest). By default, the property is set to \c QtVector3d(1.0, 1.0,
+ 1.0) (no change).
+
+ \table
+ \header
+ \li Output examples with different gamma values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_gamma1.png
+ \li \image LevelAdjust_gamma2.png
+ \li \image LevelAdjust_gamma3.png
+ \row
+ \li \b { gamma: Qt.vector3d(1.0, 1.0, 1.0) }
+ \li \b { gamma: Qt.vector3d(1.0, 0.4, 2.0) }
+ \li \b { gamma: Qt.vector3d(1.0, 0.1, 4.0) }
+ \row
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \row
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \row
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \row
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_gamma2_curve.png
+ \li \image LevelAdjust_gamma3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+ */
+ property variant gamma: Qt.vector3d(1.0, 1.0, 1.0)
+
+ /*!
+ This property defines the minimum input level for each color channel. It
+ sets the black-point, all pixels having lower value than this property
+ are rendered as black (per color channel). Increasing the value darkens
+ the dark areas.
+
+ The value ranges from "#00000000" to "#ffffffff". By default, the
+ property is set to \c "#00000000" (no change).
+
+ \table
+ \header
+ \li Output examples with different minimumInput values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_minimumInput1.png
+ \li \image LevelAdjust_minimumInput2.png
+ \li \image LevelAdjust_minimumInput3.png
+ \row
+ \li \b { minimumInput: #00000000 }
+ \li \b { minimumInput: #00000040 }
+ \li \b { minimumInput: #00000070 }
+ \row
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \row
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \row
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \row
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_minimumInput2_curve.png
+ \li \image LevelAdjust_minimumInput3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+
+ */
+ property color minimumInput: Qt.rgba(0.0, 0.0, 0.0, 0.0)
+
+ /*!
+ This property defines the maximum input level for each color channel.
+ It sets the white-point, all pixels having higher value than this
+ property are rendered as white (per color channel).
+ Decreasing the value lightens the light areas.
+
+ The value ranges from "#ffffffff" to "#00000000". By default, the
+ property is set to \c "#ffffffff" (no change).
+
+ \table
+ \header
+ \li Output examples with different maximumInput values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_maximumInput1.png
+ \li \image LevelAdjust_maximumInput2.png
+ \li \image LevelAdjust_maximumInput3.png
+ \row
+ \li \b { maximumInput: #FFFFFFFF }
+ \li \b { maximumInput: #FFFFFF80 }
+ \li \b { maximumInput: #FFFFFF30 }
+ \row
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \row
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \row
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \row
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_maximumInput2_curve.png
+ \li \image LevelAdjust_maximumInput3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+
+ */
+ property color maximumInput: Qt.rgba(1.0, 1.0, 1.0, 1.0)
+
+ /*!
+ This property defines the minimum output level for each color channel.
+ Increasing the value lightens the dark areas, reducing the contrast.
+
+ The value ranges from "#00000000" to "#ffffffff". By default, the
+ property is set to \c "#00000000" (no change).
+
+ \table
+ \header
+ \li Output examples with different minimumOutput values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_minimumOutput1.png
+ \li \image LevelAdjust_minimumOutput2.png
+ \li \image LevelAdjust_minimumOutput3.png
+ \row
+ \li \b { minimumOutput: #00000000 }
+ \li \b { minimumOutput: #00000070 }
+ \li \b { minimumOutput: #000000A0 }
+ \row
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \row
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \row
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \li \l maximumOutput: #ffffff
+ \row
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_minimumOutput2_curve.png
+ \li \image LevelAdjust_minimumOutput3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+
+ */
+ property color minimumOutput: Qt.rgba(0.0, 0.0, 0.0, 0.0)
+
+ /*!
+ This property defines the maximum output level for each color channel.
+ Decreasing the value darkens the light areas, reducing the contrast.
+
+ The value ranges from "#ffffffff" to "#00000000". By default, the
+ property is set to \c "#ffffffff" (no change).
+
+ \table
+ \header
+ \li Output examples with different maximumOutput values
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_maximumOutput1.png
+ \li \image LevelAdjust_maximumOutput2.png
+ \li \image LevelAdjust_maximumOutput3.png
+ \row
+ \li \b { maximumOutput: #FFFFFFFF }
+ \li \b { maximumOutput: #FFFFFF80 }
+ \li \b { maximumOutput: #FFFFFF30 }
+ \row
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \li \l minimumInput: #000000
+ \row
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \li \l maximumInput: #ffffff
+ \row
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \li \l minimumOutput: #000000
+ \row
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
+ \endtable
+
+ \table
+ \header
+ \li Pixel color channel luminance curves of the above images.
+ \li
+ \li
+ \row
+ \li \image LevelAdjust_default_curve.png
+ \li \image LevelAdjust_maximumOutput2_curve.png
+ \li \image LevelAdjust_maximumOutput3_curve.png
+ \row
+ \li X-axis: pixel original luminance
+ \li
+ \li
+ \row
+ \li Y-axis: color channel luminance with effect applied
+ \li
+ \li
+ \endtable
+ */
+ property color maximumOutput: Qt.rgba(1.0, 1.0, 1.0, 1.0)
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant minimumInputRGB: Qt.vector3d(rootItem.minimumInput.r, rootItem.minimumInput.g, rootItem.minimumInput.b)
+ property variant maximumInputRGB: Qt.vector3d(rootItem.maximumInput.r, rootItem.maximumInput.g, rootItem.maximumInput.b)
+ property real minimumInputAlpha: rootItem.minimumInput.a
+ property real maximumInputAlpha: rootItem.maximumInput.a
+ property variant minimumOutputRGB: Qt.vector3d(rootItem.minimumOutput.r, rootItem.minimumOutput.g, rootItem.minimumOutput.b)
+ property variant maximumOutputRGB: Qt.vector3d(rootItem.maximumOutput.r, rootItem.maximumOutput.g, rootItem.maximumOutput.b)
+ property real minimumOutputAlpha: rootItem.minimumOutput.a
+ property real maximumOutputAlpha: rootItem.maximumOutput.a
+ property variant gamma: Qt.vector3d(1.0 / Math.max(rootItem.gamma.x, 0.0001), 1.0 / Math.max(rootItem.gamma.y, 0.0001), 1.0 / Math.max(rootItem.gamma.z, 0.0001))
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp vec3 minimumInputRGB;
+ uniform highp vec3 maximumInputRGB;
+ uniform highp float minimumInputAlpha;
+ uniform highp float maximumInputAlpha;
+ uniform highp vec3 minimumOutputRGB;
+ uniform highp vec3 maximumOutputRGB;
+ uniform highp float minimumOutputAlpha;
+ uniform highp float maximumOutputAlpha;
+ uniform highp vec3 gamma;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main(void) {
+ highp vec4 textureColor = texture2D(source, qt_TexCoord0.st);
+ highp vec4 color = vec4(textureColor.rgb / max(1.0/256.0, textureColor.a), textureColor.a);
+
+ color.r = linearstep(minimumInputRGB.r, maximumInputRGB.r, color.r);
+ color.g = linearstep(minimumInputRGB.g, maximumInputRGB.g, color.g);
+ color.b = linearstep(minimumInputRGB.b, maximumInputRGB.b, color.b);
+ color.a = linearstep(minimumInputAlpha, maximumInputAlpha, color.a);
+
+ color.rgb = pow(color.rgb, gamma);
+
+ color.r = minimumOutputRGB.r + color.r * (maximumOutputRGB.r - minimumOutputRGB.r);
+ color.g = minimumOutputRGB.g + color.g * (maximumOutputRGB.g - minimumOutputRGB.g);
+ color.b = minimumOutputRGB.b + color.b * (maximumOutputRGB.b - minimumOutputRGB.b);
+ color.a = minimumOutputAlpha + color.a * (maximumOutputAlpha - minimumOutputAlpha);
+
+ gl_FragColor = vec4(color.rgb * color.a, color.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml
new file mode 100644
index 0000000000..b5845ea9d8
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml
@@ -0,0 +1,346 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype LinearGradient
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-gradient
+ \brief Draws a linear gradient.
+
+ A gradient is defined by two or more colors, which are blended seamlessly.
+ The colors start from the given start point and end to the given end point.
+
+ \table
+ \header
+ \li Effect applied
+ \row
+ \li \image LinearGradient.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet LinearGradient-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the starting point where the color at gradient
+ position of 0.0 is rendered. Colors at larger position values are
+ rendered linearly towards the end point. The point is given in pixels
+ and the default value is Qt.point(0, 0). Setting the default values for
+ the start and \l{LinearGradient::end}{end} results in a full height
+ linear gradient on the y-axis.
+
+ \table
+ \header
+ \li Output examples with different start values
+ \li
+ \li
+ \row
+ \li \image LinearGradient_start1.png
+ \li \image LinearGradient_start2.png
+ \li \image LinearGradient_start3.png
+ \row
+ \li \b { start: QPoint(0, 0) }
+ \li \b { start: QPoint(150, 150) }
+ \li \b { start: QPoint(300, 0) }
+ \row
+ \li \l end: QPoint(300, 300)
+ \li \l end: QPoint(300, 300)
+ \li \l end: QPoint(300, 300)
+ \endtable
+
+ */
+ property variant start: Qt.point(0, 0)
+
+ /*!
+ This property defines the ending point where the color at gradient
+ position of 1.0 is rendered. Colors at smaller position values are
+ rendered linearly towards the start point. The point is given in pixels
+ and the default value is Qt.point(0, height). Setting the default values
+ for the \l{LinearGradient::start}{start} and end results in a full
+ height linear gradient on the y-axis.
+
+ \table
+ \header
+ \li Output examples with different end values
+ \li
+ \li
+ \row
+ \li \image LinearGradient_end1.png
+ \li \image LinearGradient_end2.png
+ \li \image LinearGradient_end3.png
+ \row
+ \li \b { end: Qt.point(300, 300) }
+ \li \b { end: Qt.point(150, 150) }
+ \li \b { end: Qt.point(300, 0) }
+ \row
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \endtable
+
+ */
+ property variant end: Qt.point(0, height)
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ /*!
+ This property defines the item that is going to be filled with gradient.
+ Source item gets rendered into an intermediate pixel buffer and the
+ alpha values from the result are used to determine the gradient's pixels
+ visibility in the display. The default value for source is undefined and
+ in that case whole effect area is filled with gradient.
+
+ \table
+ \header
+ \li Output examples with different source values
+ \li
+ \li
+ \row
+ \li \image LinearGradient_maskSource1.png
+ \li \image LinearGradient_maskSource2.png
+ \row
+ \li \b { source: undefined }
+ \li \b { source: Image { source: images/butterfly.png } }
+ \row
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \row
+ \li \l end: Qt.point(300, 300)
+ \li \l end: Qt.point(300, 300)
+ \endtable
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+
+ /*!
+ A gradient is defined by two or more colors, which are blended
+ seamlessly. The colors are specified as a set of GradientStop child
+ items, each of which defines a position on the gradient from 0.0 to 1.0
+ and a color. The position of each GradientStop is defined by the
+ position property, and the color is definded by the color property.
+
+ \table
+ \header
+ \li Output examples with different gradient values
+ \li
+ \li
+ \row
+ \li \image LinearGradient_gradient1.png
+ \li \image LinearGradient_gradient2.png
+ \li \image LinearGradient_gradient3.png
+ \row
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.000
+ color: Qt.rgba(1, 0, 0, 1) }
+ GradientStop { position: 0.167;
+ color: Qt.rgba(1, 1, 0, 1) }
+ GradientStop { position: 0.333;
+ color: Qt.rgba(0, 1, 0, 1) }
+ GradientStop { position: 0.500;
+ color: Qt.rgba(0, 1, 1, 1) }
+ GradientStop { position: 0.667;
+ color: Qt.rgba(0, 0, 1, 1) }
+ GradientStop { position: 0.833;
+ color: Qt.rgba(1, 0, 1, 1) }
+ GradientStop { position: 1.000;
+ color: Qt.rgba(1, 0, 0, 1) }
+ }
+ \endcode
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.0
+ color: "#F0F0F0"
+ }
+ GradientStop { position: 0.5
+ color: "#000000"
+ }
+ GradientStop { position: 1.0
+ color: "#F0F0F0"
+ }
+ }
+ \endcode
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.0
+ color: "#00000000"
+ }
+ GradientStop { position: 1.0
+ color: "#FF000000"
+ }
+ }
+ \endcode
+ \row
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \li \l start: Qt.point(0, 0)
+ \row
+ \li \l end: Qt.point(300, 300)
+ \li \l end: Qt.point(300, 300)
+ \li \l end: Qt.point(300, 300)
+ \endtable
+
+ */
+ property Gradient gradient: Gradient {
+ GradientStop { position: 0.0; color: "white" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: gradientSource
+ sourceItem: Rectangle {
+ width: 16
+ height: 256
+ gradient: rootItem.gradient
+ smooth: true
+ }
+ smooth: true
+ hideSource: true
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+
+ anchors.fill: parent
+
+ property variant source: gradientSource
+ property variant maskSource: maskSourceProxy.output
+ property variant startPoint: Qt.point(start.x / width, start.y / height)
+ property real dx: end.x - start.x
+ property real dy: end.y - start.y
+ property real l: 1.0 / Math.sqrt(Math.pow(dx / width, 2.0) + Math.pow(dy / height, 2.0))
+ property real angle: Math.atan2(dx, dy)
+ property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle))
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ uniform highp vec2 startPoint;
+ uniform highp float l;
+ uniform highp vec2 matrixData;
+
+ void main() {
+ highp mat2 rot = mat2(matrixData.y, -matrixData.x,
+ matrixData.x, matrixData.y);
+
+ qt_TexCoord0 = qt_MultiTexCoord0;
+
+ qt_TexCoord1 = qt_MultiTexCoord0 * l;
+ qt_TexCoord1 -= startPoint * l;
+ qt_TexCoord1 *= rot;
+
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ fragmentShader: maskSource == undefined ? noMaskShader : maskShader
+
+ onFragmentShaderChanged: lChanged()
+
+ property string maskShader: "
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D maskSource;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+
+ void main() {
+ lowp vec4 gradientColor = texture2D(source, qt_TexCoord1);
+ lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
+ gl_FragColor = gradientColor * maskAlpha * qt_Opacity;
+ }
+ "
+
+ property string noMaskShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord1;
+
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord1) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml
new file mode 100644
index 0000000000..4744d9fb98
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml
@@ -0,0 +1,282 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype MaskedBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blur
+ \brief Applies a blur effect with a varying intesity.
+
+ MaskedBlur effect softens the image by blurring it. The intensity of the
+ blur can be controlled for each pixel using maskSource so that some parts of
+ the source are blurred more than others. By default the effect produces a
+ high quality result, thus the rendering speed may not be the highest
+ possible. The rendering speed is reduced especially if the
+ \l{MaskedBlur::samples}{samples} is large. For use cases that require faster
+ rendering speed and the highest possible visual quality is not necessary,
+ property \l{MaskedBlur::fast}{fast} can be set to true.
+
+ \table
+ \header
+ \li Source
+ \li MaskSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image MaskedBlur_mask.png
+ \li \image MaskedBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet MaskedBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is controlling the final intensity
+ of the blur. The pixel alpha channel value from maskSource defines the
+ actual blur radius that is going to be used for blurring the
+ corresponding source pixel.
+
+ Opaque maskSource pixels produce blur with specified
+ \l{MaskedBlur::radius}{radius}, while transparent pixels suppress the
+ blur completely. Semitransparent maskSource pixels produce blur with a
+ radius that is interpolated according to the pixel transparency level.
+ */
+ property variant maskSource
+
+ /*!
+ This property defines the distance of the neighboring pixels which
+ affect the blurring of an individual pixel. A larger radius increases
+ the blur effect.
+
+ Depending on the radius value, value of the
+ \l{MaskedBlur::samples}{samples} should be set to sufficiently large to
+ ensure the visual quality.
+
+ The value ranges from 0.0 (no blur) to inf. By default, the property is
+ set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image MaskedBlur_radius1.png
+ \li \image MaskedBlur_radius2.png
+ \li \image MaskedBlur_radius3.png
+ \row
+ \li \b { radius: 0 }
+ \li \b { radius: 8 }
+ \li \b { radius: 16 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l transparentBorder: false
+ \li \l transparentBorder: false
+ \li \l transparentBorder: false
+ \row
+ \li \l fast: false
+ \li \l fast: false
+ \li \l fast: false
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ Ideally, this value should be twice as large as the highest required
+ radius value, for example, if the radius is animated between 0.0 and
+ 4.0, samples should be set to 8.
+
+ The value ranges from 0 to 32. By default, the property is set to \c 0.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ When \l{MaskedBlur::fast}{fast} property is set to true, this property
+ has no effect.
+ */
+ property int samples: 0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance. Every time the source or effect
+ properties are changed, the pixels in the cache must be updated. Memory
+ consumption is increased, because an extra buffer of memory is required
+ for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ /*!
+ This property selects the blurring algorithm that is used to produce the
+ blur. Setting this to true enables fast algorithm, setting value to
+ false produces higher quality result.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different fast values
+ \li
+ \li
+ \row
+ \li \image MaskedBlur_fast1.png
+ \li \image MaskedBlur_fast2.png
+ \row
+ \li \b { fast: false }
+ \li \b { fast: true }
+ \row
+ \li \l radius: 16
+ \li \l radius: 16
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l transparentBorder: false
+ \li \l transparentBorder: false
+ \endtable
+
+ */
+ property bool fast: false
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different transparentBorder values
+ \li
+ \li
+ \row
+ \li \image MaskedBlur_transparentBorder1.png
+ \li \image MaskedBlur_transparentBorder2.png
+ \row
+ \li \b { transparentBorder: false }
+ \li \b { transparentBorder: true }
+ \row
+ \li \l radius: 64
+ \li \l radius: 64
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l fast: true
+ \li \l fast: true
+ \endtable
+
+ */
+ property bool transparentBorder: false
+
+ Loader {
+ id: loaderItem
+ anchors.fill: parent
+ sourceComponent: rootItem.fast ? fastBlur : gaussianBlur
+ }
+
+ Component {
+ id: gaussianBlur
+ GaussianMaskedBlur {
+ anchors.fill: parent
+ source: rootItem.source
+ maskSource: rootItem.maskSource
+ radius: rootItem.radius
+ maximumRadius: rootItem.samples * 0.5
+ transparentBorder: rootItem.transparentBorder
+ cached: rootItem.cached
+ }
+ }
+
+ Component {
+ id: fastBlur
+ FastMaskedBlur {
+ anchors.fill: parent
+ source:rootItem. source
+ maskSource: rootItem.maskSource
+ blur: Math.pow(rootItem.radius / 64.0, 0.4)
+ transparentBorder: rootItem.transparentBorder
+ cached: rootItem.cached
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml
new file mode 100644
index 0000000000..3a6e25ab0d
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype OpacityMask
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-mask
+ \brief Masks the source item with another item.
+
+ \table
+ \header
+ \li Source
+ \li MaskSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image OpacityMask_mask.png
+ \li \image OpacityMask_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet OpacityMask-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be masked.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is going to be used as the mask. The
+ mask item gets rendered into an intermediate pixel buffer and the alpha
+ values from the result are used to determine the source item's pixels
+ visibility in the display.
+
+ \table
+ \header
+ \li Original
+ \li Mask
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image OpacityMask_mask.png
+ \li \image OpacityMask_bug.png
+ \endtable
+ */
+ property variant maskSource
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting maskSource to the effect's parent.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant maskSource: maskSourceProxy.output
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D maskSource;
+ void main(void) {
+ gl_FragColor = texture2D(source, qt_TexCoord0.st) * (texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml
new file mode 100644
index 0000000000..26315aab5c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml
@@ -0,0 +1,312 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype RadialBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-motion-blur
+ \brief Applies directional blur in a circular direction around the items
+ center point.
+
+ Effect creates perceived impression that the source item appears to be
+ rotating to the direction of the blur.
+
+ Other available motionblur effects are
+ \l{QtGraphicalEffects1::ZoomBlur}{ZoomBlur} and
+ \l{QtGraphicalEffects1::DirectionalBlur}{DirectionalBlur}.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image RadialBlur_bug.png
+ \endtable
+
+ \section1 Example Usage
+
+ The following example shows how to apply the effect.
+ \snippet RadialBlur-example.qml example
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the direction for the blur and at the same time
+ the level of blurring. The larger the angle, the more the result becomes
+ blurred. The quality of the blur depends on
+ \l{RadialBlur::samples}{samples} property. If angle value is large, more
+ samples are needed to keep the visual quality at high level.
+
+ Allowed values are between 0.0 and 360.0. By default the property is set
+ to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different angle values
+ \li
+ \li
+ \row
+ \li \image RadialBlur_angle1.png
+ \li \image RadialBlur_angle2.png
+ \li \image RadialBlur_angle3.png
+ \row
+ \li \b { angle: 0.0 }
+ \li \b { angle: 15.0 }
+ \li \b { angle: 30.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+ */
+ property real angle: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ Allowed values are between 0 and inf (practical maximum depends on GPU).
+ By default the property is set to \c 0 (no samples).
+
+ */
+ property int samples: 0
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::RadialBlur::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::RadialBlur::verticalOffset
+
+ These properties define the offset in pixels for the perceived center
+ point of the rotation.
+
+ Allowed values are between -inf and inf.
+ By default these properties are set to \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image RadialBlur_horizontalOffset1.png
+ \li \image RadialBlur_horizontalOffset2.png
+ \li \image RadialBlur_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: 75.0 }
+ \li \b { horizontalOffset: 0.0 }
+ \li \b { horizontalOffset: -75.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l angle: 20
+ \li \l angle: 20
+ \li \l angle: 20
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: shaderItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant center: Qt.point(0.5 + rootItem.horizontalOffset / parent.width, 0.5 + rootItem.verticalOffset / parent.height)
+ property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1
+ property int samples: rootItem.samples
+ property real weight: 1.0 / Math.max(1.0, rootItem.samples)
+ property real angleSin: Math.sin(rootItem.angle/2 * Math.PI/180)
+ property real angleCos: Math.cos(rootItem.angle/2 * Math.PI/180)
+ property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
+ property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
+ property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0)
+ property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
+ property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height)
+ property real w: parent.width
+ property real h: parent.height
+
+ x: transparentBorder ? -expandPixels.width - 1 : 0
+ y: transparentBorder ? -expandPixels.height - 1 : 0
+ width: transparentBorder ? parent.width + expandPixels.width * 2.0 + 2 : parent.width
+ height: transparentBorder ? parent.height + expandPixels.height * 2.0 + 2 : parent.height
+
+ property string fragmentShaderSkeleton: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float angleSin;
+ uniform highp float angleCos;
+ uniform highp float angleSinStep;
+ uniform highp float angleCosStep;
+ uniform highp float weight;
+ uniform highp vec2 expand;
+ uniform highp vec2 center;
+ uniform highp vec2 delta;
+ uniform highp float w;
+ uniform highp float h;
+
+ void main(void) {
+ highp mat2 m;
+ gl_FragColor = vec4(0.0);
+ mediump vec2 texCoord = qt_TexCoord0;
+
+ PLACEHOLDER_EXPAND_STEPS
+
+ highp vec2 dir = vec2(texCoord.s * w - w * center.x, texCoord.t * h - h * center.y);
+ m[0] = vec2(angleCos, -angleSin);
+ m[1] = vec2(angleSin, angleCos);
+ dir *= m;
+
+ m[0] = vec2(angleCosStep, -angleSinStep);
+ m[1] = vec2(angleSinStep, angleCosStep);
+
+ PLACEHOLDER_UNROLLED_LOOP
+
+ gl_FragColor *= weight * qt_Opacity;
+ }
+ "
+
+ function buildFragmentShader() {
+ var shader = fragmentShaderSkeleton
+ var expandSteps = ""
+
+ if (transparentBorder) {
+ expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
+ }
+
+ var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
+
+ if (rootItem.samples > 1) {
+ unrolledLoop = ""
+ for (var i = 0; i < rootItem.samples; i++)
+ unrolledLoop += "gl_FragColor += texture2D(source, center + dir * delta); dir *= m;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
+ fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
+ }
+
+ onFragmentShaderChanged: sourceChanged()
+ onSamplesChanged: buildFragmentShader()
+ onTransparentBorderChanged: buildFragmentShader()
+ Component.onCompleted: buildFragmentShader()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml
new file mode 100644
index 0000000000..66c2cd6e1e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml
@@ -0,0 +1,439 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype RadialGradient
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-gradient
+ \brief Draws a radial gradient.
+
+ A gradient is defined by two or more colors, which are blended seamlessly.
+ The colors start from the middle of the item and end at the borders.
+
+ \table
+ \header
+ \li Effect applied
+ \row
+ \li \image RadialGradient.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet RadialGradient-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ /*!
+ The HorizontalOffset and verticalOffset properties define the offset in
+ pixels for the center point of the gradient compared to the item center.
+
+ The values range from -inf to inf. By default, these properties are set
+ to \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_horizontalOffset1.png
+ \li \image RadialGradient_horizontalOffset2.png
+ \li \image RadialGradient_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: -150 }
+ \li \b { horizontalOffset: 0 }
+ \li \b { horizontalOffset: 150 }
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \endtable
+
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ The HorizontalRadius and verticalRadius properties define the shape and
+ size of the radial gradient. If the radiuses are equal, the shape of the
+ gradient is a circle. If the horizontal and vertical radiuses differ,
+ the shape is elliptical. The radiuses are given in pixels.
+
+ The value ranges from -inf to inf. By default, horizontalRadius is bound
+ to width and verticalRadius is bound to height.
+
+ \table
+ \header
+ \li Output examples with different horizontalRadius values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_horizontalRadius1.png
+ \li \image RadialGradient_horizontalRadius2.png
+ \row
+ \li \b { horizontalRadius: 300 }
+ \li \b { horizontalRadius: 100 }
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \row
+ \li \l gradient: QQuickGradient(0xa05fb10)
+ \li \l gradient: QQuickGradient(0xa05fb10)
+ \endtable
+
+ */
+ property real horizontalRadius: width
+ property real verticalRadius: height
+
+ /*!
+ This property defines the rotation of the gradient around its center
+ point. The rotation is only visible when the
+ \l{RadialGradient::horizontalRadius}{horizontalRadius} and
+ \l{RadialGradient::verticalRadius}{verticalRadius} properties are not
+ equal. The angle is given in degrees and the default value is \c 0.
+
+ \table
+ \header
+ \li Output examples with different angle values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_angle1.png
+ \li \image RadialGradient_angle2.png
+ \li \image RadialGradient_angle3.png
+ \row
+ \li \b { angle: 0 }
+ \li \b { angle: 45 }
+ \li \b { angle: 90 }
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l horizontalRadius: 100
+ \li \l horizontalRadius: 100
+ \li \l horizontalRadius: 100
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \endtable
+ */
+ property real angle: 0.0
+
+ /*!
+ This property defines the item that is going to be filled with gradient.
+ Source item gets rendered into an intermediate pixel buffer and the
+ alpha values from the result are used to determine the gradient's pixels
+ visibility in the display. The default value for source is undefined and
+ in that case whole effect area is filled with gradient.
+
+ \table
+ \header
+ \li Output examples with different source values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_maskSource1.png
+ \li \image RadialGradient_maskSource2.png
+ \row
+ \li \b { source: undefined }
+ \li \b { source: Image { source: images/butterfly.png } }
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \endtable
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ A gradient is defined by two or more colors, which are blended
+ seamlessly. The colors are specified as a set of GradientStop child
+ items, each of which defines a position on the gradient from 0.0 to 1.0
+ and a color. The position of each GradientStop is defined by setting the
+ position property. The color is defined by setting the color property.
+
+ \table
+ \header
+ \li Output examples with different gradient values
+ \li
+ \li
+ \row
+ \li \image RadialGradient_gradient1.png
+ \li \image RadialGradient_gradient2.png
+ \li \image RadialGradient_gradient3.png
+ \row
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.000
+ color: Qt.rgba(1, 0, 0, 1) }
+ GradientStop { position: 0.167;
+ color: Qt.rgba(1, 1, 0, 1) }
+ GradientStop { position: 0.333;
+ color: Qt.rgba(0, 1, 0, 1) }
+ GradientStop { position: 0.500;
+ color: Qt.rgba(0, 1, 1, 1) }
+ GradientStop { position: 0.667;
+ color: Qt.rgba(0, 0, 1, 1) }
+ GradientStop { position: 0.833;
+ color: Qt.rgba(1, 0, 1, 1) }
+ GradientStop { position: 1.000;
+ color: Qt.rgba(1, 0, 0, 1) }
+ }
+ \endcode
+ \li \b {gradient:} \code
+ Gradient {
+ GradientStop { position: 0.0
+ color: "#F0F0F0"
+ }
+ GradientStop { position: 0.5
+ color: "#000000"
+ }
+ GradientStop { position: 1.0
+ color: "#F0F0F0"
+ }
+ }
+ \endcode
+ \li \b {gradient:}
+ \code
+ Gradient {
+ GradientStop { position: 0.0
+ color: "#00000000"
+ }
+ GradientStop { position: 1.0
+ color: "#FF000000"
+ }
+ }
+ \endcode
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \row
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \li \l horizontalRadius: 300
+ \row
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \li \l verticalRadius: 300
+ \row
+ \li \l angle: 0
+ \li \l angle: 0
+ \li \l angle: 0
+ \endtable
+ */
+ property Gradient gradient: Gradient {
+ GradientStop { position: 0.0; color: "white" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: gradientSource
+ sourceItem: Rectangle {
+ width: 16
+ height: 256
+ gradient: rootItem.gradient
+ smooth: true
+ }
+ smooth: true
+ hideSource: true
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant gradientImage: gradientSource
+ property variant maskSource: maskSourceProxy.output
+ property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height)
+ property real horizontalRatio: rootItem.horizontalRadius > 0 ? width / (2 * rootItem.horizontalRadius) : width * 16384
+ property real verticalRatio: rootItem.verticalRadius > 0 ? height / (2 * rootItem.verticalRadius) : height * 16384
+ property real angle: -rootItem.angle / 360 * 2 * Math.PI
+ property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle))
+
+ anchors.fill: parent
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp vec2 matrixData;
+ uniform highp float horizontalRatio;
+ uniform highp float verticalRatio;
+ uniform highp vec2 center;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 centerPoint;
+
+ void main() {
+ highp vec2 ratio = vec2(horizontalRatio, verticalRatio);
+
+ // Rotation matrix
+ highp mat2 rot = mat2(matrixData.y, -matrixData.x,
+ matrixData.x, matrixData.y);
+
+ qt_TexCoord0 = qt_MultiTexCoord0;
+
+ qt_TexCoord1 = qt_MultiTexCoord0;
+ qt_TexCoord1 -= center;
+ qt_TexCoord1 *= rot;
+ qt_TexCoord1 += center;
+ qt_TexCoord1 *= ratio;
+
+ centerPoint = center * ratio;
+
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ fragmentShader: maskSource == undefined ? noMaskShader : maskShader
+
+ onFragmentShaderChanged: horizontalRatioChanged()
+
+ property string maskShader: "
+ uniform lowp sampler2D gradientImage;
+ uniform lowp sampler2D maskSource;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 centerPoint;
+
+ void main() {
+ lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
+ lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a;
+ gl_FragColor = gradientColor * maskAlpha * qt_Opacity;
+ }
+ "
+
+ property string noMaskShader: "
+ uniform lowp sampler2D gradientImage;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 centerPoint;
+
+ void main() {
+ lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint)));
+ gl_FragColor = gradientColor * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml
new file mode 100644
index 0000000000..df0d52ff72
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml
@@ -0,0 +1,288 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype RectangularGlow
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-glow
+ \brief Generates a blurred and colorized rectangle, which gives
+ the impression that the source is glowing.
+
+ This effect is intended to have good performance. The shape of the glow is
+ limited to a rectangle with a custom corner radius. For situations where
+ custom shapes are required, consider \l {QtGraphicalEffects1::Glow} {Glow}
+ effect.
+
+ \table
+ \header
+ \li Effect applied
+ \row
+ \li \image RectangularGlow_applied.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet RectangularGlow-example.qml example
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines how many pixels outside the item area are reached
+ by the glow.
+
+ The value ranges from 0.0 (no glow) to inf (infinite glow). By default,
+ the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different glowRadius values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_glowRadius1.png
+ \li \image RectangularGlow_glowRadius2.png
+ \li \image RectangularGlow_glowRadius3.png
+ \row
+ \li \b { glowRadius: 10 }
+ \li \b { glowRadius: 20 }
+ \li \b { glowRadius: 40 }
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+
+ */
+ property real glowRadius: 0.0
+
+ /*!
+ This property defines how large part of the glow color is strenghtened
+ near the source edges.
+
+ The value ranges from 0.0 (no strenght increase) to 1.0 (maximum
+ strenght increase). By default, the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_spread1.png
+ \li \image RectangularGlow_spread2.png
+ \li \image RectangularGlow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.5 }
+ \li \b { spread: 1.0 }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+ */
+ property real spread: 0.0
+
+ /*!
+ This property defines the RGBA color value which is used for the glow.
+
+ By default, the property is set to \c "white".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_color1.png
+ \li \image RectangularGlow_color2.png
+ \li \image RectangularGlow_color3.png
+ \row
+ \li \b { color: #ffffff }
+ \li \b { color: #55ff55 }
+ \li \b { color: #5555ff }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+ */
+ property color color: "white"
+
+ /*!
+ This property defines the corner radius that is used to draw a glow with
+ rounded corners.
+
+ The value ranges from 0.0 to half of the effective width or height of
+ the glow, whichever is smaller. This can be calculated with: \c{
+ min(width, height) / 2.0 + glowRadius}
+
+ By default, the property is bound to glowRadius property. The glow
+ behaves as if the rectangle was blurred when adjusting the glowRadius
+ property.
+
+ \table
+ \header
+ \li Output examples with different cornerRadius values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_cornerRadius1.png
+ \li \image RectangularGlow_cornerRadius2.png
+ \li \image RectangularGlow_cornerRadius3.png
+ \row
+ \li \b { cornerRadius: 0 }
+ \li \b { cornerRadius: 25 }
+ \li \b { cornerRadius: 50 }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \endtable
+ */
+ property real cornerRadius: glowRadius
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+
+ x: (parent.width - width) / 2.0
+ y: (parent.height - height) / 2.0
+ width: parent.width + rootItem.glowRadius * 2 + cornerRadius * 2
+ height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2
+
+ function clampedCornerRadius() {
+ var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius;
+ return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius))
+ }
+
+ property color color: rootItem.color
+ property real inverseSpread: 1.0 - rootItem.spread
+ property real relativeSizeX: ((inverseSpread * inverseSpread) * rootItem.glowRadius + cornerRadius * 2.0) / width
+ property real relativeSizeY: relativeSizeX * (width / height)
+ property real spread: rootItem.spread / 2.0
+ property real cornerRadius: clampedCornerRadius()
+
+ fragmentShader: "
+ uniform highp float qt_Opacity;
+ uniform mediump float relativeSizeX;
+ uniform mediump float relativeSizeY;
+ uniform mediump float spread;
+ uniform lowp vec4 color;
+ varying highp vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp float alpha =
+ smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
+ smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
+
+ highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
+ gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml
new file mode 100644
index 0000000000..fa59281291
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml
@@ -0,0 +1,350 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype RecursiveBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-blur
+ \brief Blurs repeatedly, providing a strong blur effect.
+
+ The RecursiveBlur effect softens the image by blurring it with an algorithm
+ that uses a recursive feedback loop to blur the source multiple times. The
+ effect may give more blurry results than
+ \l{QtGraphicalEffects1::GaussianBlur}{GaussianBlur} or
+ \l{QtGraphicalEffects1::FastBlur}{FastBlur}, but the result is produced
+ asynchronously and takes more time.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image RecursiveBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet RecursiveBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the distance of neighboring pixels which influence
+ the blurring of individual pixels. A larger radius provides better
+ quality, but is slower to render.
+
+ \b Note: The radius value in this effect is not intended to be changed
+ or animated frequently. The correct way to use it is to set the correct
+ value and keep it unchanged for the whole duration of the iterative blur
+ sequence.
+
+ The value ranges from (no blur) to 16.0 (maximum blur step). By default,
+ the property is set to \c 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different radius values
+ \li
+ \li
+ \row
+ \li \image RecursiveBlur_radius1.png
+ \li \image RecursiveBlur_radius2.png
+ \li \image RecursiveBlur_radius3.png
+ \row
+ \li \b { radius: 2.5 }
+ \li \b { radius: 4.5 }
+ \li \b { radius: 7.5 }
+ \row
+ \li \l loops: 20
+ \li \l loops: 20
+ \li \l loops: 20
+ \endtable
+
+ */
+ property real radius: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool cached: false
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ \table
+ \header
+ \li Output examples with different transparentBorder values
+ \li
+ \li
+ \row
+ \li \image RecursiveBlur_transparentBorder1.png
+ \li \image RecursiveBlur_transparentBorder2.png
+ \row
+ \li \b { transparentBorder: false }
+ \li \b { transparentBorder: true }
+ \row
+ \li \l loops: 20
+ \li \l loops: 20
+ \row
+ \li \l radius: 7.5
+ \li \l radius: 7.5
+ \endtable
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property defines the amount of blur iterations that are going to be
+ performed for the source. When the property changes, the iterative
+ blurring process starts. If the value is decreased or if the value
+ changes from zero to non-zero, a snapshot is taken from the source. The
+ snapshot is used as a starting point for the process.
+
+ The iteration loop tries to run as fast as possible. The speed might be
+ limited by the VSYNC or the time needed for one blur step, or both.
+ Sometimes it may be desirable to perform the blurring with a slower
+ pace. In that case, it may be convenient to control the property with
+ Animation which increases the value.
+
+ The value ranges from 0 to inf. By default, the property is set to \c 0.
+
+ \table
+ \header
+ \li Output examples with different loops values
+ \li
+ \li
+ \row
+ \li \image RecursiveBlur_loops1.png
+ \li \image RecursiveBlur_loops2.png
+ \li \image RecursiveBlur_loops3.png
+ \row
+ \li \b { loops: 4 }
+ \li \b { loops: 20 }
+ \li \b { loops: 70 }
+ \row
+ \li \l radius: 7.5
+ \li \l radius: 7.5
+ \li \l radius: 7.5
+ \endtable
+
+ */
+ property int loops: 0
+
+ /*!
+ This property holds the progress of asynchronous source blurring
+ process, from 0.0 (nothing blurred) to 1.0 (finished).
+ */
+ property real progress: loops > 0.0 ? Math.min(1.0, recursionTimer.counter / loops) : 0.0
+
+ onLoopsChanged: recursiveSource.scheduleUpdate()
+ onSourceChanged: recursionTimer.reset()
+ onRadiusChanged: recursionTimer.reset()
+ onTransparentBorderChanged: recursionTimer.reset()
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2, parent.height + 2) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: verticalBlur
+ smooth: true
+ visible: rootItem.cached
+ hideSource: visible
+ live: true
+ sourceItem: inputItem.visible ? inputItem : verticalBlur
+ }
+
+ Item {
+ id: recursionTimer
+ property int counter: 0
+
+ function reset() {
+ counter = 0
+ recursiveSource.scheduleUpdate()
+ }
+
+ function nextFrame() {
+ if (loops < counter)
+ recursionTimer.counter = 0
+
+ if (counter > 0)
+ recursiveSource.sourceItem = verticalBlur
+ else
+ recursiveSource.sourceItem = inputItem
+
+ if (counter < loops) {
+ recursiveSource.scheduleUpdate()
+ counter++
+ }
+ }
+ }
+
+ ShaderEffect {
+ id: inputItem
+ property variant source: sourceProxy.output
+ property real expandX: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.width : 0.0
+ property real expandY: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.height : 0.0
+
+ anchors.fill: verticalBlur
+ visible: !verticalBlur.visible
+
+ vertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float expandX;
+ uniform highp float expandY;
+ varying highp vec2 qt_TexCoord0;
+
+ void main() {
+ mediump vec2 texCoord = qt_MultiTexCoord0;
+ texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
+ texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
+ qt_TexCoord0 = texCoord;
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;
+ }
+ "
+ }
+
+ ShaderEffectSource {
+ id: recursiveSource
+ visible: false
+ smooth: true
+ hideSource: false
+ live: false
+ sourceItem: inputItem
+ recursive: true
+ onSourceItemChanged: scheduleUpdate()
+ onScheduledUpdateCompleted: recursionTimer.nextFrame()
+ }
+
+ GaussianDirectionalBlur {
+ id: verticalBlur
+ x: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0
+ y: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0
+ width: horizontalBlur.width + 2
+ height: horizontalBlur.height + 2
+
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+
+ source: ShaderEffectSource {
+ sourceItem: horizontalBlur
+ hideSource: true
+ visible: false
+ smooth: true
+ }
+
+ deviation: (radius + 1) / 2.3333
+ radius: rootItem.radius
+ maximumRadius: Math.ceil(rootItem.radius)
+ transparentBorder: false
+ visible: loops > 0
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: rootItem.transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
+ height: rootItem.transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
+
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+
+ source: recursiveSource
+ deviation: (radius + 1) / 2.3333
+ radius: rootItem.radius
+ maximumRadius: Math.ceil(rootItem.radius)
+ transparentBorder: false
+ visible: false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml
new file mode 100644
index 0000000000..e789a49293
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype ThresholdMask
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-mask
+ \brief Masks the source item with another item and applies a threshold
+ value.
+
+ The masking behavior can be controlled with the \l threshold value for the
+ mask pixels.
+
+ \table
+ \header
+ \li Source
+ \li MaskSource
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image ThresholdMask_mask.png
+ \li \image ThresholdMask_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet ThresholdMask-example.qml example
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be masked.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the item that is going to be used as the mask.
+ Mask item gets rendered into an intermediate pixel buffer and the alpha
+ values from the result are used to determine the source item's pixels
+ visibility in the display.
+
+ \table
+ \header
+ \li Original
+ \li Mask
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image ThresholdMask_mask.png
+ \li \image ThresholdMask_bug.png
+ \endtable
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting maskSource to the effect's parent.
+ */
+ property variant maskSource
+
+ /*!
+ This property defines a threshold value for the mask pixels. The mask
+ pixels that have an alpha value below this property are used to
+ completely mask away the corresponding pixels from the source item. The
+ mask pixels that have a higher alpha value are used to alphablend the
+ source item to the display.
+
+ The value ranges from 0.0 (alpha value 0) to 1.0 (alpha value 255). By
+ default, the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different threshold values
+ \li
+ \li
+ \row
+ \li \image ThresholdMask_threshold1.png
+ \li \image ThresholdMask_threshold2.png
+ \li \image ThresholdMask_threshold3.png
+ \row
+ \li \b { threshold: 0.0 }
+ \li \b { threshold: 0.5 }
+ \li \b { threshold: 0.7 }
+ \row
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \li \l spread: 0.2
+ \endtable
+ */
+ property real threshold: 0.0
+
+ /*!
+ This property defines the smoothness of the mask edges near the
+ \l{ThresholdMask::threshold}{threshold} alpha value. Setting spread to
+ 0.0 uses mask normally with the specified threshold. Setting higher
+ spread values softens the transition from the transparent mask pixels
+ towards opaque mask pixels by adding interpolated values between them.
+
+ The value ranges from 0.0 (sharp mask edge) to 1.0 (smooth mask edge).
+ By default, the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image ThresholdMask_spread1.png
+ \li \image ThresholdMask_spread2.png
+ \li \image ThresholdMask_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.2 }
+ \li \b { spread: 0.8 }
+ \row
+ \li \l threshold: 0.4
+ \li \l threshold: 0.4
+ \li \l threshold: 0.4
+ \endtable
+
+ */
+ property real spread: 0.0
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: parent
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant maskSource: maskSourceProxy.output
+ property real threshold: rootItem.threshold
+ property real spread: rootItem.spread
+
+ anchors.fill: parent
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform lowp sampler2D maskSource;
+ uniform highp float threshold;
+ uniform highp float spread;
+ void main(void) {
+ lowp vec4 colorFragment = texture2D(source, qt_TexCoord0.st);
+ lowp vec4 maskFragment = texture2D(maskSource, qt_TexCoord0.st);
+ gl_FragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml
new file mode 100644
index 0000000000..74a5940123
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml
@@ -0,0 +1,302 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "private"
+
+/*!
+ \qmltype ZoomBlur
+ \inqmlmodule QtGraphicalEffects 1.0
+ \since QtGraphicalEffects 1.0
+ \inherits QtQuick2::Item
+ \ingroup qtgraphicaleffects-motion-blur
+ \brief Applies directional blur effect towards source items center point.
+
+ Effect creates perceived impression that the source item appears to be
+ moving towards the center point in Z-direction or that the camera appears
+ to be zooming rapidly. Other available motion blur effects are
+ \l{QtGraphicalEffects1::DirectionalBlur}{DirectionalBlur}
+ and \l{QtGraphicalEffects1::RadialBlur}{RadialBlur}.
+
+ \table
+ \header
+ \li Source
+ \li Effect applied
+ \row
+ \li \image Original_bug.png
+ \li \image ZoomBlur_bug.png
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to apply the effect.
+ \snippet ZoomBlur-example.qml example
+
+*/
+Item {
+ id: rootItem
+
+ /*!
+ This property defines the source item that is going to be blurred.
+
+ \note It is not supported to let the effect include itself, for
+ instance by setting source to the effect's parent.
+ */
+ property variant source
+
+ /*!
+ This property defines the maximum perceived amount of movement for each
+ pixel. The amount is smaller near the center and reaches the specified
+ value at the edges.
+
+ The quality of the blur depends on \l{ZoomBlur::samples}{samples}
+ property. If length value is large, more samples are needed to keep the
+ visual quality at high level.
+
+ The value ranges from 0.0 to inf. By default the property is set to \c
+ 0.0 (no blur).
+
+ \table
+ \header
+ \li Output examples with different length values
+ \li
+ \li
+ \row
+ \li \image ZoomBlur_length1.png
+ \li \image ZoomBlur_length2.png
+ \li \image ZoomBlur_length3.png
+ \row
+ \li \b { length: 0.0 }
+ \li \b { length: 32.0 }
+ \li \b { length: 48.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \li \l horizontalOffset: 0
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+
+ */
+ property real length: 0.0
+
+ /*!
+ This property defines how many samples are taken per pixel when blur
+ calculation is done. Larger value produces better quality, but is slower
+ to render.
+
+ This property is not intended to be animated. Changing this property may
+ cause the underlying OpenGL shaders to be recompiled.
+
+ Allowed values are between 0 and inf (practical maximum depends on GPU).
+ By default the property is set to \c 0 (no samples).
+
+ */
+ property int samples: 0
+
+ /*!
+ \qmlproperty real QtGraphicalEffects1::ZoomBlur::horizontalOffset
+ \qmlproperty real QtGraphicalEffects1::ZoomBlur::verticalOffset
+
+ These properties define an offset in pixels for the blur direction
+ center point.
+
+ The values range from -inf to inf. By default these properties are set
+ to \c 0.
+
+ \table
+ \header
+ \li Output examples with different horizontalOffset values
+ \li
+ \li
+ \row
+ \li \image ZoomBlur_horizontalOffset1.png
+ \li \image ZoomBlur_horizontalOffset2.png
+ \li \image ZoomBlur_horizontalOffset3.png
+ \row
+ \li \b { horizontalOffset: 100.0 }
+ \li \b { horizontalOffset: 0.0 }
+ \li \b { horizontalOffset: -100.0 }
+ \row
+ \li \l samples: 24
+ \li \l samples: 24
+ \li \l samples: 24
+ \row
+ \li \l length: 32
+ \li \l length: 32
+ \li \l length: 32
+ \row
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \li \l verticalOffset: 0
+ \endtable
+ */
+ property real horizontalOffset: 0.0
+ property real verticalOffset: 0.0
+
+ /*!
+ This property defines the blur behavior near the edges of the item,
+ where the pixel blurring is affected by the pixels outside the source
+ edges.
+
+ If the property is set to \c true, the pixels outside the source are
+ interpreted to be transparent, which is similar to OpenGL
+ clamp-to-border extension. The blur is expanded slightly outside the
+ effect item area.
+
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the
+ item, which is similar to OpenGL clamp-to-edge behavior. The blur does
+ not expand outside the effect item area.
+
+ By default, the property is set to \c false.
+
+ */
+ property bool transparentBorder: false
+
+ /*!
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height)
+ property real len: rootItem.length
+ property bool transparentBorder: rootItem.transparentBorder
+ property real samples: rootItem.samples
+ property real weight: 1.0 / Math.max(1.0, rootItem.samples)
+ property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0)
+ property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
+ property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height)
+
+ x: transparentBorder ? -expandPixels.width - 1 : 0
+ y: transparentBorder ? -expandPixels.height - 1 : 0
+ width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width
+ height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height
+
+ property string fragmentShaderSkeleton: "
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp float len;
+ uniform highp float weight;
+ uniform highp float samples;
+ uniform highp vec2 center;
+ uniform highp vec2 expand;
+ uniform highp vec2 delta;
+
+ void main(void) {
+ mediump vec2 texCoord = qt_TexCoord0;
+ mediump vec2 centerCoord = center;
+
+ PLACEHOLDER_EXPAND_STEPS
+
+ highp vec2 dir = vec2(centerCoord.x - texCoord.s, centerCoord.y - texCoord.t);
+ dir /= max(1.0, length(dir) * 2.0);
+ highp vec2 shift = delta * len * dir * 2.0 / max(1.0, samples - 1.0);
+ gl_FragColor = vec4(0.0);
+
+ PLACEHOLDER_UNROLLED_LOOP
+
+ gl_FragColor *= weight * qt_Opacity;
+ }
+ "
+
+ function buildFragmentShader() {
+ var shader = fragmentShaderSkeleton
+ var expandSteps = ""
+
+ if (transparentBorder) {
+ expandSteps += "centerCoord = (centerCoord - expand) / (1.0 - 2.0 * expand);"
+ expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
+ }
+
+ var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n"
+
+ if (rootItem.samples > 1) {
+ unrolledLoop = ""
+ for (var i = 0; i < rootItem.samples; i++)
+ unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
+ fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop)
+ }
+
+ onFragmentShaderChanged: sourceChanged()
+ onSamplesChanged: buildFragmentShader()
+ onTransparentBorderChanged: buildFragmentShader()
+ Component.onCompleted: buildFragmentShader()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml
new file mode 100644
index 0000000000..f4bd2c7421
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml
@@ -0,0 +1,393 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real spread: 0.0
+ property real blur: 0.0
+ property color color: "white"
+ property bool transparentBorder: false
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0)
+ smooth: true
+ visible: false
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ Item {
+ id: dummysource
+ width: 1
+ height: 1
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: dummy
+ width: 1
+ height: 1
+ sourceItem: dummysource
+ visible: false
+ smooth: false
+ live: false
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ x: transparentBorder ? -64 : 0
+ y: transparentBorder ? -64 : 0
+ width: transparentBorder ? parent.width + 128 : parent.width
+ height: transparentBorder ? parent.height + 128 : parent.height
+
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: rootItem.blur
+
+ property real weight1;
+ property real weight2;
+ property real weight3;
+ property real weight4;
+ property real weight5;
+ property real weight6;
+
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property alias color: rootItem.color
+
+ function weight(v) {
+ if (v <= 0.0)
+ return 1
+ if (v >= 0.5)
+ return 0
+
+ return 1.0 - v / 0.5
+ }
+
+ function calculateWeights() {
+
+ var w1 = weight(Math.abs(lod - 0.100))
+ var w2 = weight(Math.abs(lod - 0.300))
+ var w3 = weight(Math.abs(lod - 0.500))
+ var w4 = weight(Math.abs(lod - 0.700))
+ var w5 = weight(Math.abs(lod - 0.900))
+ var w6 = weight(Math.abs(lod - 1.100))
+
+ var sum = w1 + w2 + w3 + w4 + w5 + w6;
+ weight1 = w1 / sum;
+ weight2 = w2 / sum;
+ weight3 = w3 / sum;
+ weight4 = w4 / sum;
+ weight5 = w5 / sum;
+ weight6 = w6 / sum;
+
+ upateSources()
+ }
+
+ function upateSources() {
+ var sources = new Array();
+ var weights = new Array();
+
+ if (weight1 > 0) {
+ sources.push(level1)
+ weights.push(weight1)
+ }
+
+ if (weight2 > 0) {
+ sources.push(level2)
+ weights.push(weight2)
+ }
+
+ if (weight3 > 0) {
+ sources.push(level3)
+ weights.push(weight3)
+ }
+
+ if (weight4 > 0) {
+ sources.push(level4)
+ weights.push(weight4)
+ }
+
+ if (weight5 > 0) {
+ sources.push(level5)
+ weights.push(weight5)
+ }
+
+ if (weight6 > 0) {
+ sources.push(level6)
+ weights.push(weight6)
+ }
+
+ for (var j = sources.length; j < 6; j++) {
+ sources.push(dummy)
+ weights.push(0.0)
+ }
+
+ source1 = sources[0]
+ source2 = sources[1]
+ source3 = sources[2]
+ source4 = sources[3]
+ source5 = sources[4]
+ source6 = sources[5]
+
+ weight1 = weights[0]
+ weight2 = weights[1]
+ weight3 = weights[2]
+ weight4 = weights[3]
+ weight5 = weights[4]
+ weight6 = weights[5]
+ }
+
+ Component.onCompleted: calculateWeights()
+
+ onLodChanged: calculateWeights()
+
+ fragmentShader: "
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform mediump float weight1;
+ uniform mediump float weight2;
+ uniform mediump float weight3;
+ uniform mediump float weight4;
+ uniform mediump float weight5;
+ uniform highp vec4 color;
+ uniform highp float spread;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
+ sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a));
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml
new file mode 100644
index 0000000000..95e645a939
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml
@@ -0,0 +1,413 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real blur: 0.0
+ property real horizontalOffset: 0
+ property real verticalOffset: 0
+ property real spread: 0.0
+ property color color: "black"
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ property real horizontalOffset: rootItem.horizontalOffset / rootItem.width
+ property real verticalOffset: rootItem.verticalOffset / rootItem.width
+ property color color: rootItem.color
+
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ uniform highp sampler2D source;
+ uniform lowp vec4 color;
+ uniform highp float horizontalOffset;
+ uniform highp float verticalOffset;
+
+ void main(void) {
+ highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset);
+ lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0);
+ lowp float eb = 1.0 - ea;
+ gl_FragColor = (eb * color + ea * color * (1.0 - texture2D(source, pos).a)) * qt_Opacity;
+ }
+ "
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ smooth: true
+ visible: false
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ Item {
+ id: dummysource
+ width: 1
+ height: 1
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: dummy
+ width: 1
+ height: 1
+ sourceItem: dummysource
+ visible: false
+ smooth: false
+ live: false
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ width: parent.width
+ height: parent.height
+
+ property variant original: sourceProxy.output
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: rootItem.blur
+
+ property real weight1;
+ property real weight2;
+ property real weight3;
+ property real weight4;
+ property real weight5;
+ property real weight6;
+
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property color color: rootItem.color
+
+ function weight(v) {
+ if (v <= 0.0)
+ return 1
+ if (v >= 0.5)
+ return 0
+
+ return 1.0 - v / 0.5
+ }
+
+ function calculateWeights() {
+
+ var w1 = weight(Math.abs(lod - 0.100))
+ var w2 = weight(Math.abs(lod - 0.300))
+ var w3 = weight(Math.abs(lod - 0.500))
+ var w4 = weight(Math.abs(lod - 0.700))
+ var w5 = weight(Math.abs(lod - 0.900))
+ var w6 = weight(Math.abs(lod - 1.100))
+
+ var sum = w1 + w2 + w3 + w4 + w5 + w6;
+ weight1 = w1 / sum;
+ weight2 = w2 / sum;
+ weight3 = w3 / sum;
+ weight4 = w4 / sum;
+ weight5 = w5 / sum;
+ weight6 = w6 / sum;
+
+ upateSources()
+ }
+
+ function upateSources() {
+ var sources = new Array();
+ var weights = new Array();
+
+ if (weight1 > 0) {
+ sources.push(level1)
+ weights.push(weight1)
+ }
+
+ if (weight2 > 0) {
+ sources.push(level2)
+ weights.push(weight2)
+ }
+
+ if (weight3 > 0) {
+ sources.push(level3)
+ weights.push(weight3)
+ }
+
+ if (weight4 > 0) {
+ sources.push(level4)
+ weights.push(weight4)
+ }
+
+ if (weight5 > 0) {
+ sources.push(level5)
+ weights.push(weight5)
+ }
+
+ if (weight6 > 0) {
+ sources.push(level6)
+ weights.push(weight6)
+ }
+
+ for (var j = sources.length; j < 6; j++) {
+ sources.push(dummy)
+ weights.push(0.0)
+ }
+
+ source1 = sources[0]
+ source2 = sources[1]
+ source3 = sources[2]
+ source4 = sources[3]
+ source5 = sources[4]
+ source6 = sources[5]
+
+ weight1 = weights[0]
+ weight2 = weights[1]
+ weight3 = weights[2]
+ weight4 = weights[3]
+ weight5 = weights[4]
+ weight6 = weights[5]
+ }
+
+ Component.onCompleted: calculateWeights()
+
+ onLodChanged: calculateWeights()
+
+ fragmentShader: "
+ uniform lowp sampler2D original;
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform mediump float weight1;
+ uniform mediump float weight2;
+ uniform mediump float weight3;
+ uniform mediump float weight4;
+ uniform mediump float weight5;
+ uniform highp vec4 color;
+ uniform highp float spread;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp vec4 shadowColor = texture2D(source1, qt_TexCoord0) * weight1;
+ shadowColor += texture2D(source2, qt_TexCoord0) * weight2;
+ shadowColor += texture2D(source3, qt_TexCoord0) * weight3;
+ shadowColor += texture2D(source4, qt_TexCoord0) * weight4;
+ shadowColor += texture2D(source5, qt_TexCoord0) * weight5;
+ lowp vec4 originalColor = texture2D(original, qt_TexCoord0);
+ shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a));
+ gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml
new file mode 100644
index 0000000000..ae49a6e9bb
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml
@@ -0,0 +1,332 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property variant maskSource
+ property real blur: 0.0
+ property bool transparentBorder: false
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ smooth: rootItem.blur > 0
+ }
+
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: mask0
+ property variant source: maskSourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: masklevel1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: mask0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
+ visible: false
+ smooth: rootItem.blur > 0
+ }
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
+ visible: false
+ smooth: rootItem.blur > 0
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant mask: masklevel1
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: Math.sqrt(rootItem.blur) * 1.2 - 0.2
+ property real weight1
+ property real weight2
+ property real weight3
+ property real weight4
+ property real weight5
+ property real weight6
+
+ x: transparentBorder ? -64 : 0
+ y: transparentBorder ? -64 : 0
+ width: transparentBorder ? parent.width + 128 : parent.width
+ height: transparentBorder ? parent.height + 128 : parent.height
+
+ fragmentShader: "
+ uniform lowp sampler2D mask;
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform lowp sampler2D source6;
+ uniform lowp float lod;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ mediump float weight(mediump float v) {
+ if (v <= 0.0)
+ return 1.0;
+
+ if (v >= 0.5)
+ return 0.0;
+
+ return 1.0 - v * 2.0;
+ }
+
+ void main() {
+
+ lowp vec4 maskColor = texture2D(mask, qt_TexCoord0);
+ mediump float l = lod * maskColor.a;
+
+ mediump float w1 = weight(abs(l - 0.100));
+ mediump float w2 = weight(abs(l - 0.300));
+ mediump float w3 = weight(abs(l - 0.500));
+ mediump float w4 = weight(abs(l - 0.700));
+ mediump float w5 = weight(abs(l - 0.900));
+ mediump float w6 = weight(abs(l - 1.100));
+
+ mediump float sum = w1 + w2 + w3 + w4 + w5 + w6;
+ mediump float weight1 = w1 / sum;
+ mediump float weight2 = w2 / sum;
+ mediump float weight3 = w3 / sum;
+ mediump float weight4 = w4 / sum;
+ mediump float weight5 = w5 / sum;
+ mediump float weight6 = w6 / sum;
+
+ lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
+ sourceColor += texture2D(source6, qt_TexCoord0) * weight6;
+
+ gl_FragColor = sourceColor * qt_Opacity;
+
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml
new file mode 100644
index 0000000000..c2af1f34e3
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml
@@ -0,0 +1,287 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real deviation: (radius + 1) / 3.3333
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property real horizontalStep: 0.0
+ property real verticalStep: 0.0
+ property bool transparentBorder: false
+ property bool cached: false
+
+ property bool enableColor: false
+ property color color: "white"
+ property real spread: 0.0
+
+ property bool enableMask: false
+ property variant maskSource
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: rootItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ property variant source: sourceProxy.output
+ property real deviation: Math.max(0.1, rootItem.deviation)
+ property real radius: rootItem.radius
+ property int maxRadius: rootItem.maximumRadius
+ property bool transparentBorder: rootItem.transparentBorder
+ property real gaussianSum: 0.0
+ property real startIndex: 0.0
+ property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1)
+ property real expandX: transparentBorder && rootItem.horizontalStep > 0 ? maxRadius / width : 0.0
+ property real expandY: transparentBorder && rootItem.verticalStep > 0 ? maxRadius / height : 0.0
+ property variant gwts: []
+ property variant delta: Qt.vector3d(rootItem.horizontalStep * deltaFactor, rootItem.verticalStep * deltaFactor, startIndex);
+ property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]);
+ property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]);
+ property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]);
+ property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]);
+ property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]);
+ property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]);
+ property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]);
+ property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]);
+ property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]);
+ property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]);
+ property variant factor_30_32: Qt.vector3d(gwts[30], gwts[31], gwts[32]);
+
+ property color color: rootItem.color
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property variant maskSource: maskSourceProxy.output
+
+ anchors.fill: rootItem
+
+ function gausFunc(x){
+ //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2)));
+ return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2)))));
+ }
+
+ function updateGaussianWeights() {
+ gaussianSum = 0.0;
+ startIndex = -maxRadius + 0.5
+
+ var n = new Array(32);
+ for (var j = 0; j < 32; j++)
+ n[j] = 0;
+
+ var max = maxRadius * 2
+ var delta = (2 * radius - 1) / (max - 1);
+ for (var i = 0; i < max; i++) {
+ n[i] = gausFunc(-radius + 0.5 + i * delta);
+ gaussianSum += n[i];
+ }
+
+ gwts = n;
+ }
+
+ function buildFragmentShader() {
+
+ var shaderSteps = [
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z; texCoord += shift;"
+ ]
+
+ var shader = fragmentShaderBegin
+ var samples = maxRadius * 2
+ if (samples > 32) {
+ console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!")
+ samples = 32
+ }
+
+ for (var i = 0; i < samples; i++) {
+ shader += shaderSteps[i]
+ }
+
+ shader += fragmentShaderEnd
+
+ var colorizeSteps = ""
+ var colorizeUniforms = ""
+
+ var maskSteps = ""
+ var maskUniforms = ""
+
+ if (enableColor) {
+ colorizeSteps += "gl_FragColor = mix(vec4(0), color, clamp((gl_FragColor.a - 0.0) / (spread - 0.0), 0.0, 1.0));\n"
+ colorizeUniforms += "uniform highp vec4 color;\n"
+ colorizeUniforms += "uniform highp float spread;\n"
+ }
+
+ if (enableMask) {
+ maskSteps += "shift *= texture2D(maskSource, qt_TexCoord0).a;\n"
+ maskUniforms += "uniform sampler2D maskSource;\n"
+ }
+
+ shader = shader.replace("PLACEHOLDER_COLORIZE_STEPS", colorizeSteps)
+ shader = shader.replace("PLACEHOLDER_COLORIZE_UNIFORMS", colorizeUniforms)
+ shader = shader.replace("PLACEHOLDER_MASK_STEPS", maskSteps)
+ shader = shader.replace("PLACEHOLDER_MASK_UNIFORMS", maskUniforms)
+
+ fragmentShader = shader
+ }
+
+ onDeviationChanged: updateGaussianWeights()
+
+ onRadiusChanged: updateGaussianWeights()
+
+ onTransparentBorderChanged: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ onMaxRadiusChanged: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ Component.onCompleted: {
+ buildFragmentShader()
+ updateGaussianWeights()
+ }
+
+ property string fragmentShaderBegin: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform lowp sampler2D source;
+ uniform highp vec3 delta;
+ uniform highp vec3 factor_0_2;
+ uniform highp vec3 factor_3_5;
+ uniform highp vec3 factor_6_8;
+ uniform highp vec3 factor_9_11;
+ uniform highp vec3 factor_12_14;
+ uniform highp vec3 factor_15_17;
+ uniform highp vec3 factor_18_20;
+ uniform highp vec3 factor_21_23;
+ uniform highp vec3 factor_24_26;
+ uniform highp vec3 factor_27_29;
+ uniform highp vec3 factor_30_32;
+ uniform highp float gaussianSum;
+ uniform highp float expandX;
+ uniform highp float expandY;
+ PLACEHOLDER_MASK_UNIFORMS
+ PLACEHOLDER_COLORIZE_UNIFORMS
+
+ void main() {
+ highp vec2 shift = vec2(delta.x, delta.y);
+
+ PLACEHOLDER_MASK_STEPS
+
+ highp float index = delta.z;
+ mediump vec2 texCoord = qt_TexCoord0;
+ texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
+ texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
+ texCoord += (shift * index);
+
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+ "
+
+ property string fragmentShaderEnd: "
+
+ gl_FragColor /= gaussianSum;
+
+ PLACEHOLDER_COLORIZE_STEPS
+
+ gl_FragColor *= qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml
new file mode 100644
index 0000000000..c7458561a5
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property real spread: 0.0
+ property color color: "white"
+ property bool cached: false
+ property bool transparentBorder: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ GaussianDirectionalBlur {
+ id: shaderItem
+ x: transparentBorder ? -maximumRadius - 1 : 0
+ y: transparentBorder ? -maximumRadius - 1 : 0
+ width: horizontalBlur.width
+ height: horizontalBlur.height
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+ source: horizontalBlur
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ transparentBorder: rootItem.transparentBorder
+ enableColor: true
+ color: rootItem.color
+ spread: rootItem.spread
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
+ height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+ source: sourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ transparentBorder: rootItem.transparentBorder
+ visible: false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml
new file mode 100644
index 0000000000..7621c6b05a
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property real horizontalOffset: 0
+ property real verticalOffset: 0
+ property real spread: 0
+ property color color: "black"
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect{
+ id: shadowItem
+ anchors.fill: parent
+
+ property variant original: sourceProxy.output
+ property color color: rootItem.color
+ property real horizontalOffset: rootItem.horizontalOffset / rootItem.width
+ property real verticalOffset: rootItem.verticalOffset / rootItem.height
+
+ visible: false
+ fragmentShader: "
+ uniform highp sampler2D original;
+ uniform lowp float qt_Opacity;
+ uniform lowp vec4 color;
+ uniform highp float horizontalOffset;
+ uniform highp float verticalOffset;
+ varying highp vec2 qt_TexCoord0;
+
+ void main(void) {
+ highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset);
+ lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0);
+ lowp float eb = 1.0 - ea;
+ gl_FragColor = eb * color + ea * color * (1.0 - texture2D(original, pos).a) * qt_Opacity;
+ }
+ "
+ }
+
+ GaussianDirectionalBlur {
+ id: blurItem
+ anchors.fill: parent
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+ source: horizontalBlur
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ visible: false
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: transparentBorder ? parent.width + 2 * maximumRadius : parent.width
+ height: parent.height
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+ source: shadowItem
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: blurredSource
+ sourceItem: blurItem
+ live: true
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ anchors.fill: parent
+
+ property variant original: sourceProxy.output
+ property variant shadow: blurredSource
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property color color: rootItem.color
+
+ fragmentShader: "
+ uniform highp sampler2D original;
+ uniform highp sampler2D shadow;
+ uniform lowp float qt_Opacity;
+ uniform highp float spread;
+ uniform lowp vec4 color;
+ varying highp vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main(void) {
+ lowp vec4 originalColor = texture2D(original, qt_TexCoord0);
+ lowp vec4 shadowColor = texture2D(shadow, qt_TexCoord0);
+ shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a));
+ gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml
new file mode 100644
index 0000000000..02009209c6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property variant maskSource
+ property real radius: 0.0
+ property int maximumRadius: 0
+ property bool cached: false
+ property bool transparentBorder: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ SourceProxy {
+ id: maskSourceProxy
+ input: rootItem.maskSource
+ sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: blur
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: blur
+ live: true
+ hideSource: visible
+ }
+
+ GaussianDirectionalBlur {
+ id: blur
+ x: transparentBorder ? -maximumRadius - 1: 0
+ y: transparentBorder ? -maximumRadius - 1: 0
+ width: horizontalBlur.width
+ height: horizontalBlur.height
+ horizontalStep: 0.0
+ verticalStep: 1.0 / parent.height
+ source: horizontalBlur
+ enableMask: true
+ maskSource: maskSourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ transparentBorder: rootItem.transparentBorder
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
+ height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
+ horizontalStep: 1.0 / parent.width
+ verticalStep: 0.0
+ source: sourceProxy.output
+ enableMask: true
+ maskSource: maskSourceProxy.output
+ radius: rootItem.radius
+ maximumRadius: rootItem.maximumRadius
+ transparentBorder: rootItem.transparentBorder
+ visible: false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml
new file mode 100644
index 0000000000..2561d70e45
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant input
+ property variant output
+ property variant sourceRect
+ visible: false
+
+ Component.onCompleted: evaluateInput()
+
+ onInputChanged: evaluateInput()
+
+ onSourceRectChanged: evaluateInput()
+
+ function evaluateInput() {
+ if (input == undefined) {
+ output = input
+ }
+ else if (sourceRect != undefined && sourceRect != Qt.rect(0, 0, 0, 0) && !isQQuickShaderEffectSource(input)) {
+ proxySource.sourceItem = input
+ output = proxySource
+ proxySource.sourceRect = sourceRect
+ }
+ else if (isQQuickItemLayerEnabled(input)) {
+ output = input
+ }
+ else if ((isQQuickImage(input) && !hasTileMode(input) && !hasChildren(input))) {
+ output = input
+ }
+ else if (isQQuickShaderEffectSource(input)) {
+ output = input
+ }
+ else {
+ proxySource.sourceItem = input
+ output = proxySource
+ proxySource.sourceRect = Qt.rect(0, 0, 0, 0)
+ }
+ }
+
+ function isQQuickItemLayerEnabled(item) {
+ if (item.hasOwnProperty("layer")) {
+ var l = item["layer"]
+ if (l.hasOwnProperty("enabled") && l["enabled"].toString() == "true")
+ return true
+ }
+ return false
+ }
+
+ function isQQuickImage(item) {
+ var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ]
+ return hasProperties(item, imageProperties)
+ }
+
+ function isQQuickShaderEffectSource(item) {
+ var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ]
+ return hasProperties(item, shaderEffectSourceProperties)
+ }
+
+ function hasProperties(item, properties) {
+ var counter = 0
+ for (var j = 0; j < properties.length; j++) {
+ if (item.hasOwnProperty(properties [j]))
+ counter++
+ }
+ return properties.length == counter
+ }
+
+ function hasChildren(item) {
+ if (item.hasOwnProperty("childrenRect")) {
+ if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)")
+ return true
+ else
+ return false
+ }
+ return false
+ }
+
+ function hasTileMode(item) {
+ if (item.hasOwnProperty("fillMode")) {
+ if (item["fillMode"].toString() != "0")
+ return true
+ else
+ return false
+ }
+ return false
+ }
+
+ ShaderEffectSource {
+ id: proxySource
+ live: rootItem.input != rootItem.output
+ hideSource: false
+ smooth: true
+ visible: false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/qmldir b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/qmldir
new file mode 100644
index 0000000000..1377291f73
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/qmldir
@@ -0,0 +1,25 @@
+Blend 1.0 Blend.qml
+BrightnessContrast 1.0 BrightnessContrast.qml
+Colorize 1.0 Colorize.qml
+ColorOverlay 1.0 ColorOverlay.qml
+ConicalGradient 1.0 ConicalGradient.qml
+Desaturate 1.0 Desaturate.qml
+DirectionalBlur 1.0 DirectionalBlur.qml
+Displace 1.0 Displace.qml
+DropShadow 1.0 DropShadow.qml
+FastBlur 1.0 FastBlur.qml
+GammaAdjust 1.0 GammaAdjust.qml
+GaussianBlur 1.0 GaussianBlur.qml
+Glow 1.0 Glow.qml
+HueSaturation 1.0 HueSaturation.qml
+InnerShadow 1.0 InnerShadow.qml
+LevelAdjust 1.0 LevelAdjust.qml
+LinearGradient 1.0 LinearGradient.qml
+MaskedBlur 1.0 MaskedBlur.qml
+OpacityMask 1.0 OpacityMask.qml
+RadialBlur 1.0 RadialBlur.qml
+RadialGradient 1.0 RadialGradient.qml
+RecursiveBlur 1.0 RecursiveBlur.qml
+RectangularGlow 1.0 RectangularGlow.qml
+ThresholdMask 1.0 ThresholdMask.qml
+ZoomBlur 1.0 ZoomBlur.qml
diff --git a/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/plugins.qmltypes
new file mode 100644
index 0000000000..cadef10370
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/plugins.qmltypes
@@ -0,0 +1,5623 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable -builtins'
+
+Module {
+ Component {
+ name: "QAbstractItemModel"
+ prototype: "QObject"
+ Enum {
+ name: "LayoutChangeHint"
+ values: {
+ "NoLayoutChangeHint": 0,
+ "VerticalSortHint": 1,
+ "HorizontalSortHint": 2
+ }
+ }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "topLeft"; type: "QModelIndex" }
+ Parameter { name: "bottomRight"; type: "QModelIndex" }
+ Parameter { name: "roles"; type: "QVector<int>" }
+ }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "topLeft"; type: "QModelIndex" }
+ Parameter { name: "bottomRight"; type: "QModelIndex" }
+ }
+ Signal {
+ name: "headerDataChanged"
+ Parameter { name: "orientation"; type: "Qt::Orientation" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "layoutChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
+ }
+ Signal {
+ name: "layoutChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ }
+ Signal { name: "layoutChanged" }
+ Signal {
+ name: "layoutAboutToBeChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
+ }
+ Signal {
+ name: "layoutAboutToBeChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ }
+ Signal { name: "layoutAboutToBeChanged" }
+ Signal {
+ name: "rowsAboutToBeInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsAboutToBeRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal { name: "modelAboutToBeReset" }
+ Signal { name: "modelReset" }
+ Signal {
+ name: "rowsAboutToBeMoved"
+ Parameter { name: "sourceParent"; type: "QModelIndex" }
+ Parameter { name: "sourceStart"; type: "int" }
+ Parameter { name: "sourceEnd"; type: "int" }
+ Parameter { name: "destinationParent"; type: "QModelIndex" }
+ Parameter { name: "destinationRow"; type: "int" }
+ }
+ Signal {
+ name: "rowsMoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ Parameter { name: "destination"; type: "QModelIndex" }
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeMoved"
+ Parameter { name: "sourceParent"; type: "QModelIndex" }
+ Parameter { name: "sourceStart"; type: "int" }
+ Parameter { name: "sourceEnd"; type: "int" }
+ Parameter { name: "destinationParent"; type: "QModelIndex" }
+ Parameter { name: "destinationColumn"; type: "int" }
+ }
+ Signal {
+ name: "columnsMoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ Parameter { name: "destination"; type: "QModelIndex" }
+ Parameter { name: "column"; type: "int" }
+ }
+ Method { name: "submit"; type: "bool" }
+ Method { name: "revert" }
+ }
+ Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" }
+ Component {
+ name: "QDoubleValidator"
+ prototype: "QValidator"
+ Enum {
+ name: "Notation"
+ values: {
+ "StandardNotation": 0,
+ "ScientificNotation": 1
+ }
+ }
+ Property { name: "bottom"; type: "double" }
+ Property { name: "top"; type: "double" }
+ Property { name: "decimals"; type: "int" }
+ Property { name: "notation"; type: "Notation" }
+ Signal {
+ name: "bottomChanged"
+ Parameter { name: "bottom"; type: "double" }
+ }
+ Signal {
+ name: "topChanged"
+ Parameter { name: "top"; type: "double" }
+ }
+ Signal {
+ name: "decimalsChanged"
+ Parameter { name: "decimals"; type: "int" }
+ }
+ Signal {
+ name: "notationChanged"
+ Parameter { name: "notation"; type: "QDoubleValidator::Notation" }
+ }
+ }
+ Component {
+ name: "QInputMethod"
+ prototype: "QObject"
+ exports: ["QtQuick/InputMethod 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Action"
+ values: {
+ "Click": 0,
+ "ContextMenu": 1
+ }
+ }
+ Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "keyboardRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "visible"; type: "bool"; isReadonly: true }
+ Property { name: "animating"; type: "bool"; isReadonly: true }
+ Property { name: "locale"; type: "QLocale"; isReadonly: true }
+ Property { name: "inputDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Signal {
+ name: "inputDirectionChanged"
+ Parameter { name: "newDirection"; type: "Qt::LayoutDirection" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method {
+ name: "update"
+ Parameter { name: "queries"; type: "Qt::InputMethodQueries" }
+ }
+ Method { name: "reset" }
+ Method { name: "commit" }
+ Method {
+ name: "invokeAction"
+ Parameter { name: "a"; type: "Action" }
+ Parameter { name: "cursorPosition"; type: "int" }
+ }
+ }
+ Component {
+ name: "QIntValidator"
+ prototype: "QValidator"
+ Property { name: "bottom"; type: "int" }
+ Property { name: "top"; type: "int" }
+ Signal {
+ name: "bottomChanged"
+ Parameter { name: "bottom"; type: "int" }
+ }
+ Signal {
+ name: "topChanged"
+ Parameter { name: "top"; type: "int" }
+ }
+ }
+ Component {
+ name: "QKeySequence"
+ exports: ["QtQuick/StandardKey 2.2"]
+ exportMetaObjectRevisions: [2]
+ Enum {
+ name: "StandardKey"
+ values: {
+ "UnknownKey": 0,
+ "HelpContents": 1,
+ "WhatsThis": 2,
+ "Open": 3,
+ "Close": 4,
+ "Save": 5,
+ "New": 6,
+ "Delete": 7,
+ "Cut": 8,
+ "Copy": 9,
+ "Paste": 10,
+ "Undo": 11,
+ "Redo": 12,
+ "Back": 13,
+ "Forward": 14,
+ "Refresh": 15,
+ "ZoomIn": 16,
+ "ZoomOut": 17,
+ "Print": 18,
+ "AddTab": 19,
+ "NextChild": 20,
+ "PreviousChild": 21,
+ "Find": 22,
+ "FindNext": 23,
+ "FindPrevious": 24,
+ "Replace": 25,
+ "SelectAll": 26,
+ "Bold": 27,
+ "Italic": 28,
+ "Underline": 29,
+ "MoveToNextChar": 30,
+ "MoveToPreviousChar": 31,
+ "MoveToNextWord": 32,
+ "MoveToPreviousWord": 33,
+ "MoveToNextLine": 34,
+ "MoveToPreviousLine": 35,
+ "MoveToNextPage": 36,
+ "MoveToPreviousPage": 37,
+ "MoveToStartOfLine": 38,
+ "MoveToEndOfLine": 39,
+ "MoveToStartOfBlock": 40,
+ "MoveToEndOfBlock": 41,
+ "MoveToStartOfDocument": 42,
+ "MoveToEndOfDocument": 43,
+ "SelectNextChar": 44,
+ "SelectPreviousChar": 45,
+ "SelectNextWord": 46,
+ "SelectPreviousWord": 47,
+ "SelectNextLine": 48,
+ "SelectPreviousLine": 49,
+ "SelectNextPage": 50,
+ "SelectPreviousPage": 51,
+ "SelectStartOfLine": 52,
+ "SelectEndOfLine": 53,
+ "SelectStartOfBlock": 54,
+ "SelectEndOfBlock": 55,
+ "SelectStartOfDocument": 56,
+ "SelectEndOfDocument": 57,
+ "DeleteStartOfWord": 58,
+ "DeleteEndOfWord": 59,
+ "DeleteEndOfLine": 60,
+ "InsertParagraphSeparator": 61,
+ "InsertLineSeparator": 62,
+ "SaveAs": 63,
+ "Preferences": 64,
+ "Quit": 65,
+ "FullScreen": 66,
+ "Deselect": 67,
+ "DeleteCompleteLine": 68
+ }
+ }
+ }
+ Component {
+ name: "QObject"
+ exports: ["QtQml/QtObject 2.0", "QtQuick/QtObject 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "objectName"; type: "string" }
+ Signal {
+ name: "objectNameChanged"
+ Parameter { name: "objectName"; type: "string" }
+ }
+ Method { name: "toString" }
+ Method { name: "destroy" }
+ Method {
+ name: "destroy"
+ Parameter { name: "delay"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQmlApplication"
+ prototype: "QObject"
+ Property { name: "arguments"; type: "QStringList"; isReadonly: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "version"; type: "string" }
+ Property { name: "organization"; type: "string" }
+ Property { name: "domain"; type: "string" }
+ Signal { name: "aboutToQuit" }
+ Method {
+ name: "setName"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setVersion"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setOrganization"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setDomain"
+ Parameter { name: "arg"; type: "string" }
+ }
+ }
+ Component {
+ name: "QQmlBind"
+ prototype: "QObject"
+ exports: ["QtQml/Binding 2.0", "QtQuick/Binding 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "property"; type: "string" }
+ Property { name: "value"; type: "QVariant" }
+ Property { name: "when"; type: "bool" }
+ }
+ Component {
+ name: "QQmlComponent"
+ prototype: "QObject"
+ exports: [
+ "QML/Component 1.0",
+ "QtQml/Component 2.0",
+ "QtQuick/Component 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0, 0]
+ attachedType: "QQmlComponentAttached"
+ Enum {
+ name: "CompilationMode"
+ values: {
+ "PreferSynchronous": 0,
+ "Asynchronous": 1
+ }
+ }
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "progress"; type: "double"; isReadonly: true }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "url"; type: "QUrl"; isReadonly: true }
+ Signal {
+ name: "statusChanged"
+ Parameter { type: "QQmlComponent::Status" }
+ }
+ Signal {
+ name: "progressChanged"
+ Parameter { type: "double" }
+ }
+ Method {
+ name: "loadUrl"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "loadUrl"
+ Parameter { name: "url"; type: "QUrl" }
+ Parameter { name: "mode"; type: "CompilationMode" }
+ }
+ Method {
+ name: "setData"
+ Parameter { type: "QByteArray" }
+ Parameter { name: "baseUrl"; type: "QUrl" }
+ }
+ Method { name: "errorString"; type: "string" }
+ }
+ Component {
+ name: "QQmlComponentAttached"
+ prototype: "QObject"
+ Signal { name: "completed" }
+ Signal { name: "destruction" }
+ }
+ Component {
+ name: "QQmlConnections"
+ prototype: "QObject"
+ exports: ["QtQml/Connections 2.0", "QtQuick/Connections 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "ignoreUnknownSignals"; type: "bool" }
+ }
+ Component {
+ name: "QQmlDelegateModel"
+ defaultProperty: "delegate"
+ prototype: "QQmlInstanceModel"
+ exports: ["QtQuick/VisualDataModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlDelegateModelAttached"
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "filterOnGroup"; type: "string" }
+ Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true }
+ Property {
+ name: "persistedItems"
+ type: "QQmlDelegateModelGroup"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true }
+ Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "rootIndex"; type: "QVariant" }
+ Signal { name: "filterGroupChanged" }
+ Signal { name: "defaultGroupsChanged" }
+ Method {
+ name: "modelIndex"
+ type: "QVariant"
+ Parameter { name: "idx"; type: "int" }
+ }
+ Method { name: "parentModelIndex"; type: "QVariant" }
+ }
+ Component {
+ name: "QQmlDelegateModelAttached"
+ prototype: "QObject"
+ Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true }
+ Property { name: "groups"; type: "QStringList" }
+ Property { name: "isUnresolved"; type: "bool"; isReadonly: true }
+ Signal { name: "unresolvedChanged" }
+ }
+ Component {
+ name: "QQmlDelegateModelGroup"
+ prototype: "QObject"
+ exports: ["QtQuick/VisualDataGroup 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "includeByDefault"; type: "bool" }
+ Signal { name: "defaultIncludeChanged" }
+ Signal {
+ name: "changed"
+ Parameter { name: "removed"; type: "QQmlV4Handle" }
+ Parameter { name: "inserted"; type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "insert"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "create"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "resolve"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "remove"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "addGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "removeGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "setGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "move"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "get"
+ type: "QQmlV4Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component { name: "QQmlDelegateModelParts"; prototype: "QObject" }
+ Component {
+ name: "QQmlEasingValueType"
+ prototype: "QQmlValueType"
+ exports: ["QtQuick/Easing 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Type"
+ values: {
+ "Linear": 0,
+ "InQuad": 1,
+ "OutQuad": 2,
+ "InOutQuad": 3,
+ "OutInQuad": 4,
+ "InCubic": 5,
+ "OutCubic": 6,
+ "InOutCubic": 7,
+ "OutInCubic": 8,
+ "InQuart": 9,
+ "OutQuart": 10,
+ "InOutQuart": 11,
+ "OutInQuart": 12,
+ "InQuint": 13,
+ "OutQuint": 14,
+ "InOutQuint": 15,
+ "OutInQuint": 16,
+ "InSine": 17,
+ "OutSine": 18,
+ "InOutSine": 19,
+ "OutInSine": 20,
+ "InExpo": 21,
+ "OutExpo": 22,
+ "InOutExpo": 23,
+ "OutInExpo": 24,
+ "InCirc": 25,
+ "OutCirc": 26,
+ "InOutCirc": 27,
+ "OutInCirc": 28,
+ "InElastic": 29,
+ "OutElastic": 30,
+ "InOutElastic": 31,
+ "OutInElastic": 32,
+ "InBack": 33,
+ "OutBack": 34,
+ "InOutBack": 35,
+ "OutInBack": 36,
+ "InBounce": 37,
+ "OutBounce": 38,
+ "InOutBounce": 39,
+ "OutInBounce": 40,
+ "InCurve": 41,
+ "OutCurve": 42,
+ "SineCurve": 43,
+ "CosineCurve": 44,
+ "Bezier": 45
+ }
+ }
+ Property { name: "type"; type: "Type" }
+ Property { name: "amplitude"; type: "double" }
+ Property { name: "overshoot"; type: "double" }
+ Property { name: "period"; type: "double" }
+ Property { name: "bezierCurve"; type: "QVariantList" }
+ }
+ Component {
+ name: "QQmlInstanceModel"
+ prototype: "QObject"
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Signal {
+ name: "modelUpdated"
+ Parameter { name: "changeSet"; type: "QQmlChangeSet" }
+ Parameter { name: "reset"; type: "bool" }
+ }
+ Signal {
+ name: "createdItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "initItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "destroyingItem"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQmlInstantiator"
+ defaultProperty: "delegate"
+ prototype: "QObject"
+ exports: ["QtQml/Instantiator 2.1", "QtQuick/Instantiator 2.1"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "active"; type: "bool" }
+ Property { name: "asynchronous"; type: "bool" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "object"; type: "QObject"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "objectAdded"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "objectRemoved"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "objectAt"
+ type: "QObject*"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQmlListElement"
+ prototype: "QObject"
+ exports: ["QtQuick/ListElement 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQmlListModel"
+ prototype: "QAbstractListModel"
+ exports: ["QtQuick/ListModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "dynamicRoles"; type: "bool" }
+ Method { name: "clear" }
+ Method {
+ name: "remove"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "insert"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "get"
+ type: "QQmlV4Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "set"
+ Parameter { name: "index"; type: "int" }
+ Parameter { type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "setProperty"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "property"; type: "string" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "move"
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ Parameter { name: "count"; type: "int" }
+ }
+ Method { name: "sync" }
+ }
+ Component {
+ name: "QQmlLocale"
+ exports: ["QtQml/Locale 2.2", "QtQuick/Locale 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Enum {
+ name: "MeasurementSystem"
+ values: {
+ "MetricSystem": 0,
+ "ImperialSystem": 1,
+ "ImperialUSSystem": 1,
+ "ImperialUKSystem": 2
+ }
+ }
+ Enum {
+ name: "FormatType"
+ values: {
+ "LongFormat": 0,
+ "ShortFormat": 1,
+ "NarrowFormat": 2
+ }
+ }
+ Enum {
+ name: "CurrencySymbolFormat"
+ values: {
+ "CurrencyIsoCode": 0,
+ "CurrencySymbol": 1,
+ "CurrencyDisplayName": 2
+ }
+ }
+ Enum {
+ name: "DayOfWeek"
+ values: {
+ "Sunday": 0,
+ "Monday": 1,
+ "Tuesday": 2,
+ "Wednesday": 3,
+ "Thursday": 4,
+ "Friday": 5,
+ "Saturday": 6
+ }
+ }
+ }
+ Component {
+ name: "QQmlObjectModel"
+ defaultProperty: "children"
+ prototype: "QQmlInstanceModel"
+ exports: ["QtQuick/VisualItemModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlObjectModelAttached"
+ Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQmlObjectModelAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ }
+ Component {
+ name: "QQmlTimer"
+ prototype: "QObject"
+ exports: ["QtQml/Timer 2.0", "QtQuick/Timer 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "interval"; type: "int" }
+ Property { name: "running"; type: "bool" }
+ Property { name: "repeat"; type: "bool" }
+ Property { name: "triggeredOnStart"; type: "bool" }
+ Property { name: "parent"; type: "QObject"; isReadonly: true; isPointer: true }
+ Signal { name: "triggered" }
+ Method { name: "start" }
+ Method { name: "stop" }
+ Method { name: "restart" }
+ }
+ Component { name: "QQmlValueType"; prototype: "QObject" }
+ Component {
+ name: "QQuickAbstractAnimation"
+ prototype: "QObject"
+ exports: ["QtQuick/Animation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Loops"
+ values: {
+ "Infinite": -2
+ }
+ }
+ Property { name: "running"; type: "bool" }
+ Property { name: "paused"; type: "bool" }
+ Property { name: "alwaysRunToEnd"; type: "bool" }
+ Property { name: "loops"; type: "int" }
+ Signal { name: "started" }
+ Signal { name: "stopped" }
+ Signal {
+ name: "runningChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "pausedChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "alwaysRunToEndChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "loopCountChanged"
+ Parameter { type: "int" }
+ }
+ Method { name: "restart" }
+ Method { name: "start" }
+ Method { name: "pause" }
+ Method { name: "resume" }
+ Method { name: "stop" }
+ Method { name: "complete" }
+ }
+ Component {
+ name: "QQuickAccessibleAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/Accessible 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "role"; type: "QAccessible::Role" }
+ Property { name: "name"; type: "string" }
+ Property { name: "description"; type: "string" }
+ Method { name: "valueChanged" }
+ Method { name: "cursorPositionChanged" }
+ }
+ Component {
+ name: "QQuickAnchorAnimation"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/AnchorAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "duration"; type: "int" }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Signal {
+ name: "durationChanged"
+ Parameter { type: "int" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { type: "QEasingCurve" }
+ }
+ }
+ Component {
+ name: "QQuickAnchorChanges"
+ prototype: "QQuickStateOperation"
+ exports: ["QtQuick/AnchorChanges 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickAnchorSet"
+ prototype: "QObject"
+ Property { name: "left"; type: "QQmlScriptString" }
+ Property { name: "right"; type: "QQmlScriptString" }
+ Property { name: "horizontalCenter"; type: "QQmlScriptString" }
+ Property { name: "top"; type: "QQmlScriptString" }
+ Property { name: "bottom"; type: "QQmlScriptString" }
+ Property { name: "verticalCenter"; type: "QQmlScriptString" }
+ Property { name: "baseline"; type: "QQmlScriptString" }
+ }
+ Component {
+ name: "QQuickAnchors"
+ prototype: "QObject"
+ Property { name: "left"; type: "QQuickAnchorLine" }
+ Property { name: "right"; type: "QQuickAnchorLine" }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine" }
+ Property { name: "top"; type: "QQuickAnchorLine" }
+ Property { name: "bottom"; type: "QQuickAnchorLine" }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine" }
+ Property { name: "baseline"; type: "QQuickAnchorLine" }
+ Property { name: "margins"; type: "double" }
+ Property { name: "leftMargin"; type: "double" }
+ Property { name: "rightMargin"; type: "double" }
+ Property { name: "horizontalCenterOffset"; type: "double" }
+ Property { name: "topMargin"; type: "double" }
+ Property { name: "bottomMargin"; type: "double" }
+ Property { name: "verticalCenterOffset"; type: "double" }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "fill"; type: "QQuickItem"; isPointer: true }
+ Property { name: "centerIn"; type: "QQuickItem"; isPointer: true }
+ Property { name: "alignWhenCentered"; type: "bool" }
+ Signal { name: "centerAlignedChanged" }
+ }
+ Component {
+ name: "QQuickAnimatedImage"
+ defaultProperty: "data"
+ prototype: "QQuickImage"
+ exports: ["QtQuick/AnimatedImage 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "playing"; type: "bool" }
+ Property { name: "paused"; type: "bool" }
+ Property { name: "currentFrame"; type: "int" }
+ Property { name: "frameCount"; type: "int"; isReadonly: true }
+ Property { name: "sourceSize"; type: "QSize"; isReadonly: true }
+ Signal { name: "frameChanged" }
+ }
+ Component {
+ name: "QQuickAnimatedSprite"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/AnimatedSprite 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "LoopParameters"
+ values: {
+ "Infinite": -1
+ }
+ }
+ Property { name: "running"; type: "bool" }
+ Property { name: "interpolate"; type: "bool" }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "reverse"; type: "bool" }
+ Property { name: "frameSync"; type: "bool" }
+ Property { name: "frameCount"; type: "int" }
+ Property { name: "frameHeight"; type: "int" }
+ Property { name: "frameWidth"; type: "int" }
+ Property { name: "frameX"; type: "int" }
+ Property { name: "frameY"; type: "int" }
+ Property { name: "frameRate"; type: "double" }
+ Property { name: "frameDuration"; type: "int" }
+ Property { name: "loops"; type: "int" }
+ Property { name: "paused"; type: "bool" }
+ Property { name: "currentFrame"; type: "int" }
+ Signal {
+ name: "pausedChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "runningChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "interpolateChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Signal {
+ name: "reverseChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "frameSyncChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "frameCountChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameXChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameYChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameRateChanged"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Signal {
+ name: "frameDurationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "loopsChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "currentFrameChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method { name: "start" }
+ Method { name: "stop" }
+ Method { name: "restart" }
+ Method {
+ name: "advance"
+ Parameter { name: "frames"; type: "int" }
+ }
+ Method { name: "advance" }
+ Method { name: "pause" }
+ Method { name: "resume" }
+ Method {
+ name: "setRunning"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setPaused"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setInterpolate"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Method {
+ name: "setReverse"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setFrameSync"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setFrameCount"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameRate"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Method {
+ name: "setFrameDuration"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method { name: "resetFrameRate" }
+ Method { name: "resetFrameDuration" }
+ Method {
+ name: "setLoops"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setCurrentFrame"
+ Parameter { name: "arg"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickAnimationController"
+ defaultProperty: "animation"
+ prototype: "QObject"
+ exports: ["QtQuick/AnimationController 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "progress"; type: "double" }
+ Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
+ Method { name: "reload" }
+ Method { name: "completeToBeginning" }
+ Method { name: "completeToEnd" }
+ }
+ Component {
+ name: "QQuickAnimationGroup"
+ defaultProperty: "animations"
+ prototype: "QQuickAbstractAnimation"
+ Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickAnimator"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/Animator 2.2"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Property { name: "duration"; type: "int" }
+ Property { name: "to"; type: "double" }
+ Property { name: "from"; type: "double" }
+ Signal {
+ name: "targetItemChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "durationChanged"
+ Parameter { name: "duration"; type: "int" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { name: "curve"; type: "QEasingCurve" }
+ }
+ Signal {
+ name: "toChanged"
+ Parameter { name: "to"; type: "double" }
+ }
+ Signal {
+ name: "fromChanged"
+ Parameter { name: "from"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickApplication"
+ prototype: "QQmlApplication"
+ exports: ["QtQuick/Application 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "active"; type: "bool"; isReadonly: true }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true }
+ Property { name: "state"; type: "Qt::ApplicationState"; isReadonly: true }
+ Signal {
+ name: "stateChanged"
+ Parameter { name: "state"; type: "Qt::ApplicationState" }
+ }
+ }
+ Component {
+ name: "QQuickBasePositioner"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Positioner 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickPositionerAttached"
+ Property { name: "spacing"; type: "double" }
+ Property { name: "populate"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "move"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "add"; type: "QQuickTransition"; isPointer: true }
+ }
+ Component {
+ name: "QQuickBehavior"
+ defaultProperty: "animation"
+ prototype: "QObject"
+ exports: ["QtQuick/Behavior 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ }
+ Component {
+ name: "QQuickBorderImage"
+ defaultProperty: "data"
+ prototype: "QQuickImageBase"
+ exports: ["QtQuick/BorderImage 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "TileMode"
+ values: {
+ "Stretch": 0,
+ "Repeat": 1,
+ "Round": 2
+ }
+ }
+ Property { name: "border"; type: "QQuickScaleGrid"; isReadonly: true; isPointer: true }
+ Property { name: "horizontalTileMode"; type: "TileMode" }
+ Property { name: "verticalTileMode"; type: "TileMode" }
+ Property { name: "sourceSize"; type: "QSize"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickCanvasItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Canvas 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RenderTarget"
+ values: {
+ "Image": 0,
+ "FramebufferObject": 1
+ }
+ }
+ Enum {
+ name: "RenderStrategy"
+ values: {
+ "Immediate": 0,
+ "Threaded": 1,
+ "Cooperative": 2
+ }
+ }
+ Property { name: "available"; type: "bool"; isReadonly: true }
+ Property { name: "contextType"; type: "string" }
+ Property { name: "context"; type: "QQmlV4Handle"; isReadonly: true }
+ Property { name: "canvasSize"; type: "QSizeF" }
+ Property { name: "tileSize"; type: "QSize" }
+ Property { name: "canvasWindow"; type: "QRectF" }
+ Property { name: "renderTarget"; type: "RenderTarget" }
+ Property { name: "renderStrategy"; type: "RenderStrategy" }
+ Signal {
+ name: "paint"
+ Parameter { name: "region"; type: "QRect" }
+ }
+ Signal { name: "painted" }
+ Signal { name: "imageLoaded" }
+ Method {
+ name: "loadImage"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "unloadImage"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageLoaded"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageLoading"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageError"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "getContext"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "requestAnimationFrame"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "cancelRequestAnimationFrame"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "requestPaint" }
+ Method {
+ name: "markDirty"
+ Parameter { name: "dirtyRect"; type: "QRectF" }
+ }
+ Method { name: "markDirty" }
+ Method {
+ name: "save"
+ type: "bool"
+ Parameter { name: "filename"; type: "string" }
+ }
+ Method {
+ name: "toDataURL"
+ type: "string"
+ Parameter { name: "type"; type: "string" }
+ }
+ Method { name: "toDataURL"; type: "string" }
+ }
+ Component {
+ name: "QQuickColorAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["QtQuick/ColorAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "QColor" }
+ Property { name: "to"; type: "QColor" }
+ }
+ Component {
+ name: "QQuickColumn"
+ defaultProperty: "data"
+ prototype: "QQuickBasePositioner"
+ exports: ["QtQuick/Column 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickCurve"
+ prototype: "QQuickPathElement"
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "relativeX"; type: "double" }
+ Property { name: "relativeY"; type: "double" }
+ }
+ Component {
+ name: "QQuickDoubleValidator"
+ prototype: "QDoubleValidator"
+ exports: ["QtQuick/DoubleValidator 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "locale"; type: "string" }
+ Signal { name: "localeNameChanged" }
+ }
+ Component {
+ name: "QQuickDrag"
+ prototype: "QObject"
+ exports: ["QtQuick/Drag 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickDragAttached"
+ Enum {
+ name: "DragType"
+ values: {
+ "None": 0,
+ "Automatic": 1,
+ "Internal": 2
+ }
+ }
+ Enum {
+ name: "Axis"
+ values: {
+ "XAxis": 1,
+ "YAxis": 2,
+ "XAndYAxis": 3,
+ "XandYAxis": 3
+ }
+ }
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "axis"; type: "Axis" }
+ Property { name: "minimumX"; type: "double" }
+ Property { name: "maximumX"; type: "double" }
+ Property { name: "minimumY"; type: "double" }
+ Property { name: "maximumY"; type: "double" }
+ Property { name: "active"; type: "bool"; isReadonly: true }
+ Property { name: "filterChildren"; type: "bool" }
+ Property { name: "threshold"; type: "double" }
+ }
+ Component {
+ name: "QQuickDragAttached"
+ prototype: "QObject"
+ Property { name: "active"; type: "bool" }
+ Property { name: "source"; type: "QObject"; isPointer: true }
+ Property { name: "target"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "hotSpot"; type: "QPointF" }
+ Property { name: "keys"; type: "QStringList" }
+ Property { name: "mimeData"; type: "QVariantMap" }
+ Property { name: "supportedActions"; type: "Qt::DropActions" }
+ Property { name: "proposedAction"; type: "Qt::DropAction" }
+ Property { name: "dragType"; type: "QQuickDrag::DragType" }
+ Signal { name: "dragStarted" }
+ Signal {
+ name: "dragFinished"
+ Parameter { name: "dropAction"; type: "Qt::DropAction" }
+ }
+ Method {
+ name: "start"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "startDrag"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "cancel" }
+ Method { name: "drop"; type: "int" }
+ }
+ Component {
+ name: "QQuickDropArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/DropArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "containsDrag"; type: "bool"; isReadonly: true }
+ Property { name: "keys"; type: "QStringList" }
+ Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true }
+ Signal { name: "sourceChanged" }
+ Signal {
+ name: "entered"
+ Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true }
+ }
+ Signal { name: "exited" }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true }
+ }
+ Signal {
+ name: "dropped"
+ Parameter { name: "drop"; type: "QQuickDropEvent"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickDropAreaDrag"
+ prototype: "QObject"
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "source"; type: "QObject"; isReadonly: true; isPointer: true }
+ Signal { name: "positionChanged" }
+ }
+ Component {
+ name: "QQuickFlickable"
+ defaultProperty: "flickableData"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Flickable 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "BoundsBehavior"
+ values: {
+ "StopAtBounds": 0,
+ "DragOverBounds": 1,
+ "DragAndOvershootBounds": 2
+ }
+ }
+ Enum {
+ name: "FlickableDirection"
+ values: {
+ "AutoFlickDirection": 0,
+ "HorizontalFlick": 1,
+ "VerticalFlick": 2,
+ "HorizontalAndVerticalFlick": 3
+ }
+ }
+ Property { name: "contentWidth"; type: "double" }
+ Property { name: "contentHeight"; type: "double" }
+ Property { name: "contentX"; type: "double" }
+ Property { name: "contentY"; type: "double" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "topMargin"; type: "double" }
+ Property { name: "bottomMargin"; type: "double" }
+ Property { name: "originY"; type: "double"; isReadonly: true }
+ Property { name: "leftMargin"; type: "double" }
+ Property { name: "rightMargin"; type: "double" }
+ Property { name: "originX"; type: "double"; isReadonly: true }
+ Property { name: "horizontalVelocity"; type: "double"; isReadonly: true }
+ Property { name: "verticalVelocity"; type: "double"; isReadonly: true }
+ Property { name: "boundsBehavior"; type: "BoundsBehavior" }
+ Property { name: "rebound"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "maximumFlickVelocity"; type: "double" }
+ Property { name: "flickDeceleration"; type: "double" }
+ Property { name: "moving"; type: "bool"; isReadonly: true }
+ Property { name: "movingHorizontally"; type: "bool"; isReadonly: true }
+ Property { name: "movingVertically"; type: "bool"; isReadonly: true }
+ Property { name: "flicking"; type: "bool"; isReadonly: true }
+ Property { name: "flickingHorizontally"; type: "bool"; isReadonly: true }
+ Property { name: "flickingVertically"; type: "bool"; isReadonly: true }
+ Property { name: "dragging"; type: "bool"; isReadonly: true }
+ Property { name: "draggingHorizontally"; type: "bool"; isReadonly: true }
+ Property { name: "draggingVertically"; type: "bool"; isReadonly: true }
+ Property { name: "flickableDirection"; type: "FlickableDirection" }
+ Property { name: "interactive"; type: "bool" }
+ Property { name: "pressDelay"; type: "int" }
+ Property { name: "atXEnd"; type: "bool"; isReadonly: true }
+ Property { name: "atYEnd"; type: "bool"; isReadonly: true }
+ Property { name: "atXBeginning"; type: "bool"; isReadonly: true }
+ Property { name: "atYBeginning"; type: "bool"; isReadonly: true }
+ Property {
+ name: "visibleArea"
+ type: "QQuickFlickableVisibleArea"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "pixelAligned"; type: "bool" }
+ Property { name: "flickableData"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "flickableChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Signal { name: "isAtBoundaryChanged" }
+ Signal { name: "movementStarted" }
+ Signal { name: "movementEnded" }
+ Signal { name: "flickStarted" }
+ Signal { name: "flickEnded" }
+ Signal { name: "dragStarted" }
+ Signal { name: "dragEnded" }
+ Method {
+ name: "resizeContent"
+ Parameter { name: "w"; type: "double" }
+ Parameter { name: "h"; type: "double" }
+ Parameter { name: "center"; type: "QPointF" }
+ }
+ Method { name: "returnToBounds" }
+ Method {
+ name: "flick"
+ Parameter { name: "xVelocity"; type: "double" }
+ Parameter { name: "yVelocity"; type: "double" }
+ }
+ Method { name: "cancelFlick" }
+ }
+ Component {
+ name: "QQuickFlickableVisibleArea"
+ prototype: "QObject"
+ Property { name: "xPosition"; type: "double"; isReadonly: true }
+ Property { name: "yPosition"; type: "double"; isReadonly: true }
+ Property { name: "widthRatio"; type: "double"; isReadonly: true }
+ Property { name: "heightRatio"; type: "double"; isReadonly: true }
+ Signal {
+ name: "xPositionChanged"
+ Parameter { name: "xPosition"; type: "double" }
+ }
+ Signal {
+ name: "yPositionChanged"
+ Parameter { name: "yPosition"; type: "double" }
+ }
+ Signal {
+ name: "widthRatioChanged"
+ Parameter { name: "widthRatio"; type: "double" }
+ }
+ Signal {
+ name: "heightRatioChanged"
+ Parameter { name: "heightRatio"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickFlipable"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Flipable 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Side"
+ values: {
+ "Front": 0,
+ "Back": 1
+ }
+ }
+ Property { name: "front"; type: "QQuickItem"; isPointer: true }
+ Property { name: "back"; type: "QQuickItem"; isPointer: true }
+ Property { name: "side"; type: "Side"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickFlow"
+ defaultProperty: "data"
+ prototype: "QQuickBasePositioner"
+ exports: ["QtQuick/Flow 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Flow"
+ values: {
+ "LeftToRight": 0,
+ "TopToBottom": 1
+ }
+ }
+ Property { name: "flow"; type: "Flow" }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickFocusScope"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/FocusScope 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickFontLoader"
+ prototype: "QObject"
+ exports: ["QtQuick/FontLoader 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "name"; type: "string" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickFontValueType"
+ prototype: "QQmlValueType"
+ exports: ["QtQuick/Font 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "FontWeight"
+ values: {
+ "Light": 25,
+ "Normal": 50,
+ "DemiBold": 63,
+ "Bold": 75,
+ "Black": 87
+ }
+ }
+ Enum {
+ name: "Capitalization"
+ values: {
+ "MixedCase": 0,
+ "AllUppercase": 1,
+ "AllLowercase": 2,
+ "SmallCaps": 3,
+ "Capitalize": 4
+ }
+ }
+ Property { name: "family"; type: "string" }
+ Property { name: "bold"; type: "bool" }
+ Property { name: "weight"; type: "FontWeight" }
+ Property { name: "italic"; type: "bool" }
+ Property { name: "underline"; type: "bool" }
+ Property { name: "overline"; type: "bool" }
+ Property { name: "strikeout"; type: "bool" }
+ Property { name: "pointSize"; type: "double" }
+ Property { name: "pixelSize"; type: "int" }
+ Property { name: "capitalization"; type: "Capitalization" }
+ Property { name: "letterSpacing"; type: "double" }
+ Property { name: "wordSpacing"; type: "double" }
+ }
+ Component {
+ name: "QQuickGradient"
+ defaultProperty: "stops"
+ prototype: "QObject"
+ exports: ["QtQuick/Gradient 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true }
+ Signal { name: "updated" }
+ }
+ Component {
+ name: "QQuickGradientStop"
+ prototype: "QObject"
+ exports: ["QtQuick/GradientStop 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "position"; type: "double" }
+ Property { name: "color"; type: "QColor" }
+ }
+ Component {
+ name: "QQuickGrid"
+ defaultProperty: "data"
+ prototype: "QQuickBasePositioner"
+ exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Enum {
+ name: "Flow"
+ values: {
+ "LeftToRight": 0,
+ "TopToBottom": 1
+ }
+ }
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Property { name: "rows"; type: "int" }
+ Property { name: "columns"; type: "int" }
+ Property { name: "rowSpacing"; type: "double" }
+ Property { name: "columnSpacing"; type: "double" }
+ Property { name: "flow"; type: "Flow" }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" }
+ Property {
+ name: "effectiveHorizontalItemAlignment"
+ revision: 1
+ type: "HAlignment"
+ isReadonly: true
+ }
+ Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "effectiveHorizontalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ }
+ Component {
+ name: "QQuickGridMesh"
+ prototype: "QQuickShaderEffectMesh"
+ exports: ["QtQuick/GridMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "resolution"; type: "QSize" }
+ }
+ Component {
+ name: "QQuickGridView"
+ defaultProperty: "data"
+ prototype: "QQuickItemView"
+ exports: ["QtQuick/GridView 2.0", "QtQuick/GridView 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickGridViewAttached"
+ Enum {
+ name: "Flow"
+ values: {
+ "FlowLeftToRight": 0,
+ "FlowTopToBottom": 2
+ }
+ }
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapToRow": 1,
+ "SnapOneRow": 2
+ }
+ }
+ Property { name: "flow"; type: "Flow" }
+ Property { name: "cellWidth"; type: "double" }
+ Property { name: "cellHeight"; type: "double" }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Signal { name: "highlightMoveDurationChanged" }
+ Method { name: "moveCurrentIndexUp" }
+ Method { name: "moveCurrentIndexDown" }
+ Method { name: "moveCurrentIndexLeft" }
+ Method { name: "moveCurrentIndexRight" }
+ }
+ Component {
+ name: "QQuickGridViewAttached"
+ prototype: "QQuickItemViewAttached"
+ Property { name: "view"; type: "QQuickGridView"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickImage"
+ defaultProperty: "data"
+ prototype: "QQuickImageBase"
+ exports: ["QtQuick/Image 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "FillMode"
+ values: {
+ "Stretch": 0,
+ "PreserveAspectFit": 1,
+ "PreserveAspectCrop": 2,
+ "Tile": 3,
+ "TileVertically": 4,
+ "TileHorizontally": 5,
+ "Pad": 6
+ }
+ }
+ Property { name: "fillMode"; type: "FillMode" }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Signal { name: "paintedGeometryChanged" }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ }
+ Component {
+ name: "QQuickImageBase"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "progress"; type: "double"; isReadonly: true }
+ Property { name: "asynchronous"; type: "bool" }
+ Property { name: "cache"; type: "bool" }
+ Property { name: "sourceSize"; type: "QSize" }
+ Property { name: "mirror"; type: "bool" }
+ Signal {
+ name: "sourceChanged"
+ Parameter { type: "QUrl" }
+ }
+ Signal {
+ name: "statusChanged"
+ Parameter { type: "QQuickImageBase::Status" }
+ }
+ Signal {
+ name: "progressChanged"
+ Parameter { name: "progress"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickImplicitSizeItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ Property { name: "implicitWidth"; type: "double"; isReadonly: true }
+ Property { name: "implicitHeight"; type: "double"; isReadonly: true }
+ Signal { name: "implicitWidthChanged2"; revision: 1 }
+ Signal { name: "implicitHeightChanged2"; revision: 1 }
+ }
+ Component {
+ name: "QQuickIntValidator"
+ prototype: "QIntValidator"
+ exports: ["QtQuick/IntValidator 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "locale"; type: "string" }
+ Signal { name: "localeNameChanged" }
+ }
+ Component {
+ name: "QQuickItem"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["QtQuick/Item 2.0", "QtQuick/Item 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Enum {
+ name: "TransformOrigin"
+ values: {
+ "TopLeft": 0,
+ "Top": 1,
+ "TopRight": 2,
+ "Left": 3,
+ "Center": 4,
+ "Right": 5,
+ "BottomLeft": 6,
+ "Bottom": 7,
+ "BottomRight": 8
+ }
+ }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickItemLayer"
+ prototype: "QObject"
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "textureSize"; type: "QSize" }
+ Property { name: "sourceRect"; type: "QRectF" }
+ Property { name: "mipmap"; type: "bool" }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "wrapMode"; type: "QQuickShaderEffectSource::WrapMode" }
+ Property { name: "format"; type: "QQuickShaderEffectSource::Format" }
+ Property { name: "samplerName"; type: "QByteArray" }
+ Property { name: "effect"; type: "QQmlComponent"; isPointer: true }
+ Signal {
+ name: "enabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Signal {
+ name: "sizeChanged"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ Signal {
+ name: "mipmapChanged"
+ Parameter { name: "mipmap"; type: "bool" }
+ }
+ Signal {
+ name: "wrapModeChanged"
+ Parameter { name: "mode"; type: "QQuickShaderEffectSource::WrapMode" }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "name"; type: "QByteArray" }
+ }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "component"; type: "QQmlComponent"; isPointer: true }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { name: "smooth"; type: "bool" }
+ }
+ Signal {
+ name: "formatChanged"
+ Parameter { name: "format"; type: "QQuickShaderEffectSource::Format" }
+ }
+ Signal {
+ name: "sourceRectChanged"
+ Parameter { name: "sourceRect"; type: "QRectF" }
+ }
+ }
+ Component {
+ name: "QQuickItemView"
+ defaultProperty: "flickableData"
+ prototype: "QQuickFlickable"
+ exports: ["QtQuick/ItemView 2.1"]
+ exportMetaObjectRevisions: [1]
+ Enum {
+ name: "LayoutDirection"
+ values: {
+ "LeftToRight": 0,
+ "RightToLeft": 1,
+ "VerticalTopToBottom": 2,
+ "VerticalBottomToTop": 3
+ }
+ }
+ Enum {
+ name: "VerticalLayoutDirection"
+ values: {
+ "TopToBottom": 2,
+ "BottomToTop": 3
+ }
+ }
+ Enum {
+ name: "HighlightRangeMode"
+ values: {
+ "NoHighlightRange": 0,
+ "ApplyRange": 1,
+ "StrictlyEnforceRange": 2
+ }
+ }
+ Enum {
+ name: "PositionMode"
+ values: {
+ "Beginning": 0,
+ "Center": 1,
+ "End": 2,
+ "Visible": 3,
+ "Contain": 4,
+ "SnapPosition": 5
+ }
+ }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "keyNavigationWraps"; type: "bool" }
+ Property { name: "cacheBuffer"; type: "int" }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "verticalLayoutDirection"; type: "VerticalLayoutDirection" }
+ Property { name: "header"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "headerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "footer"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "footerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "populate"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "add"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "addDisplaced"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "move"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "moveDisplaced"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "remove"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "removeDisplaced"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "displaced"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "highlight"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "highlightFollowsCurrentItem"; type: "bool" }
+ Property { name: "highlightRangeMode"; type: "HighlightRangeMode" }
+ Property { name: "preferredHighlightBegin"; type: "double" }
+ Property { name: "preferredHighlightEnd"; type: "double" }
+ Property { name: "highlightMoveDuration"; type: "int" }
+ Signal { name: "populateTransitionChanged" }
+ Signal { name: "addTransitionChanged" }
+ Signal { name: "addDisplacedTransitionChanged" }
+ Signal { name: "moveTransitionChanged" }
+ Signal { name: "moveDisplacedTransitionChanged" }
+ Signal { name: "removeTransitionChanged" }
+ Signal { name: "removeDisplacedTransitionChanged" }
+ Signal { name: "displacedTransitionChanged" }
+ Method {
+ name: "positionViewAtIndex"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "mode"; type: "int" }
+ }
+ Method {
+ name: "indexAt"
+ type: "int"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method { name: "positionViewAtBeginning" }
+ Method { name: "positionViewAtEnd" }
+ Method { name: "forceLayout"; revision: 1 }
+ }
+ Component {
+ name: "QQuickItemViewAttached"
+ prototype: "QObject"
+ Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
+ Property { name: "delayRemove"; type: "bool" }
+ Property { name: "section"; type: "string"; isReadonly: true }
+ Property { name: "previousSection"; type: "string"; isReadonly: true }
+ Property { name: "nextSection"; type: "string"; isReadonly: true }
+ Signal { name: "currentItemChanged" }
+ Signal { name: "add" }
+ Signal { name: "remove" }
+ Signal { name: "prevSectionChanged" }
+ }
+ Component {
+ name: "QQuickKeyNavigationAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/KeyNavigation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Priority"
+ values: {
+ "BeforeItem": 0,
+ "AfterItem": 1
+ }
+ }
+ Property { name: "left"; type: "QQuickItem"; isPointer: true }
+ Property { name: "right"; type: "QQuickItem"; isPointer: true }
+ Property { name: "up"; type: "QQuickItem"; isPointer: true }
+ Property { name: "down"; type: "QQuickItem"; isPointer: true }
+ Property { name: "tab"; type: "QQuickItem"; isPointer: true }
+ Property { name: "backtab"; type: "QQuickItem"; isPointer: true }
+ Property { name: "priority"; type: "Priority" }
+ }
+ Component {
+ name: "QQuickKeysAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/Keys 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Priority"
+ values: {
+ "BeforeItem": 0,
+ "AfterItem": 1
+ }
+ }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "forwardTo"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "priority"; type: "Priority" }
+ Signal {
+ name: "pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit0Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit1Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit2Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit3Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit4Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit5Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit6Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit7Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit8Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit9Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "leftPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "rightPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "upPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "downPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "tabPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "backtabPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "asteriskPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "numberSignPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "escapePressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "returnPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "enterPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "deletePressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "spacePressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "backPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "cancelPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "selectPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "yesPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "noPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context1Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context2Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context3Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context4Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "callPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "hangupPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "flipPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "menuPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "volumeUpPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "volumeDownPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickLayoutMirroringAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/LayoutMirroring 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "childrenInherit"; type: "bool" }
+ }
+ Component {
+ name: "QQuickListView"
+ defaultProperty: "data"
+ prototype: "QQuickItemView"
+ exports: ["QtQuick/ListView 2.0", "QtQuick/ListView 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickListViewAttached"
+ Enum {
+ name: "Orientation"
+ values: {
+ "Horizontal": 1,
+ "Vertical": 2
+ }
+ }
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapToItem": 1,
+ "SnapOneItem": 2
+ }
+ }
+ Property { name: "highlightMoveVelocity"; type: "double" }
+ Property { name: "highlightResizeVelocity"; type: "double" }
+ Property { name: "highlightResizeDuration"; type: "int" }
+ Property { name: "spacing"; type: "double" }
+ Property { name: "orientation"; type: "Orientation" }
+ Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true }
+ Property { name: "currentSection"; type: "string"; isReadonly: true }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Method { name: "incrementCurrentIndex" }
+ Method { name: "decrementCurrentIndex" }
+ }
+ Component {
+ name: "QQuickListViewAttached"
+ prototype: "QQuickItemViewAttached"
+ Property { name: "view"; type: "QQuickListView"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickLoader"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Loader 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "active"; type: "bool" }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "sourceComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "item"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "progress"; type: "double"; isReadonly: true }
+ Property { name: "asynchronous"; type: "bool" }
+ Signal { name: "loaded" }
+ Method {
+ name: "setSource"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickMouseArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/MouseArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "mouseX"; type: "double"; isReadonly: true }
+ Property { name: "mouseY"; type: "double"; isReadonly: true }
+ Property { name: "containsMouse"; type: "bool"; isReadonly: true }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "pressedButtons"; type: "Qt::MouseButtons"; isReadonly: true }
+ Property { name: "acceptedButtons"; type: "Qt::MouseButtons" }
+ Property { name: "hoverEnabled"; type: "bool" }
+ Property { name: "drag"; type: "QQuickDrag"; isReadonly: true; isPointer: true }
+ Property { name: "preventStealing"; type: "bool" }
+ Property { name: "propagateComposedEvents"; type: "bool" }
+ Property { name: "cursorShape"; type: "Qt::CursorShape" }
+ Signal { name: "hoveredChanged" }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "mouseXChanged"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "mouseYChanged"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pressed"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pressAndHold"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "doubleClicked"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "wheel"
+ Parameter { name: "wheel"; type: "QQuickWheelEvent"; isPointer: true }
+ }
+ Signal { name: "entered" }
+ Signal { name: "exited" }
+ Signal { name: "canceled" }
+ }
+ Component {
+ name: "QQuickMouseEvent"
+ prototype: "QObject"
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "button"; type: "int"; isReadonly: true }
+ Property { name: "buttons"; type: "int"; isReadonly: true }
+ Property { name: "modifiers"; type: "int"; isReadonly: true }
+ Property { name: "wasHeld"; type: "bool"; isReadonly: true }
+ Property { name: "isClick"; type: "bool"; isReadonly: true }
+ Property { name: "accepted"; type: "bool" }
+ }
+ Component {
+ name: "QQuickMultiPointTouchArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/MultiPointTouchArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true }
+ Property { name: "minimumTouchPoints"; type: "int" }
+ Property { name: "maximumTouchPoints"; type: "int" }
+ Signal {
+ name: "pressed"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ Signal {
+ name: "updated"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ Signal {
+ name: "canceled"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ Signal {
+ name: "gestureStarted"
+ Parameter { name: "gesture"; type: "QQuickGrabGestureEvent"; isPointer: true }
+ }
+ Signal {
+ name: "touchUpdated"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ }
+ Component {
+ name: "QQuickNumberAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["QtQuick/NumberAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "double" }
+ Property { name: "to"; type: "double" }
+ }
+ Component {
+ name: "QQuickOpacityAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/OpacityAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickPackage"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["QtQuick/Package 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickPackageAttached"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPackageAttached"
+ prototype: "QObject"
+ Property { name: "name"; type: "string" }
+ }
+ Component {
+ name: "QQuickPaintedItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/PaintedItem 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RenderTarget"
+ values: {
+ "Image": 0,
+ "FramebufferObject": 1,
+ "InvertedYFramebufferObject": 2
+ }
+ }
+ Property { name: "contentsSize"; type: "QSize" }
+ Property { name: "fillColor"; type: "QColor" }
+ Property { name: "contentsScale"; type: "double" }
+ Property { name: "renderTarget"; type: "RenderTarget" }
+ }
+ Component {
+ name: "QQuickParallelAnimation"
+ defaultProperty: "animations"
+ prototype: "QQuickAnimationGroup"
+ exports: ["QtQuick/ParallelAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickParentAnimation"
+ defaultProperty: "animations"
+ prototype: "QQuickAnimationGroup"
+ exports: ["QtQuick/ParentAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "newParent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "via"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickParentChange"
+ prototype: "QQuickStateOperation"
+ exports: ["QtQuick/ParentChange 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "x"; type: "QQmlScriptString" }
+ Property { name: "y"; type: "QQmlScriptString" }
+ Property { name: "width"; type: "QQmlScriptString" }
+ Property { name: "height"; type: "QQmlScriptString" }
+ Property { name: "scale"; type: "QQmlScriptString" }
+ Property { name: "rotation"; type: "QQmlScriptString" }
+ }
+ Component {
+ name: "QQuickPath"
+ defaultProperty: "pathElements"
+ prototype: "QObject"
+ exports: ["QtQuick/Path 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true }
+ Property { name: "startX"; type: "double" }
+ Property { name: "startY"; type: "double" }
+ Property { name: "closed"; type: "bool"; isReadonly: true }
+ Signal { name: "changed" }
+ }
+ Component {
+ name: "QQuickPathAnimation"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/PathAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Orientation"
+ values: {
+ "Fixed": 0,
+ "RightFirst": 1,
+ "LeftFirst": 2,
+ "BottomFirst": 3,
+ "TopFirst": 4
+ }
+ }
+ Property { name: "duration"; type: "int" }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Property { name: "path"; type: "QQuickPath"; isPointer: true }
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "orientation"; type: "Orientation" }
+ Property { name: "anchorPoint"; type: "QPointF" }
+ Property { name: "orientationEntryDuration"; type: "int" }
+ Property { name: "orientationExitDuration"; type: "int" }
+ Property { name: "endRotation"; type: "double" }
+ Signal {
+ name: "durationChanged"
+ Parameter { type: "int" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { type: "QEasingCurve" }
+ }
+ Signal {
+ name: "orientationChanged"
+ Parameter { type: "Orientation" }
+ }
+ Signal {
+ name: "anchorPointChanged"
+ Parameter { type: "QPointF" }
+ }
+ Signal {
+ name: "orientationEntryDurationChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "orientationExitDurationChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "endRotationChanged"
+ Parameter { type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickPathArc"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathArc 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "ArcDirection"
+ values: {
+ "Clockwise": 0,
+ "Counterclockwise": 1
+ }
+ }
+ Property { name: "radiusX"; type: "double" }
+ Property { name: "radiusY"; type: "double" }
+ Property { name: "useLargeArc"; type: "bool" }
+ Property { name: "direction"; type: "ArcDirection" }
+ }
+ Component {
+ name: "QQuickPathAttribute"
+ prototype: "QQuickPathElement"
+ exports: ["QtQuick/PathAttribute 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "name"; type: "string" }
+ Property { name: "value"; type: "double" }
+ }
+ Component {
+ name: "QQuickPathCatmullRomCurve"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathCurve 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickPathCubic"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathCubic 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "control1X"; type: "double" }
+ Property { name: "control1Y"; type: "double" }
+ Property { name: "control2X"; type: "double" }
+ Property { name: "control2Y"; type: "double" }
+ Property { name: "relativeControl1X"; type: "double" }
+ Property { name: "relativeControl1Y"; type: "double" }
+ Property { name: "relativeControl2X"; type: "double" }
+ Property { name: "relativeControl2Y"; type: "double" }
+ }
+ Component {
+ name: "QQuickPathElement"
+ prototype: "QObject"
+ Signal { name: "changed" }
+ }
+ Component {
+ name: "QQuickPathInterpolator"
+ prototype: "QObject"
+ exports: ["QtQuick/PathInterpolator 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "path"; type: "QQuickPath"; isPointer: true }
+ Property { name: "progress"; type: "double" }
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "angle"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPathLine"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathLine 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickPathPercent"
+ prototype: "QQuickPathElement"
+ exports: ["QtQuick/PathPercent 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "value"; type: "double" }
+ }
+ Component {
+ name: "QQuickPathQuad"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathQuad 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "controlX"; type: "double" }
+ Property { name: "controlY"; type: "double" }
+ Property { name: "relativeControlX"; type: "double" }
+ Property { name: "relativeControlY"; type: "double" }
+ }
+ Component {
+ name: "QQuickPathSvg"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathSvg 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "path"; type: "string" }
+ }
+ Component {
+ name: "QQuickPathView"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/PathView 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickPathViewAttached"
+ Enum {
+ name: "HighlightRangeMode"
+ values: {
+ "NoHighlightRange": 0,
+ "ApplyRange": 1,
+ "StrictlyEnforceRange": 2
+ }
+ }
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapToItem": 1,
+ "SnapOneItem": 2
+ }
+ }
+ Enum {
+ name: "PositionMode"
+ values: {
+ "Beginning": 0,
+ "Center": 1,
+ "End": 2,
+ "Contain": 4,
+ "SnapPosition": 5
+ }
+ }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "path"; type: "QQuickPath"; isPointer: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "offset"; type: "double" }
+ Property { name: "highlight"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "preferredHighlightBegin"; type: "double" }
+ Property { name: "preferredHighlightEnd"; type: "double" }
+ Property { name: "highlightRangeMode"; type: "HighlightRangeMode" }
+ Property { name: "highlightMoveDuration"; type: "int" }
+ Property { name: "dragMargin"; type: "double" }
+ Property { name: "maximumFlickVelocity"; type: "double" }
+ Property { name: "flickDeceleration"; type: "double" }
+ Property { name: "interactive"; type: "bool" }
+ Property { name: "moving"; type: "bool"; isReadonly: true }
+ Property { name: "flicking"; type: "bool"; isReadonly: true }
+ Property { name: "dragging"; type: "bool"; isReadonly: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "pathItemCount"; type: "int" }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Property { name: "cacheItemCount"; type: "int" }
+ Signal { name: "snapPositionChanged" }
+ Signal { name: "movementStarted" }
+ Signal { name: "movementEnded" }
+ Signal { name: "flickStarted" }
+ Signal { name: "flickEnded" }
+ Signal { name: "dragStarted" }
+ Signal { name: "dragEnded" }
+ Method { name: "incrementCurrentIndex" }
+ Method { name: "decrementCurrentIndex" }
+ Method {
+ name: "positionViewAtIndex"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "mode"; type: "int" }
+ }
+ Method {
+ name: "indexAt"
+ type: "int"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickPathViewAttached"
+ prototype: "QObject"
+ Property { name: "view"; type: "QQuickPathView"; isReadonly: true; isPointer: true }
+ Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
+ Property { name: "onPath"; type: "bool"; isReadonly: true }
+ Signal { name: "currentItemChanged" }
+ Signal { name: "pathChanged" }
+ }
+ Component {
+ name: "QQuickPauseAnimation"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/PauseAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "duration"; type: "int" }
+ Signal {
+ name: "durationChanged"
+ Parameter { type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickPen"
+ prototype: "QObject"
+ Property { name: "width"; type: "double" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "pixelAligned"; type: "bool" }
+ Signal { name: "penChanged" }
+ }
+ Component {
+ name: "QQuickPinch"
+ prototype: "QObject"
+ exports: ["QtQuick/Pinch 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Axis"
+ values: {
+ "NoDrag": 0,
+ "XAxis": 1,
+ "YAxis": 2,
+ "XAndYAxis": 3,
+ "XandYAxis": 3
+ }
+ }
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "minimumScale"; type: "double" }
+ Property { name: "maximumScale"; type: "double" }
+ Property { name: "minimumRotation"; type: "double" }
+ Property { name: "maximumRotation"; type: "double" }
+ Property { name: "dragAxis"; type: "Axis" }
+ Property { name: "minimumX"; type: "double" }
+ Property { name: "maximumX"; type: "double" }
+ Property { name: "minimumY"; type: "double" }
+ Property { name: "maximumY"; type: "double" }
+ Property { name: "active"; type: "bool"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPinchArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/PinchArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "pinchStarted"
+ Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pinchUpdated"
+ Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pinchFinished"
+ Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickPositionerAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "isFirstItem"; type: "bool"; isReadonly: true }
+ Property { name: "isLastItem"; type: "bool"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPropertyAction"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/PropertyAction 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "property"; type: "string" }
+ Property { name: "properties"; type: "string" }
+ Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "value"; type: "QVariant" }
+ Signal {
+ name: "valueChanged"
+ Parameter { type: "QVariant" }
+ }
+ Signal {
+ name: "propertiesChanged"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickPropertyAnimation"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/PropertyAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "duration"; type: "int" }
+ Property { name: "from"; type: "QVariant" }
+ Property { name: "to"; type: "QVariant" }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "property"; type: "string" }
+ Property { name: "properties"; type: "string" }
+ Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "durationChanged"
+ Parameter { type: "int" }
+ }
+ Signal {
+ name: "fromChanged"
+ Parameter { type: "QVariant" }
+ }
+ Signal {
+ name: "toChanged"
+ Parameter { type: "QVariant" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { type: "QEasingCurve" }
+ }
+ Signal {
+ name: "propertiesChanged"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickPropertyChanges"
+ prototype: "QQuickStateOperation"
+ exports: ["QtQuick/PropertyChanges 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "restoreEntryValues"; type: "bool" }
+ Property { name: "explicit"; type: "bool" }
+ }
+ Component {
+ name: "QQuickRectangle"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Rectangle 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "color"; type: "QColor" }
+ Property { name: "gradient"; type: "QQuickGradient"; isPointer: true }
+ Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
+ Property { name: "radius"; type: "double" }
+ }
+ Component {
+ name: "QQuickRepeater"
+ defaultProperty: "delegate"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Repeater 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Signal {
+ name: "itemAdded"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "itemRemoved"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickRotation"
+ prototype: "QQuickTransform"
+ exports: ["QtQuick/Rotation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "origin"; type: "QVector3D" }
+ Property { name: "angle"; type: "double" }
+ Property { name: "axis"; type: "QVector3D" }
+ }
+ Component {
+ name: "QQuickRotationAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["QtQuick/RotationAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RotationDirection"
+ values: {
+ "Numerical": 0,
+ "Shortest": 1,
+ "Clockwise": 2,
+ "Counterclockwise": 3
+ }
+ }
+ Property { name: "from"; type: "double" }
+ Property { name: "to"; type: "double" }
+ Property { name: "direction"; type: "RotationDirection" }
+ }
+ Component {
+ name: "QQuickRotationAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/RotationAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RotationDirection"
+ values: {
+ "Numerical": 0,
+ "Shortest": 1,
+ "Clockwise": 2,
+ "Counterclockwise": 3
+ }
+ }
+ Property { name: "direction"; type: "RotationDirection" }
+ Signal {
+ name: "directionChanged"
+ Parameter { name: "dir"; type: "RotationDirection" }
+ }
+ }
+ Component {
+ name: "QQuickRow"
+ defaultProperty: "data"
+ prototype: "QQuickBasePositioner"
+ exports: ["QtQuick/Row 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickScale"
+ prototype: "QQuickTransform"
+ exports: ["QtQuick/Scale 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "origin"; type: "QVector3D" }
+ Property { name: "xScale"; type: "double" }
+ Property { name: "yScale"; type: "double" }
+ Property { name: "zScale"; type: "double" }
+ Signal { name: "scaleChanged" }
+ }
+ Component {
+ name: "QQuickScaleAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/ScaleAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickScaleGrid"
+ prototype: "QObject"
+ Property { name: "left"; type: "int" }
+ Property { name: "top"; type: "int" }
+ Property { name: "right"; type: "int" }
+ Property { name: "bottom"; type: "int" }
+ Signal { name: "borderChanged" }
+ }
+ Component {
+ name: "QQuickScriptAction"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/ScriptAction 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "script"; type: "QQmlScriptString" }
+ Property { name: "scriptName"; type: "string" }
+ }
+ Component {
+ name: "QQuickSequentialAnimation"
+ defaultProperty: "animations"
+ prototype: "QQuickAnimationGroup"
+ exports: ["QtQuick/SequentialAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickShaderEffect"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/ShaderEffect 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "CullMode"
+ values: {
+ "NoCulling": 0,
+ "BackFaceCulling": 1,
+ "FrontFaceCulling": 2
+ }
+ }
+ Enum {
+ name: "Status"
+ values: {
+ "Compiled": 0,
+ "Uncompiled": 1,
+ "Error": 2
+ }
+ }
+ Property { name: "fragmentShader"; type: "QByteArray" }
+ Property { name: "vertexShader"; type: "QByteArray" }
+ Property { name: "blending"; type: "bool" }
+ Property { name: "mesh"; type: "QVariant" }
+ Property { name: "cullMode"; type: "CullMode" }
+ Property { name: "log"; type: "string"; isReadonly: true }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickShaderEffectMesh"
+ prototype: "QObject"
+ exports: ["QtQuick/ShaderEffectMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Signal { name: "geometryChanged" }
+ }
+ Component {
+ name: "QQuickShaderEffectSource"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/ShaderEffectSource 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "WrapMode"
+ values: {
+ "ClampToEdge": 0,
+ "RepeatHorizontally": 1,
+ "RepeatVertically": 2,
+ "Repeat": 3
+ }
+ }
+ Enum {
+ name: "Format"
+ values: {
+ "Alpha": 6406,
+ "RGB": 6407,
+ "RGBA": 6408
+ }
+ }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "sourceItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "sourceRect"; type: "QRectF" }
+ Property { name: "textureSize"; type: "QSize" }
+ Property { name: "format"; type: "Format" }
+ Property { name: "live"; type: "bool" }
+ Property { name: "hideSource"; type: "bool" }
+ Property { name: "mipmap"; type: "bool" }
+ Property { name: "recursive"; type: "bool" }
+ Signal { name: "scheduledUpdateCompleted" }
+ Method { name: "scheduleUpdate" }
+ }
+ Component {
+ name: "QQuickSmoothedAnimation"
+ prototype: "QQuickNumberAnimation"
+ exports: ["QtQuick/SmoothedAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "ReversingMode"
+ values: {
+ "Eased": 0,
+ "Immediate": 1,
+ "Sync": 2
+ }
+ }
+ Property { name: "velocity"; type: "double" }
+ Property { name: "reversingMode"; type: "ReversingMode" }
+ Property { name: "maximumEasingTime"; type: "double" }
+ }
+ Component {
+ name: "QQuickSpringAnimation"
+ prototype: "QQuickNumberAnimation"
+ exports: ["QtQuick/SpringAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "velocity"; type: "double" }
+ Property { name: "spring"; type: "double" }
+ Property { name: "damping"; type: "double" }
+ Property { name: "epsilon"; type: "double" }
+ Property { name: "modulus"; type: "double" }
+ Property { name: "mass"; type: "double" }
+ Signal { name: "syncChanged" }
+ }
+ Component {
+ name: "QQuickSprite"
+ prototype: "QQuickStochasticState"
+ exports: ["QtQuick/Sprite 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "reverse"; type: "bool" }
+ Property { name: "frameSync"; type: "bool" }
+ Property { name: "frames"; type: "int" }
+ Property { name: "frameCount"; type: "int" }
+ Property { name: "frameHeight"; type: "int" }
+ Property { name: "frameWidth"; type: "int" }
+ Property { name: "frameX"; type: "int" }
+ Property { name: "frameY"; type: "int" }
+ Property { name: "frameRate"; type: "double" }
+ Property { name: "frameRateVariation"; type: "double" }
+ Property { name: "frameDuration"; type: "int" }
+ Property { name: "frameDurationVariation"; type: "int" }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Signal {
+ name: "frameHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "reverseChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "frameCountChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameXChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameYChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameRateChanged"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Signal {
+ name: "frameRateVariationChanged"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Signal {
+ name: "frameDurationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameDurationVariationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameSyncChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Method {
+ name: "setFrameHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setReverse"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setFrames"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameCount"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameRate"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Method {
+ name: "setFrameRateVariation"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Method {
+ name: "setFrameDuration"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameDurationVariation"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameSync"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickSpriteSequence"
+ defaultProperty: "sprites"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/SpriteSequence 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "running"; type: "bool" }
+ Property { name: "interpolate"; type: "bool" }
+ Property { name: "goalSprite"; type: "string" }
+ Property { name: "currentSprite"; type: "string"; isReadonly: true }
+ Property { name: "sprites"; type: "QQuickSprite"; isList: true; isReadonly: true }
+ Signal {
+ name: "runningChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "interpolateChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "goalSpriteChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Signal {
+ name: "currentSpriteChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "jumpTo"
+ Parameter { name: "sprite"; type: "string" }
+ }
+ Method {
+ name: "setGoalSprite"
+ Parameter { name: "sprite"; type: "string" }
+ }
+ Method {
+ name: "setRunning"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setInterpolate"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickState"
+ defaultProperty: "changes"
+ prototype: "QObject"
+ exports: ["QtQuick/State 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "name"; type: "string" }
+ Property { name: "when"; type: "QQmlBinding"; isPointer: true }
+ Property { name: "extend"; type: "string" }
+ Property { name: "changes"; type: "QQuickStateOperation"; isList: true; isReadonly: true }
+ Signal { name: "completed" }
+ }
+ Component {
+ name: "QQuickStateChangeScript"
+ prototype: "QQuickStateOperation"
+ exports: ["QtQuick/StateChangeScript 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "script"; type: "QQmlScriptString" }
+ Property { name: "name"; type: "string" }
+ }
+ Component {
+ name: "QQuickStateGroup"
+ prototype: "QObject"
+ exports: ["QtQuick/StateGroup 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "state"; type: "string" }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ }
+ Component { name: "QQuickStateOperation"; prototype: "QObject" }
+ Component {
+ name: "QQuickStochasticState"
+ prototype: "QObject"
+ Property { name: "duration"; type: "int" }
+ Property { name: "durationVariation"; type: "int" }
+ Property { name: "randomStart"; type: "bool" }
+ Property { name: "to"; type: "QVariantMap" }
+ Property { name: "name"; type: "string" }
+ Signal {
+ name: "durationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Signal {
+ name: "toChanged"
+ Parameter { name: "arg"; type: "QVariantMap" }
+ }
+ Signal {
+ name: "durationVariationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal { name: "entered" }
+ Signal {
+ name: "randomStartChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setDuration"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setName"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setTo"
+ Parameter { name: "arg"; type: "QVariantMap" }
+ }
+ Method {
+ name: "setDurationVariation"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setRandomStart"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickSystemPalette"
+ prototype: "QObject"
+ exports: ["QtQuick/SystemPalette 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "ColorGroup"
+ values: {
+ "Active": 0,
+ "Inactive": 2,
+ "Disabled": 1
+ }
+ }
+ Property { name: "colorGroup"; type: "QQuickSystemPalette::ColorGroup" }
+ Property { name: "window"; type: "QColor"; isReadonly: true }
+ Property { name: "windowText"; type: "QColor"; isReadonly: true }
+ Property { name: "base"; type: "QColor"; isReadonly: true }
+ Property { name: "text"; type: "QColor"; isReadonly: true }
+ Property { name: "alternateBase"; type: "QColor"; isReadonly: true }
+ Property { name: "button"; type: "QColor"; isReadonly: true }
+ Property { name: "buttonText"; type: "QColor"; isReadonly: true }
+ Property { name: "light"; type: "QColor"; isReadonly: true }
+ Property { name: "midlight"; type: "QColor"; isReadonly: true }
+ Property { name: "dark"; type: "QColor"; isReadonly: true }
+ Property { name: "mid"; type: "QColor"; isReadonly: true }
+ Property { name: "shadow"; type: "QColor"; isReadonly: true }
+ Property { name: "highlight"; type: "QColor"; isReadonly: true }
+ Property { name: "highlightedText"; type: "QColor"; isReadonly: true }
+ Signal { name: "paletteChanged" }
+ }
+ Component {
+ name: "QQuickText"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Text 2.0", "QtQuick/Text 2.2"]
+ exportMetaObjectRevisions: [0, 2]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextStyle"
+ values: {
+ "Normal": 0,
+ "Outline": 1,
+ "Raised": 2,
+ "Sunken": 3
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2,
+ "StyledText": 4
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Enum {
+ name: "LineHeightMode"
+ values: {
+ "ProportionalHeight": 0,
+ "FixedHeight": 1
+ }
+ }
+ Enum {
+ name: "FontSizeMode"
+ values: {
+ "FixedSize": 0,
+ "HorizontalFit": 1,
+ "VerticalFit": 2,
+ "Fit": 3
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "linkColor"; type: "QColor" }
+ Property { name: "style"; type: "TextStyle" }
+ Property { name: "styleColor"; type: "QColor" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "truncated"; type: "bool"; isReadonly: true }
+ Property { name: "maximumLineCount"; type: "int" }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "elide"; type: "TextElideMode" }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "lineHeight"; type: "double" }
+ Property { name: "lineHeightMode"; type: "LineHeightMode" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "minimumPixelSize"; type: "int" }
+ Property { name: "minimumPointSize"; type: "int" }
+ Property { name: "fontSizeMode"; type: "FontSizeMode" }
+ Property { name: "renderType"; type: "RenderType" }
+ Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ revision: 2
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "styleChanged"
+ Parameter { name: "style"; type: "TextStyle" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "elideModeChanged"
+ Parameter { name: "mode"; type: "TextElideMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "lineHeightChanged"
+ Parameter { name: "lineHeight"; type: "double" }
+ }
+ Signal {
+ name: "lineHeightModeChanged"
+ Parameter { name: "mode"; type: "LineHeightMode" }
+ }
+ Signal {
+ name: "lineLaidOut"
+ Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
+ }
+ Method { name: "doLayout" }
+ }
+ Component { name: "QQuickTextDocument"; prototype: "QObject" }
+ Component {
+ name: "QQuickTextEdit"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: [
+ "QtQuick/TextEdit 2.0",
+ "QtQuick/TextEdit 2.1",
+ "QtQuick/TextEdit 2.2"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "SelectionMode"
+ values: {
+ "SelectCharacters": 0,
+ "SelectWords": 1
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "selectionColor"; type: "QColor" }
+ Property { name: "selectedTextColor"; type: "QColor" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "cursorVisible"; type: "bool" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "persistentSelection"; type: "bool" }
+ Property { name: "textMargin"; type: "double" }
+ Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
+ Property { name: "selectByKeyboard"; revision: 1; type: "bool" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "mouseSelectionMode"; type: "SelectionMode" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "renderType"; type: "RenderType" }
+ Property {
+ name: "textDocument"
+ revision: 1
+ type: "QQuickTextDocument"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "selectionColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "selectedTextColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "readOnlyChanged"
+ Parameter { name: "isReadOnly"; type: "bool" }
+ }
+ Signal {
+ name: "cursorVisibleChanged"
+ Parameter { name: "isCursorVisible"; type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnPressChanged"
+ Parameter { name: "activeFocusOnPressed"; type: "bool" }
+ }
+ Signal {
+ name: "persistentSelectionChanged"
+ Parameter { name: "isPersistentSelection"; type: "bool" }
+ }
+ Signal {
+ name: "textMarginChanged"
+ Parameter { name: "textMargin"; type: "double" }
+ }
+ Signal {
+ name: "selectByKeyboardChanged"
+ revision: 1
+ Parameter { name: "selectByKeyboard"; type: "bool" }
+ }
+ Signal {
+ name: "selectByMouseChanged"
+ Parameter { name: "selectByMouse"; type: "bool" }
+ }
+ Signal {
+ name: "mouseSelectionModeChanged"
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ revision: 2
+ Parameter { name: "link"; type: "string" }
+ }
+ Method { name: "selectAll" }
+ Method { name: "selectWord" }
+ Method {
+ name: "select"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "deselect" }
+ Method {
+ name: "isRightToLeft"
+ type: "bool"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "cut" }
+ Method { name: "copy" }
+ Method { name: "paste" }
+ Method { name: "undo" }
+ Method { name: "redo" }
+ Method {
+ name: "insert"
+ Parameter { name: "position"; type: "int" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "append"
+ revision: 2
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QRectF"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "positionAt"
+ type: "int"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Method {
+ name: "getText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "getFormattedText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickTextInput"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/TextInput 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "EchoMode"
+ values: {
+ "Normal": 0,
+ "NoEcho": 1,
+ "Password": 2,
+ "PasswordEchoOnEdit": 3
+ }
+ }
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "SelectionMode"
+ values: {
+ "SelectCharacters": 0,
+ "SelectWords": 1
+ }
+ }
+ Enum {
+ name: "CursorPosition"
+ values: {
+ "CursorBetweenCharacters": 0,
+ "CursorOnCharacter": 1
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "selectionColor"; type: "QColor" }
+ Property { name: "selectedTextColor"; type: "QColor" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "cursorVisible"; type: "bool" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "maximumLength"; type: "int" }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "inputMask"; type: "string" }
+ Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Property { name: "echoMode"; type: "EchoMode" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "passwordCharacter"; type: "string" }
+ Property { name: "displayText"; type: "string"; isReadonly: true }
+ Property { name: "autoScroll"; type: "bool" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "mouseSelectionMode"; type: "SelectionMode" }
+ Property { name: "persistentSelection"; type: "bool" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "renderType"; type: "RenderType" }
+ Signal { name: "accepted" }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "readOnlyChanged"
+ Parameter { name: "isReadOnly"; type: "bool" }
+ }
+ Signal {
+ name: "cursorVisibleChanged"
+ Parameter { name: "isCursorVisible"; type: "bool" }
+ }
+ Signal {
+ name: "maximumLengthChanged"
+ Parameter { name: "maximumLength"; type: "int" }
+ }
+ Signal {
+ name: "inputMaskChanged"
+ Parameter { name: "inputMask"; type: "string" }
+ }
+ Signal {
+ name: "echoModeChanged"
+ Parameter { name: "echoMode"; type: "EchoMode" }
+ }
+ Signal {
+ name: "activeFocusOnPressChanged"
+ Parameter { name: "activeFocusOnPress"; type: "bool" }
+ }
+ Signal {
+ name: "autoScrollChanged"
+ Parameter { name: "autoScroll"; type: "bool" }
+ }
+ Signal {
+ name: "selectByMouseChanged"
+ Parameter { name: "selectByMouse"; type: "bool" }
+ }
+ Signal {
+ name: "mouseSelectionModeChanged"
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Method { name: "selectAll" }
+ Method { name: "selectWord" }
+ Method {
+ name: "select"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "deselect" }
+ Method {
+ name: "isRightToLeft"
+ type: "bool"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "cut" }
+ Method { name: "copy" }
+ Method { name: "paste" }
+ Method { name: "undo" }
+ Method { name: "redo" }
+ Method {
+ name: "insert"
+ Parameter { name: "position"; type: "int" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "positionAt"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QRectF"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Method {
+ name: "getText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickTouchPoint"
+ prototype: "QObject"
+ exports: ["QtQuick/TouchPoint 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "pointId"; type: "int"; isReadonly: true }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "pressure"; type: "double"; isReadonly: true }
+ Property { name: "velocity"; type: "QVector2D"; isReadonly: true }
+ Property { name: "area"; type: "QRectF"; isReadonly: true }
+ Property { name: "startX"; type: "double"; isReadonly: true }
+ Property { name: "startY"; type: "double"; isReadonly: true }
+ Property { name: "previousX"; type: "double"; isReadonly: true }
+ Property { name: "previousY"; type: "double"; isReadonly: true }
+ Property { name: "sceneX"; type: "double"; isReadonly: true }
+ Property { name: "sceneY"; type: "double"; isReadonly: true }
+ }
+ Component { name: "QQuickTransform"; prototype: "QObject" }
+ Component {
+ name: "QQuickTransition"
+ defaultProperty: "animations"
+ prototype: "QObject"
+ exports: ["QtQuick/Transition 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "string" }
+ Property { name: "to"; type: "string" }
+ Property { name: "reversible"; type: "bool" }
+ Property { name: "running"; type: "bool"; isReadonly: true }
+ Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true }
+ Property { name: "enabled"; type: "bool" }
+ }
+ Component {
+ name: "QQuickTranslate"
+ prototype: "QQuickTransform"
+ exports: ["QtQuick/Translate 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ }
+ Component {
+ name: "QQuickUniformAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/UniformAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "uniform"; type: "string" }
+ Signal {
+ name: "uniformChanged"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickVector3dAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["QtQuick/Vector3dAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "QVector3D" }
+ Property { name: "to"; type: "QVector3D" }
+ }
+ Component {
+ name: "QQuickViewSection"
+ prototype: "QObject"
+ exports: ["QtQuick/ViewSection 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "SectionCriteria"
+ values: {
+ "FullString": 0,
+ "FirstCharacter": 1
+ }
+ }
+ Enum {
+ name: "LabelPositioning"
+ values: {
+ "InlineLabels": 1,
+ "CurrentLabelAtStart": 2,
+ "NextLabelAtEnd": 4
+ }
+ }
+ Property { name: "property"; type: "string" }
+ Property { name: "criteria"; type: "SectionCriteria" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "labelPositioning"; type: "int" }
+ Signal { name: "sectionsChanged" }
+ }
+ Component {
+ name: "QQuickViewTransitionAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/ViewTransition 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "destination"; type: "QPointF"; isReadonly: true }
+ Property { name: "targetIndexes"; type: "QList<int>"; isReadonly: true }
+ Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickWorkerScript"
+ prototype: "QObject"
+ exports: ["QtQuick/WorkerScript 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "source"; type: "QUrl" }
+ Signal {
+ name: "message"
+ Parameter { name: "messageObject"; type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "sendMessage"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickXAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/XAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickYAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/YAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QRegExpValidator"
+ prototype: "QValidator"
+ exports: ["QtQuick/RegExpValidator 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "regExp"; type: "QRegExp" }
+ Signal {
+ name: "regExpChanged"
+ Parameter { name: "regExp"; type: "QRegExp" }
+ }
+ }
+ Component {
+ name: "QValidator"
+ prototype: "QObject"
+ Signal { name: "changed" }
+ }
+ Component {
+ name: "Qt"
+ Enum {
+ name: "GlobalColor"
+ values: {
+ "color0": 0,
+ "color1": 1,
+ "black": 2,
+ "white": 3,
+ "darkGray": 4,
+ "gray": 5,
+ "lightGray": 6,
+ "red": 7,
+ "green": 8,
+ "blue": 9,
+ "cyan": 10,
+ "magenta": 11,
+ "yellow": 12,
+ "darkRed": 13,
+ "darkGreen": 14,
+ "darkBlue": 15,
+ "darkCyan": 16,
+ "darkMagenta": 17,
+ "darkYellow": 18,
+ "transparent": 19
+ }
+ }
+ Enum {
+ name: "KeyboardModifiers"
+ values: {
+ "NoModifier": 0,
+ "ShiftModifier": 33554432,
+ "ControlModifier": 67108864,
+ "AltModifier": 134217728,
+ "MetaModifier": 268435456,
+ "KeypadModifier": 536870912,
+ "GroupSwitchModifier": 1073741824,
+ "KeyboardModifierMask": -33554432
+ }
+ }
+ Enum {
+ name: "MouseButtons"
+ values: {
+ "NoButton": 0,
+ "LeftButton": 1,
+ "RightButton": 2,
+ "MidButton": 4,
+ "MiddleButton": 4,
+ "BackButton": 8,
+ "XButton1": 8,
+ "ExtraButton1": 8,
+ "ForwardButton": 16,
+ "XButton2": 16,
+ "ExtraButton2": 16,
+ "TaskButton": 32,
+ "ExtraButton3": 32,
+ "ExtraButton4": 64,
+ "ExtraButton5": 128,
+ "ExtraButton6": 256,
+ "ExtraButton7": 512,
+ "ExtraButton8": 1024,
+ "ExtraButton9": 2048,
+ "ExtraButton10": 4096,
+ "ExtraButton11": 8192,
+ "ExtraButton12": 16384,
+ "ExtraButton13": 32768,
+ "ExtraButton14": 65536,
+ "ExtraButton15": 131072,
+ "ExtraButton16": 262144,
+ "ExtraButton17": 524288,
+ "ExtraButton18": 1048576,
+ "ExtraButton19": 2097152,
+ "ExtraButton20": 4194304,
+ "ExtraButton21": 8388608,
+ "ExtraButton22": 16777216,
+ "ExtraButton23": 33554432,
+ "ExtraButton24": 67108864,
+ "AllButtons": 134217727,
+ "MaxMouseButton": 67108864,
+ "MouseButtonMask": -1
+ }
+ }
+ Enum {
+ name: "Orientation"
+ values: {
+ "Horizontal": 1,
+ "Vertical": 2
+ }
+ }
+ Enum {
+ name: "Orientations"
+ values: {
+ "Horizontal": 1,
+ "Vertical": 2
+ }
+ }
+ Enum {
+ name: "FocusPolicy"
+ values: {
+ "NoFocus": 0,
+ "TabFocus": 1,
+ "ClickFocus": 2,
+ "StrongFocus": 11,
+ "WheelFocus": 15
+ }
+ }
+ Enum {
+ name: "SortOrder"
+ values: {
+ "AscendingOrder": 0,
+ "DescendingOrder": 1
+ }
+ }
+ Enum {
+ name: "Alignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignLeading": 1,
+ "AlignRight": 2,
+ "AlignTrailing": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8,
+ "AlignAbsolute": 16,
+ "AlignHorizontal_Mask": 31,
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128,
+ "AlignBaseline": 256,
+ "AlignVertical_Mask": 480,
+ "AlignCenter": 132
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WindowType"
+ values: {
+ "Widget": 0,
+ "Window": 1,
+ "Dialog": 3,
+ "Sheet": 5,
+ "Drawer": 7,
+ "Popup": 9,
+ "Tool": 11,
+ "ToolTip": 13,
+ "SplashScreen": 15,
+ "Desktop": 17,
+ "SubWindow": 18,
+ "ForeignWindow": 33,
+ "CoverWindow": 65,
+ "WindowType_Mask": 255,
+ "MSWindowsFixedSizeDialogHint": 256,
+ "MSWindowsOwnDC": 512,
+ "BypassWindowManagerHint": 1024,
+ "X11BypassWindowManagerHint": 1024,
+ "FramelessWindowHint": 2048,
+ "WindowTitleHint": 4096,
+ "WindowSystemMenuHint": 8192,
+ "WindowMinimizeButtonHint": 16384,
+ "WindowMaximizeButtonHint": 32768,
+ "WindowMinMaxButtonsHint": 49152,
+ "WindowContextHelpButtonHint": 65536,
+ "WindowShadeButtonHint": 131072,
+ "WindowStaysOnTopHint": 262144,
+ "WindowTransparentForInput": 524288,
+ "WindowOverridesSystemGestures": 1048576,
+ "WindowDoesNotAcceptFocus": 2097152,
+ "CustomizeWindowHint": 33554432,
+ "WindowStaysOnBottomHint": 67108864,
+ "WindowCloseButtonHint": 134217728,
+ "MacWindowToolBarButtonHint": 268435456,
+ "BypassGraphicsProxyWidget": 536870912,
+ "WindowOkButtonHint": 524288,
+ "WindowCancelButtonHint": 1048576,
+ "NoDropShadowWindowHint": 1073741824,
+ "WindowFullscreenButtonHint": -2147483648
+ }
+ }
+ Enum {
+ name: "WindowFlags"
+ values: {
+ "Widget": 0,
+ "Window": 1,
+ "Dialog": 3,
+ "Sheet": 5,
+ "Drawer": 7,
+ "Popup": 9,
+ "Tool": 11,
+ "ToolTip": 13,
+ "SplashScreen": 15,
+ "Desktop": 17,
+ "SubWindow": 18,
+ "ForeignWindow": 33,
+ "CoverWindow": 65,
+ "WindowType_Mask": 255,
+ "MSWindowsFixedSizeDialogHint": 256,
+ "MSWindowsOwnDC": 512,
+ "BypassWindowManagerHint": 1024,
+ "X11BypassWindowManagerHint": 1024,
+ "FramelessWindowHint": 2048,
+ "WindowTitleHint": 4096,
+ "WindowSystemMenuHint": 8192,
+ "WindowMinimizeButtonHint": 16384,
+ "WindowMaximizeButtonHint": 32768,
+ "WindowMinMaxButtonsHint": 49152,
+ "WindowContextHelpButtonHint": 65536,
+ "WindowShadeButtonHint": 131072,
+ "WindowStaysOnTopHint": 262144,
+ "WindowTransparentForInput": 524288,
+ "WindowOverridesSystemGestures": 1048576,
+ "WindowDoesNotAcceptFocus": 2097152,
+ "CustomizeWindowHint": 33554432,
+ "WindowStaysOnBottomHint": 67108864,
+ "WindowCloseButtonHint": 134217728,
+ "MacWindowToolBarButtonHint": 268435456,
+ "BypassGraphicsProxyWidget": 536870912,
+ "WindowOkButtonHint": 524288,
+ "WindowCancelButtonHint": 1048576,
+ "NoDropShadowWindowHint": 1073741824,
+ "WindowFullscreenButtonHint": -2147483648
+ }
+ }
+ Enum {
+ name: "WindowState"
+ values: {
+ "WindowNoState": 0,
+ "WindowMinimized": 1,
+ "WindowMaximized": 2,
+ "WindowFullScreen": 4,
+ "WindowActive": 8
+ }
+ }
+ Enum {
+ name: "WindowStates"
+ values: {
+ "WindowNoState": 0,
+ "WindowMinimized": 1,
+ "WindowMaximized": 2,
+ "WindowFullScreen": 4,
+ "WindowActive": 8
+ }
+ }
+ Enum {
+ name: "ApplicationState"
+ values: {
+ "ApplicationSuspended": 0,
+ "ApplicationHidden": 1,
+ "ApplicationInactive": 2,
+ "ApplicationActive": 4
+ }
+ }
+ Enum {
+ name: "ScreenOrientation"
+ values: {
+ "PrimaryOrientation": 0,
+ "PortraitOrientation": 1,
+ "LandscapeOrientation": 2,
+ "InvertedPortraitOrientation": 4,
+ "InvertedLandscapeOrientation": 8
+ }
+ }
+ Enum {
+ name: "ScreenOrientations"
+ values: {
+ "PrimaryOrientation": 0,
+ "PortraitOrientation": 1,
+ "LandscapeOrientation": 2,
+ "InvertedPortraitOrientation": 4,
+ "InvertedLandscapeOrientation": 8
+ }
+ }
+ Enum {
+ name: "WidgetAttribute"
+ values: {
+ "WA_Disabled": 0,
+ "WA_UnderMouse": 1,
+ "WA_MouseTracking": 2,
+ "WA_ContentsPropagated": 3,
+ "WA_OpaquePaintEvent": 4,
+ "WA_NoBackground": 4,
+ "WA_StaticContents": 5,
+ "WA_LaidOut": 7,
+ "WA_PaintOnScreen": 8,
+ "WA_NoSystemBackground": 9,
+ "WA_UpdatesDisabled": 10,
+ "WA_Mapped": 11,
+ "WA_MacNoClickThrough": 12,
+ "WA_InputMethodEnabled": 14,
+ "WA_WState_Visible": 15,
+ "WA_WState_Hidden": 16,
+ "WA_ForceDisabled": 32,
+ "WA_KeyCompression": 33,
+ "WA_PendingMoveEvent": 34,
+ "WA_PendingResizeEvent": 35,
+ "WA_SetPalette": 36,
+ "WA_SetFont": 37,
+ "WA_SetCursor": 38,
+ "WA_NoChildEventsFromChildren": 39,
+ "WA_WindowModified": 41,
+ "WA_Resized": 42,
+ "WA_Moved": 43,
+ "WA_PendingUpdate": 44,
+ "WA_InvalidSize": 45,
+ "WA_MacBrushedMetal": 46,
+ "WA_MacMetalStyle": 46,
+ "WA_CustomWhatsThis": 47,
+ "WA_LayoutOnEntireRect": 48,
+ "WA_OutsideWSRange": 49,
+ "WA_GrabbedShortcut": 50,
+ "WA_TransparentForMouseEvents": 51,
+ "WA_PaintUnclipped": 52,
+ "WA_SetWindowIcon": 53,
+ "WA_NoMouseReplay": 54,
+ "WA_DeleteOnClose": 55,
+ "WA_RightToLeft": 56,
+ "WA_SetLayoutDirection": 57,
+ "WA_NoChildEventsForParent": 58,
+ "WA_ForceUpdatesDisabled": 59,
+ "WA_WState_Created": 60,
+ "WA_WState_CompressKeys": 61,
+ "WA_WState_InPaintEvent": 62,
+ "WA_WState_Reparented": 63,
+ "WA_WState_ConfigPending": 64,
+ "WA_WState_Polished": 66,
+ "WA_WState_DND": 67,
+ "WA_WState_OwnSizePolicy": 68,
+ "WA_WState_ExplicitShowHide": 69,
+ "WA_ShowModal": 70,
+ "WA_MouseNoMask": 71,
+ "WA_GroupLeader": 72,
+ "WA_NoMousePropagation": 73,
+ "WA_Hover": 74,
+ "WA_InputMethodTransparent": 75,
+ "WA_QuitOnClose": 76,
+ "WA_KeyboardFocusChange": 77,
+ "WA_AcceptDrops": 78,
+ "WA_DropSiteRegistered": 79,
+ "WA_ForceAcceptDrops": 79,
+ "WA_WindowPropagation": 80,
+ "WA_NoX11EventCompression": 81,
+ "WA_TintedBackground": 82,
+ "WA_X11OpenGLOverlay": 83,
+ "WA_AlwaysShowToolTips": 84,
+ "WA_MacOpaqueSizeGrip": 85,
+ "WA_SetStyle": 86,
+ "WA_SetLocale": 87,
+ "WA_MacShowFocusRect": 88,
+ "WA_MacNormalSize": 89,
+ "WA_MacSmallSize": 90,
+ "WA_MacMiniSize": 91,
+ "WA_LayoutUsesWidgetRect": 92,
+ "WA_StyledBackground": 93,
+ "WA_MSWindowsUseDirect3D": 94,
+ "WA_CanHostQMdiSubWindowTitleBar": 95,
+ "WA_MacAlwaysShowToolWindow": 96,
+ "WA_StyleSheet": 97,
+ "WA_ShowWithoutActivating": 98,
+ "WA_X11BypassTransientForHint": 99,
+ "WA_NativeWindow": 100,
+ "WA_DontCreateNativeAncestors": 101,
+ "WA_MacVariableSize": 102,
+ "WA_DontShowOnScreen": 103,
+ "WA_X11NetWmWindowTypeDesktop": 104,
+ "WA_X11NetWmWindowTypeDock": 105,
+ "WA_X11NetWmWindowTypeToolBar": 106,
+ "WA_X11NetWmWindowTypeMenu": 107,
+ "WA_X11NetWmWindowTypeUtility": 108,
+ "WA_X11NetWmWindowTypeSplash": 109,
+ "WA_X11NetWmWindowTypeDialog": 110,
+ "WA_X11NetWmWindowTypeDropDownMenu": 111,
+ "WA_X11NetWmWindowTypePopupMenu": 112,
+ "WA_X11NetWmWindowTypeToolTip": 113,
+ "WA_X11NetWmWindowTypeNotification": 114,
+ "WA_X11NetWmWindowTypeCombo": 115,
+ "WA_X11NetWmWindowTypeDND": 116,
+ "WA_MacFrameworkScaled": 117,
+ "WA_SetWindowModality": 118,
+ "WA_WState_WindowOpacitySet": 119,
+ "WA_TranslucentBackground": 120,
+ "WA_AcceptTouchEvents": 121,
+ "WA_WState_AcceptedTouchBeginEvent": 122,
+ "WA_TouchPadAcceptSingleTouchEvents": 123,
+ "WA_X11DoNotAcceptFocus": 126,
+ "WA_MacNoShadow": 127,
+ "WA_AttributeCount": 128
+ }
+ }
+ Enum {
+ name: "ApplicationAttribute"
+ values: {
+ "AA_ImmediateWidgetCreation": 0,
+ "AA_MSWindowsUseDirect3DByDefault": 1,
+ "AA_DontShowIconsInMenus": 2,
+ "AA_NativeWindows": 3,
+ "AA_DontCreateNativeWidgetSiblings": 4,
+ "AA_MacPluginApplication": 5,
+ "AA_DontUseNativeMenuBar": 6,
+ "AA_MacDontSwapCtrlAndMeta": 7,
+ "AA_Use96Dpi": 8,
+ "AA_X11InitThreads": 10,
+ "AA_SynthesizeTouchForUnhandledMouseEvents": 11,
+ "AA_SynthesizeMouseForUnhandledTouchEvents": 12,
+ "AA_UseHighDpiPixmaps": 13,
+ "AA_AttributeCount": 14
+ }
+ }
+ Enum {
+ name: "ImageConversionFlags"
+ values: {
+ "ColorMode_Mask": 3,
+ "AutoColor": 0,
+ "ColorOnly": 3,
+ "MonoOnly": 2,
+ "AlphaDither_Mask": 12,
+ "ThresholdAlphaDither": 0,
+ "OrderedAlphaDither": 4,
+ "DiffuseAlphaDither": 8,
+ "NoAlpha": 12,
+ "Dither_Mask": 48,
+ "DiffuseDither": 0,
+ "OrderedDither": 16,
+ "ThresholdDither": 32,
+ "DitherMode_Mask": 192,
+ "AutoDither": 0,
+ "PreferDither": 64,
+ "AvoidDither": 128,
+ "NoOpaqueDetection": 256,
+ "NoFormatConversion": 512
+ }
+ }
+ Enum {
+ name: "BGMode"
+ values: {
+ "TransparentMode": 0,
+ "OpaqueMode": 1
+ }
+ }
+ Enum {
+ name: "Key"
+ values: {
+ "Key_Escape": 16777216,
+ "Key_Tab": 16777217,
+ "Key_Backtab": 16777218,
+ "Key_Backspace": 16777219,
+ "Key_Return": 16777220,
+ "Key_Enter": 16777221,
+ "Key_Insert": 16777222,
+ "Key_Delete": 16777223,
+ "Key_Pause": 16777224,
+ "Key_Print": 16777225,
+ "Key_SysReq": 16777226,
+ "Key_Clear": 16777227,
+ "Key_Home": 16777232,
+ "Key_End": 16777233,
+ "Key_Left": 16777234,
+ "Key_Up": 16777235,
+ "Key_Right": 16777236,
+ "Key_Down": 16777237,
+ "Key_PageUp": 16777238,
+ "Key_PageDown": 16777239,
+ "Key_Shift": 16777248,
+ "Key_Control": 16777249,
+ "Key_Meta": 16777250,
+ "Key_Alt": 16777251,
+ "Key_CapsLock": 16777252,
+ "Key_NumLock": 16777253,
+ "Key_ScrollLock": 16777254,
+ "Key_F1": 16777264,
+ "Key_F2": 16777265,
+ "Key_F3": 16777266,
+ "Key_F4": 16777267,
+ "Key_F5": 16777268,
+ "Key_F6": 16777269,
+ "Key_F7": 16777270,
+ "Key_F8": 16777271,
+ "Key_F9": 16777272,
+ "Key_F10": 16777273,
+ "Key_F11": 16777274,
+ "Key_F12": 16777275,
+ "Key_F13": 16777276,
+ "Key_F14": 16777277,
+ "Key_F15": 16777278,
+ "Key_F16": 16777279,
+ "Key_F17": 16777280,
+ "Key_F18": 16777281,
+ "Key_F19": 16777282,
+ "Key_F20": 16777283,
+ "Key_F21": 16777284,
+ "Key_F22": 16777285,
+ "Key_F23": 16777286,
+ "Key_F24": 16777287,
+ "Key_F25": 16777288,
+ "Key_F26": 16777289,
+ "Key_F27": 16777290,
+ "Key_F28": 16777291,
+ "Key_F29": 16777292,
+ "Key_F30": 16777293,
+ "Key_F31": 16777294,
+ "Key_F32": 16777295,
+ "Key_F33": 16777296,
+ "Key_F34": 16777297,
+ "Key_F35": 16777298,
+ "Key_Super_L": 16777299,
+ "Key_Super_R": 16777300,
+ "Key_Menu": 16777301,
+ "Key_Hyper_L": 16777302,
+ "Key_Hyper_R": 16777303,
+ "Key_Help": 16777304,
+ "Key_Direction_L": 16777305,
+ "Key_Direction_R": 16777312,
+ "Key_Space": 32,
+ "Key_Any": 32,
+ "Key_Exclam": 33,
+ "Key_QuoteDbl": 34,
+ "Key_NumberSign": 35,
+ "Key_Dollar": 36,
+ "Key_Percent": 37,
+ "Key_Ampersand": 38,
+ "Key_Apostrophe": 39,
+ "Key_ParenLeft": 40,
+ "Key_ParenRight": 41,
+ "Key_Asterisk": 42,
+ "Key_Plus": 43,
+ "Key_Comma": 44,
+ "Key_Minus": 45,
+ "Key_Period": 46,
+ "Key_Slash": 47,
+ "Key_0": 48,
+ "Key_1": 49,
+ "Key_2": 50,
+ "Key_3": 51,
+ "Key_4": 52,
+ "Key_5": 53,
+ "Key_6": 54,
+ "Key_7": 55,
+ "Key_8": 56,
+ "Key_9": 57,
+ "Key_Colon": 58,
+ "Key_Semicolon": 59,
+ "Key_Less": 60,
+ "Key_Equal": 61,
+ "Key_Greater": 62,
+ "Key_Question": 63,
+ "Key_At": 64,
+ "Key_A": 65,
+ "Key_B": 66,
+ "Key_C": 67,
+ "Key_D": 68,
+ "Key_E": 69,
+ "Key_F": 70,
+ "Key_G": 71,
+ "Key_H": 72,
+ "Key_I": 73,
+ "Key_J": 74,
+ "Key_K": 75,
+ "Key_L": 76,
+ "Key_M": 77,
+ "Key_N": 78,
+ "Key_O": 79,
+ "Key_P": 80,
+ "Key_Q": 81,
+ "Key_R": 82,
+ "Key_S": 83,
+ "Key_T": 84,
+ "Key_U": 85,
+ "Key_V": 86,
+ "Key_W": 87,
+ "Key_X": 88,
+ "Key_Y": 89,
+ "Key_Z": 90,
+ "Key_BracketLeft": 91,
+ "Key_Backslash": 92,
+ "Key_BracketRight": 93,
+ "Key_AsciiCircum": 94,
+ "Key_Underscore": 95,
+ "Key_QuoteLeft": 96,
+ "Key_BraceLeft": 123,
+ "Key_Bar": 124,
+ "Key_BraceRight": 125,
+ "Key_AsciiTilde": 126,
+ "Key_nobreakspace": 160,
+ "Key_exclamdown": 161,
+ "Key_cent": 162,
+ "Key_sterling": 163,
+ "Key_currency": 164,
+ "Key_yen": 165,
+ "Key_brokenbar": 166,
+ "Key_section": 167,
+ "Key_diaeresis": 168,
+ "Key_copyright": 169,
+ "Key_ordfeminine": 170,
+ "Key_guillemotleft": 171,
+ "Key_notsign": 172,
+ "Key_hyphen": 173,
+ "Key_registered": 174,
+ "Key_macron": 175,
+ "Key_degree": 176,
+ "Key_plusminus": 177,
+ "Key_twosuperior": 178,
+ "Key_threesuperior": 179,
+ "Key_acute": 180,
+ "Key_mu": 181,
+ "Key_paragraph": 182,
+ "Key_periodcentered": 183,
+ "Key_cedilla": 184,
+ "Key_onesuperior": 185,
+ "Key_masculine": 186,
+ "Key_guillemotright": 187,
+ "Key_onequarter": 188,
+ "Key_onehalf": 189,
+ "Key_threequarters": 190,
+ "Key_questiondown": 191,
+ "Key_Agrave": 192,
+ "Key_Aacute": 193,
+ "Key_Acircumflex": 194,
+ "Key_Atilde": 195,
+ "Key_Adiaeresis": 196,
+ "Key_Aring": 197,
+ "Key_AE": 198,
+ "Key_Ccedilla": 199,
+ "Key_Egrave": 200,
+ "Key_Eacute": 201,
+ "Key_Ecircumflex": 202,
+ "Key_Ediaeresis": 203,
+ "Key_Igrave": 204,
+ "Key_Iacute": 205,
+ "Key_Icircumflex": 206,
+ "Key_Idiaeresis": 207,
+ "Key_ETH": 208,
+ "Key_Ntilde": 209,
+ "Key_Ograve": 210,
+ "Key_Oacute": 211,
+ "Key_Ocircumflex": 212,
+ "Key_Otilde": 213,
+ "Key_Odiaeresis": 214,
+ "Key_multiply": 215,
+ "Key_Ooblique": 216,
+ "Key_Ugrave": 217,
+ "Key_Uacute": 218,
+ "Key_Ucircumflex": 219,
+ "Key_Udiaeresis": 220,
+ "Key_Yacute": 221,
+ "Key_THORN": 222,
+ "Key_ssharp": 223,
+ "Key_division": 247,
+ "Key_ydiaeresis": 255,
+ "Key_AltGr": 16781571,
+ "Key_Multi_key": 16781600,
+ "Key_Codeinput": 16781623,
+ "Key_SingleCandidate": 16781628,
+ "Key_MultipleCandidate": 16781629,
+ "Key_PreviousCandidate": 16781630,
+ "Key_Mode_switch": 16781694,
+ "Key_Kanji": 16781601,
+ "Key_Muhenkan": 16781602,
+ "Key_Henkan": 16781603,
+ "Key_Romaji": 16781604,
+ "Key_Hiragana": 16781605,
+ "Key_Katakana": 16781606,
+ "Key_Hiragana_Katakana": 16781607,
+ "Key_Zenkaku": 16781608,
+ "Key_Hankaku": 16781609,
+ "Key_Zenkaku_Hankaku": 16781610,
+ "Key_Touroku": 16781611,
+ "Key_Massyo": 16781612,
+ "Key_Kana_Lock": 16781613,
+ "Key_Kana_Shift": 16781614,
+ "Key_Eisu_Shift": 16781615,
+ "Key_Eisu_toggle": 16781616,
+ "Key_Hangul": 16781617,
+ "Key_Hangul_Start": 16781618,
+ "Key_Hangul_End": 16781619,
+ "Key_Hangul_Hanja": 16781620,
+ "Key_Hangul_Jamo": 16781621,
+ "Key_Hangul_Romaja": 16781622,
+ "Key_Hangul_Jeonja": 16781624,
+ "Key_Hangul_Banja": 16781625,
+ "Key_Hangul_PreHanja": 16781626,
+ "Key_Hangul_PostHanja": 16781627,
+ "Key_Hangul_Special": 16781631,
+ "Key_Dead_Grave": 16781904,
+ "Key_Dead_Acute": 16781905,
+ "Key_Dead_Circumflex": 16781906,
+ "Key_Dead_Tilde": 16781907,
+ "Key_Dead_Macron": 16781908,
+ "Key_Dead_Breve": 16781909,
+ "Key_Dead_Abovedot": 16781910,
+ "Key_Dead_Diaeresis": 16781911,
+ "Key_Dead_Abovering": 16781912,
+ "Key_Dead_Doubleacute": 16781913,
+ "Key_Dead_Caron": 16781914,
+ "Key_Dead_Cedilla": 16781915,
+ "Key_Dead_Ogonek": 16781916,
+ "Key_Dead_Iota": 16781917,
+ "Key_Dead_Voiced_Sound": 16781918,
+ "Key_Dead_Semivoiced_Sound": 16781919,
+ "Key_Dead_Belowdot": 16781920,
+ "Key_Dead_Hook": 16781921,
+ "Key_Dead_Horn": 16781922,
+ "Key_Back": 16777313,
+ "Key_Forward": 16777314,
+ "Key_Stop": 16777315,
+ "Key_Refresh": 16777316,
+ "Key_VolumeDown": 16777328,
+ "Key_VolumeMute": 16777329,
+ "Key_VolumeUp": 16777330,
+ "Key_BassBoost": 16777331,
+ "Key_BassUp": 16777332,
+ "Key_BassDown": 16777333,
+ "Key_TrebleUp": 16777334,
+ "Key_TrebleDown": 16777335,
+ "Key_MediaPlay": 16777344,
+ "Key_MediaStop": 16777345,
+ "Key_MediaPrevious": 16777346,
+ "Key_MediaNext": 16777347,
+ "Key_MediaRecord": 16777348,
+ "Key_MediaPause": 16777349,
+ "Key_MediaTogglePlayPause": 16777350,
+ "Key_HomePage": 16777360,
+ "Key_Favorites": 16777361,
+ "Key_Search": 16777362,
+ "Key_Standby": 16777363,
+ "Key_OpenUrl": 16777364,
+ "Key_LaunchMail": 16777376,
+ "Key_LaunchMedia": 16777377,
+ "Key_Launch0": 16777378,
+ "Key_Launch1": 16777379,
+ "Key_Launch2": 16777380,
+ "Key_Launch3": 16777381,
+ "Key_Launch4": 16777382,
+ "Key_Launch5": 16777383,
+ "Key_Launch6": 16777384,
+ "Key_Launch7": 16777385,
+ "Key_Launch8": 16777386,
+ "Key_Launch9": 16777387,
+ "Key_LaunchA": 16777388,
+ "Key_LaunchB": 16777389,
+ "Key_LaunchC": 16777390,
+ "Key_LaunchD": 16777391,
+ "Key_LaunchE": 16777392,
+ "Key_LaunchF": 16777393,
+ "Key_MonBrightnessUp": 16777394,
+ "Key_MonBrightnessDown": 16777395,
+ "Key_KeyboardLightOnOff": 16777396,
+ "Key_KeyboardBrightnessUp": 16777397,
+ "Key_KeyboardBrightnessDown": 16777398,
+ "Key_PowerOff": 16777399,
+ "Key_WakeUp": 16777400,
+ "Key_Eject": 16777401,
+ "Key_ScreenSaver": 16777402,
+ "Key_WWW": 16777403,
+ "Key_Memo": 16777404,
+ "Key_LightBulb": 16777405,
+ "Key_Shop": 16777406,
+ "Key_History": 16777407,
+ "Key_AddFavorite": 16777408,
+ "Key_HotLinks": 16777409,
+ "Key_BrightnessAdjust": 16777410,
+ "Key_Finance": 16777411,
+ "Key_Community": 16777412,
+ "Key_AudioRewind": 16777413,
+ "Key_BackForward": 16777414,
+ "Key_ApplicationLeft": 16777415,
+ "Key_ApplicationRight": 16777416,
+ "Key_Book": 16777417,
+ "Key_CD": 16777418,
+ "Key_Calculator": 16777419,
+ "Key_ToDoList": 16777420,
+ "Key_ClearGrab": 16777421,
+ "Key_Close": 16777422,
+ "Key_Copy": 16777423,
+ "Key_Cut": 16777424,
+ "Key_Display": 16777425,
+ "Key_DOS": 16777426,
+ "Key_Documents": 16777427,
+ "Key_Excel": 16777428,
+ "Key_Explorer": 16777429,
+ "Key_Game": 16777430,
+ "Key_Go": 16777431,
+ "Key_iTouch": 16777432,
+ "Key_LogOff": 16777433,
+ "Key_Market": 16777434,
+ "Key_Meeting": 16777435,
+ "Key_MenuKB": 16777436,
+ "Key_MenuPB": 16777437,
+ "Key_MySites": 16777438,
+ "Key_News": 16777439,
+ "Key_OfficeHome": 16777440,
+ "Key_Option": 16777441,
+ "Key_Paste": 16777442,
+ "Key_Phone": 16777443,
+ "Key_Calendar": 16777444,
+ "Key_Reply": 16777445,
+ "Key_Reload": 16777446,
+ "Key_RotateWindows": 16777447,
+ "Key_RotationPB": 16777448,
+ "Key_RotationKB": 16777449,
+ "Key_Save": 16777450,
+ "Key_Send": 16777451,
+ "Key_Spell": 16777452,
+ "Key_SplitScreen": 16777453,
+ "Key_Support": 16777454,
+ "Key_TaskPane": 16777455,
+ "Key_Terminal": 16777456,
+ "Key_Tools": 16777457,
+ "Key_Travel": 16777458,
+ "Key_Video": 16777459,
+ "Key_Word": 16777460,
+ "Key_Xfer": 16777461,
+ "Key_ZoomIn": 16777462,
+ "Key_ZoomOut": 16777463,
+ "Key_Away": 16777464,
+ "Key_Messenger": 16777465,
+ "Key_WebCam": 16777466,
+ "Key_MailForward": 16777467,
+ "Key_Pictures": 16777468,
+ "Key_Music": 16777469,
+ "Key_Battery": 16777470,
+ "Key_Bluetooth": 16777471,
+ "Key_WLAN": 16777472,
+ "Key_UWB": 16777473,
+ "Key_AudioForward": 16777474,
+ "Key_AudioRepeat": 16777475,
+ "Key_AudioRandomPlay": 16777476,
+ "Key_Subtitle": 16777477,
+ "Key_AudioCycleTrack": 16777478,
+ "Key_Time": 16777479,
+ "Key_Hibernate": 16777480,
+ "Key_View": 16777481,
+ "Key_TopMenu": 16777482,
+ "Key_PowerDown": 16777483,
+ "Key_Suspend": 16777484,
+ "Key_ContrastAdjust": 16777485,
+ "Key_LaunchG": 16777486,
+ "Key_LaunchH": 16777487,
+ "Key_TouchpadToggle": 16777488,
+ "Key_TouchpadOn": 16777489,
+ "Key_TouchpadOff": 16777490,
+ "Key_MicMute": 16777491,
+ "Key_Red": 16777492,
+ "Key_Green": 16777493,
+ "Key_Yellow": 16777494,
+ "Key_Blue": 16777495,
+ "Key_ChannelUp": 16777496,
+ "Key_ChannelDown": 16777497,
+ "Key_MediaLast": 16842751,
+ "Key_Select": 16842752,
+ "Key_Yes": 16842753,
+ "Key_No": 16842754,
+ "Key_Cancel": 16908289,
+ "Key_Printer": 16908290,
+ "Key_Execute": 16908291,
+ "Key_Sleep": 16908292,
+ "Key_Play": 16908293,
+ "Key_Zoom": 16908294,
+ "Key_Context1": 17825792,
+ "Key_Context2": 17825793,
+ "Key_Context3": 17825794,
+ "Key_Context4": 17825795,
+ "Key_Call": 17825796,
+ "Key_Hangup": 17825797,
+ "Key_Flip": 17825798,
+ "Key_ToggleCallHangup": 17825799,
+ "Key_VoiceDial": 17825800,
+ "Key_LastNumberRedial": 17825801,
+ "Key_Camera": 17825824,
+ "Key_CameraFocus": 17825825,
+ "Key_unknown": 33554431
+ }
+ }
+ Enum {
+ name: "ArrowType"
+ values: {
+ "NoArrow": 0,
+ "UpArrow": 1,
+ "DownArrow": 2,
+ "LeftArrow": 3,
+ "RightArrow": 4
+ }
+ }
+ Enum {
+ name: "PenStyle"
+ values: {
+ "NoPen": 0,
+ "SolidLine": 1,
+ "DashLine": 2,
+ "DotLine": 3,
+ "DashDotLine": 4,
+ "DashDotDotLine": 5,
+ "CustomDashLine": 6
+ }
+ }
+ Enum {
+ name: "PenCapStyle"
+ values: {
+ "FlatCap": 0,
+ "SquareCap": 16,
+ "RoundCap": 32,
+ "MPenCapStyle": 48
+ }
+ }
+ Enum {
+ name: "PenJoinStyle"
+ values: {
+ "MiterJoin": 0,
+ "BevelJoin": 64,
+ "RoundJoin": 128,
+ "SvgMiterJoin": 256,
+ "MPenJoinStyle": 448
+ }
+ }
+ Enum {
+ name: "BrushStyle"
+ values: {
+ "NoBrush": 0,
+ "SolidPattern": 1,
+ "Dense1Pattern": 2,
+ "Dense2Pattern": 3,
+ "Dense3Pattern": 4,
+ "Dense4Pattern": 5,
+ "Dense5Pattern": 6,
+ "Dense6Pattern": 7,
+ "Dense7Pattern": 8,
+ "HorPattern": 9,
+ "VerPattern": 10,
+ "CrossPattern": 11,
+ "BDiagPattern": 12,
+ "FDiagPattern": 13,
+ "DiagCrossPattern": 14,
+ "LinearGradientPattern": 15,
+ "RadialGradientPattern": 16,
+ "ConicalGradientPattern": 17,
+ "TexturePattern": 24
+ }
+ }
+ Enum {
+ name: "SizeMode"
+ values: {
+ "AbsoluteSize": 0,
+ "RelativeSize": 1
+ }
+ }
+ Enum {
+ name: "CursorShape"
+ values: {
+ "ArrowCursor": 0,
+ "UpArrowCursor": 1,
+ "CrossCursor": 2,
+ "WaitCursor": 3,
+ "IBeamCursor": 4,
+ "SizeVerCursor": 5,
+ "SizeHorCursor": 6,
+ "SizeBDiagCursor": 7,
+ "SizeFDiagCursor": 8,
+ "SizeAllCursor": 9,
+ "BlankCursor": 10,
+ "SplitVCursor": 11,
+ "SplitHCursor": 12,
+ "PointingHandCursor": 13,
+ "ForbiddenCursor": 14,
+ "WhatsThisCursor": 15,
+ "BusyCursor": 16,
+ "OpenHandCursor": 17,
+ "ClosedHandCursor": 18,
+ "DragCopyCursor": 19,
+ "DragMoveCursor": 20,
+ "DragLinkCursor": 21,
+ "LastCursor": 21,
+ "BitmapCursor": 24,
+ "CustomCursor": 25
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2
+ }
+ }
+ Enum {
+ name: "AspectRatioMode"
+ values: {
+ "IgnoreAspectRatio": 0,
+ "KeepAspectRatio": 1,
+ "KeepAspectRatioByExpanding": 2
+ }
+ }
+ Enum {
+ name: "DockWidgetArea"
+ values: {
+ "LeftDockWidgetArea": 1,
+ "RightDockWidgetArea": 2,
+ "TopDockWidgetArea": 4,
+ "BottomDockWidgetArea": 8,
+ "DockWidgetArea_Mask": 15,
+ "AllDockWidgetAreas": 15,
+ "NoDockWidgetArea": 0
+ }
+ }
+ Enum {
+ name: "DockWidgetAreas"
+ values: {
+ "LeftDockWidgetArea": 1,
+ "RightDockWidgetArea": 2,
+ "TopDockWidgetArea": 4,
+ "BottomDockWidgetArea": 8,
+ "DockWidgetArea_Mask": 15,
+ "AllDockWidgetAreas": 15,
+ "NoDockWidgetArea": 0
+ }
+ }
+ Enum {
+ name: "ToolBarArea"
+ values: {
+ "LeftToolBarArea": 1,
+ "RightToolBarArea": 2,
+ "TopToolBarArea": 4,
+ "BottomToolBarArea": 8,
+ "ToolBarArea_Mask": 15,
+ "AllToolBarAreas": 15,
+ "NoToolBarArea": 0
+ }
+ }
+ Enum {
+ name: "ToolBarAreas"
+ values: {
+ "LeftToolBarArea": 1,
+ "RightToolBarArea": 2,
+ "TopToolBarArea": 4,
+ "BottomToolBarArea": 8,
+ "ToolBarArea_Mask": 15,
+ "AllToolBarAreas": 15,
+ "NoToolBarArea": 0
+ }
+ }
+ Enum {
+ name: "DateFormat"
+ values: {
+ "TextDate": 0,
+ "ISODate": 1,
+ "SystemLocaleDate": 2,
+ "LocalDate": 2,
+ "LocaleDate": 3,
+ "SystemLocaleShortDate": 4,
+ "SystemLocaleLongDate": 5,
+ "DefaultLocaleShortDate": 6,
+ "DefaultLocaleLongDate": 7,
+ "RFC2822Date": 8
+ }
+ }
+ Enum {
+ name: "TimeSpec"
+ values: {
+ "LocalTime": 0,
+ "UTC": 1,
+ "OffsetFromUTC": 2,
+ "TimeZone": 3
+ }
+ }
+ Enum {
+ name: "DayOfWeek"
+ values: {
+ "Monday": 1,
+ "Tuesday": 2,
+ "Wednesday": 3,
+ "Thursday": 4,
+ "Friday": 5,
+ "Saturday": 6,
+ "Sunday": 7
+ }
+ }
+ Enum {
+ name: "ScrollBarPolicy"
+ values: {
+ "ScrollBarAsNeeded": 0,
+ "ScrollBarAlwaysOff": 1,
+ "ScrollBarAlwaysOn": 2
+ }
+ }
+ Enum {
+ name: "CaseSensitivity"
+ values: {
+ "CaseInsensitive": 0,
+ "CaseSensitive": 1
+ }
+ }
+ Enum {
+ name: "Corner"
+ values: {
+ "TopLeftCorner": 0,
+ "TopRightCorner": 1,
+ "BottomLeftCorner": 2,
+ "BottomRightCorner": 3
+ }
+ }
+ Enum {
+ name: "Edge"
+ values: {
+ "TopEdge": 1,
+ "LeftEdge": 2,
+ "RightEdge": 4,
+ "BottomEdge": 8
+ }
+ }
+ Enum {
+ name: "ConnectionType"
+ values: {
+ "AutoConnection": 0,
+ "DirectConnection": 1,
+ "QueuedConnection": 2,
+ "BlockingQueuedConnection": 3,
+ "UniqueConnection": 128
+ }
+ }
+ Enum {
+ name: "ShortcutContext"
+ values: {
+ "WidgetShortcut": 0,
+ "WindowShortcut": 1,
+ "ApplicationShortcut": 2,
+ "WidgetWithChildrenShortcut": 3
+ }
+ }
+ Enum {
+ name: "FillRule"
+ values: {
+ "OddEvenFill": 0,
+ "WindingFill": 1
+ }
+ }
+ Enum {
+ name: "MaskMode"
+ values: {
+ "MaskInColor": 0,
+ "MaskOutColor": 1
+ }
+ }
+ Enum {
+ name: "ClipOperation"
+ values: {
+ "NoClip": 0,
+ "ReplaceClip": 1,
+ "IntersectClip": 2
+ }
+ }
+ Enum {
+ name: "ItemSelectionMode"
+ values: {
+ "ContainsItemShape": 0,
+ "IntersectsItemShape": 1,
+ "ContainsItemBoundingRect": 2,
+ "IntersectsItemBoundingRect": 3
+ }
+ }
+ Enum {
+ name: "TransformationMode"
+ values: {
+ "FastTransformation": 0,
+ "SmoothTransformation": 1
+ }
+ }
+ Enum {
+ name: "Axis"
+ values: {
+ "XAxis": 0,
+ "YAxis": 1,
+ "ZAxis": 2
+ }
+ }
+ Enum {
+ name: "ContextMenuPolicy"
+ values: {
+ "NoContextMenu": 0,
+ "DefaultContextMenu": 1,
+ "ActionsContextMenu": 2,
+ "CustomContextMenu": 3,
+ "PreventContextMenu": 4
+ }
+ }
+ Enum {
+ name: "InputMethodQuery"
+ values: {
+ "ImEnabled": 1,
+ "ImCursorRectangle": 2,
+ "ImMicroFocus": 2,
+ "ImFont": 4,
+ "ImCursorPosition": 8,
+ "ImSurroundingText": 16,
+ "ImCurrentSelection": 32,
+ "ImMaximumTextLength": 64,
+ "ImAnchorPosition": 128,
+ "ImHints": 256,
+ "ImPreferredLanguage": 512,
+ "ImPlatformData": -2147483648,
+ "ImQueryInput": 186,
+ "ImQueryAll": -1
+ }
+ }
+ Enum {
+ name: "InputMethodQueries"
+ values: {
+ "ImEnabled": 1,
+ "ImCursorRectangle": 2,
+ "ImMicroFocus": 2,
+ "ImFont": 4,
+ "ImCursorPosition": 8,
+ "ImSurroundingText": 16,
+ "ImCurrentSelection": 32,
+ "ImMaximumTextLength": 64,
+ "ImAnchorPosition": 128,
+ "ImHints": 256,
+ "ImPreferredLanguage": 512,
+ "ImPlatformData": -2147483648,
+ "ImQueryInput": 186,
+ "ImQueryAll": -1
+ }
+ }
+ Enum {
+ name: "InputMethodHint"
+ values: {
+ "ImhNone": 0,
+ "ImhHiddenText": 1,
+ "ImhSensitiveData": 2,
+ "ImhNoAutoUppercase": 4,
+ "ImhPreferNumbers": 8,
+ "ImhPreferUppercase": 16,
+ "ImhPreferLowercase": 32,
+ "ImhNoPredictiveText": 64,
+ "ImhDate": 128,
+ "ImhTime": 256,
+ "ImhPreferLatin": 512,
+ "ImhMultiLine": 1024,
+ "ImhDigitsOnly": 65536,
+ "ImhFormattedNumbersOnly": 131072,
+ "ImhUppercaseOnly": 262144,
+ "ImhLowercaseOnly": 524288,
+ "ImhDialableCharactersOnly": 1048576,
+ "ImhEmailCharactersOnly": 2097152,
+ "ImhUrlCharactersOnly": 4194304,
+ "ImhLatinOnly": 8388608,
+ "ImhExclusiveInputMask": -65536
+ }
+ }
+ Enum {
+ name: "InputMethodHints"
+ values: {
+ "ImhNone": 0,
+ "ImhHiddenText": 1,
+ "ImhSensitiveData": 2,
+ "ImhNoAutoUppercase": 4,
+ "ImhPreferNumbers": 8,
+ "ImhPreferUppercase": 16,
+ "ImhPreferLowercase": 32,
+ "ImhNoPredictiveText": 64,
+ "ImhDate": 128,
+ "ImhTime": 256,
+ "ImhPreferLatin": 512,
+ "ImhMultiLine": 1024,
+ "ImhDigitsOnly": 65536,
+ "ImhFormattedNumbersOnly": 131072,
+ "ImhUppercaseOnly": 262144,
+ "ImhLowercaseOnly": 524288,
+ "ImhDialableCharactersOnly": 1048576,
+ "ImhEmailCharactersOnly": 2097152,
+ "ImhUrlCharactersOnly": 4194304,
+ "ImhLatinOnly": 8388608,
+ "ImhExclusiveInputMask": -65536
+ }
+ }
+ Enum {
+ name: "ToolButtonStyle"
+ values: {
+ "ToolButtonIconOnly": 0,
+ "ToolButtonTextOnly": 1,
+ "ToolButtonTextBesideIcon": 2,
+ "ToolButtonTextUnderIcon": 3,
+ "ToolButtonFollowStyle": 4
+ }
+ }
+ Enum {
+ name: "LayoutDirection"
+ values: {
+ "LeftToRight": 0,
+ "RightToLeft": 1,
+ "LayoutDirectionAuto": 2
+ }
+ }
+ Enum {
+ name: "DropAction"
+ values: {
+ "CopyAction": 1,
+ "MoveAction": 2,
+ "LinkAction": 4,
+ "ActionMask": 255,
+ "TargetMoveAction": 32770,
+ "IgnoreAction": 0
+ }
+ }
+ Enum {
+ name: "DropActions"
+ values: {
+ "CopyAction": 1,
+ "MoveAction": 2,
+ "LinkAction": 4,
+ "ActionMask": 255,
+ "TargetMoveAction": 32770,
+ "IgnoreAction": 0
+ }
+ }
+ Enum {
+ name: "CheckState"
+ values: {
+ "Unchecked": 0,
+ "PartiallyChecked": 1,
+ "Checked": 2
+ }
+ }
+ Enum {
+ name: "ItemFlags"
+ values: {
+ "NoItemFlags": 0,
+ "ItemIsSelectable": 1,
+ "ItemIsEditable": 2,
+ "ItemIsDragEnabled": 4,
+ "ItemIsDropEnabled": 8,
+ "ItemIsUserCheckable": 16,
+ "ItemIsEnabled": 32,
+ "ItemIsTristate": 64,
+ "ItemNeverHasChildren": 128
+ }
+ }
+ Enum {
+ name: "MatchFlags"
+ values: {
+ "MatchExactly": 0,
+ "MatchContains": 1,
+ "MatchStartsWith": 2,
+ "MatchEndsWith": 3,
+ "MatchRegExp": 4,
+ "MatchWildcard": 5,
+ "MatchFixedString": 8,
+ "MatchCaseSensitive": 16,
+ "MatchWrap": 32,
+ "MatchRecursive": 64
+ }
+ }
+ Enum {
+ name: "WindowModality"
+ values: {
+ "NonModal": 0,
+ "WindowModal": 1,
+ "ApplicationModal": 2
+ }
+ }
+ Enum {
+ name: "TextInteractionFlag"
+ values: {
+ "NoTextInteraction": 0,
+ "TextSelectableByMouse": 1,
+ "TextSelectableByKeyboard": 2,
+ "LinksAccessibleByMouse": 4,
+ "LinksAccessibleByKeyboard": 8,
+ "TextEditable": 16,
+ "TextEditorInteraction": 19,
+ "TextBrowserInteraction": 13
+ }
+ }
+ Enum {
+ name: "TextInteractionFlags"
+ values: {
+ "NoTextInteraction": 0,
+ "TextSelectableByMouse": 1,
+ "TextSelectableByKeyboard": 2,
+ "LinksAccessibleByMouse": 4,
+ "LinksAccessibleByKeyboard": 8,
+ "TextEditable": 16,
+ "TextEditorInteraction": 19,
+ "TextBrowserInteraction": 13
+ }
+ }
+ Enum {
+ name: "SizeHint"
+ values: {
+ "MinimumSize": 0,
+ "PreferredSize": 1,
+ "MaximumSize": 2,
+ "MinimumDescent": 3,
+ "NSizeHints": 4
+ }
+ }
+ Enum {
+ name: "GestureState"
+ values: {
+ "NoGesture": 0,
+ "GestureStarted": 1,
+ "GestureUpdated": 2,
+ "GestureFinished": 3,
+ "GestureCanceled": 4
+ }
+ }
+ Enum {
+ name: "GestureType"
+ values: {
+ "TapGesture": 1,
+ "TapAndHoldGesture": 2,
+ "PanGesture": 3,
+ "PinchGesture": 4,
+ "SwipeGesture": 5,
+ "CustomGesture": 256,
+ "LastGestureType": -1
+ }
+ }
+ Enum {
+ name: "CursorMoveStyle"
+ values: {
+ "LogicalMoveStyle": 0,
+ "VisualMoveStyle": 1
+ }
+ }
+ Enum {
+ name: "TimerType"
+ values: {
+ "PreciseTimer": 0,
+ "CoarseTimer": 1,
+ "VeryCoarseTimer": 2
+ }
+ }
+ Enum {
+ name: "ScrollPhase"
+ values: {
+ "ScrollBegin": 1,
+ "ScrollUpdate": 2,
+ "ScrollEnd": 3
+ }
+ }
+ }
+ Component { name: "QEasingCurve"; prototype: "QQmlEasingValueType" }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/qmldir b/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/qmldir
new file mode 100644
index 0000000000..4a79c82e76
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/qmldir
@@ -0,0 +1,4 @@
+module QtQuick
+plugin qtquick2plugin
+classname QtQuick2Plugin
+typeinfo plugins.qmltypes
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ApplicationWindow.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ApplicationWindow.qml
new file mode 100644
index 0000000000..6e0160df27
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ApplicationWindow.qml
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick.Window 2.1
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Layouts 1.0
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ApplicationWindow
+ \since 5.1
+ \inqmlmodule QtQuick.Controls
+ \ingroup applicationwindow
+ \brief Provides a top-level application window.
+
+ ApplicationWindow is a \l Window that adds convenience for positioning items,
+ such as \l MenuBar, \l ToolBar, and \l StatusBar in a platform independent
+ manner.
+
+ \code
+ ApplicationWindow {
+ id: window
+ menuBar: MenuBar {
+ Menu { MenuItem {...} }
+ Menu { MenuItem {...} }
+ }
+
+ toolBar: ToolBar {
+ RowLayout {
+ anchors.fill: parent
+ ToolButton {...}
+ }
+ }
+
+ TabView {
+ id: myContent
+ anchors.fill: parent
+ ...
+ }
+ }
+ \endcode
+*/
+
+Window {
+ id: root
+
+ /*!
+ \qmlproperty MenuBar ApplicationWindow::menuBar
+
+ This property holds the \l MenuBar.
+
+ By default, this value is not set.
+ */
+ property MenuBar menuBar: null
+
+ /*!
+ \qmlproperty Item ApplicationWindow::toolBar
+
+ This property holds the toolbar \l Item.
+
+ It can be set to any Item type, but is generally used with \l ToolBar.
+
+ By default, this value is not set. When you set the toolbar item, it will
+ be anchored automatically into the application window.
+ */
+ property Item toolBar
+
+ /*!
+ \qmlproperty Item ApplicationWindow::statusBar
+
+ This property holds the status bar \l Item.
+
+ It can be set to any Item type, but is generally used with \l StatusBar.
+
+ By default, this value is not set. When you set the status bar item, it
+ will be anchored automatically into the application window.
+ */
+ property Item statusBar
+
+ onToolBarChanged: { if (toolBar) { toolBar.parent = toolBarArea } }
+
+ onStatusBarChanged: { if (statusBar) { statusBar.parent = statusBarArea } }
+
+ onVisibleChanged: { if (visible && menuBar) { menuBar.__parentWindow = root } }
+
+ /*! \internal */
+ default property alias data: contentArea.data
+
+ color: syspal.window
+
+ flags: Qt.Window | Qt.WindowFullscreenButtonHint |
+ Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint |
+ Qt.WindowCloseButtonHint | Qt.WindowFullscreenButtonHint
+ // QTBUG-35049: Windows is removing features we didn't ask for, even though Qt::CustomizeWindowHint is not set
+ // Otherwise Qt.Window | Qt.WindowFullscreenButtonHint would be enough
+
+ SystemPalette {id: syspal}
+
+ Item {
+ id: backgroundItem
+ anchors.fill: parent
+
+ Keys.forwardTo: menuBar ? [menuBar.__contentItem] : []
+
+ Item {
+ id: contentArea
+ anchors.top: toolBarArea.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: statusBarArea.top
+ }
+
+ Item {
+ id: toolBarArea
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ implicitHeight: childrenRect.height
+ height: visibleChildren.length > 0 ? implicitHeight: 0
+ }
+
+ Item {
+ id: statusBarArea
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ implicitHeight: childrenRect.height
+ height: visibleChildren.length > 0 ? implicitHeight: 0
+ }
+
+ onVisibleChanged: if (visible && menuBar) menuBar.__parentWindow = root
+
+ states: State {
+ name: "hasMenuBar"
+ when: menuBar && !menuBar.__isNative
+
+ ParentChange {
+ target: menuBar.__contentItem
+ parent: backgroundItem
+ }
+
+ PropertyChanges {
+ target: menuBar.__contentItem
+ x: 0
+ y: 0
+ width: backgroundItem.width
+ }
+
+ AnchorChanges {
+ target: toolBarArea
+ anchors.top: menuBar.__contentItem.bottom
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/BusyIndicator.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/BusyIndicator.qml
new file mode 100644
index 0000000000..01820bb820
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/BusyIndicator.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype BusyIndicator
+ \inqmlmodule QtQuick.Controls
+ \since 5.2
+ \ingroup controls
+ \brief A busy indicator.
+
+ The busy indicator should be used to indicate activity while content is
+ being loaded or the UI is blocked waiting for a resource to become available.
+
+ You can create a custom appearance for a Busy Indicator by
+ assigning a \l {QtQuick.Controls.Styles::BusyIndicatorStyle}{BusyIndicatorStyle}.
+ */
+Control {
+ id: indicator
+
+ /*! \qmlproperty bool BusyIndicator::running
+
+ This property holds whether the busy indicator is currently indicating
+ activity.
+
+ \note The indicator is only visible when this property is set to \c true.
+
+ The default value is \c true.
+ */
+ property bool running: true
+
+ Accessible.role: Accessible.Indicator
+ Accessible.name: "busy"
+
+ style: Qt.createComponent(Settings.style + "/BusyIndicatorStyle.qml", indicator)
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Button.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Button.qml
new file mode 100644
index 0000000000..1875e423a6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Button.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Button
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A push button with a text label.
+
+ The push button is perhaps the most commonly used widget in any graphical
+ user interface. Pushing (or clicking) a button commands the computer to
+ perform some action or answer a question. Common examples of buttons are
+ OK, Apply, Cancel, Close, Yes, No, and Help buttons.
+
+ Button is similar to the QPushButton widget.
+
+ You can create a custom appearance for a Button by
+ assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}.
+ */
+BasicButton {
+ id: button
+
+ /*! This property holds whether the push button is the default button.
+ Default buttons decide what happens when the user presses enter in a
+ dialog without giving a button explicit focus. \note This property only
+ changes the appearance of the button. The expected behavior needs to be
+ implemented by the user.
+
+ The default value is \c false.
+ */
+ property bool isDefault: false
+
+ /*! Assign a \l Menu to this property to get a pull-down menu button.
+
+ The default value is \c null.
+ */
+ property Menu menu: null
+
+ __effectivePressed: __behavior.effectivePressed || menu && menu.__popupVisible
+
+ activeFocusOnTab: true
+
+ Accessible.name: text
+
+ style: Qt.createComponent(Settings.style + "/ButtonStyle.qml", button)
+
+ Binding {
+ target: menu
+ property: "__minimumWidth"
+ value: button.__panel.width
+ }
+
+ Binding {
+ target: menu
+ property: "__visualItem"
+ value: button
+ }
+
+ Connections {
+ target: __behavior
+ onEffectivePressedChanged: {
+ if (__behavior.effectivePressed && menu)
+ popupMenuTimer.start()
+ }
+ }
+
+ Timer {
+ id: popupMenuTimer
+ interval: 10
+ onTriggered: {
+ __behavior.keyPressed = false
+ if (Qt.application.layoutDirection === Qt.RightToLeft)
+ menu.__popup(button.width, button.height, 0)
+ else
+ menu.__popup(0, button.height, 0)
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/CheckBox.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/CheckBox.qml
new file mode 100644
index 0000000000..00671755c7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/CheckBox.qml
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype CheckBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A checkbox with a text label.
+
+ A CheckBox is an option button that can be toggled on (checked) or off
+ (unchecked). Checkboxes are typically used to represent features in an
+ application that can be enabled or disabled without affecting others.
+
+ The state of the checkbox can be set with the \l {AbstractCheckable::checked}{checked} property.
+
+ In addition to the checked and unchecked states, there is a third state:
+ partially checked. This state indicates that the
+ regular checked/unchecked state can not be determined; generally because of
+ other states that affect the checkbox. This state is useful when several
+ child nodes are selected in a treeview, for example.
+
+ The partially checked state can be made available to the user by setting
+ \l partiallyCheckedEnabled to \c true, or set directly by setting
+ \l checkedState to \c Qt.PartiallyChecked. \l checkedState behaves
+ identically to \l {AbstractCheckable::checked}{checked} when \l partiallyCheckedEnabled
+ is \c false; setting one will appropriately set the other.
+
+ The label is shown next to the checkbox, and you can set the label text using its
+ \l {AbstractCheckable::text}{text} property.
+
+ \qml
+ Column {
+ CheckBox {
+ text: qsTr("Breakfast")
+ }
+ CheckBox {
+ text: qsTr("Lunch")
+ }
+ CheckBox {
+ text: qsTr("Dinner")
+ }
+ }
+ \endqml
+
+ Whenever a CheckBox is clicked, it emits the \l {AbstractCheckable::clicked}{clicked()} signal.
+
+ You can create a custom appearance for a CheckBox by
+ assigning a \l {QtQuick.Controls.Styles::CheckBoxStyle}{CheckBoxStyle}.
+*/
+
+AbstractCheckable {
+ id: checkBox
+
+ /*!
+ \qmlproperty enumeration CheckBox::checkedState
+
+ This property indicates the current checked state of the checkbox.
+
+ Possible values:
+ \c Qt.UnChecked - The checkbox is not checked (default).
+ \c Qt.Checked - The checkbox is checked.
+ \c Qt.PartiallyChecked - The checkbox is in a partially checked (or
+ "mixed") state.
+
+ The \l {AbstractCheckable::checked}{checked} property also determines whether
+ this property is \c Qt.Checked or \c Qt.UnChecked, and vice versa.
+ */
+ property int checkedState: checked ? Qt.Checked : Qt.Unchecked
+
+ /*!
+ This property determines whether the \c Qt.PartiallyChecked state is
+ available.
+
+ A checkbox may be in a partially checked state when the regular checked
+ state can not be determined.
+
+ Setting \l checkedState to \c Qt.PartiallyChecked will implicitly set
+ this property to \c true.
+
+ If this property is \c true, \l {AbstractCheckable::checked}{checked} will be \c false.
+
+ By default, this property is \c false.
+ */
+ property bool partiallyCheckedEnabled: false
+
+ /*!
+ \internal
+ True if onCheckedChanged should be ignored because we were reacting
+ to onCheckedStateChanged.
+ */
+ property bool __ignoreChecked: false
+
+ style: Qt.createComponent(Settings.style + "/CheckBoxStyle.qml", checkBox)
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.CheckBox
+ Accessible.name: text
+
+ __cycleStatesHandler: __cycleCheckBoxStates
+
+ onCheckedChanged: {
+ if (!__ignoreChecked)
+ checkedState = checked ? Qt.Checked : Qt.Unchecked;
+ }
+
+ onCheckedStateChanged: {
+ __ignoreChecked = true;
+ if (checkedState === Qt.PartiallyChecked) {
+ partiallyCheckedEnabled = true;
+ checked = false;
+ } else {
+ checked = checkedState === Qt.Checked;
+ }
+ __ignoreChecked = false;
+ }
+
+ onPartiallyCheckedEnabledChanged: {
+ if (exclusiveGroup && partiallyCheckedEnabled) {
+ console.warn("Cannot have partially checked boxes in an ExclusiveGroup.");
+ }
+ }
+
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup && partiallyCheckedEnabled) {
+ console.warn("Cannot have partially checked boxes in an ExclusiveGroup.");
+ }
+ }
+
+ /*! \internal */
+ function __cycleCheckBoxStates() {
+ if (!partiallyCheckedEnabled) {
+ checked = !checked;
+ } else {
+ switch (checkedState) {
+ case Qt.Unchecked: checkedState = Qt.Checked; break;
+ case Qt.Checked: checkedState = Qt.PartiallyChecked; break;
+ case Qt.PartiallyChecked: checkedState = Qt.Unchecked; break;
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ComboBox.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ComboBox.qml
new file mode 100644
index 0000000000..db39f579fe
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ComboBox.qml
@@ -0,0 +1,562 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ComboBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Provides a drop-down list functionality.
+
+ Add items to the comboBox by assigning it a ListModel, or a list of strings to the \l model property.
+
+ \qml
+ ComboBox {
+ width: 200
+ model: [ "Banana", "Apple", "Coconut" ]
+ }
+ \endqml
+
+ In this example we are demonstrating how to use a ListModel with a combo box.
+
+ \qml
+ ComboBox {
+ currentIndex: 2
+ model: ListModel {
+ id: cbItems
+ ListElement { text: "Banana"; color: "Yellow" }
+ ListElement { text: "Apple"; color: "Green" }
+ ListElement { text: "Coconut"; color: "Brown" }
+ }
+ width: 200
+ onCurrentIndexChanged: console.debug(cbItems.get(currentIndex).text + ", " + cbItems.get(currentIndex).color)
+ }
+ \endqml
+
+ You can make a combo box editable by setting the \l editable property. An editable combo box will
+ autocomplete its text based on what is available in the model.
+
+ In the next example we demonstrate how you can append content to an editable combo box by
+ reacting to the \l accepted signal. Note that you have to explicitly prevent duplicates.
+
+ \qml
+ ComboBox {
+ editable: true
+ model: ListModel {
+ id: model
+ ListElement { text: "Banana"; color: "Yellow" }
+ ListElement { text: "Apple"; color: "Green" }
+ ListElement { text: "Coconut"; color: "Brown" }
+ }
+ onAccepted: {
+ if (editableCombo.find(currentText) === -1) {
+ model.append({text: editText})
+ currentIndex = editableCombo.find(editText)
+ }
+ }
+ }
+ \endqml
+
+
+ You can create a custom appearance for a ComboBox by
+ assigning a \l {QtQuick.Controls.Styles::ComboBoxStyle}{ComboBoxStyle}.
+*/
+
+Control {
+ id: comboBox
+
+ /*! \qmlproperty model ComboBox::model
+ The model to populate the ComboBox from.
+
+ Changing the model after initialization will reset \l currentIndex to \c 0.
+ */
+ property alias model: popupItems.model
+
+ /*! The model role used for populating the ComboBox. */
+ property string textRole: ""
+
+ /*! \qmlproperty int ComboBox::currentIndex
+ The index of the currently selected item in the ComboBox.
+
+ \sa model
+ */
+ property alias currentIndex: popup.__selectedIndex
+
+ /*! \qmlproperty string ComboBox::currentText
+ The text of the currently selected item in the ComboBox.
+
+ \note Since \c currentText depends on \c currentIndex, there's no way to ensure \c currentText
+ will be up to date whenever a \c onCurrentIndexChanged handler is called.
+ */
+ readonly property alias currentText: popup.currentText
+
+ /*! This property holds whether the combo box can be edited by the user.
+ The default value is \c false.
+ \since QtQuick.Controls 1.1
+ */
+ property bool editable: false
+
+ /*! \qmlproperty string ComboBox::editText
+ \since QtQuick.Controls 1.1
+ This property specifies text being manipulated by the user for an editable combo box.
+ */
+ property alias editText: input.text
+
+ /*! This property specifies whether the combobox should gain active focus when pressed.
+ The default value is \c false. */
+ property bool activeFocusOnPress: false
+
+ /*! \qmlproperty bool ComboBox::pressed
+
+ This property holds whether the button is being pressed. */
+ readonly property bool pressed: mouseArea.pressed && mouseArea.containsMouse || popup.__popupVisible
+
+ /*! \qmlproperty bool ComboBox::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*! \qmlproperty int ComboBox::count
+ \since QtQuick.Controls 1.1
+ This property holds the number of items in the combo box.
+ */
+ readonly property alias count: popupItems.count
+
+ /*! Returns the text for a given \a index.
+ If an invalid index is provided, \c null is returned
+ \since QtQuick.Controls 1.1
+ */
+ function textAt (index) {
+ if (index >= count || index < 0)
+ return null;
+ return popupItems.objectAt(index).text;
+ }
+
+ /*! Finds and returns the index of a given \a text
+ If no match is found, \c -1 is returned. The search is case sensitive.
+ \since QtQuick.Controls 1.1
+ */
+ function find (text) {
+ return input.find(text, Qt.MatchExactly)
+ }
+
+ /*!
+ \qmlproperty Validator ComboBox::validator
+ \since QtQuick.Controls 1.1
+
+ Allows you to set a text validator for an editable ComboBox.
+ When a validator is set,
+ the text field will only accept input which leaves the text property in
+ an intermediate state. The accepted signal will only be sent
+ if the text is in an acceptable state when enter is pressed.
+
+ Currently supported validators are \l{QtQuick2::IntValidator},
+ \l{QtQuick2::DoubleValidator}, and \l{QtQuick2::RegExpValidator}. An
+ example of using validators is shown below, which allows input of
+ integers between 11 and 31 into the text field:
+
+ \note This property is only applied when \l editable is \c true
+
+ \qml
+ import QtQuick 2.1
+ import QtQuick.Controls 1.1
+
+ ComboBox {
+ editable: true
+ model: 10
+ validator: IntValidator {bottom: 0; top: 10;}
+ focus: true
+ }
+ \endqml
+
+ \sa acceptableInput, accepted, editable
+ */
+ property alias validator: input.validator
+
+ /*!
+ \qmlproperty bool ComboBox::acceptableInput
+ \since QtQuick.Controls 1.1
+
+ Returns \c true if the combo box contains acceptable
+ text in the editable text field.
+
+ If a validator was set, this property will return \c
+ true if the current text satisfies the validator or mask as
+ a final string (not as an intermediate string).
+
+ \sa validator, accepted
+
+ */
+ readonly property alias acceptableInput: input.acceptableInput
+
+ /*!
+ \qmlsignal ComboBox::accepted()
+ \since QtQuick.Controls 1.1
+
+ This signal is emitted when the Return or Enter key is pressed on an
+ \l editable combo box. If the confirmed string is not currently in the model,
+ the currentIndex will be set to -1 and the \l currentText will be updated
+ accordingly.
+
+ \note If there is a \l validator set on the combobox,
+ the signal will only be emitted if the input is in an acceptable state.
+ */
+ signal accepted
+
+ /*!
+ \qmlsignal ComboBox::activated(int index)
+ \since QtQuick.Controls 1.1
+
+ \a index is the triggered model index or -1 if a new string is accepted
+
+ This signal is similar to currentIndex changed, but will only
+ be emitted if the combo box index was changed by the user and not
+ when set programatically.
+ */
+ signal activated(int index)
+
+ /*!
+ \qmlmethod ComboBox::selectAll()
+ \since QtQuick.Controls 1.1
+
+ Causes all \l editText to be selected.
+ */
+ function selectAll() {
+ input.selectAll()
+ }
+
+ /*! \internal */
+ property var __popup: popup
+
+ style: Qt.createComponent(Settings.style + "/ComboBoxStyle.qml", comboBox)
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.ComboBox
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ onPressed: {
+ if (comboBox.activeFocusOnPress)
+ forceActiveFocus()
+ popup.show()
+ }
+ }
+
+ Component.onCompleted: {
+ if (currentIndex === -1)
+ currentIndex = 0
+
+ popup.ready = true
+ popup.resolveTextValue(textRole)
+ }
+
+ Keys.onPressed: {
+ // Perform one-character based lookup for non-editable combo box
+ if (!editable && event.text.length > 0) {
+ var index = input.find(event.text, Qt.MatchStartsWith);
+ if (index >= 0 && index !== currentIndex) {
+ currentIndex = index;
+ activated(currentIndex);
+ }
+ }
+ }
+
+ TextInput {
+ id: input
+
+ visible: editable
+ enabled: editable
+ focus: true
+ clip: contentWidth > width
+ text: currentText
+
+ anchors.fill: parent
+ anchors.leftMargin: 8
+ anchors.rightMargin: __style.drowDownButtonWidth
+
+ verticalAlignment: Text.AlignVCenter
+
+ renderType: Text.NativeRendering
+ selectByMouse: true
+ selectionColor: syspal.highlight
+ selectedTextColor: syspal.highlightedText
+ onAccepted: {
+ var idx = input.find(editText)
+ if (idx > -1) {
+ var string = textAt(idx);
+ if (string.length === editText.length) {
+ currentIndex = idx;
+ editText = string;
+ }
+ } else {
+ currentIndex = -1;
+ popup.currentText = editText;
+ }
+ comboBox.accepted();
+ }
+
+ SystemPalette { id: syspal }
+
+ property bool blockUpdate: false
+ property string prevText
+
+ function find (text, searchType) {
+ for (var i = 0 ; i < popupItems.count ; ++i) {
+ var currentString = popupItems.objectAt(i).text
+ if (searchType === Qt.MatchExactly) {
+ if (text === currentString)
+ return i;
+ } else if (searchType === Qt.CaseSensitive) {
+ if (currentString.indexOf(text) === 0)
+ return i;
+ } else if (currentString.toLowerCase().indexOf(text.toLowerCase()) === 0) {
+ return i
+ }
+ }
+ return -1;
+ }
+
+ // Finds first entry and shortest entry. Used by editable combo
+ function tryComplete (inputText) {
+ var candidate = "";
+ var shortestString = "";
+ for (var i = 0 ; i < popupItems.count ; ++i) {
+ var currentString = popupItems.objectAt(i).text;
+
+ if (currentString.toLowerCase().indexOf(inputText.toLowerCase()) === 0) {
+ if (candidate.length) { // Find smallest possible match
+ var cmp = 0;
+
+ // We try to complete the shortest string that matches our search
+ if (currentString.length < candidate.length)
+ candidate = currentString
+
+ while (cmp < Math.min(currentString.length, shortestString.length)
+ && shortestString[cmp].toLowerCase() === currentString[cmp].toLowerCase())
+ cmp++;
+ shortestString = shortestString.substring(0, cmp);
+ } else { // First match, select as current index and find other matches
+ candidate = currentString;
+ shortestString = currentString;
+ }
+ }
+ }
+
+ if (candidate.length)
+ return inputText + candidate.substring(inputText.length, candidate.length);
+ return inputText;
+ }
+
+ property bool allowComplete: false
+ Keys.onPressed: allowComplete = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete);
+
+ onTextChanged: {
+ if (editable && !blockUpdate && allowComplete) {
+ var completed = input.tryComplete(text)
+ if (completed.length > text.length) {
+ var oldtext = input.text;
+ input.text = completed;
+ input.select(text.length, oldtext.length);
+ }
+ }
+ prevText = text
+ }
+ }
+
+ onTextRoleChanged: popup.resolveTextValue(textRole)
+
+ Menu {
+ id: popup
+ objectName: "popup"
+
+ style: isPopup ? __style.__popupStyle : __style.__dropDownStyle
+
+ property string currentText: selectedText
+ onSelectedTextChanged: if (selectedText) popup.currentText = selectedText
+
+ property string selectedText
+ on__SelectedIndexChanged: updateSelectedText()
+ property string textRole: ""
+
+ property bool ready: false
+ property bool isPopup: !editable && !!__panel && __panel.popup
+
+ property int y: isPopup ? (comboBox.__panel.height - comboBox.__panel.implicitHeight) / 2.0 : comboBox.__panel.height
+ __minimumWidth: comboBox.width
+ __visualItem: comboBox
+
+ property ExclusiveGroup eg: ExclusiveGroup { id: eg }
+
+ property bool __modelIsArray: popupItems.model ? popupItems.model.constructor === Array : false
+
+ Instantiator {
+ id: popupItems
+ active: false
+
+ property bool updatingModel: false
+ onModelChanged: {
+ if (active) {
+ if (updatingModel && popup.__selectedIndex === 0) {
+ // We still want to update the currentText
+ popup.updateSelectedText()
+ } else {
+ updatingModel = true
+ popup.__selectedIndex = 0
+ }
+ }
+ }
+
+ MenuItem {
+ text: popup.textRole === '' ?
+ modelData :
+ ((popup.__modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '')
+ onTriggered: {
+ if (index !== currentIndex)
+ activated(index)
+ comboBox.editText = text
+ }
+ checkable: true
+ exclusiveGroup: eg
+ }
+ onObjectAdded: {
+ popup.insertItem(index, object)
+ if (!updatingModel && index === popup.__selectedIndex)
+ popup.selectedText = object["text"]
+ }
+ onObjectRemoved: popup.removeItem(object)
+
+ }
+
+ function resolveTextValue(initialTextRole) {
+ if (!ready || !model) {
+ popupItems.active = false
+ return;
+ }
+
+ var get = model['get'];
+ if (!get && popup.__modelIsArray) {
+ if (model[0].constructor !== String && model[0].constructor !== Number)
+ get = function(i) { return model[i]; }
+ }
+
+ var modelMayHaveRoles = get !== undefined
+ textRole = initialTextRole
+ if (textRole === "" && modelMayHaveRoles && get(0)) {
+ // No text role set, check whether model has a suitable role
+ // If 'text' is found, or there's only one role, pick that.
+ var listElement = get(0)
+ var roleName = ""
+ var roleCount = 0
+ for (var role in listElement) {
+ if (listElement[role].constructor === Function)
+ continue;
+ if (role === "text") {
+ roleName = role
+ break
+ } else if (!roleName) {
+ roleName = role
+ }
+ ++roleCount
+ }
+ if (roleCount > 1 && roleName !== "text") {
+ console.warn("No suitable 'textRole' found for ComboBox.")
+ } else {
+ textRole = roleName
+ }
+ }
+
+ if (!popupItems.active)
+ popupItems.active = true
+ else
+ updateSelectedText()
+ }
+
+ function show() {
+ if (items[__selectedIndex])
+ items[__selectedIndex].checked = true
+ __currentIndex = comboBox.currentIndex
+ if (Qt.application.layoutDirection === Qt.RightToLeft)
+ __popup(comboBox.width, y, isPopup ? __selectedIndex : 0)
+ else
+ __popup(0, y, isPopup ? __selectedIndex : 0)
+ }
+
+ function updateSelectedText() {
+ var selectedItem;
+ if (__selectedIndex !== -1 && (selectedItem = items[__selectedIndex]))
+ selectedText = selectedItem.text
+ }
+ }
+
+ // The key bindings below will only be in use when popup is
+ // not visible. Otherwise, native popup key handling will take place:
+ Keys.onSpacePressed: {
+ if (!popup.popupVisible)
+ popup.show()
+ }
+
+ Keys.onUpPressed: {
+ input.blockUpdate = true
+ if (currentIndex > 0) {
+ currentIndex--;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+
+ Keys.onDownPressed: {
+ input.blockUpdate = true;
+ if (currentIndex < popupItems.count - 1) {
+ currentIndex++;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/GroupBox.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/GroupBox.qml
new file mode 100644
index 0000000000..12959d16ff
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/GroupBox.qml
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Layouts 1.0
+
+/*!
+ \qmltype GroupBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief GroupBox provides a group box frame with a title.
+
+ A group box provides a frame, a title on top and displays various other controls inside itself. Group boxes can also be checkable.
+
+ Child controls in checkable group boxes are enabled or disabled depending on whether or not the group box is checked.
+
+ You can minimize the space consumption of a group box by enabling the flat property.
+ In most styles, enabling this property results in the removal of the left, right and bottom edges of the frame.
+
+ To add content to a group box, you can reparent it to its contentItem property.
+
+ The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor
+ items inside the group box, you must specify an explicit width and height on the GroupBox itself.
+
+ The following example shows how we use a GroupBox with a column:
+
+ \qml
+ GroupBox {
+ title: qsTr("Package selection")
+ Column {
+ spacing: 2
+ CheckBox {
+ text: qsTr("Update system")
+ }
+ CheckBox {
+ text: qsTr("Update applications")
+ }
+ CheckBox {
+ text: qsTr("Update documentation")
+ }
+ }
+ }
+ \endqml
+
+ \sa CheckBox, RadioButton, Layout
+
+*/
+
+FocusScope {
+ id: groupbox
+
+ /*!
+ This property holds the group box title text.
+
+ There is no default title text.
+ */
+ property string title
+
+ /*!
+ This property holds whether the group box is painted flat or has a frame.
+
+ A group box usually consists of a surrounding frame with a title at the top.
+ If this property is enabled, only the top part of the frame is drawn in most styles;
+ otherwise, the whole frame is drawn.
+
+ By default, this property is disabled, so group boxes are not flat unless explicitly specified.
+
+ \note In some styles, flat and non-flat group boxes have similar representations and may not be as
+ distinguishable as they are in other styles.
+ */
+ property bool flat: false
+
+ /*!
+ This property holds whether the group box has a checkbox in its title.
+
+ If this property is true, the group box displays its title using a checkbox in place of an ordinary label.
+ If the checkbox is checked, the group box's children are enabled; otherwise, they are disabled and inaccessible.
+
+ By default, group boxes are not checkable.
+ */
+ property bool checkable: false
+
+ /*!
+ \qmlproperty bool GroupBox::checked
+
+ This property holds whether the group box is checked.
+
+ If the group box is checkable, it is displayed with a check box. If the check box is checked, the group
+ box's children are enabled; otherwise, the children are disabled and are inaccessible to the user.
+
+ By default, checkable group boxes are also checked.
+ */
+ property alias checked: check.checked
+
+
+ /*! \internal */
+ default property alias __content: container.data
+
+ /*!
+ \qmlproperty Item GroupBox::contentItem
+
+ This property holds the content Item of the group box.
+
+ Items declared as children of a GroupBox are automatically parented to the GroupBox's contentItem.
+ Items created dynamically need to be explicitly parented to the contentItem:
+
+ \note The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor
+ items inside the group box, you must specify an explicit width and height on the GroupBox itself.
+ */
+ readonly property alias contentItem: container
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/GroupBoxStyle.qml", groupbox)
+
+ /*! \internal */
+ property alias __checkbox: check
+
+ /*! \internal */
+ property alias __style: styleLoader.item
+
+ implicitWidth: Math.max((!anchors.fill ? container.calcWidth() : 0) + loader.leftMargin + loader.rightMargin,
+ sizeHint.implicitWidth + (checkable ? 24 : 6))
+ implicitHeight: (!anchors.fill ? container.calcHeight() : 0) + loader.topMargin + loader.bottomMargin
+
+ Layout.minimumWidth: implicitWidth
+ Layout.minimumHeight: implicitHeight
+
+ Accessible.role: Accessible.Grouping
+ Accessible.name: title
+
+ activeFocusOnTab: false
+
+
+ data: [
+ Loader {
+ id: loader
+ anchors.fill: parent
+ property int topMargin: __style ? __style.padding.top : 0
+ property int bottomMargin: __style ? __style.padding.bottom : 0
+ property int leftMargin: __style ? __style.padding.left : 0
+ property int rightMargin: __style ? __style.padding.right : 0
+ sourceComponent: styleLoader.item ? styleLoader.item.panel : null
+ onLoaded: item.z = -1
+ Text { id: sizeHint ; visible: false ; text: title }
+ Loader {
+ id: styleLoader
+ property alias __control: groupbox
+ sourceComponent: groupbox.style
+ }
+ },
+ CheckBox {
+ id: check
+ objectName: "check"
+ checked: true
+ text: groupbox.title
+ visible: checkable
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: loader.topMargin
+ activeFocusOnTab: groupbox.checkable
+ style: CheckBoxStyle { panel: Item{} }
+ },
+ Item {
+ id: container
+ objectName: "container"
+ z: 1
+ focus: true
+ anchors.fill: parent
+
+ anchors.topMargin: loader.topMargin
+ anchors.leftMargin: loader.leftMargin
+ anchors.rightMargin: loader.rightMargin
+ anchors.bottomMargin: loader.bottomMargin
+ enabled: (!groupbox.checkable || groupbox.checked)
+
+ property Item layoutItem: container.children.length === 1 ? container.children[0] : null
+ function calcWidth () { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) : container.childrenRect.width) }
+ function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) : container.childrenRect.height) }
+ }]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Label.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Label.qml
new file mode 100644
index 0000000000..01f2a1629c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Label.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+/*!
+ \qmltype Label
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A text label.
+
+ In addition to the normal \l Text element, Label follows the font and
+ color scheme of the system.
+ Use the \c text property to assign a text to the label. For other properties
+ check \l Text.
+
+ A simple label looks like this:
+ \qml
+ Label {
+ text: "Hello world"
+ }
+ \endqml
+
+ You can use the properties of \l Text to change the appearance
+ of the text as desired:
+ \qml
+ Label {
+ text: "Hello world"
+ font.pixelSize: 22
+ font.italic: true
+ color: "steelblue"
+ }
+ \endqml
+
+ \sa Text, TextField, TextEdit
+*/
+
+Text {
+ /*!
+ \qmlproperty string Label::text
+
+ The text to display. Use this property to get and set it.
+ */
+
+ id: label
+ color: pal.text
+ activeFocusOnTab: false
+ renderType: Text.NativeRendering
+ SystemPalette {
+ id: pal
+ colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Menu.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Menu.qml
new file mode 100644
index 0000000000..9c76684605
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Menu.qml
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Menu
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup menus
+ \brief Provides a menu component for use in menu bars, as context menu,
+ and other popup menus.
+
+ \code
+ Menu {
+ title: "Edit"
+
+ MenuItem {
+ text: "Cut"
+ shortcut: "Ctrl+X"
+ onTriggered: ...
+ }
+
+ MenuItem {
+ text: "Copy"
+ shortcut: "Ctrl+C"
+ onTriggered: ...
+ }
+
+ MenuItem {
+ text: "Paste"
+ shortcut: "Ctrl+V"
+ onTriggered: ...
+ }
+
+ MenuSeparator { }
+
+ Menu {
+ title: "More Stuff"
+
+ MenuItem {
+ text: "Do Nothing"
+ }
+ }
+ }
+ \endcode
+
+ The main uses for menus:
+ \list
+ \li
+ as a \e top-level menu in a \l MenuBar
+ \li
+ as a \e submenu inside another menu
+ \li
+ as a standalone or \e context menu
+ \endlist
+
+ Note that some properties, such as \c enabled, \c text, or \c iconSource,
+ only make sense in a particular use case of the menu.
+
+ \sa MenuBar, MenuItem, MenuSeparator
+*/
+
+MenuPrivate {
+ id: root
+
+ /*! \internal
+ \omit
+ Documented in qqquickmenu.cpp.
+ \endomit
+ */
+ function addMenu(title) {
+ return root.insertMenu(items.length, title)
+ }
+
+ /*! \internal
+ \omit
+ Documented in qquickmenu.cpp.
+ \endomit
+ */
+ function insertMenu(index, title) {
+ if (!__selfComponent)
+ __selfComponent = Qt.createComponent("Menu.qml", root)
+ var submenu = __selfComponent.createObject(__selfComponent, { "title": title })
+ root.insertItem(index, submenu)
+ return submenu
+ }
+
+ /*! \internal */
+ property Component __selfComponent: null
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/MenuStyle.qml", root)
+
+ /*! \internal */
+ property var __parentContentItem: __parentMenu.__contentItem
+ /*! \internal */
+ property int __currentIndex: -1
+ /*! \internal */
+ on__MenuClosed: __currentIndex = -1
+
+ /*! \internal */
+ __contentItem: Loader {
+ sourceComponent: MenuContentItem {
+ menu: root
+ }
+ active: !root.__isNative && root.__popupVisible
+ focus: true
+ Keys.forwardTo: item ? [item, root.__parentContentItem] : []
+ property bool altPressed: root.__parentContentItem ? root.__parentContentItem.altPressed : false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/MenuBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/MenuBar.qml
new file mode 100644
index 0000000000..42b3f39aad
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/MenuBar.qml
@@ -0,0 +1,276 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype MenuBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup applicationwindow
+ \brief Provides a horizontal menu bar.
+
+ \code
+ MenuBar {
+ Menu {
+ title: "File"
+ MenuItem { text: "Open..." }
+ MenuItem { text: "Close" }
+ }
+
+ Menu {
+ title: "Edit"
+ MenuItem { text: "Cut" }
+ MenuItem { text: "Copy" }
+ MenuItem { text: "Paste" }
+ }
+ }
+ \endcode
+
+ \sa ApplicationWindow::menuBar
+*/
+
+MenuBarPrivate {
+ id: root
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/MenuBarStyle.qml", root)
+
+ /*! \internal */
+ __contentItem: Loader {
+ id: topLoader
+ sourceComponent: __menuBarComponent
+ active: !root.__isNative
+ focus: true
+ Keys.forwardTo: [item]
+ property bool altPressed: item ? item.altPressed : false
+ }
+
+ /*! \internal */
+ property Component __menuBarComponent: Loader {
+ id: menuBarLoader
+
+ property Style __style: styleLoader.item
+ property Component menuItemStyle: __style ? __style.menuItem : null
+
+ property var control: root
+ onStatusChanged: if (status === Loader.Error) console.error("Failed to load panel for", root)
+
+ visible: status === Loader.Ready
+ sourceComponent: __style ? __style.frame : undefined
+
+ Loader {
+ id: styleLoader
+ property alias __control: menuBarLoader
+ sourceComponent: root.style
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", root)
+ }
+ }
+
+ property int openedMenuIndex: -1
+ property bool preselectMenuItem: false
+ property alias contentHeight: row.height
+
+ Binding {
+ // Make sure the styled menu bar is in the background
+ target: menuBarLoader.item
+ property: "z"
+ value: menuMouseArea.z - 1
+ }
+
+ focus: true
+
+ property bool altPressed: false
+ property bool altPressedAgain: false
+ property var mnemonicsMap: ({})
+
+ Keys.onPressed: {
+ var action = null
+ if (event.key === Qt.Key_Alt) {
+ if (!altPressed)
+ altPressed = true
+ else
+ altPressedAgain = true
+ } else if (altPressed && (action = mnemonicsMap[event.text.toUpperCase()])) {
+ preselectMenuItem = true
+ action.trigger()
+ event.accepted = true
+ }
+ }
+
+ function dismissActiveFocus(event, reason) {
+ if (reason) {
+ altPressedAgain = false
+ altPressed = false
+ openedMenuIndex = -1
+ root.__contentItem.parent.forceActiveFocus()
+ } else {
+ event.accepted = false
+ }
+ }
+
+ Keys.onReleased: dismissActiveFocus(event, altPressedAgain && openedMenuIndex === -1)
+ Keys.onEscapePressed: dismissActiveFocus(event, openedMenuIndex === -1)
+
+ function maybeOpenFirstMenu(event) {
+ if (altPressed && openedMenuIndex === -1) {
+ preselectMenuItem = true
+ openedMenuIndex = 0
+ } else {
+ event.accepted = false
+ }
+ }
+
+ Keys.onUpPressed: maybeOpenFirstMenu(event)
+ Keys.onDownPressed: maybeOpenFirstMenu(event)
+
+ Keys.onLeftPressed: {
+ if (openedMenuIndex > 0) {
+ preselectMenuItem = true
+ openedMenuIndex--
+ }
+ }
+
+ Keys.onRightPressed: {
+ if (openedMenuIndex !== -1 && openedMenuIndex < root.menus.length - 1) {
+ preselectMenuItem = true
+ openedMenuIndex++
+ }
+ }
+
+ MouseArea {
+ id: menuMouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+
+ onPositionChanged: updateCurrentItem(mouse, false)
+ onPressed: {
+ if (updateCurrentItem(mouse)) {
+ menuBarLoader.preselectMenuItem = false
+ menuBarLoader.openedMenuIndex = currentItem.menuItemIndex
+ }
+ }
+ onExited: hoveredItem = null
+
+ property Item currentItem: null
+ property Item hoveredItem: null
+ function updateCurrentItem(mouse) {
+ var pos = mapToItem(row, mouse.x, mouse.y)
+ if (!hoveredItem || !hoveredItem.contains(Qt.point(pos.x - currentItem.x, pos.y - currentItem.y))) {
+ hoveredItem = row.childAt(pos.x, pos.y)
+ if (!hoveredItem)
+ return false;
+ currentItem = hoveredItem
+ if (menuBarLoader.openedMenuIndex !== -1) {
+ menuBarLoader.preselectMenuItem = false
+ menuBarLoader.openedMenuIndex = currentItem.menuItemIndex
+ }
+ }
+ return true;
+ }
+
+ Row {
+ id: row
+ width: parent.width
+ LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
+
+ Repeater {
+ id: itemsRepeater
+ model: root.menus
+ Loader {
+ id: menuItemLoader
+
+ property var menuItem: modelData
+ property bool selected: menuMouseArea.hoveredItem === menuItemLoader
+ property bool sunken: menuItem.__popupVisible || menuBarLoader.openedMenuIndex === index
+ property bool showUnderlined: menuBarLoader.altPressed
+
+ sourceComponent: menuBarLoader.menuItemStyle
+ property int menuItemIndex: index
+ visible: menuItem.visible
+
+ Connections {
+ target: menuBarLoader
+ onOpenedMenuIndexChanged: {
+ if (menuBarLoader.openedMenuIndex === index) {
+ if (row.LayoutMirroring.enabled)
+ menuItem.__popup(menuItemLoader.width, menuBarLoader.height, 0)
+ else
+ menuItem.__popup(0, menuBarLoader.height, 0)
+ if (menuBarLoader.preselectMenuItem)
+ menuItem.__currentIndex = 0
+ } else {
+ menuItem.__closeMenu()
+ }
+ }
+ }
+
+ Connections {
+ target: menuItem
+ onPopupVisibleChanged: {
+ if (!menuItem.__popupVisible && menuBarLoader.openedMenuIndex === index)
+ menuBarLoader.openedMenuIndex = -1
+ }
+ }
+
+ Connections {
+ target: menuItem.__action
+ onTriggered: menuBarLoader.openedMenuIndex = menuItemIndex
+ }
+
+ Component.onCompleted: {
+ menuItem.__visualItem = menuItemLoader
+
+ var title = menuItem.title
+ var ampersandPos = title.indexOf("&")
+ if (ampersandPos !== -1)
+ menuBarLoader.mnemonicsMap[title[ampersandPos + 1].toUpperCase()] = menuItem.__action
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/AbstractCheckable.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/AbstractCheckable.qml
new file mode 100644
index 0000000000..858569e8f5
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/AbstractCheckable.qml
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+
+/*!
+ \qmltype AbstractCheckable
+ \inqmlmodule QtQuick.Controls
+ \ingroup controls
+ \brief An abstract representation of a checkable control with a label
+ \qmlabstract
+ \internal
+
+ A checkable control is one that has two states: checked (on) and
+ unchecked (off). AbstractCheckable encapsulates the basic behavior and
+ states that are required by checkable controls.
+
+ Examples of checkable controls are RadioButton and
+ CheckBox. CheckBox extends AbstractCheckable's behavior by adding a third
+ state: partially checked.
+*/
+
+Control {
+ id: abstractCheckable
+
+ /*!
+ Emitted whenever the control is clicked.
+ */
+ signal clicked
+
+ /*!
+ \qmlproperty bool AbstractCheckable::pressed
+
+ This property is \c true if the control is being pressed.
+ Set this property to manually invoke a mouse click.
+ */
+ property alias pressed: mouseArea.effectivePressed
+
+ /*! \qmlproperty bool AbstractCheckcable::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*!
+ This property is \c true if the control is checked.
+ */
+ property bool checked: false
+
+ /*!
+ This property is \c true if the control takes the focus when it is
+ pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be
+ called on the control.
+ */
+ property bool activeFocusOnPress: false
+
+ /*!
+ This property stores the ExclusiveGroup that the control belongs to.
+ */
+ property ExclusiveGroup exclusiveGroup: null
+
+ /*!
+ This property holds the text that the label should display.
+ */
+ property string text
+
+ /*! \internal */
+ property var __cycleStatesHandler: cycleRadioButtonStates
+
+ activeFocusOnTab: true
+
+ MouseArea {
+ id: mouseArea
+ focus: true
+ anchors.fill: parent
+ hoverEnabled: true
+ enabled: !keyPressed
+
+ property bool keyPressed: false
+ property bool effectivePressed: pressed && containsMouse || keyPressed
+
+ onClicked: abstractCheckable.clicked();
+
+ onPressed: if (activeFocusOnPress) forceActiveFocus();
+
+ onReleased: {
+ if (containsMouse && (!exclusiveGroup || !checked))
+ __cycleStatesHandler();
+ }
+ }
+
+ /*! \internal */
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup)
+ exclusiveGroup.bindCheckable(abstractCheckable)
+ }
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && !mouseArea.pressed)
+ mouseArea.keyPressed = true;
+ }
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && mouseArea.keyPressed) {
+ mouseArea.keyPressed = false;
+ if (!exclusiveGroup || !checked)
+ __cycleStatesHandler();
+ clicked();
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/BasicButton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/BasicButton.qml
new file mode 100644
index 0000000000..4c1eeb042c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/BasicButton.qml
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+
+/*!
+ \qmltype BasicButton
+ \internal
+ \qmlabstract
+ \inqmlmodule QtQuick.Controls.Private
+*/
+
+Control {
+ id: button
+
+ /*! This signal is emitted when the button is clicked. */
+ signal clicked
+
+ /*! \qmlproperty bool BasicButton::pressed
+
+ This property holds whether the button is being pressed. */
+ readonly property alias pressed: button.__effectivePressed
+
+ /*! \qmlproperty bool BasicButton::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: behavior.containsMouse
+
+ /*! This property holds whether the button is checkable.
+
+ The default value is \c false. */
+ property bool checkable: false
+
+ /*! This property holds whether the button is checked.
+
+ Only checkable buttons can be checked.
+
+ The default value is \c false. */
+ property bool checked: false
+
+ /*! This property holds the ExclusiveGroup that the button belongs to.
+
+ The default value is \c null. */
+ property ExclusiveGroup exclusiveGroup: null
+
+ /*! This property holds the associated button action.
+
+ If a button has an action associated, the action defines the
+ button's properties like checked, text, tooltip etc.
+
+ When an action is set, it's still possible to override the \l text,
+ \l tooltip, \l iconSource, and \l iconName properties.
+
+ The default value is \c null. */
+ property Action action: null
+
+ /*! This property specifies whether the button should gain active focus when pressed.
+
+ The default value is \c false. */
+ property bool activeFocusOnPress: false
+
+ /*! This property holds the text shown on the button. If the button has no
+ text, the \l text property will be an empty string.
+
+ The default value is the empty string.
+ */
+ property string text: action ? action.text : ""
+
+ /*! This property holds the button tooltip. */
+ property string tooltip: action ? (action.tooltip || StyleHelpers.removeMnemonics(action.text)) : ""
+
+ /*! This property holds the icon shown on the button. If the button has no
+ icon, the iconSource property will be an empty string.
+
+ The default value is the empty string.
+ */
+ property url iconSource: action ? action.iconSource : ""
+
+ /*! The image label source as theme name.
+ When an icon from the platform icon theme is found, this takes
+ precedence over iconSource.
+ */
+ property string iconName: action ? action.iconName : ""
+
+ /*! \internal */
+ property color __textColor: syspal.text
+ /*! \internal */
+ property string __position: "only"
+ /*! \internal */
+ readonly property bool __iconOverriden: button.action && (button.action.iconSource !== button.iconSource || button.action.iconName !== button.iconName)
+ /*! \internal */
+ property Action __action: action || ownAction
+ /*! \internal */
+ readonly property Action __iconAction: __iconOverriden ? ownAction : __action
+
+ /*! \internal */
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup)
+ exclusiveGroup.bindCheckable(button)
+ }
+
+ Accessible.role: Accessible.Button
+ Accessible.description: tooltip
+
+ /*! \internal */
+ function accessiblePressAction() {
+ __action.trigger(button)
+ }
+
+ Action {
+ id: ownAction
+ iconSource: !button.action || __iconOverriden ? button.iconSource : ""
+ iconName: !button.action || __iconOverriden ? button.iconName : ""
+ }
+
+ Connections {
+ target: __action
+ onTriggered: button.clicked()
+ }
+
+ activeFocusOnTab: true
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && !behavior.pressed)
+ behavior.keyPressed = true;
+ }
+
+ onFocusChanged: if (!focus) behavior.keyPressed = false
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && behavior.keyPressed) {
+ behavior.keyPressed = false;
+ __action.trigger(button)
+ behavior.toggle()
+ }
+ }
+
+ MouseArea {
+ id: behavior
+ property bool keyPressed: false
+ property bool effectivePressed: pressed && containsMouse || keyPressed
+
+ anchors.fill: parent
+ hoverEnabled: true
+ enabled: !keyPressed
+
+ function toggle() {
+ if (button.checkable && !button.action && !(button.checked && button.exclusiveGroup))
+ button.checked = !button.checked
+ }
+
+ onReleased: {
+ if (containsMouse) {
+ toggle()
+ __action.trigger(button)
+ }
+ }
+ onExited: Tooltip.hideText()
+ onCanceled: Tooltip.hideText()
+ onPressed: {
+ if (activeFocusOnPress)
+ button.forceActiveFocus()
+ }
+
+ Timer {
+ interval: 1000
+ running: behavior.containsMouse && !pressed && tooltip.length
+ onTriggered: Tooltip.showText(behavior, Qt.point(behavior.mouseX, behavior.mouseY), tooltip)
+ }
+ }
+
+ /*! \internal */
+ property var __behavior: behavior
+
+ /*! \internal */
+ property bool __effectivePressed: behavior.effectivePressed
+
+ SystemPalette { id: syspal }
+
+ states: [
+ State {
+ name: "boundAction"
+ when: action !== null
+ PropertyChanges {
+ target: button
+ enabled: action.enabled
+ checkable: action.checkable
+ checked: action.checked
+ }
+ }
+ ]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ColumnMenuContent.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ColumnMenuContent.qml
new file mode 100644
index 0000000000..bb21dcb9ce
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ColumnMenuContent.qml
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+
+Item {
+ id: content
+
+ property Component menuItemDelegate
+ property Component scrollerStyle
+ property var itemsModel
+ property int minWidth: 100
+ property real maxHeight: 800
+ property int margin: 1
+
+ signal triggered(var item)
+
+ function menuItemAt(index) {
+ list.currentIndex = index
+ return list.currentItem
+ }
+
+ width: Math.max(list.contentWidth, minWidth)
+ height: Math.min(list.contentHeight, fittedMaxHeight) + 2 * margin
+
+ readonly property int currentIndex: menu.__currentIndex
+ property Item currentItem: null
+ readonly property int itemHeight: (list.count > 0 && list.contentItem.children[0]) ? list.contentItem.children[0].height : 23
+ readonly property int fittingItems: Math.floor((maxHeight - downScroller.height) / itemHeight)
+ readonly property real fittedMaxHeight: itemHeight * fittingItems + downScroller.height
+ readonly property bool shouldUseScrollers: scrollView.__style.useScrollers && itemsModel.length > fittingItems
+ readonly property real upScrollerHeight: upScroller.visible ? upScroller.height : 0
+ readonly property real downScrollerHeight: downScroller.visible ? downScroller.height : 0
+
+ function updateCurrentItem(mouse) {
+ var pos = mapToItem(list.contentItem, mouse.x, mouse.y)
+ if (!currentItem || !currentItem.contains(Qt.point(pos.x - currentItem.x, pos.y - currentItem.y))) {
+ if (currentItem && !hoverArea.pressed && currentItem.isSubmenu)
+ currentItem.closeSubMenu()
+ currentItem = list.itemAt(pos.x, pos.y)
+ if (currentItem) {
+ menu.__currentIndex = currentItem.menuItemIndex
+ if (currentItem.isSubmenu && !currentItem.menuItem.__popupVisible)
+ currentItem.showSubMenu(false)
+ } else {
+ menu.__currentIndex = -1
+ }
+ }
+ }
+
+ ScrollView {
+ id: scrollView
+ anchors {
+ fill: parent
+ topMargin: content.margin + upScrollerHeight
+ bottomMargin: downScrollerHeight - content.margin - 1
+ rightMargin: -1
+ }
+
+ style: scrollerStyle
+ __wheelAreaScrollSpeed: itemHeight
+
+ ListView {
+ id: list
+ model: itemsModel
+ delegate: menuItemDelegate
+ snapMode: ListView.SnapToItem
+ boundsBehavior: Flickable.StopAtBounds
+ highlightFollowsCurrentItem: true
+ highlightMoveDuration: 0
+ }
+ }
+
+ MouseArea {
+ id: hoverArea
+ anchors.left: scrollView.left
+ width: scrollView.width - scrollView.__verticalScrollBar.width
+ height: parent.height
+
+ hoverEnabled: true
+ acceptedButtons: Qt.AllButtons
+
+ onPositionChanged: updateCurrentItem(mouse)
+ onReleased: content.triggered(currentItem)
+ onExited: {
+ if (currentItem && !currentItem.menuItem.__popupVisible) {
+ currentItem = null
+ menu.__currentIndex = -1
+ }
+ }
+
+ MenuContentScroller {
+ id: upScroller
+ direction: "up"
+ visible: shouldUseScrollers && !list.atYBeginning
+ x: margin
+ function scrollABit() { list.contentY -= itemHeight }
+ }
+
+ MenuContentScroller {
+ id: downScroller
+ direction: "down"
+ visible: shouldUseScrollers && !list.atYEnd
+ x: margin
+ function scrollABit() { list.contentY += itemHeight }
+ }
+ }
+
+ Timer {
+ interval: 1
+ running: true
+ repeat: false
+ onTriggered: list.positionViewAtIndex(currentIndex, scrollView.__style.useScrollers
+ ? ListView.Center : ListView.Beginning)
+ }
+
+ Binding {
+ target: scrollView.__verticalScrollBar
+ property: "singleStep"
+ value: itemHeight
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Control.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Control.qml
new file mode 100644
index 0000000000..0ce8908fb0
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Control.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls.Styles 1.1
+
+/*!
+ \qmltype Control
+ \internal
+ \qmlabstract
+ \inqmlmodule QtQuick.Controls.Private
+*/
+FocusScope {
+ id: root
+
+ /*! \qmlproperty Component Control::style
+
+ The style Component for this control.
+ \sa {Qt Quick Controls Styles QML Types}
+
+ */
+ property Component style
+
+ /*! \internal */
+ property QtObject __style: styleLoader.item
+
+ /*! \internal */
+ property Item __panel: panelLoader.item
+
+ /*! \internal */
+ property var styleHints
+
+ implicitWidth: __panel ? __panel.implicitWidth: 0
+ implicitHeight: __panel ? __panel.implicitHeight: 0
+ baselineOffset: __panel ? __panel.baselineOffset: 0
+ activeFocusOnTab: false
+
+ /*! \internal */
+ property alias __styleData: styleLoader.styleData
+
+ Loader {
+ id: panelLoader
+ anchors.fill: parent
+ sourceComponent: __style ? __style.panel : null
+ onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root)
+ Loader {
+ id: styleLoader
+ sourceComponent: style
+ property Item __control: root
+ property QtObject styleData: null
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", root)
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FastGlow.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FastGlow.qml
new file mode 100644
index 0000000000..f4bd2c7421
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FastGlow.qml
@@ -0,0 +1,393 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real spread: 0.0
+ property real blur: 0.0
+ property color color: "white"
+ property bool transparentBorder: false
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0)
+ smooth: true
+ visible: false
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ Item {
+ id: dummysource
+ width: 1
+ height: 1
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: dummy
+ width: 1
+ height: 1
+ sourceItem: dummysource
+ visible: false
+ smooth: false
+ live: false
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ x: transparentBorder ? -64 : 0
+ y: transparentBorder ? -64 : 0
+ width: transparentBorder ? parent.width + 128 : parent.width
+ height: transparentBorder ? parent.height + 128 : parent.height
+
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: rootItem.blur
+
+ property real weight1;
+ property real weight2;
+ property real weight3;
+ property real weight4;
+ property real weight5;
+ property real weight6;
+
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property alias color: rootItem.color
+
+ function weight(v) {
+ if (v <= 0.0)
+ return 1
+ if (v >= 0.5)
+ return 0
+
+ return 1.0 - v / 0.5
+ }
+
+ function calculateWeights() {
+
+ var w1 = weight(Math.abs(lod - 0.100))
+ var w2 = weight(Math.abs(lod - 0.300))
+ var w3 = weight(Math.abs(lod - 0.500))
+ var w4 = weight(Math.abs(lod - 0.700))
+ var w5 = weight(Math.abs(lod - 0.900))
+ var w6 = weight(Math.abs(lod - 1.100))
+
+ var sum = w1 + w2 + w3 + w4 + w5 + w6;
+ weight1 = w1 / sum;
+ weight2 = w2 / sum;
+ weight3 = w3 / sum;
+ weight4 = w4 / sum;
+ weight5 = w5 / sum;
+ weight6 = w6 / sum;
+
+ upateSources()
+ }
+
+ function upateSources() {
+ var sources = new Array();
+ var weights = new Array();
+
+ if (weight1 > 0) {
+ sources.push(level1)
+ weights.push(weight1)
+ }
+
+ if (weight2 > 0) {
+ sources.push(level2)
+ weights.push(weight2)
+ }
+
+ if (weight3 > 0) {
+ sources.push(level3)
+ weights.push(weight3)
+ }
+
+ if (weight4 > 0) {
+ sources.push(level4)
+ weights.push(weight4)
+ }
+
+ if (weight5 > 0) {
+ sources.push(level5)
+ weights.push(weight5)
+ }
+
+ if (weight6 > 0) {
+ sources.push(level6)
+ weights.push(weight6)
+ }
+
+ for (var j = sources.length; j < 6; j++) {
+ sources.push(dummy)
+ weights.push(0.0)
+ }
+
+ source1 = sources[0]
+ source2 = sources[1]
+ source3 = sources[2]
+ source4 = sources[3]
+ source5 = sources[4]
+ source6 = sources[5]
+
+ weight1 = weights[0]
+ weight2 = weights[1]
+ weight3 = weights[2]
+ weight4 = weights[3]
+ weight5 = weights[4]
+ weight6 = weights[5]
+ }
+
+ Component.onCompleted: calculateWeights()
+
+ onLodChanged: calculateWeights()
+
+ fragmentShader: "
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform mediump float weight1;
+ uniform mediump float weight2;
+ uniform mediump float weight3;
+ uniform mediump float weight4;
+ uniform mediump float weight5;
+ uniform highp vec4 color;
+ uniform highp float spread;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
+ sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a));
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FocusFrame.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FocusFrame.qml
new file mode 100644
index 0000000000..449d06b1a6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FocusFrame.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype FocusFrame
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+Item {
+ id: root
+ activeFocusOnTab: false
+ Accessible.role: Accessible.StatusBar
+
+ anchors.topMargin: focusMargin
+ anchors.leftMargin: focusMargin
+ anchors.rightMargin: focusMargin
+ anchors.bottomMargin: focusMargin
+
+ property int focusMargin: loader.item ? loader.item.margin : -3
+
+ Loader {
+ id: loader
+ z: 2
+ anchors.fill: parent
+ sourceComponent: Qt.createComponent(Settings.style + "/FocusFrameStyle.qml", root)
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentItem.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentItem.qml
new file mode 100644
index 0000000000..7056b4e1f0
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentItem.qml
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+
+Loader {
+ id: menuFrameLoader
+
+ readonly property Style __style: styleLoader.item
+ readonly property Component menuItemStyle: __style ? __style.menuItem : null
+
+ property var menu: root
+ property alias contentWidth: content.width
+ property alias contentHeight: content.height
+
+ readonly property int subMenuXPos: width + (item && item["subMenuOverlap"] || 0)
+
+ visible: status === Loader.Ready
+ sourceComponent: __style ? __style.frame : undefined
+
+ Loader {
+ id: styleLoader
+ active: !menu.isNative
+ sourceComponent: menu.style
+ property alias __control: menuFrameLoader
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", menu)
+ }
+ }
+
+ focus: true
+ property var mnemonicsMap: ({})
+
+ Keys.onPressed: {
+ var item = null
+ if (!(event.modifiers & Qt.AltModifier)
+ && (item = mnemonicsMap[event.text.toUpperCase()])) {
+ if (item.isSubmenu) {
+ menu.__currentIndex = item.menuItemIndex
+ item.showSubMenu(true)
+ item.menuItem.__currentIndex = 0
+ } else {
+ triggerAndDismiss(item)
+ }
+ event.accepted = true
+ } else {
+ event.accepted = false
+ }
+ }
+
+ Keys.onEscapePressed: menu.__dismissMenu()
+
+ Keys.onDownPressed: {
+ if (menu.__currentIndex < 0)
+ menu.__currentIndex = -1
+
+ for (var i = menu.__currentIndex + 1;
+ i < menu.items.length && !canBeHovered(i); i++)
+ ;
+ event.accepted = true
+ }
+
+ Keys.onUpPressed: {
+ for (var i = menu.__currentIndex - 1;
+ i >= 0 && !canBeHovered(i); i--)
+ ;
+ event.accepted = true
+ }
+
+ function canBeHovered(index) {
+ var item = content.menuItemAt(index)
+ if (item && !item["isSeparator"] && item.enabled) {
+ menu.__currentIndex = index
+ return true
+ }
+ return false
+ }
+
+ Keys.onLeftPressed: {
+ if ((event.accepted = menu.__parentMenu.hasOwnProperty("title")))
+ __closeMenu()
+ }
+
+ Keys.onRightPressed: {
+ var item = content.menuItemAt(menu.__currentIndex)
+ if ((event.accepted = (item && item.isSubmenu))) {
+ item.showSubMenu(true)
+ item.menuItem.__currentIndex = 0
+ }
+ }
+
+ Keys.onSpacePressed: triggerCurrent()
+ Keys.onReturnPressed: triggerCurrent()
+ Keys.onEnterPressed: triggerCurrent()
+
+ function triggerCurrent() {
+ var item = content.menuItemAt(menu.__currentIndex)
+ if (item)
+ content.triggered(item)
+ }
+
+ function triggerAndDismiss(item) {
+ if (item && !item.isSeparator) {
+ menu.__dismissMenu()
+ if (!item.isSubmenu)
+ item.menuItem.trigger()
+ }
+ }
+
+ Binding {
+ // Make sure the styled frame is in the background
+ target: item
+ property: "z"
+ value: content.z - 1
+ }
+
+ ColumnMenuContent {
+ id: content
+ menuItemDelegate: menuItemComponent
+ scrollerStyle: __style ? __style.scrollerStyle : undefined
+ itemsModel: menu.items
+ margin: menuFrameLoader.item ? menuFrameLoader.item.margin : 0
+ minWidth: menu.__minimumWidth
+ maxHeight: menuFrameLoader.item ? menuFrameLoader.item.maxHeight : 0
+ onTriggered: triggerAndDismiss(item)
+ }
+
+ Component {
+ id: menuItemComponent
+ Loader {
+ id: menuItemLoader
+
+ property var menuItem: modelData
+ readonly property bool isSeparator: !!menuItem && menuItem.type === MenuItemType.Separator
+ readonly property bool isSubmenu: !!menuItem && menuItem.type === MenuItemType.Menu
+ property bool selected: !(isSeparator || !!scrollerDirection) && menu.__currentIndex === index
+ property string text: isSubmenu ? menuItem.title : !(isSeparator || !!scrollerDirection) ? menuItem.text : ""
+ property bool showUnderlined: menu.__contentItem.altPressed
+ readonly property var scrollerDirection: menuItem["scrollerDirection"]
+
+ property int menuItemIndex: index
+
+ sourceComponent: menuFrameLoader.menuItemStyle
+ enabled: visible && !isSeparator && !!menuItem && menuItem.enabled
+ visible: !!menuItem && menuItem.visible
+ active: visible
+
+ function showSubMenu(immediately) {
+ if (immediately) {
+ if (menu.__currentIndex === menuItemIndex)
+ menuItem.__popup(menuFrameLoader.subMenuXPos, 0, -1)
+ } else {
+ openMenuTimer.start()
+ }
+ }
+
+ Timer {
+ id: openMenuTimer
+ interval: 50
+ onTriggered: menuItemLoader.showSubMenu(true)
+ }
+
+ function closeSubMenu() { closeMenuTimer.start() }
+
+ Timer {
+ id: closeMenuTimer
+ interval: 1
+ onTriggered: {
+ if (menu.__currentIndex !== menuItemIndex)
+ menuItem.__closeMenu()
+ }
+ }
+
+ onLoaded: {
+ menuItem.__visualItem = menuItemLoader
+
+ if (content.width < item.implicitWidth)
+ content.width = item.implicitWidth
+
+ var title = text
+ var ampersandPos = title.indexOf("&")
+ if (ampersandPos !== -1)
+ menuFrameLoader.mnemonicsMap[title[ampersandPos + 1].toUpperCase()] = menuItemLoader
+ }
+
+ Binding {
+ target: menuItemLoader.item
+ property: "width"
+ property alias menuItem: menuItemLoader.item
+ value: menuItem ? Math.max(menu.__minimumWidth, content.width) - 2 * menuItem.x : 0
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentScroller.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentScroller.qml
new file mode 100644
index 0000000000..30a8825af2
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentScroller.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+MouseArea {
+ property string direction
+
+ anchors {
+ top: direction === "up" ? parent.top : undefined
+ bottom: direction === "down" ? parent.bottom : undefined
+ }
+
+ hoverEnabled: visible
+ height: scrollerLoader.item.height
+ width: parent.width
+
+ Loader {
+ id: scrollerLoader
+
+ sourceComponent: menuItemDelegate
+ property int index: -1
+ property var modelData: {
+ "visible": true,
+ "scrollerDirection": direction,
+ "enabled": true
+ }
+ }
+
+ Timer {
+ interval: 100
+ repeat: true
+ triggeredOnStart: true
+ running: parent.containsMouse
+ onTriggered: scrollABit()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ModalPopupBehavior.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ModalPopupBehavior.qml
new file mode 100644
index 0000000000..8b78cb31b3
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ModalPopupBehavior.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+// KNOWN ISSUES
+// none
+
+/*!
+ \qmltype ModalPopupBehavior
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+Item {
+ id: popupBehavior
+
+ property bool showing: false
+ property bool whenAlso: true // modifier to the "showing" property
+ property bool consumeCancelClick: true
+ property int delay: 0 // delay before popout becomes visible
+ property int deallocationDelay: 3000 // 3 seconds
+
+ property Component popupComponent
+
+ property alias popup: popupLoader.item // read-only
+ property alias window: popupBehavior.root // read-only
+
+ signal prepareToShow
+ signal prepareToHide
+ signal cancelledByClick
+
+ // implementation
+
+ anchors.fill: parent
+
+ onShowingChanged: notifyChange()
+ onWhenAlsoChanged: notifyChange()
+ function notifyChange() {
+ if(showing && whenAlso) {
+ if(popupLoader.sourceComponent == undefined) {
+ popupLoader.sourceComponent = popupComponent;
+ }
+ } else {
+ mouseArea.enabled = false; // disable before opacity is changed in case it has fading behavior
+ if(Qt.isQtObject(popupLoader.item)) {
+ popupBehavior.prepareToHide();
+ popupLoader.item.opacity = 0;
+ }
+ }
+ }
+
+ property Item root: findRoot()
+ function findRoot() {
+ var p = parent;
+ while(p.parent != undefined)
+ p = p.parent;
+
+ return p;
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ enabled: false // enabled only when popout is showing
+ onPressed: {
+ popupBehavior.showing = false;
+ mouse.accepted = consumeCancelClick;
+ cancelledByClick();
+ }
+ }
+
+ Loader {
+ id: popupLoader
+ }
+
+ Timer { // visibility timer
+ running: Qt.isQtObject(popupLoader.item) && showing && whenAlso
+ interval: delay
+ onTriggered: {
+ popupBehavior.prepareToShow();
+ mouseArea.enabled = true;
+ popup.opacity = 1;
+ }
+ }
+
+ Timer { // deallocation timer
+ running: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity == 0
+ interval: deallocationDelay
+ onTriggered: popupLoader.sourceComponent = undefined
+ }
+
+ states: State {
+ name: "active"
+ when: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity > 0
+ ParentChange { target: popupBehavior; parent: root }
+ }
+ }
+
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollBar.qml
new file mode 100644
index 0000000000..65ed51cfce
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollBar.qml
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ScrollBar
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+Item {
+ id: scrollbar
+
+ property bool isTransient: false
+ property bool active: false
+ property int orientation: Qt.Horizontal
+ property alias minimumValue: slider.minimumValue
+ property alias maximumValue: slider.maximumValue
+ property alias value: slider.value
+ property int singleStep: 20
+
+ activeFocusOnTab: false
+
+ Accessible.role: Accessible.ScrollBar
+ implicitWidth: panelLoader.implicitWidth
+ implicitHeight: panelLoader.implicitHeight
+
+ property bool upPressed
+ property bool downPressed
+ property bool pageUpPressed
+ property bool pageDownPressed
+ property bool handlePressed
+
+
+ property Item __panel: panelLoader.item
+ Loader {
+ id: panelLoader
+ anchors.fill: parent
+ sourceComponent: __style ? __style.__scrollbar : null
+ onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root)
+ property alias __control: scrollbar
+ property QtObject __styleData: QtObject {
+ readonly property alias horizontal: internal.horizontal
+ readonly property alias upPressed: scrollbar.upPressed
+ readonly property alias downPressed: scrollbar.downPressed
+ readonly property alias handlePressed: scrollbar.handlePressed
+ }
+ }
+
+ MouseArea {
+ id: internal
+ property bool horizontal: orientation === Qt.Horizontal
+ property int pageStep: internal.horizontal ? width : height
+ property bool scrollToClickposition: internal.scrollToClickPosition
+ anchors.fill: parent
+ cursorShape: __panel.visible ? Qt.ArrowCursor : Qt.IBeamCursor // forces a cursor change
+
+ property bool autoincrement: false
+ property bool scrollToClickPosition: __style ? __style.scrollToClickedPosition : 0
+
+ // Update hover item
+ onEntered: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY)
+ onExited: if (!pressed) __panel.activeControl = "none"
+ onMouseXChanged: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY)
+ hoverEnabled: true
+
+ property var pressedX
+ property var pressedY
+ property int oldPosition
+ property int grooveSize
+
+ Timer {
+ running: upPressed || downPressed || pageUpPressed || pageDownPressed
+ interval: 350
+ onTriggered: internal.autoincrement = true
+ }
+
+ Timer {
+ running: internal.autoincrement
+ interval: 60
+ repeat: true
+ onTriggered: {
+ if (upPressed && internal.containsMouse)
+ internal.decrement();
+ else if (downPressed && internal.containsMouse)
+ internal.increment();
+ else if (pageUpPressed)
+ internal.decrementPage();
+ else if (pageDownPressed)
+ internal.incrementPage();
+ }
+ }
+
+ onPositionChanged: {
+ if (handlePressed) {
+ if (!horizontal)
+ slider.position = oldPosition + (mouseY - pressedY)
+ else
+ slider.position = oldPosition + (mouseX - pressedX)
+ }
+ }
+
+ onPressed: {
+ __panel.activeControl = __panel.hitTest(mouseX, mouseY)
+ scrollToClickposition = scrollToClickPosition
+ var handleRect = __panel.subControlRect("handle")
+ var grooveRect = __panel.subControlRect("groove")
+ grooveSize = horizontal ? grooveRect.width - handleRect.width:
+ grooveRect.height - handleRect.height;
+ if (__panel.activeControl === "handle") {
+ pressedX = mouseX;
+ pressedY = mouseY;
+ handlePressed = true;
+ oldPosition = slider.position;
+ } else if (__panel.activeControl === "up") {
+ decrement();
+ upPressed = Qt.binding(function() {return containsMouse});
+ } else if (__panel.activeControl === "down") {
+ increment();
+ downPressed = Qt.binding(function() {return containsMouse});
+ } else if (!scrollToClickposition){
+ if (__panel.activeControl === "upPage") {
+ decrementPage();
+ pageUpPressed = true;
+ } else if (__panel.activeControl === "downPage") {
+ incrementPage();
+ pageDownPressed = true;
+ }
+ } else { // scroll to click position
+ slider.position = horizontal ? mouseX - handleRect.width/2 - grooveRect.x
+ : mouseY - handleRect.height/2 - grooveRect.y
+ pressedX = mouseX;
+ pressedY = mouseY;
+ handlePressed = true;
+ oldPosition = slider.position;
+ }
+ }
+
+ onReleased: {
+ __panel.activeControl = __panel.hitTest(mouseX, mouseY);
+ autoincrement = false;
+ upPressed = false;
+ downPressed = false;
+ handlePressed = false;
+ pageUpPressed = false;
+ pageDownPressed = false;
+ }
+
+ onWheel: {
+ var stepCount = -(wheel.angleDelta.x ? wheel.angleDelta.x : wheel.angleDelta.y) / 120
+ if (stepCount != 0) {
+ if (wheel.modifiers & Qt.ControlModifier || wheel.modifiers & Qt.ShiftModifier)
+ incrementPage(stepCount)
+ else
+ increment(stepCount)
+ }
+ }
+
+ function incrementPage(stepCount) {
+ value = boundValue(value + getSteps(pageStep, stepCount))
+ }
+
+ function decrementPage(stepCount) {
+ value = boundValue(value - getSteps(pageStep, stepCount))
+ }
+
+ function increment(stepCount) {
+ value = boundValue(value + getSteps(singleStep, stepCount))
+ }
+
+ function decrement(stepCount) {
+ value = boundValue(value - getSteps(singleStep, stepCount))
+ }
+
+ function boundValue(val) {
+ return Math.min(Math.max(val, minimumValue), maximumValue)
+ }
+
+ function getSteps(step, count) {
+ if (count)
+ step *= count
+ return step
+ }
+
+ RangeModel {
+ id: slider
+ minimumValue: 0.0
+ maximumValue: 1.0
+ value: 0
+ stepSize: 0.0
+ inverted: false
+ positionAtMaximum: internal.grooveSize
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollViewHelper.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollViewHelper.qml
new file mode 100644
index 0000000000..3f1166f3e8
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollViewHelper.qml
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ScrollViewHeader
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+Item {
+ id: wheelarea
+
+ property alias horizontalScrollBar: hscrollbar
+ property alias verticalScrollBar: vscrollbar
+ property bool blockUpdates: false
+ property int availableHeight
+ property int availableWidth
+ property int contentHeight
+ property int contentWidth
+ property real originX
+ property real originY
+ property bool active
+
+ property int leftMargin: outerFrame ? root.__style.padding.left : 0
+ property int rightMargin: outerFrame ? root.__style.padding.right : 0
+ property int topMargin: outerFrame ? root.__style.padding.top : 0
+ property int bottomMargin: outerFrame ? root.__style.padding.bottom : 0
+
+ anchors.fill: parent
+
+ property bool recursionGuard: false
+
+ function doLayout() {
+ if (!recursionGuard) {
+ recursionGuard = true
+ wheelarea.availableWidth = viewport.width
+ wheelarea.availableHeight = viewport.height
+ wheelarea.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0
+ wheelarea.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0
+ wheelarea.originX = flickableItem !== null ? flickableItem.originX : 0
+ wheelarea.originY = flickableItem !== null ? flickableItem.originY : 0
+ recursionGuard = false
+ }
+ }
+
+ Connections {
+ target: viewport
+ onWidthChanged: doLayout()
+ onHeightChanged: doLayout()
+ }
+
+ Connections {
+ target: flickableItem
+ onContentWidthChanged: doLayout()
+ onContentHeightChanged: doLayout()
+ }
+
+ Connections {
+ target: flickableItem
+ onContentXChanged: {
+ hscrollbar.flash()
+ vscrollbar.flash()
+ }
+ onContentYChanged: {
+ hscrollbar.flash()
+ vscrollbar.flash()
+ }
+ }
+
+ Loader {
+ id: cornerFill
+ z: 1
+ sourceComponent: __style.corner
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: bottomMargin
+ anchors.rightMargin: rightMargin
+ width: visible ? vscrollbar.width : 0
+ height: visible ? hscrollbar.height : 0
+ visible: hscrollbar.visible && !hscrollbar.isTransient && vscrollbar.visible && !vscrollbar.isTransient
+ }
+
+ ScrollBar {
+ id: hscrollbar
+ isTransient: !!__panel && !!__panel.isTransient
+ active: !!__panel && (__panel.sunken || __panel.activeControl !== "none")
+ enabled: !isTransient || __panel.visible
+ orientation: Qt.Horizontal
+ visible: contentWidth > availableWidth
+ height: visible ? implicitHeight : 0
+ z: 1
+ maximumValue: contentWidth > availableWidth ? originX + contentWidth - availableWidth : 0
+ minimumValue: originX
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: cornerFill.left
+ anchors.leftMargin: leftMargin
+ anchors.bottomMargin: bottomMargin
+ onValueChanged: {
+ if (!blockUpdates) {
+ flickableItem.contentX = value
+ }
+ }
+ Binding {
+ target: hscrollbar.__panel
+ property: "raised"
+ value: vscrollbar.active || wheelarea.active
+ when: hscrollbar.isTransient
+ }
+ Binding {
+ target: hscrollbar.__panel
+ property: "visible"
+ value: true
+ when: !hscrollbar.isTransient || wheelarea.active
+ }
+ function flash() {
+ if (hscrollbar.isTransient) {
+ hscrollbar.__panel.on = true
+ hscrollbar.__panel.visible = true
+ hFlasher.start()
+ }
+ }
+ Timer {
+ id: hFlasher
+ interval: 10
+ onTriggered: hscrollbar.__panel.on = false
+ }
+ }
+
+ ScrollBar {
+ id: vscrollbar
+ isTransient: !!__panel && !!__panel.isTransient
+ active: !!__panel && (__panel.sunken || __panel.activeControl !== "none")
+ enabled: !isTransient || __panel.visible
+ orientation: Qt.Vertical
+ visible: contentHeight > availableHeight
+ width: visible ? implicitWidth : 0
+ z: 1
+ anchors.bottom: cornerFill.top
+ maximumValue: contentHeight > availableHeight ? originY + contentHeight - availableHeight + __viewTopMargin : 0
+ minimumValue: originY
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.topMargin: __scrollBarTopMargin + topMargin
+ anchors.rightMargin: rightMargin
+ onValueChanged: {
+ if (flickableItem && !blockUpdates && enabled) {
+ flickableItem.contentY = value
+ }
+ }
+ Binding {
+ target: vscrollbar.__panel
+ property: "raised"
+ value: hscrollbar.active || wheelarea.active
+ when: vscrollbar.isTransient
+ }
+ Binding {
+ target: vscrollbar.__panel
+ property: "visible"
+ value: true
+ when: !vscrollbar.isTransient || wheelarea.active
+ }
+ function flash() {
+ if (vscrollbar.isTransient) {
+ vscrollbar.__panel.on = true
+ vscrollbar.__panel.visible = true
+ vFlasher.start()
+ }
+ }
+ Timer {
+ id: vFlasher
+ interval: 10
+ onTriggered: vscrollbar.__panel.on = false
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/SourceProxy.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/SourceProxy.qml
new file mode 100644
index 0000000000..1cf03f313e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/SourceProxy.qml
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant input
+ property variant output
+ property variant sourceRect
+ visible: false
+
+ Component.onCompleted: evaluateInput()
+
+ onInputChanged: evaluateInput()
+
+ onSourceRectChanged: evaluateInput()
+
+ function evaluateInput() {
+ if (input == undefined) {
+ output = input
+ }
+ else if (sourceRect != undefined && sourceRect != Qt.rect(0, 0, 0, 0) && !isQQuickShaderEffectSource(input)) {
+ proxySource.sourceItem = input
+ output = proxySource
+ proxySource.sourceRect = sourceRect
+ }
+ else if (isQQuickItemLayerEnabled(input)) {
+ output = input
+ }
+ else if ((isQQuickImage(input) && !hasTileMode(input) && !hasChildren(input))) {
+ output = input
+ }
+ else if (isQQuickShaderEffectSource(input)) {
+ output = input
+ }
+ else {
+ proxySource.sourceItem = input
+ output = proxySource
+ proxySource.sourceRect = Qt.rect(0, 0, 0, 0)
+ }
+ }
+
+ function isQQuickItemLayerEnabled(item) {
+ if (item.hasOwnProperty("layer")) {
+ var l = item["layer"]
+ if (l.hasOwnProperty("enabled") && l["enabled"].toString() == "true")
+ return true
+ }
+ return false
+ }
+
+ function isQQuickImage(item) {
+ var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ]
+ return hasProperties(item, imageProperties)
+ }
+
+ function isQQuickShaderEffectSource(item) {
+ var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ]
+ return hasProperties(item, shaderEffectSourceProperties)
+ }
+
+ function hasProperties(item, properties) {
+ var counter = 0
+ for (var j = 0; j < properties.length; j++) {
+ if (item.hasOwnProperty(properties [j]))
+ counter++
+ }
+ return properties.length == counter
+ }
+
+ function hasChildren(item) {
+ if (item.hasOwnProperty("childrenRect")) {
+ if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)")
+ return true
+ else
+ return false
+ }
+ return false
+ }
+
+ function hasTileMode(item) {
+ if (item.hasOwnProperty("fillMode")) {
+ if (item["fillMode"].toString() != "0")
+ return true
+ else
+ return false
+ }
+ return false
+ }
+
+ ShaderEffectSource {
+ id: proxySource
+ live: rootItem.input != rootItem.output
+ hideSource: false
+ smooth: true
+ visible: false
+ }
+}
+
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackView.js b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackView.js
new file mode 100644
index 0000000000..fa9bb08e8c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackView.js
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var stackView = [];
+
+function push(p)
+{
+ if (!p)
+ return
+ stackView.push(p)
+ __depth++
+ return p
+}
+
+function pop()
+{
+ if (stackView.length === 0)
+ return null
+ var p = stackView.pop()
+ __depth--
+ return p
+}
+
+function current()
+{
+ if (stackView.length === 0)
+ return null
+ return stackView[stackView.length-1]
+}
+
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackViewSlideDelegate.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackViewSlideDelegate.qml
new file mode 100644
index 0000000000..88530e696c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackViewSlideDelegate.qml
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+
+/*!
+ \qmltype StackViewSlideTransition
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+StackViewDelegate {
+ id: root
+
+ property bool horizontal: true
+
+ function getTransition(properties)
+ {
+ return root[horizontal ? "horizontalSlide" : "verticalSlide"][properties.name]
+ }
+
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.y = 0
+ }
+
+ property QtObject horizontalSlide: QtObject {
+ property Component pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: target.width
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: -target.width
+ duration: 300
+ }
+ }
+
+ property Component popTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: -target.width
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: target.width
+ duration: 300
+ }
+ }
+ property Component replaceTransition: pushTransition
+ }
+
+ property QtObject verticalSlide: QtObject {
+ property Component pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: -target.height
+ duration: 300
+ }
+ }
+
+ property Component popTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: -target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: target.height
+ duration: 300
+ }
+ property Component replaceTransition: pushTransition
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Style.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Style.qml
new file mode 100644
index 0000000000..ed31536dd7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Style.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Style
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+
+AbstractStyle {
+ /*! The control attached to this style */
+ readonly property Item control: __control
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TabBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TabBar.qml
new file mode 100644
index 0000000000..2e374f994e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TabBar.qml
@@ -0,0 +1,308 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+
+/*!
+ \qmltype TabBar
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+FocusScope {
+ id: tabbar
+ height: Math.max(tabrow.height, Math.max(leftCorner.height, rightCorner.height))
+ width: tabView.width
+
+ activeFocusOnTab: true
+
+ Keys.onRightPressed: {
+ if (tabView && tabView.currentIndex < tabView.count - 1)
+ tabView.currentIndex = tabView.currentIndex + 1
+ }
+ Keys.onLeftPressed: {
+ if (tabView && tabView.currentIndex > 0)
+ tabView.currentIndex = tabView.currentIndex - 1
+ }
+
+ onTabViewChanged: parent = tabView
+ visible: tabView ? tabView.tabsVisible : true
+
+ property var tabView
+ property var style
+ property var styleItem: tabView.__styleItem ? tabView.__styleItem : null
+
+ property bool tabsMovable: styleItem ? styleItem.tabsMovable : false
+
+ property int tabsAlignment: styleItem ? styleItem.tabsAlignment : Qt.AlignLeft
+
+ property int tabOverlap: styleItem ? styleItem.tabOverlap : 0
+
+ property int elide: Text.ElideRight
+
+ property real availableWidth: tabbar.width - leftCorner.width - rightCorner.width
+
+ property var __selectedTabRect
+
+ function tab(index) {
+ for (var i = 0; i < tabrow.children.length; ++i) {
+ if (tabrow.children[i].tabindex == index) {
+ return tabrow.children[i]
+ }
+ }
+ return null;
+ }
+
+ /*! \internal */
+ function __isAncestorOf(item, child) {
+ //TODO: maybe removed from 5.2 if the function was merged in qtdeclarative
+ if (child === item)
+ return false;
+
+ while (child) {
+ child = child.parent;
+ if (child === item)
+ return true;
+ }
+ return false;
+ }
+ Loader {
+ id: background
+ anchors.fill: parent
+ sourceComponent: styleItem ? styleItem.tabBar : undefined
+ }
+
+ ListView {
+ id: tabrow
+ objectName: "tabrow"
+ Accessible.role: Accessible.PageTabList
+ LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
+ spacing: -tabOverlap
+ orientation: Qt.Horizontal
+ interactive: false
+ focus: true
+
+ // Note this will silence the binding loop warnings caused by QTBUG-35038
+ // and should be removed when this issue is resolved.
+ property int contentWidthWorkaround: contentWidth > 0 ? contentWidth: 0
+ width: Math.min(availableWidth, count ? contentWidthWorkaround : availableWidth)
+ height: currentItem ? currentItem.height : 0
+
+ highlightMoveDuration: 0
+ currentIndex: tabView.currentIndex
+ onCurrentIndexChanged: tabrow.positionViewAtIndex(currentIndex, ListView.Contain)
+
+ moveDisplaced: Transition {
+ NumberAnimation {
+ property: "x"
+ duration: 125
+ easing.type: Easing.OutQuad
+ }
+ }
+
+ states: [
+ State {
+ name: "left"
+ when: tabsAlignment === Qt.AlignLeft
+ AnchorChanges { target:tabrow ; anchors.left: parent.left }
+ PropertyChanges { target:tabrow ; anchors.leftMargin: leftCorner.width }
+ },
+ State {
+ name: "center"
+ when: tabsAlignment === Qt.AlignHCenter
+ AnchorChanges { target:tabrow ; anchors.horizontalCenter: tabbar.horizontalCenter }
+ },
+ State {
+ name: "right"
+ when: tabsAlignment === Qt.AlignRight
+ AnchorChanges { target:tabrow ; anchors.right: parent.right }
+ PropertyChanges { target:tabrow ; anchors.rightMargin: rightCorner.width }
+ }
+ ]
+
+ model: tabView.__tabs
+
+ delegate: MouseArea {
+ id: tabitem
+ objectName: "mousearea"
+ hoverEnabled: true
+ focus: true
+
+ Binding {
+ target: tabbar
+ when: selected
+ property: "__selectedTabRect"
+ value: Qt.rect(x, y, width, height)
+ }
+
+ drag.target: tabsMovable ? tabloader : null
+ drag.axis: Drag.XAxis
+ drag.minimumX: drag.active ? 0 : -Number.MAX_VALUE
+ drag.maximumX: tabrow.width - tabitem.width
+
+ property int tabindex: index
+ property bool selected : tabView.currentIndex === index
+ property string title: modelData.title
+ property bool nextSelected: tabView.currentIndex === index + 1
+ property bool previousSelected: tabView.currentIndex === index - 1
+
+ z: selected ? 1 : -index
+ implicitWidth: tabloader.implicitWidth
+ implicitHeight: tabloader.implicitHeight
+
+ function changeTab() {
+ tabView.currentIndex = index;
+ var next = tabbar.nextItemInFocusChain(true);
+ if (__isAncestorOf(tabView.getTab(currentIndex), next))
+ next.forceActiveFocus();
+ }
+
+ onClicked: {
+ if (tabrow.interactive) {
+ changeTab()
+ }
+ }
+ onPressed: {
+ if (!tabrow.interactive) {
+ changeTab()
+ }
+ }
+
+ Loader {
+ id: tabloader
+
+ property Item control: tabView
+ property int index: tabindex
+
+ property QtObject styleData: QtObject {
+ readonly property alias index: tabitem.tabindex
+ readonly property alias selected: tabitem.selected
+ readonly property alias title: tabitem.title
+ readonly property alias nextSelected: tabitem.nextSelected
+ readonly property alias previsousSelected: tabitem.previousSelected
+ readonly property alias hovered: tabitem.containsMouse
+ readonly property bool activeFocus: tabbar.activeFocus
+ readonly property real availableWidth: tabbar.availableWidth
+ }
+
+ sourceComponent: loader.item ? loader.item.tab : null
+
+ Drag.keys: "application/x-tabbartab"
+ Drag.active: tabitem.drag.active
+ Drag.source: tabitem
+
+ property real __prevX: 0
+ property real __dragX: 0
+ onXChanged: {
+ if (Drag.active) {
+ // keep track for the snap back animation
+ __dragX = tabitem.mapFromItem(tabrow, tabloader.x, 0).x
+
+ // when moving to the left, the hot spot is the left edge and vice versa
+ Drag.hotSpot.x = x < __prevX ? 0 : width
+ __prevX = x
+ }
+ }
+
+ width: tabitem.width
+ state: Drag.active ? "drag" : ""
+
+ transitions: [
+ Transition {
+ to: "drag"
+ PropertyAction { target: tabloader; property: "parent"; value: tabrow }
+ },
+ Transition {
+ from: "drag"
+ SequentialAnimation {
+ PropertyAction { target: tabloader; property: "parent"; value: tabitem }
+ NumberAnimation {
+ target: tabloader
+ duration: 50
+ easing.type: Easing.OutQuad
+ property: "x"
+ from: tabloader.__dragX
+ to: 0
+ }
+ }
+ }
+ ]
+ }
+
+ Accessible.role: Accessible.PageTab
+ Accessible.name: modelData.title
+ }
+ }
+
+ Loader {
+ id: leftCorner
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ sourceComponent: styleItem ? styleItem.leftCorner : undefined
+ width: item ? item.implicitWidth : 0
+ height: item ? item.implicitHeight : 0
+ }
+
+ Loader {
+ id: rightCorner
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ sourceComponent: styleItem ? styleItem.rightCorner : undefined
+ width: item ? item.implicitWidth : 0
+ height: item ? item.implicitHeight : 0
+ }
+
+ DropArea {
+ anchors.fill: tabrow
+ keys: "application/x-tabbartab"
+ onPositionChanged: {
+ var source = drag.source
+ var target = tabrow.itemAt(drag.x, drag.y)
+ if (source && target && source !== target) {
+ source = source.drag.target
+ target = target.drag.target
+ var center = target.parent.x + target.width / 2
+ if ((source.index > target.index && source.x < center)
+ || (source.index < target.index && source.x + source.width > center))
+ tabView.moveTab(source.index, target.index)
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TableViewSelection.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TableViewSelection.qml
new file mode 100644
index 0000000000..181c19e779
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TableViewSelection.qml
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+QtObject {
+
+ property int count: 0
+ signal selectionChanged
+
+ property bool __dirty: false
+ property var __ranges: new Array()
+
+ function forEach (callback) {
+ if (!(callback instanceof Function)) {
+ console.warn("TableViewSelection.forEach: argument is not a function")
+ return;
+ }
+ __forEach(callback, -1)
+ }
+
+ function contains(index) {
+ for (var i = 0 ; i < __ranges.length ; ++i) {
+ if (__ranges[i][0] <= index && index <= __ranges[i][1])
+ return true;
+ else if (__ranges[i][0] > index)
+ return false;
+ }
+ return false;
+ }
+
+ function clear() {
+ __ranges = new Array()
+ __dirty = true
+ count = 0
+ selectionChanged()
+ }
+
+ function selectAll() { select(0, rowCount - 1) }
+ function select(first, last) { __select(true, first, last) }
+ function deselect(first, last) { __select(false, first, last) }
+
+ // --- private section ---
+
+ function __printRanges() {
+ var out = ""
+ for (var i = 0 ; i < __ranges.length ; ++ i)
+ out += ("{" + __ranges[i][0] + "," + __ranges[i][1] + "} ")
+ print(out)
+ }
+
+ function __count() {
+ var sum = 0
+ for (var i = 0 ; i < __ranges.length ; ++i) {
+ sum += (1 + __ranges[i][1] - __ranges[i][0])
+ }
+ return sum
+ }
+
+ function __forEach (callback, startIndex) {
+ __dirty = false
+ var i, j
+
+ for (i = 0 ; i < __ranges.length && !__dirty ; ++i) {
+ for (j = __ranges[i][0] ; !__dirty && j <= __ranges[i][1] ; ++j) {
+ if (j >= startIndex)
+ callback.call(this, j)
+ }
+ }
+
+ // Restart iteration at last index if selection changed
+ if (__dirty)
+ return __forEach(callback, j)
+ }
+
+ function __selectOne(index) {
+ __ranges = [[index, index]]
+ __dirty = true
+ count = 1
+ selectionChanged();
+ }
+
+ function __select(select, first, last) {
+
+ var i, range
+ var start = first
+ var stop = first
+ var startRangeIndex = -1
+ var stopRangeIndex = -1
+ var newRangePos = 0
+
+ if (first < 0 || last < 0 || first >= rowCount || last >=rowCount) {
+ console.warn("TableViewSelection: index out of range")
+ return
+ }
+
+ if (last !== undefined) {
+ start = first <= last ? first : last
+ stop = first <= last ? last : first
+ }
+
+ if (select) {
+
+ // Find beginning and end ranges
+ for (i = 0 ; i < __ranges.length; ++ i) {
+ range = __ranges[i]
+ if (range[0] > stop + 1) continue; // above range
+ if (range[1] < start - 1) { // below range
+ newRangePos = i + 1
+ continue;
+ }
+ if (startRangeIndex == -1)
+ startRangeIndex = i
+ stopRangeIndex = i
+ }
+
+ if (startRangeIndex !== -1)
+ start = Math.min(__ranges[startRangeIndex][0], start)
+ if (stopRangeIndex !== -1)
+ stop = Math.max(__ranges[stopRangeIndex][1], stop)
+
+ if (startRangeIndex == -1)
+ startRangeIndex = newRangePos
+
+ __ranges.splice(Math.max(0, startRangeIndex),
+ 1 + stopRangeIndex - startRangeIndex, [start, stop])
+
+ } else {
+
+ // Find beginning and end ranges
+ for (i = 0 ; i < __ranges.length; ++ i) {
+ range = __ranges[i]
+ if (range[1] < start) continue; // below range
+ if (range[0] > stop) continue; // above range
+ if (startRangeIndex == -1)
+ startRangeIndex = i
+ stopRangeIndex = i
+ }
+
+ // Slice ranges accordingly
+ if (startRangeIndex >= 0 && stopRangeIndex >= 0) {
+ var startRange = __ranges[startRangeIndex]
+ var stopRange = __ranges[stopRangeIndex]
+ var length = 1 + stopRangeIndex - startRangeIndex
+ if (start <= startRange[0] && stop >= stopRange[1]) { //remove
+ __ranges.splice(startRangeIndex, length)
+ } else if (start - 1 < startRange[0] && stop <= stopRange[1]) { //cut front
+ __ranges.splice(startRangeIndex, length, [stop + 1, stopRange[1]])
+ } else if (start - 1 < startRange[1] && stop >= stopRange[1]) { // cut back
+ __ranges.splice(startRangeIndex, length, [startRange[0], start - 1])
+ } else { //split
+ __ranges.splice(startRangeIndex, length, [startRange[0], start - 1], [stop + 1, stopRange[1]])
+ }
+ }
+ }
+ __dirty = true
+ count = __count() // forces a re-evaluation of indexes in the delegates
+ selectionChanged()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TextSingleton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TextSingleton.qml
new file mode 100644
index 0000000000..7a3f07cdd1
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TextSingleton.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.1
+Text {}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/qmldir b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/qmldir
new file mode 100644
index 0000000000..3513878067
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/qmldir
@@ -0,0 +1,22 @@
+module QtQuick.Controls.Private
+AbstractCheckable 1.0 AbstractCheckable.qml
+Control 1.0 Control.qml
+FocusFrame 1.0 FocusFrame.qml
+Margins 1.0 Margins.qml
+BasicButton 1.0 BasicButton.qml
+ScrollBar 1.0 ScrollBar.qml
+ScrollViewHelper 1.0 ScrollViewHelper.qml
+Style 1.0 Style.qml
+TabBar 1.0 TabBar.qml
+StackViewSlideDelegate 1.0 StackViewSlideDelegate.qml
+StyleHelpers 1.0 style.js
+JSArray 1.0 StackView.js
+TableViewSelection 1.0 TableViewSelection.qml
+FastGlow 1.0 FastGlow.qml
+SourceProxy 1.0 SourceProxy.qml
+GroupBoxStyle 1.0 ../Styles/Base/GroupBoxStyle.qml
+ToolButtonStyle 1.0 ../Styles/Base/ToolButtonStyle.qml
+MenuContentItem 1.0 MenuContentItem.qml
+MenuContentScroller 1.0 MenuContentScroller.qml
+ColumnMenuContent 1.0 ColumnMenuContent.qml
+singleton TextSingleton 1.0 TextSingleton.qml
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js
new file mode 100644
index 0000000000..2c47ff0e72
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+function underlineAmpersands(match, p1, p2, p3) {
+ if (p2 === "&")
+ return p1.concat(p2, p3)
+ return p1.concat("<u>", p2, "</u>", p3)
+}
+
+function removeAmpersands(match, p1, p2, p3) {
+ return p1.concat(p2, p3)
+}
+
+function replaceAmpersands(text, replaceFunction) {
+ return text.replace(/([^&]*)&(.)([^&]*)/g, replaceFunction)
+}
+
+function stylizeMnemonics(text) {
+ return replaceAmpersands(text, underlineAmpersands)
+}
+
+function removeMnemonics(text) {
+ return replaceAmpersands(text, removeAmpersands)
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ProgressBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ProgressBar.qml
new file mode 100644
index 0000000000..523f3978e0
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ProgressBar.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ProgressBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A progress indicator.
+
+ The ProgressBar is used to give an indication of the progress of an operation.
+ \l value is updated regularly and must be between \l minimumValue and \l maximumValue.
+
+ You can create a custom appearance for a ProgressBar by
+ assigning a \l {QtQuick.Controls.Styles::ProgressBarStyle}{ProgressBarStyle}.
+*/
+
+Control {
+ id: progressbar
+
+ /*! This property holds the progress bar's current value.
+ Attempting to change the current value to one outside the minimum-maximum
+ range has no effect on the current value.
+
+ The default value is \c{0}.
+ */
+ property real value: 0
+
+ /*! This property is the progress bar's minimum value.
+ The \l value is clamped to this value.
+ The default value is \c{0}.
+ */
+ property real minimumValue: 0
+
+ /*! This property is the progress bar's maximum value.
+ The \l value is clamped to this value.
+ If maximumValue is smaller than \l minimumValue, \l minimumValue will be enforced.
+ The default value is \c{1}.
+ */
+ property real maximumValue: 1
+
+ /*! This property toggles indeterminate mode.
+ When the actual progress is unknown, use this option.
+ The progress bar will be animated as a busy indicator instead.
+ The default value is \c false.
+ */
+ property bool indeterminate: false
+
+ /*! \qmlproperty enumeration orientation
+
+ This property holds the orientation of the progress bar.
+
+ \list
+ \li Qt.Horizontal - Horizontal orientation. (Default)
+ \li Qt.Vertical - Vertical orientation.
+ \endlist
+ */
+ property int orientation: Qt.Horizontal
+
+ /*! \qmlproperty bool ProgressBar::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: hoverArea.containsMouse
+
+ /*! \internal */
+ style: Qt.createComponent(Settings.style + "/ProgressBarStyle.qml", progressbar)
+
+ /*! \internal */
+ property bool __initialized: false
+ /*! \internal */
+ onMaximumValueChanged: setValue(value)
+ /*! \internal */
+ onMinimumValueChanged: setValue(value)
+ /*! \internal */
+ onValueChanged: if (__initialized) setValue(value)
+ /*! \internal */
+ Component.onCompleted: {
+ __initialized = true;
+ setValue(value)
+ }
+
+ activeFocusOnTab: false
+
+ Accessible.role: Accessible.ProgressBar
+ Accessible.name: value
+
+ implicitWidth:(__panel ? __panel.implicitWidth : 0)
+ implicitHeight: (__panel ? __panel.implicitHeight: 0)
+
+ MouseArea {
+ id: hoverArea
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ /*! \internal */
+ function setValue(v) {
+ var newval = parseFloat(v)
+ if (!isNaN(newval)) {
+ // we give minimumValue priority over maximum if they are inconsistent
+ if (newval > maximumValue) {
+ if (maximumValue >= minimumValue)
+ newval = maximumValue;
+ else
+ newval = minimumValue
+ } else if (v < minimumValue) {
+ newval = minimumValue
+ }
+ if (value !== newval)
+ value = newval
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/RadioButton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/RadioButton.qml
new file mode 100644
index 0000000000..5ab7f68cb9
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/RadioButton.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype RadioButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A radio button with a text label.
+
+ A RadioButton is an option button that can be switched on (checked) or off
+ (unchecked). Radio buttons typically present the user with a "one of many"
+ choice. In a group of radio buttons, only one radio button at a time can be
+ checked; if the user selects another button, the previously selected button
+ is switched off.
+
+ \qml
+ GroupBox {
+ title: qsTr("Search")
+ Column {
+ ExclusiveGroup { id: group }
+ RadioButton {
+ text: qsTr("From top")
+ exclusiveGroup: group
+ checked: true
+ }
+ RadioButton {
+ text: qsTr("From cursor")
+ exclusiveGroup: group
+ }
+ }
+ }
+ \endqml
+
+ You can create a custom appearance for a RadioButton by
+ assigning a \l {QtQuick.Controls.Styles::RadioButtonStyle}{RadioButtonStyle}.
+*/
+
+AbstractCheckable {
+ id: radioButton
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.RadioButton
+
+ /*!
+ The style that should be applied to the radio button. Custom style
+ components can be created with:
+
+ \codeline Qt.createComponent("path/to/style.qml", radioButtonId);
+ */
+ style: Qt.createComponent(Settings.style + "/RadioButtonStyle.qml", radioButton)
+
+ __cycleStatesHandler: function() { checked = !checked; }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ScrollView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ScrollView.qml
new file mode 100644
index 0000000000..6f1187ea50
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ScrollView.qml
@@ -0,0 +1,318 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+
+/*!
+ \qmltype ScrollView
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup views
+ \brief Provides a scrolling view within another Item.
+
+ A ScrollView can be used either to replace a \l Flickable or decorate an
+ existing \l Flickable. Depending on the platform, it will add scroll bars and
+ a content frame.
+
+ Only one Item can be a direct child of the ScrollView and the child is implicitly anchored
+ to fill the scroll view.
+
+ Example:
+ \code
+ ScrollView {
+ Image { imageSource: "largeImage.png" }
+ }
+ \endcode
+
+ In the previous example the Image item will implicitly get scroll behavior as if it was
+ used within a \l Flickable. The width and height of the child item will be used to
+ define the size of the content area.
+
+ Example:
+ \code
+ ScrollView {
+ ListView {
+ ...
+ }
+ }
+ \endcode
+
+ In this case the content size of the ScrollView will simply mirror that of its contained
+ \l flickableItem.
+
+ You can create a custom appearance for a ScrollView by
+ assigning a \l {QtQuick.Controls.Styles::ScrollViewStyle}{ScrollViewStyle}.
+*/
+
+FocusScope {
+ id: root
+
+ implicitWidth: 240
+ implicitHeight: 150
+
+ /*!
+ This property tells the ScrollView if it should render
+ a frame around its content.
+
+ The default value is \c false.
+ */
+ property bool frameVisible: false
+
+ /*!
+ This property controls if there should be a highlight
+ around the frame when the ScrollView has input focus.
+
+ The default value is \c false.
+
+ \note This property is only applicable on some platforms, such
+ as Mac OS.
+ */
+ property bool highlightOnFocus: false
+
+ /*!
+ \qmlproperty Item ScrollView::viewport
+
+ The viewport determines the current "window" on the contentItem.
+ In other words, it clips it and the size of the viewport tells you
+ how much of the content area is visible.
+ */
+ property alias viewport: viewportItem
+
+ /*!
+ \qmlproperty Item ScrollView::flickableItem
+
+ The flickableItem of the ScrollView. If the contentItem provided
+ to the ScrollView is a Flickable, it will be the \l contentItem.
+ */
+ readonly property alias flickableItem: internal.flickableItem
+
+ /*!
+ The contentItem of the ScrollView. This is set by the user.
+
+ Note that the definition of contentItem is somewhat different to that
+ of a Flickable, where the contentItem is implicitly created.
+ */
+ default property Item contentItem
+
+ /*! \internal */
+ property Item __scroller: scroller
+ /*! \internal */
+ property alias __wheelAreaScrollSpeed: wheelArea.scrollSpeed
+ /*! \internal */
+ property int __scrollBarTopMargin: 0
+ /*! \internal */
+ property int __viewTopMargin: 0
+ /*! \internal */
+ property alias __horizontalScrollBar: scroller.horizontalScrollBar
+ /*! \internal */
+ property alias __verticalScrollBar: scroller.verticalScrollBar
+ /*! \qmlproperty Component ScrollView::style
+
+ The style Component for this control.
+ \sa {Qt Quick Controls Styles QML Types}
+
+ */
+ property Component style: Qt.createComponent(Settings.style + "/ScrollViewStyle.qml", root)
+
+ /*! \internal */
+ property Style __style: styleLoader.item
+
+ activeFocusOnTab: true
+
+ onContentItemChanged: {
+
+ if (contentItem.hasOwnProperty("contentY") && // Check if flickable
+ contentItem.hasOwnProperty("contentHeight")) {
+ internal.flickableItem = contentItem // "Use content if it is a flickable
+ internal.flickableItem.parent = viewportItem
+ } else {
+ internal.flickableItem = flickableComponent.createObject(viewportItem)
+ contentItem.parent = internal.flickableItem.contentItem
+ }
+ internal.flickableItem.anchors.fill = viewportItem
+ if (!Settings.hasTouchScreen)
+ internal.flickableItem.interactive = false
+ }
+
+
+ children: Item {
+ id: internal
+
+ property Flickable flickableItem
+
+ Loader {
+ id: styleLoader
+ sourceComponent: style
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", root)
+ }
+ property alias __control: root
+ }
+
+ Binding {
+ target: flickableItem
+ property: "contentHeight"
+ when: contentItem !== flickableItem
+ value: contentItem ? contentItem.height : 0
+ }
+
+ Binding {
+ target: flickableItem
+ when: contentItem !== flickableItem
+ property: "contentWidth"
+ value: contentItem ? contentItem.width : 0
+ }
+
+ Connections {
+ target: flickableItem
+
+ onContentYChanged: {
+ scroller.blockUpdates = true
+ scroller.verticalScrollBar.value = flickableItem.contentY
+ scroller.blockUpdates = false
+ }
+
+ onContentXChanged: {
+ scroller.blockUpdates = true
+ scroller.horizontalScrollBar.value = flickableItem.contentX
+ scroller.blockUpdates = false
+ }
+
+ }
+
+ anchors.fill: parent
+
+ Component {
+ id: flickableComponent
+ Flickable {}
+ }
+
+ WheelArea {
+ id: wheelArea
+ parent: flickableItem
+
+ // ### Note this is needed due to broken mousewheel behavior in Flickable.
+
+ anchors.fill: parent
+
+ property int acceleration: 40
+ property int flickThreshold: 20
+ property real speedThreshold: 3
+ property real ignored: 0.001 // ## flick() does not work with 0 yVelocity
+ property int maxFlick: 400
+
+ property bool horizontalRecursionGuard: false
+ property bool verticalRecursionGuard: false
+
+ horizontalMinimumValue: flickableItem ? flickableItem.originX : 0
+ horizontalMaximumValue: flickableItem ? flickableItem.originX + flickableItem.contentWidth - viewport.width : 0
+
+ verticalMinimumValue: flickableItem ? flickableItem.originY : 0
+ verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0
+
+ Connections {
+ target: flickableItem
+
+ onContentYChanged: {
+ wheelArea.verticalRecursionGuard = true
+ wheelArea.verticalValue = flickableItem.contentY
+ wheelArea.verticalRecursionGuard = false
+ }
+ onContentXChanged: {
+ wheelArea.horizontalRecursionGuard = true
+ wheelArea.horizontalValue = flickableItem.contentX
+ wheelArea.horizontalRecursionGuard = false
+ }
+ }
+
+ onVerticalValueChanged: {
+ if (!verticalRecursionGuard) {
+ if (flickableItem.contentY < flickThreshold && verticalDelta > speedThreshold) {
+ flickableItem.flick(ignored, Math.min(maxFlick, acceleration * verticalDelta))
+ } else if (flickableItem.contentY > flickableItem.contentHeight
+ - flickThreshold - viewport.height && verticalDelta < -speedThreshold) {
+ flickableItem.flick(ignored, Math.max(-maxFlick, acceleration * verticalDelta))
+ } else {
+ flickableItem.contentY = verticalValue
+ }
+ }
+ }
+
+ onHorizontalValueChanged: {
+ if (!horizontalRecursionGuard)
+ flickableItem.contentX = horizontalValue
+ }
+ }
+
+ ScrollViewHelper {
+ id: scroller
+ anchors.fill: parent
+ active: wheelArea.active
+ property bool outerFrame: !frameVisible || !(__style ? __style.__externalScrollBars : 0)
+ property int scrollBarSpacing: outerFrame ? 0 : (__style ? __style.__scrollBarSpacing : 0)
+ property int verticalScrollbarOffset: verticalScrollBar.visible && !verticalScrollBar.isTransient ?
+ verticalScrollBar.width + scrollBarSpacing : 0
+ property int horizontalScrollbarOffset: horizontalScrollBar.visible && !horizontalScrollBar.isTransient ?
+ horizontalScrollBar.height + scrollBarSpacing : 0
+ Loader {
+ id: frameLoader
+ sourceComponent: __style ? __style.frame : null
+ anchors.fill: parent
+ anchors.rightMargin: scroller.outerFrame ? 0 : scroller.verticalScrollbarOffset
+ anchors.bottomMargin: scroller.outerFrame ? 0 : scroller.horizontalScrollbarOffset
+ }
+
+ Item {
+ id: viewportItem
+ anchors.fill: frameLoader
+ anchors.topMargin: frameVisible ? __style.padding.top : 0
+ anchors.leftMargin: frameVisible ? __style.padding.left : 0
+ anchors.rightMargin: (frameVisible ? __style.padding.right : 0) + (scroller.outerFrame ? scroller.verticalScrollbarOffset : 0)
+ anchors.bottomMargin: (frameVisible ? __style.padding.bottom : 0) + (scroller.outerFrame ? scroller.horizontalScrollbarOffset : 0)
+ clip: true
+ }
+ }
+ FocusFrame { visible: highlightOnFocus && root.activeFocus }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Slider.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Slider.qml
new file mode 100644
index 0000000000..d87bb526ae
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Slider.qml
@@ -0,0 +1,299 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Slider
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Provides a vertical or horizontal slider control.
+
+ The slider is the classic control for providing a bounded value. It lets
+ the user move a slider handle along a horizontal or vertical groove
+ and translates the handle's position into a value within the legal range.
+
+ \code
+ Slider {
+ onValueChanged: print(value)
+ }
+ \endcode
+
+ The Slider value is by default in the range [0, 1]. If integer values are
+ needed, you can set the \l stepSize.
+
+ You can create a custom appearance for a Slider by
+ assigning a \l {QtQuick.Controls.Styles::SliderStyle}{SliderStyle}.
+*/
+
+Control {
+ id: slider
+
+ /*!
+ \qmlproperty enumeration Slider::orientation
+
+ This property holds the layout orientation of the slider.
+ The default value is \c Qt.Horizontal.
+ */
+ property int orientation: Qt.Horizontal
+
+ /*!
+ \qmlproperty real Slider::minimumValue
+
+ This property holds the minimum value of the Slider.
+ The default value is \c{0.0}.
+ */
+ property alias minimumValue: range.minimumValue
+
+ /*!
+ \qmlproperty real Slider::maximumValue
+
+ This property holds the maximum value of the Slider
+ The default value is \c{1.0}.
+ */
+ property alias maximumValue: range.maximumValue
+
+ /*!
+ \qmlproperty bool Slider::updateValueWhileDragging
+
+ This property indicates whether the current \l value should be updated while
+ the user is moving the slider handle, or only when the button has been released.
+ This property could for instance be modified if changing the slider value would turn
+ out to be too time consuming.
+
+ The default value is \c true.
+ */
+ property bool updateValueWhileDragging: true
+
+ /*!
+ \qmlproperty bool Slider::pressed
+
+ This property indicates whether the slider handle is being pressed.
+ */
+ readonly property alias pressed: mouseArea.pressed
+
+ /*!
+ \qmlproperty bool Slider::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*!
+ \qmlproperty real Slider::stepSize
+
+ This property indicates the slider step size.
+
+ A value of 0 indicates that the value of the slider operates in a
+ continuous range between \l minimumValue and \l maximumValue.
+
+ Any non 0 value indicates a discrete stepSize. The following example
+ will generate a slider with integer values in the range [0-5].
+
+ \qml
+ Slider {
+ maximumValue: 5.0
+ stepSize: 1.0
+ }
+ \endqml
+
+ The default value is \c{0.0}.
+ */
+ property alias stepSize: range.stepSize
+
+ /*!
+ \qmlproperty real Slider::value
+
+ This property holds the current value of the Slider.
+ The default value is \c{0.0}.
+ */
+ property alias value: range.value
+
+ /*!
+ \qmlproperty bool Slider::activeFocusOnPress
+
+ This property indicates whether the Slider should receive active focus when
+ pressed.
+ */
+ property bool activeFocusOnPress: false
+
+ /*!
+ \qmlproperty bool Slider::tickmarksEnabled
+
+ This property indicates whether the Slider should display tickmarks
+ at step intervals. Tick mark spacing is calculated based on the
+ \l stepSize property.
+
+ The default value is \c false.
+ */
+ property bool tickmarksEnabled: false
+
+ /*! \internal */
+ property bool __horizontal: orientation === Qt.Horizontal
+
+ /*! \internal */
+ property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y)
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.Slider
+ Accessible.name: value
+
+ style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider)
+
+ Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0
+ Keys.onLeftPressed: value -= (maximumValue - minimumValue)/10.0
+
+ RangeModel {
+ id: range
+ minimumValue: 0.0
+ maximumValue: 1.0
+ value: 0
+ stepSize: 0.0
+ inverted: __horizontal ? false : true
+
+ positionAtMinimum: 0
+ positionAtMaximum: __horizontal ? slider.width - fakeHandle.width : slider.height - fakeHandle.height
+ }
+
+ Item {
+ id: fakeHandle
+ anchors.verticalCenter: __horizontal ? parent.verticalCenter : undefined
+ anchors.horizontalCenter: !__horizontal ? parent.horizontalCenter : undefined
+ width: __panel.handleWidth
+ height: __panel.handleHeight
+
+ function updatePos() {
+ if (updateValueWhileDragging && !mouseArea.drag.active)
+ range.position = __horizontal ? x : y
+ }
+
+ onXChanged: updatePos();
+ onYChanged: updatePos();
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ hoverEnabled: true
+ anchors.centerIn: parent
+
+ preventStealing: true
+
+ width: parent.width
+ height: parent.height
+
+ property int clickOffset: 0
+
+ function clamp ( val ) {
+ return Math.max(range.positionAtMinimum, Math.min(range.positionAtMaximum, val))
+ }
+
+ onMouseXChanged: {
+ if (pressed && __horizontal) {
+ var pos = clamp (mouse.x + clickOffset - fakeHandle.width/2)
+ fakeHandle.x = pos
+ }
+ }
+
+ onMouseYChanged: {
+ if (pressed && !__horizontal) {
+ var pos = clamp (mouse.y + clickOffset- fakeHandle.height/2)
+ fakeHandle.y = pos
+ }
+ }
+
+ onPressed: {
+ if (slider.activeFocusOnPress)
+ slider.forceActiveFocus();
+
+ var point = mouseArea.mapToItem(fakeHandle, mouse.x, mouse.y)
+ if (fakeHandle.contains(Qt.point(point.x, point.y))) {
+ clickOffset = __horizontal ? fakeHandle.width/2 - point.x : fakeHandle.height/2 - point.y
+ }
+ }
+
+ onReleased: {
+ // If we don't update while dragging, this is the only
+ // moment that the range is updated.
+ if (!slider.updateValueWhileDragging)
+ range.position = __horizontal ? fakeHandle.x : fakeHandle.y;
+ clickOffset = 0
+ }
+ }
+
+
+ // During the drag, we simply ignore the position set from the range, this
+ // means that setting a value while dragging will not "interrupt" the
+ // dragging activity.
+ Binding {
+ when: !mouseArea.drag.active
+ target: fakeHandle
+ property: __horizontal ? "x" : "y"
+ value: range.position
+ }
+
+ WheelArea {
+ id: wheelarea
+ anchors.fill: parent
+ horizontalMinimumValue: slider.minimumValue
+ horizontalMaximumValue: slider.maximumValue
+ verticalMinimumValue: slider.minimumValue
+ verticalMaximumValue: slider.maximumValue
+ property real step: (slider.maximumValue - slider.minimumValue)/(range.positionAtMaximum - range.positionAtMinimum)
+
+ onVerticalWheelMoved: {
+ if (verticalDelta !== 0) {
+ var delta = Math.abs(verticalDelta)*step > stepSize ? verticalDelta*step : verticalDelta/Math.abs(verticalDelta)*stepSize
+ value += delta
+ }
+ }
+
+ onHorizontalWheelMoved: {
+ if (horizontalDelta !== 0) {
+ var delta = Math.abs(horizontalDelta)*step > stepSize ? horizontalDelta*step : horizontalDelta/Math.abs(horizontalDelta)*stepSize
+ value += delta
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SpinBox.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SpinBox.qml
new file mode 100644
index 0000000000..c756566dec
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SpinBox.qml
@@ -0,0 +1,339 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype SpinBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Provides a spin box control.
+
+ SpinBox allows the user to choose a value by clicking the up or down buttons, or by
+ pressing up or down on the keyboard. The user can also type the value in manually.
+
+ By default the SpinBox provides discrete values in the range [0-99] with a \l stepSize of 1 and 0 \l decimals.
+
+ \code
+ SpinBox {
+ id: spinbox
+ }
+ \endcode
+
+ Note that if you require decimal values you will need to set the \l decimals to a non 0 value.
+
+ \code
+ SpinBox {
+ id: spinbox
+ decimals: 2
+ }
+ \endcode
+
+*/
+
+Control {
+ id: spinbox
+
+ /*!
+ \qmlproperty real SpinBox::value
+
+ The value of this SpinBox, clamped to \l minimumValue and \l maximumValue.
+
+ The default value is \c{0.0}.
+ */
+ property alias value: validator.value
+
+ /*!
+ \qmlproperty real SpinBox::minimumValue
+
+ The minimum value of the SpinBox range.
+ The \l value is clamped to this value.
+
+ The default value is \c{0.0}.
+ */
+ property alias minimumValue: validator.minimumValue
+
+ /*!
+ \qmlproperty real SpinBox::maximumValue
+
+ The maximum value of the SpinBox range.
+ The \l value is clamped to this value. If maximumValue is smaller than
+ \l minimumValue, \l minimumValue will be enforced.
+
+ The default value is \c{99}.
+ */
+ property alias maximumValue: validator.maximumValue
+
+ /*! \qmlproperty real SpinBox::stepSize
+ The amount by which the \l value is incremented/decremented when a
+ spin button is pressed.
+
+ The default value is \c{1.0}.
+ */
+ property alias stepSize: validator.stepSize
+
+ /*! \qmlproperty string SpinBox::suffix
+ The suffix for the value. I.e "cm" */
+ property alias suffix: validator.suffix
+
+ /*! \qmlproperty string SpinBox::prefix
+ The prefix for the value. I.e "$" */
+ property alias prefix: validator.prefix
+
+ /*! \qmlproperty int SpinBox::decimals
+ This property indicates the amount of decimals.
+ Note that if you enter more decimals than specified, they will
+ be truncated to the specified amount of decimal places.
+ The default value is \c{0}.
+ */
+ property alias decimals: validator.decimals
+
+ /*! \qmlproperty font SpinBox::font
+
+ This property indicates the current font used by the SpinBox.
+ */
+ property alias font: input.font
+
+ /*! This property indicates whether the Spinbox should get active
+ focus when pressed.
+ The default value is \c true.
+ */
+ property bool activeFocusOnPress: true
+
+ /*! \qmlproperty enumeration horizontalAlignment
+ \since 5.2
+
+ This property indicates how the content is horizontally aligned
+ within the text field.
+
+ The supported values are:
+ \list
+ \li Qt.AlignLeft
+ \li Qt.AlignHCenter
+ \li Qt.AlignRight
+ \endlist
+
+ The default value is style dependent.
+ */
+ property int horizontalAlignment: __panel ? __panel.horizontalAlignment : Qt.AlignLeft
+
+ /*!
+ \qmlproperty bool SpinBox::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*!
+ \qmlsignal SpinBox::editingFinished()
+ \since 5.2
+
+ This signal is emitted when the Return or Enter key is pressed or
+ the control loses focus. Note that if there is a validator
+ set on the control and enter/return is pressed, this signal will
+ only be emitted if the validator returns an acceptable state.
+ */
+ signal editingFinished()
+
+ style: Qt.createComponent(Settings.style + "/SpinBoxStyle.qml", spinbox)
+
+ /*! \internal */
+ function __increment() {
+ validator.increment()
+ input.selectValue()
+ }
+
+ /*! \internal */
+ function __decrement() {
+ validator.decrement()
+ input.selectValue()
+ }
+
+ /*! \internal */
+ property alias __text: input.text
+
+ __styleData: QtObject {
+ readonly property bool upEnabled: value != maximumValue;
+ readonly property alias upHovered: mouseUp.containsMouse
+ readonly property alias upPressed: mouseUp.pressed
+
+ readonly property bool downEnabled: value != minimumValue;
+ readonly property alias downPressed: mouseDown.pressed
+ readonly property alias downHovered: mouseDown.containsMouse
+
+ readonly property int contentHeight: Math.max(input.implicitHeight, 16)
+ readonly property int contentWidth: Math.max(maxSizeHint.implicitWidth, minSizeHint.implicitWidth)
+ }
+
+ Text {
+ id: maxSizeHint
+ text: prefix + maximumValue.toFixed(decimals) + suffix
+ font: input.font
+ visible: false
+ }
+
+ Text {
+ id: minSizeHint
+ text: prefix + minimumValue.toFixed(decimals) + suffix
+ font: input.font
+ visible: false
+ }
+
+ activeFocusOnTab: true
+
+ onActiveFocusChanged: if (activeFocus) input.selectValue()
+
+ Accessible.name: input.text
+ Accessible.role: Accessible.SpinBox
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ onPressed: if (activeFocusOnPress) input.forceActiveFocus()
+ onWheel: {
+ if (wheel.angleDelta.y > 0)
+ __increment();
+ else
+ __decrement();
+ }
+ }
+
+ TextInput {
+ id: input
+ clip: contentWidth > width
+ anchors.fill: parent
+ anchors.leftMargin: __style ? __style.padding.left : 0
+ anchors.topMargin: __style ? __style.padding.top : 0
+ anchors.rightMargin: __style ? __style.padding.right: 0
+ anchors.bottomMargin: __style ? __style.padding.bottom: 0
+
+ focus: true
+ activeFocusOnPress: spinbox.activeFocusOnPress
+
+ horizontalAlignment: spinbox.horizontalAlignment
+ verticalAlignment: __panel ? __panel.verticalAlignment : Qt.AlignVCenter
+ selectByMouse: true
+
+ validator: SpinBoxValidator {
+ id: validator
+ property bool ready: false // Delay validation until all properties are ready
+ onTextChanged: if (ready) input.text = validator.text
+ Component.onCompleted: {input.text = validator.text ; ready = true}
+ }
+ onAccepted: {
+ input.text = validator.text
+ selectValue()
+ }
+
+ onEditingFinished: spinbox.editingFinished()
+
+ color: __panel ? __panel.foregroundColor : "black"
+ selectionColor: __panel ? __panel.selectionColor : "black"
+ selectedTextColor: __panel ? __panel.selectedTextColor : "black"
+
+ opacity: parent.enabled ? 1 : 0.5
+ renderType: __style ? __style.renderType : Text.NativeRendering
+
+ function selectValue() {
+ select(prefix.length, text.length - suffix.length)
+ }
+ }
+
+ // Spinbox increment button
+
+ MouseArea {
+ id: mouseUp
+ objectName: "mouseUp"
+ hoverEnabled: true
+
+ property var upRect: __panel ? __panel.upRect : null
+
+ anchors.left: parent.left
+ anchors.top: parent.top
+
+ anchors.leftMargin: upRect ? upRect.x : 0
+ anchors.topMargin: upRect ? upRect.y : 0
+
+ width: upRect ? upRect.width : 0
+ height: upRect ? upRect.height : 0
+
+ onClicked: __increment()
+ onPressed: if (activeFocusOnPress) input.forceActiveFocus()
+
+ property bool autoincrement: false;
+ onReleased: autoincrement = false
+ Timer { running: mouseUp.pressed; interval: 350 ; onTriggered: mouseUp.autoincrement = true }
+ Timer { running: mouseUp.autoincrement; interval: 60 ; repeat: true ; onTriggered: __increment() }
+ }
+
+ // Spinbox decrement button
+
+ MouseArea {
+ id: mouseDown
+ objectName: "mouseDown"
+ hoverEnabled: true
+
+ onClicked: __decrement()
+ onPressed: if (activeFocusOnPress) input.forceActiveFocus()
+
+ property var downRect: __panel ? __panel.downRect : null
+
+ anchors.left: parent.left
+ anchors.top: parent.top
+
+ anchors.leftMargin: downRect ? downRect.x : 0
+ anchors.topMargin: downRect ? downRect.y : 0
+
+ width: downRect ? downRect.width : 0
+ height: downRect ? downRect.height : 0
+
+ property bool autoincrement: false;
+ onReleased: autoincrement = false
+ Timer { running: mouseDown.pressed; interval: 350 ; onTriggered: mouseDown.autoincrement = true }
+ Timer { running: mouseDown.autoincrement; interval: 60 ; repeat: true ; onTriggered: __decrement() }
+ }
+
+ Keys.onUpPressed: __increment()
+ Keys.onDownPressed: __decrement()
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SplitView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SplitView.qml
new file mode 100644
index 0000000000..1f829a3468
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SplitView.qml
@@ -0,0 +1,504 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Layouts 1.0
+import QtQuick.Controls.Private 1.0 as Private
+
+/*!
+ \qmltype SplitView
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup views
+ \brief Lays out items with a draggable splitter between each item.
+
+ SplitView is a control that lays out items horizontally or
+ vertically with a draggable splitter between each item.
+
+ There will always be one (and only one) item in the SplitView that has \l{Layout::fillWidth}{Layout.fillWidth}
+ set to \c true (or \l{Layout::fillHeight}{Layout.fillHeight}, if orientation is Qt.Vertical). This means that the
+ item will get all leftover space when other items have been laid out.
+ By default, the last visible child of the SplitView will have this set, but
+ it can be changed by explicitly setting fillWidth to \c true on another item.
+ As the fillWidth item will automatically be resized to fit the extra space, explicit assignments
+ to width and height will be ignored (but \l{Layout::minimumWidth}{Layout.minimumWidth} and
+ \l{Layout::maximumWidth}{Layout.maximumWidth} will still be respected).
+
+ A handle can belong to the item either on the left or top side, or on the right or bottom side:
+ \list
+ \li If the fillWidth item is to the right: the handle belongs to the left item.
+ \li if the fillWidth item is on the left: the handle belongs to the right item.
+ \endlist
+
+ This will again control which item gets resized when the user drags a handle,
+ and which handle gets hidden when an item is told to hide.
+
+ SplitView supports setting attached Layout properties on child items, which
+ means that you can set the following attached properties for each child:
+ \list
+ \li \l{Layout::minimumWidth}{Layout.minimumWidth}
+ \li \l{Layout::minimumHeight}{Layout.minimumHeight}
+ \li \l{Layout::maximumWidth}{Layout.maximumWidth}
+ \li \l{Layout::maximumHeight}{Layout.maximumHeight}
+ \li \l{Layout::fillWidth}{Layout.fillWidth} (\c true for only one child)
+ \li \l{Layout::fillHeight}{Layout.fillHeight} (\c true for only one child)
+ \endlist
+
+ \note Please import QtQuick.Layout 1.0 in your QML file in order to use the Layout
+ attached properties inside SplitView.
+
+ Example:
+
+ To create a SplitView with three items, and let the center item get superfluous space, one
+ could do the following:
+
+ \qml
+ SplitView {
+ anchors.fill: parent
+ orientation: Qt.Horizontal
+
+ Rectangle {
+ width: 200
+ Layout.maximumWidth: 400
+ color: "gray"
+ }
+ Rectangle {
+ id: centerItem
+ Layout.minimumWidth: 50
+ Layout.fillWidth: true
+ color: "darkgray"
+ }
+ Rectangle {
+ width: 200
+ color: "gray"
+ }
+ }
+ \endqml
+*/
+
+Item {
+ id: root
+
+ /*!
+ \qmlproperty enumeration SplitView::orientation
+
+ This property holds the orientation of the SplitView.
+ The value can be either \c Qt.Horizontal or \c Qt.Vertical.
+ The default value is \c Qt.Horizontal.
+ */
+ property int orientation: Qt.Horizontal
+
+ /*!
+ This property holds the delegate that will be instantiated between each
+ child item. Inside the delegate the following properties are available:
+
+ \table
+ \row \li readonly property bool styleData.index \li Specifies the index of the splitter handle. The handle
+ between the first and the second item will get index 0,
+ the next handle index 1 etc.
+ \row \li readonly property bool styleData.hovered \li The handle is being hovered.
+ \row \li readonly property bool styleData.pressed \li The handle is being pressed.
+ \row \li readonly property bool styleData.resizing \li The handle is being dragged.
+ \endtable
+
+*/
+ property Component handleDelegate: Rectangle {
+ width: 1
+ height: 1
+ color: Qt.darker(pal.window, 1.5)
+ }
+
+ /*!
+ This propery is \c true when the user is resizing any of the items by
+ dragging on the splitter handles.
+ */
+ property bool resizing: false
+
+ /*! \internal */
+ default property alias __contents: contents.data
+ /*! \internal */
+ property alias __items: splitterItems.children
+ /*! \internal */
+ property alias __handles: splitterHandles.children
+
+ clip: true
+ Component.onCompleted: d.init()
+ onWidthChanged: d.updateLayout()
+ onHeightChanged: d.updateLayout()
+ onOrientationChanged: d.changeOrientation()
+
+ SystemPalette { id: pal }
+
+ QtObject {
+ id: d
+ property bool horizontal: orientation == Qt.Horizontal
+ readonly property string minimum: horizontal ? "minimumWidth" : "minimumHeight"
+ readonly property string maximum: horizontal ? "maximumWidth" : "maximumHeight"
+ readonly property string otherMinimum: horizontal ? "minimumHeight" : "minimumWidth"
+ readonly property string otherMaximum: horizontal ? "maximumHeight" : "maximumWidth"
+ readonly property string offset: horizontal ? "x" : "y"
+ readonly property string otherOffset: horizontal ? "y" : "x"
+ readonly property string size: horizontal ? "width" : "height"
+ readonly property string otherSize: horizontal ? "height" : "width"
+ readonly property string implicitSize: horizontal ? "implicitWidth" : "implicitHeight"
+ readonly property string implicitOtherSize: horizontal ? "implicitHeight" : "implicitWidth"
+
+ property int fillIndex: -1
+ property bool updateLayoutGuard: true
+
+ function init()
+ {
+ for (var i=0; i<__contents.length; ++i) {
+ var item = __contents[i];
+ if (!item.hasOwnProperty("x"))
+ continue
+
+ if (splitterItems.children.length > 0)
+ handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1})
+ item.parent = splitterItems
+ i-- // item was removed from list
+
+ // should match disconnections in Component.onDestruction
+ item.widthChanged.connect(d.updateLayout)
+ item.heightChanged.connect(d.updateLayout)
+ item.Layout.maximumWidthChanged.connect(d.updateLayout)
+ item.Layout.minimumWidthChanged.connect(d.updateLayout)
+ item.Layout.maximumHeightChanged.connect(d.updateLayout)
+ item.Layout.minimumHeightChanged.connect(d.updateLayout)
+ item.visibleChanged.connect(d.updateFillIndex)
+ item.Layout.fillWidthChanged.connect(d.updateFillIndex)
+ item.Layout.fillHeightChanged.connect(d.updateFillIndex)
+ }
+
+ d.calculateImplicitSize()
+ d.updateLayoutGuard = false
+ d.updateFillIndex()
+ }
+
+ function updateFillIndex()
+ {
+ if (lastItem.visible !== root.visible)
+ return
+ var policy = (root.orientation === Qt.Horizontal) ? "fillWidth" : "fillHeight"
+ for (var i=0; i<__items.length-1; ++i) {
+ if (__items[i].Layout[policy] === true)
+ break;
+ }
+
+ d.fillIndex = i
+ d.updateLayout()
+ }
+
+ function changeOrientation()
+ {
+ if (__items.length == 0)
+ return;
+ d.updateLayoutGuard = true
+
+ // Swap width/height for items and handles:
+ for (var i=0; i<__items.length; ++i) {
+ var item = __items[i]
+ var tmp = item.x
+ item.x = item.y
+ item.y = tmp
+ tmp = item.width
+ item.width = item.height
+ item.height = tmp
+
+ var handle = __handles[i]
+ if (handle) {
+ tmp = handle.x
+ handle.x = handle.y
+ handle.y = handle.x
+ tmp = handle.width
+ handle.width = handle.height
+ handle.height = tmp
+ }
+ }
+
+ // Change d.horizontal explicit, since the binding will change too late:
+ d.horizontal = orientation == Qt.Horizontal
+ d.updateLayoutGuard = false
+ d.updateFillIndex()
+ }
+
+ function calculateImplicitSize()
+ {
+ var implicitSize = 0
+ var implicitOtherSize = 0
+
+ for (var i=0; i<__items.length; ++i) {
+ var item = __items[i];
+ implicitSize += clampedMinMax(item[d.size], item.Layout[minimum], item.Layout[maximum])
+ var os = clampedMinMax(item[otherSize], item.Layout[otherMinimum], item.Layout[otherMaximum])
+ implicitOtherSize = Math.max(implicitOtherSize, os)
+
+ var handle = __handles[i]
+ if (handle)
+ implicitSize += handle[d.size]
+ }
+
+ root[d.implicitSize] = implicitSize
+ root[d.implicitOtherSize] = implicitOtherSize
+ }
+
+ function clampedMinMax(value, minimum, maximum)
+ {
+ if (value < minimum)
+ value = minimum
+ if (value > maximum)
+ value = maximum
+ return value
+ }
+
+ function accumulatedSize(firstIndex, lastIndex, includeFillItemMinimum)
+ {
+ // Go through items and handles, and
+ // calculate their acummulated width.
+ var w = 0
+ for (var i=firstIndex; i<lastIndex; ++i) {
+
+ var item = __items[i]
+ if (item.visible || i == d.fillIndex) {
+ if (i !== d.fillIndex)
+ w += item[d.size];
+ else if (includeFillItemMinimum && item.Layout[minimum] !== undefined)
+ w += item.Layout[minimum]
+ }
+
+ var handle = __handles[i]
+ if (handle && handle.visible)
+ w += handle[d.size]
+ }
+ return w
+ }
+
+ function updateLayout()
+ {
+ // This function will reposition both handles and
+ // items according to the their width/height:
+ if (__items.length === 0)
+ return;
+ if (!lastItem.visible)
+ return;
+ if (d.updateLayoutGuard === true)
+ return
+ d.updateLayoutGuard = true
+
+ // Ensure all items within their min/max:
+ for (var i=0; i<__items.length; ++i) {
+ if (i !== d.fillIndex) {
+ var item = __items[i];
+ var clampedSize = clampedMinMax(item[d.size], item.Layout[d.minimum], item.Layout[d.maximum])
+ if (clampedSize != item[d.size])
+ item[d.size] = clampedSize
+ }
+ }
+
+ // Set size of fillItem to remaining available space.
+ // Special case: If SplitView size is zero, we leave fillItem with the size
+ // it already got, and assume that SplitView ends up with implicit size as size:
+ if (root[d.size] != 0) {
+ var fillItem = __items[fillIndex]
+ var superfluous = root[d.size] - d.accumulatedSize(0, __items.length, false)
+ var s = Math.max(superfluous, fillItem.Layout[minimum])
+ s = Math.min(s, fillItem.Layout[maximum])
+ fillItem[d.size] = s
+ }
+
+ // Position items and handles according to their width:
+ var lastVisibleItem, lastVisibleHandle, handle
+ for (i=0; i<__items.length; ++i) {
+ // Position item to the right of the previous visible handle:
+ item = __items[i];
+ if (item.visible || i == d.fillIndex) {
+ item[d.offset] = lastVisibleHandle ? lastVisibleHandle[d.offset] + lastVisibleHandle[d.size] : 0
+ item[d.otherOffset] = 0
+ item[d.otherSize] = clampedMinMax(root[otherSize], item.Layout[otherMinimum], item.Layout[otherMaximum])
+ lastVisibleItem = item
+ }
+
+ handle = __handles[i]
+ if (handle && handle.visible) {
+ handle[d.offset] = lastVisibleItem[d.offset] + Math.max(0, lastVisibleItem[d.size])
+ handle[d.otherOffset] = 0
+ handle[d.otherSize] = root[d.otherSize]
+ lastVisibleHandle = handle
+ }
+ }
+
+ d.updateLayoutGuard = false
+ }
+ }
+
+ Component {
+ id: handleLoader
+ Loader {
+ id: itemHandle
+
+ property int __handleIndex: -1
+ property QtObject styleData: QtObject {
+ readonly property int index: __handleIndex
+ readonly property alias hovered: mouseArea.containsMouse
+ readonly property alias pressed: mouseArea.pressed
+ readonly property bool resizing: mouseArea.drag.active
+ onResizingChanged: root.resizing = resizing
+ }
+ property bool resizeLeftItem: (d.fillIndex > __handleIndex)
+ visible: __items[__handleIndex + (resizeLeftItem ? 0 : 1)].visible
+ sourceComponent: handleDelegate
+ onWidthChanged: d.updateLayout()
+ onHeightChanged: d.updateLayout()
+ onXChanged: moveHandle()
+ onYChanged: moveHandle()
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ anchors.leftMargin: (parent.width <= 1) ? -2 : 0
+ anchors.rightMargin: (parent.width <= 1) ? -2 : 0
+ anchors.topMargin: (parent.height <= 1) ? -2 : 0
+ anchors.bottomMargin: (parent.height <= 1) ? -2 : 0
+ hoverEnabled: true
+ drag.threshold: 0
+ drag.target: parent
+ drag.axis: root.orientation === Qt.Horizontal ? Drag.XAxis : Drag.YAxis
+ cursorShape: root.orientation === Qt.Horizontal ? Qt.SplitHCursor : Qt.SplitVCursor
+ }
+
+ function moveHandle() {
+ // Moving the handle means resizing an item. Which one,
+ // left or right, depends on where the fillItem is.
+ // 'updateLayout' will be overridden in case new width violates max/min.
+ // 'updateLayout' will be triggered when an item changes width.
+ if (d.updateLayoutGuard)
+ return
+
+ var leftHandle, leftItem, rightItem, rightHandle
+ var leftEdge, rightEdge, newWidth, leftStopX, rightStopX
+ var i
+
+ if (resizeLeftItem) {
+ // Ensure that the handle is not crossing other handles. So
+ // find the first visible handle to the left to determine the left edge:
+ leftEdge = 0
+ for (i=__handleIndex-1; i>=0; --i) {
+ leftHandle = __handles[i]
+ if (leftHandle.visible) {
+ leftEdge = leftHandle[d.offset] + leftHandle[d.size]
+ break;
+ }
+ }
+
+ // Ensure: leftStopX >= itemHandle[d.offset] >= rightStopX
+ var min = d.accumulatedSize(__handleIndex+1, __items.length, true)
+ rightStopX = root[d.size] - min - itemHandle[d.size]
+ leftStopX = Math.max(leftEdge, itemHandle[d.offset])
+ itemHandle[d.offset] = Math.min(rightStopX, Math.max(leftStopX, itemHandle[d.offset]))
+
+ newWidth = itemHandle[d.offset] - leftEdge
+ leftItem = __items[__handleIndex]
+ // The next line will trigger 'updateLayout':
+ leftItem[d.size] = newWidth
+ } else {
+ // Resize item to the right.
+ // Ensure that the handle is not crossing other handles. So
+ // find the first visible handle to the right to determine the right edge:
+ rightEdge = root[d.size]
+ for (i=__handleIndex+1; i<__handles.length; ++i) {
+ rightHandle = __handles[i]
+ if (rightHandle.visible) {
+ rightEdge = rightHandle[d.offset]
+ break;
+ }
+ }
+
+ // Ensure: leftStopX <= itemHandle[d.offset] <= rightStopX
+ min = d.accumulatedSize(0, __handleIndex+1, true)
+ leftStopX = min - itemHandle[d.size]
+ rightStopX = Math.min((rightEdge - itemHandle[d.size]), itemHandle[d.offset])
+ itemHandle[d.offset] = Math.max(leftStopX, Math.min(itemHandle[d.offset], rightStopX))
+
+ newWidth = rightEdge - (itemHandle[d.offset] + itemHandle[d.size])
+ rightItem = __items[__handleIndex+1]
+ // The next line will trigger 'updateLayout':
+ rightItem[d.size] = newWidth
+ }
+ }
+ }
+ }
+
+ Item {
+ id: contents
+ visible: false
+ anchors.fill: parent
+ }
+ Item {
+ id: splitterItems
+ anchors.fill: parent
+ }
+ Item {
+ id: splitterHandles
+ anchors.fill: parent
+ }
+
+ Item {
+ id: lastItem
+ onVisibleChanged: d.updateFillIndex()
+ }
+
+ Component.onDestruction: {
+ for (var i=0; i<splitterItems.children.length; ++i) {
+ var item = splitterItems.children[i];
+
+ // should match connections in init()
+ item.widthChanged.disconnect(d.updateLayout)
+ item.heightChanged.disconnect(d.updateLayout)
+ item.Layout.maximumWidthChanged.disconnect(d.updateLayout)
+ item.Layout.minimumWidthChanged.disconnect(d.updateLayout)
+ item.Layout.maximumHeightChanged.disconnect(d.updateLayout)
+ item.Layout.minimumHeightChanged.disconnect(d.updateLayout)
+ item.visibleChanged.disconnect(d.updateFillIndex)
+ item.Layout.fillWidthChanged.disconnect(d.updateFillIndex)
+ item.Layout.fillHeightChanged.disconnect(d.updateFillIndex)
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackView.qml
new file mode 100644
index 0000000000..18f77d2ec5
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackView.qml
@@ -0,0 +1,963 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StackView
+ \inherits Item
+ \ingroup views
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+
+ \brief Provides a stack-based navigation model.
+
+ StackView implements a stack-based navigation model, which can be used
+ with a set of interlinked information pages. Items are pushed onto the stack
+ as the user navigates deeper into the material, and popped off again when he
+ chooses to go back.
+
+ \section1 Using StackView in an Application
+ Using the StackView in the application is typically a simple matter of adding
+ the StackView as a child of a Window. The stack is usually anchored to the
+ edges of the window, except at the top or bottom where it might be anchored
+ to a status bar, or some other similar UI component. The stack can then be
+ used by invoking its navigation methods. The first item to show in the StackView
+ is commonly loaded assigning it to \l initialItem.
+
+ \note Items pushed onto the stack view have \l{Supported Attached Properties}{Stack attached properties}.
+
+ \section1 Basic Navigation
+ There are three primary navigation operations in StackView: push(), pop(), and
+ replace (replace by specifying argument \c replace to push()).
+ These correspond to classic stack operations where "push" adds an item to the
+ top of a stack, "pop" removes the top item from the stack, and "replace" is like a
+ pop followed by a push in that it replaces the topmost item on the stack with
+ a new item (but the applied transtition might be different). The topmost item
+ in the stack corresponds to the one that is \l{StackView::currentItem} {currently}
+ visible on the screen. That means that "push" is the logical equivalent of navigating
+ forward or deeper into the application, "pop" is the equivalent of navigating back,
+ and "replace" is the equivalent of replacing the current item.
+
+ Sometimes it is necessary to go back more than a single step in the stack, for
+ example, to return to a "main" item or some kind of section item in the application.
+ For this use case, it is possible to specify an item as a parameter for pop().
+ This is called an "unwind" operation as the stack gets unwound to the specified item.
+ If the item is not found then the stack unwinds until there is only a single item in
+ the stack, which becomes the current item. To explicitly unwind to the bottom
+ of the stack it is recommended to use \l{pop()} {pop(null)}, though technically any
+ non-existent item will do.
+
+ Given the stack [A, B, C]:
+
+ \list
+ \li \l{push()}{push(D)} => [A, B, C, D] - "push" transition animation between C and D
+ \li pop() => [A, B] - "pop" transition animation between C and B
+ \li \l{push()}{push(D, replace)} => [A, B, D] - "replace" transition between C and D
+ \li \l{pop()}{pop(A)} => [A] - "pop" transition between C and A
+ \endlist
+
+ \note Note that when the stack is empty, a push() will not perform a
+ transition animation because there is nothing to transition from (typically during
+ application start-up). A pop() on a stack with depth 1 or 0 is a no-operation.
+ If removing all items from the stack is needed, a separate function clear() is
+ available.
+
+ Calling push() returns the item that was pushed onto the stack.
+ Calling pop() returns the item that was popped off the stack. When pop() is
+ called in an unwind operation the top-most item (the first item that was
+ popped, which will also be the one transitioning out) is returned.
+
+ \section1 Deep Linking
+ \e{Deep linking} means launching an application into a particular state. For example,
+ a newspaper application could be launched into showing a particular article,
+ bypassing the front item (and possibly a section item) that would normally have
+ to be navigated through to get to the article concerned. In terms of StackView, deep
+ linking means the ability to modify the state of the stack, so much so that it is
+ possible to push a set of items to the top of the stack, or to completely reset
+ the stack to a given state.
+
+ The API for deep linking in StackView is the same as for basic navigation. Pushing
+ an array instead of a single item, will involve that all the items in that array will
+ be pushed onto the stack. The transition animation, however, will be conducted as
+ if only the last item in the array was pushed onto the stack. The normal semantics
+ of push() apply for deep linking, meaning that push() adds whatever is pushed onto
+ the stack. Note also that only the last item of the array will be loaded.
+ The rest will be lazy-loaded as needed when entering the screen upon subsequent
+ calls to pop (or when requesting the item by using \a get).
+
+ This gives us the following result, given the stack [A, B, C]:
+
+ \list
+ \li \l{push()}{push([D, E, F])} => [A, B, C, D, E, F] - "push" transition animation between C and F
+ \li \l{push()}{push([D, E, F], replace)} => [A, B, D, E, F] - "replace" transition animation between C and F
+ \li clear(); \l{push()}{push([D, E, F])} => [D, E, F] - no transition animation (since the stack was empty)
+ \endlist
+
+ \section1 Pushing items
+
+ An item pushed onto the StackView can be either an Item, a URL, a string
+ with a URL, or a Component. To push it, assign it to a property "item"
+ inside a property list, and send it as an argument to \l{StackView::push}{push}:
+
+ \code
+ stackView.push({item: yourItem})
+ \endcode
+
+ The list can contain several properties that control how the item should be pushed:
+ \list
+ \li \c item: this property is required, and holds the item to be pushed.
+ \li \c properties: a list of QML properties to be assigned to the item upon push. These
+ properties will be copied into the item at load time, or when the item will become
+ the current item (normally upon push).
+ \li \c immediate: set this property to \c true to skip transition effects. When pushing
+ an array, this property only needs to be set on the first element to make the
+ whole operation immediate.
+ \li \c replace: set this property to replace the current item on the stack. When pushing
+ an array, you only need to set this property on the first element to replace
+ as many elements on the stack as inside the array.
+ \li \c destroyOnPop: set this boolean to true if StackView needs to destroy the item when
+ it is popped off the stack. By default (if \a destroyOnPop is not specified), StackView
+ will destroy items pushed as components or URLs. Items not destroyed will be re-parented
+ back to the original parents they had before being pushed onto the stack and hidden.
+ If you need to set this property, do it with care, so that items are not leaked.
+ \endlist
+
+ If the only argument needed is "item", the following short-hand notation can be applied:
+
+ \code
+ stackView.push(yourItem)
+ \endcode
+
+ You can push several items in one go by using an array of property lists. This is
+ optimizing compared to pushing items one by one, since StackView then can load only the
+ last item in the list. The rest will be loaded as they are about to become
+ the current item (which happens when the stack is popped). The following example shows how
+ to push an array of items:
+
+ \code
+ stackView.push([{item: yourItem1}, {item: yourItem2}])
+ \endcode
+
+ If an inline item is pushed, the item is temporarily re-parented into the StackView. When the item
+ is later popped off, it gets re-parented back to its original owner again.
+ If, however, an item is pushed as a component or a URL, the actual item will be created as an
+ item from that component. This happens automatically when the item is about to become the current
+ item in the stack. Ownership of the item will then normally be taken by the StackView. It will as
+ such automatically destroy the item when it is later popped off. The component that declared the item, by
+ contrast, remains in the ownership of the application and is not destroyed by the stack.
+ This can be overridden by explicitly setting \c{destroyOnPop} in the list of arguments given to push.
+
+ If the \c properties to be pushed are specified, they will be copied into the item at loading time
+ (in case of a component or URL), or when the item will become the current item (in case of an inline
+ item). The following example shows how this can be done:
+
+ \code
+ stackView.push({item: someItem, properties: {fgcolor: "red", bgcolor: "blue"}})
+ \endcode
+
+
+ \note Note that if an item is declared inside another item, and if that parent gets destroyed,
+ (even if a component was used), that child item will also be destroyed.
+ This follows normal Qt parent-child destruction rules, but sometimes comes as a surprise
+ for developers.
+
+ \section1 Lifecycle
+ An item's lifecycle in the StackView can have the following transitions:
+ \list 1
+ \li instantiation
+ \li inactive
+ \li activating
+ \li active
+ \li deactivating
+ \li inactive
+ \li destruction
+ \endlist
+
+ It can move any number of times between inactive and active. When an item is activated,
+ it's visible on the screen and is considered to be the current item. An item
+ in a StackView that is not visible is not activated, even if the item is currently the
+ top-most item in the stack. When the stack becomes visible, the item that is top-most gets
+ activated. Likewise if the stack is then hidden, the topmost item would be deactivated.
+ Popping the item off the top of the stack at this point would not result in further
+ deactivation since the item is not active.
+
+ There is an attached \l{Stack::status}{Stack.status} property that tracks the lifecycle. The
+ status values list is an enumeration with values \c Stack.Inactive, \c Stack.Activating,
+ \c Stack.Active and \c Stack.Deactivating. Combined with the normal \c Component.onComplete and
+ \c Component.onDestruction signals the entire lifecycle is thus:
+
+ \list
+ \li Created: Component.onCompleted()
+ \li Activating: Stack.onStatusChanged (Stack.status is Stack.Activating)
+ \li Acivated: Stack.onStatusChanged (Stack.status is Stack.Active)
+ \li Deactivating: Stack.onStatusChanged (Stack.status is Stack.Deactivating)
+ \li Deactivated: Stack.onStatusChanged (Stack.status is Stack.Inactive)
+ \li Destruction: Component.onDestruction()
+ \endlist
+
+ \section1 Finding items
+ Sometimes it is necessary to search for an item, for example, in order to unwind the stack to
+ an item to which the application does not have a reference. This is facilitated using a
+ function find() in StackView. The find() function takes a callback function as its
+ only argument. The callback gets invoked for each item in the stack (starting at the top).
+ If the callback returns true, then it signals that a match has been found and the find()
+ function returns that item. If the callback fails to return true (no match is found),
+ then find() returns \c null.
+
+ The code below searches for an item in the stack that has a name "order_id" and then unwinds to
+ that item. Note that since find() returns \c {null} if no item is found, and since pop unwinds to
+ the bottom of the stack if null is given as the target item, the code works well even in
+ case no matching item is found.
+
+ \code
+ stackView.pop(stackView.find(function(item) {
+ return item.name == "order_id";
+ }));
+ \endcode
+
+ You can also get to an item in the stack using \l {get()}{get(index)}. You should use
+ this function if your item depends on another item in the stack, as the function will
+ ensure that the item at the given index gets loaded before it is returned.
+
+ \code
+ previousItem = stackView.get(myItem.Stack.index - 1));
+ \endcode
+
+ \section1 Transitions
+
+ A transition is performed whenever a item is pushed or popped, and consists of
+ two items: enterItem and exitItem. The StackView itself will never move items
+ around, but instead delegate the job to an external animation set provided
+ by the style or the application developer. How items should visually enter and leave the stack
+ (and the geometry they should end up with) is therefore completely controlled from the outside.
+
+ When the transition starts, the StackView will search for a transition that
+ matches the operation executed. There are three transitions to choose
+ from: pushTransition, popTransition, and replaceTransition. Each implements how
+ enterItem should animate in, and exitItem out. The transitions are
+ collected inside a StackViewDelegate object assigned to
+ \l {StackView::delegate}{delegate}. By default, popTransition and
+ replaceTransition will be the same as pushTransition, unless you set them
+ to something else.
+
+ A simple fade transition could be implemented as:
+
+ \qml
+ StackView {
+ delegate: StackViewDelegate {
+ function transitionFinished(properties)
+ {
+ properties.exitItem.opacity = 1
+ }
+
+ property Component pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "opacity"
+ from: 0
+ to: 1
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "opacity"
+ from: 1
+ to: 0
+ }
+ }
+ }
+ }
+ \endqml
+
+ PushTransition needs to inherit from StackViewTransition, which is a ParallelAnimation that
+ contains the properties \c enterItem and \c exitItem. You set the target of your
+ inner animations to those items. Since the same items instance can be pushed several
+ times to a StackView, you should always override
+ \l {StackViewDelegate::transitionFinished(properties)}{StackViewDelegate.transitionFinished(properties)}.
+ Implement this function to reset any properties animated on the exitItem so that later
+ transitions can expect the items to be in a default state.
+
+ A more complex example could look like the following. Here, the items are lying on the side before
+ being rotated to an upright position:
+
+ \qml
+ StackView {
+ delegate: StackViewDelegate {
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.rotation = 0
+ }
+
+ property Component pushTransition: StackViewTransition {
+ SequentialAnimation {
+ ScriptAction {
+ script: enterItem.rotation = 90
+ }
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: enterItem.width
+ to: 0
+ }
+ PropertyAnimation {
+ target: enterItem
+ property: "rotation"
+ from: 90
+ to: 0
+ }
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: -exitItem.width
+ }
+ }
+ }
+ }
+ \endqml
+
+ \section2 Advanced usage
+
+ When the StackView needs a new transition, it first calls
+ \l {StackViewDelegate::getTransition(properties)}{StackViewDelegate.getTransition(properties)}.
+ The base implementation of this function just looks for a property named \c properties.name inside
+ itself (root), which is how it finds \c {property Component pushTransition} in the examples above.
+
+ \code
+ function getTransition(properties)
+ {
+ return root[properties.name]
+ }
+ \endcode
+
+ You can override this function for your delegate if you need extra logic to decide which
+ transition to return. You could for example introspect the items, and return different animations
+ depending on the their internal state. StackView will expect you to return a Component that
+ contains a StackViewTransition, or a StackViewTransition directly. The former is easier, as StackView will
+ then create the transition and later destroy it when it's done, while avoiding any sideeffects
+ caused by the transition being alive long after it has run. Returning a StackViewTransition directly
+ can be useful if you need to write some sort of transition caching for performance reasons.
+ As an optimization, you can also return \c null to signal that you just want to show/hide the items
+ immediately without creating or running any transitions. You can also override this function if
+ you need to alter the items in any way before the transition starts.
+
+ \c properties contains the properties that will be assigned to the StackViewTransition before
+ it runs. In fact, you can add more properties to this object during the call
+ if you need to initialize additional properties of your custom StackViewTransition when the returned
+ component is instantiated.
+
+ The following example shows how you can decide which animation to use during runtime :
+
+ \qml
+ StackViewDelegate {
+ function getTransition(properties)
+ {
+ return (properties.enterItem.Stack.index % 2) ? horizontalTransition : verticalTransition
+ }
+
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.y = 0
+ }
+
+ property Component horizontalTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: target.width
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: target.width
+ duration: 300
+ }
+ }
+
+ property Component verticalTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: target.height
+ duration: 300
+ }
+ }
+ }
+ \endqml
+
+ \section1 Supported Attached Properties
+
+ Items in a StackView support these attached properties:
+ \list
+ \li \l{Stack::index}{Stack.index} - Contains the index of the item inside the StackView
+ \li \l{Stack::view}{Stack.view} - Contains the StackView the item is in
+ \li \l{Stack::status}{Stack.status} - Contains the status of the item
+ \endlist
+*/
+
+Item {
+ id: root
+
+ /*! \qmlproperty int StackView::depth
+ \readonly
+ The number of items currently pushed onto the stack.
+ */
+ readonly property alias depth: root.__depth
+
+ /*! \qmlproperty Item StackView::currentItem
+ \readonly
+ The currently top-most item in the stack.
+ */
+ readonly property alias currentItem: root.__currentItem
+
+ /*! The first \l item that should be shown when the StackView is created.
+ \a initialItem can take same value as the first argument to \l{StackView::push()}
+ {StackView.push()}. Note that this is just a convenience for writing
+ \c{Component.onCompleted: stackView.push(myInitialItem)}
+
+ Examples:
+
+ \list
+ \li initialItem: Qt.resolvedUrl("MyItem.qml")
+ \li initialItem: myItem
+ \li initialItem: {"item" : Qt.resolvedUrl("MyRectangle.qml"), "properties" : {"color" : "red"}}
+ \endlist
+ \sa push
+ */
+ property var initialItem: null
+
+ /*! \readonly
+ \a busy is \c true if a transition is running, and \c false otherwise. */
+ readonly property bool busy: __currentTransition !== null
+
+ /*! The transitions to use when pushing or popping items.
+ For better understanding on how to apply custom transitions, read \l{Transitions}.
+ \sa {Stack::transitions}{Stack.transitions} */
+ property StackViewDelegate delegate: StackViewSlideDelegate {}
+
+ /*! Pushes an item onto the stack. The function takes a property list as argument, which
+ should contain one or more of the following properties:
+ \list
+ \li \c item: this property is required, and holds the item you want to push.
+ \li \c properties: a list of QML properties that should be assigned
+ to the item upon push. These properties will be copied into the item when it is
+ loaded (in case of a component or URL), or when it becomes the current item for the
+ first time (normally upon push).
+ \li \c immediate: set this property to \c true to skip transition effects. When pushing
+ an array, you only need to set this property on the first element to make the
+ whole operation immediate.
+ \li \c replace: set this property to replace the current item on the stack. When pushing
+ an array, you only need to set this property on the first element to replace
+ as many elements on the stack as inside the array.
+ \li \c destroyOnPop: set this property to specify if the item needs to be destroyed
+ when its popped off the stack. By default (if \a destroyOnPop is not specified),
+ StackView will destroy items pushed as components or URLs. Items
+ not destroyed will be re-parented to the original parents they had before being
+ pushed onto the stack, and hidden. If you need to set this property, do it with
+ care, so that items are not leaked.
+ \endlist
+
+ You can also push an array of items (property lists) if you need to push several items
+ in one go. A transition will then only occur between the current item and the last
+ item in the list. Loading the other items will be deferred until needed.
+
+ Examples:
+ \list
+ \li stackView.push({item:anItem})
+ \li stackView.push({item:aURL, immediate: true, replace: true})
+ \li stackView.push({item:aRectangle, properties:{color:"red"}})
+ \li stackView.push({item:aComponent, properties:{color:"red"}})
+ \li stackView.push({item:aComponent.createObject(), destroyOnPop:true})
+ \li stackView.push([{item:anitem, immediate:true}, {item:aURL}])
+ \endlist
+
+ \note Note: if the only argument needed is "item", you can apply the following short-
+ hand notation: \c{stackView.push(anItem)}.
+
+ Returns the item that became current.
+
+ \sa initialItem
+ \sa {Pushing items}
+ */
+ function push(item) {
+ // Note: we support two different APIs in this function; The old meego API, and
+ // the new "property list" API. Hence the reason for hiding the fact that you
+ // can pass more arguments than shown in the signature:
+ if (__recursionGuard(true))
+ return
+ var properties = arguments[1]
+ var immediate = arguments[2]
+ var replace = arguments[3]
+ var arrayPushed = (item instanceof Array)
+ var firstItem = arrayPushed ? item[0] : item
+ immediate = (immediate || JSArray.stackView.length === 0)
+
+ if (firstItem && firstItem.item && firstItem.hasOwnProperty("x") === false) {
+ // Property list API used:
+ immediate = immediate || firstItem.immediate
+ replace = replace || firstItem.replace
+ }
+
+ // Create, and push, a new javascript object, called "element", onto the stack.
+ // This element contains all the information necessary to construct the item, and
+ // will, after loaded, also contain the loaded item:
+ if (arrayPushed) {
+ if (item.length === 0)
+ return
+ var outElement = replace ? JSArray.pop() : JSArray.current()
+ for (var i=0; i<item.length; ++i)
+ JSArray.push({itemComponent:item[i], loaded: false, index: __depth, properties: properties});
+ } else {
+ outElement = replace ? JSArray.pop() : JSArray.current()
+ JSArray.push({itemComponent:item, loaded: false, index: __depth, properties: properties})
+ }
+
+ var currentElement = JSArray.current()
+ var transition = {
+ inElement: currentElement,
+ outElement: outElement,
+ immediate: immediate,
+ replace: replace,
+ push: true
+ }
+ __performTransition(transition)
+ __recursionGuard(false)
+ return __currentItem
+ }
+
+ /*! Pops one or more items off the stack. The function takes a property list as argument
+ which can contain one or more of the following properties:
+ \list
+ \li \c item: if specified, all items down to (but not including) \a item will be
+ popped off. If \a item is \c null, all items down to (but not including) the
+ first item will be popped. If not specified, only the current item will be
+ popped.
+ \li \c immediate: set this property to \c true to skip transition effects.
+ \endlist
+
+ Examples:
+ \list
+ \li stackView.pop()
+ \li stackView.pop({item:someItem, immediate: true})
+ \li stackView.pop({immediate: true})
+ \li stackView.pop(null)
+ \endlist
+
+ \note Note: If the only argument needed is "item", you can apply the following short-
+ hand notation: \c{stackView.pop(anItem)}.
+
+ Returns the item that was popped off
+ \sa clear()
+ */
+ function pop(item) {
+ if (__depth <= 1)
+ return null
+ if (item && item.hasOwnProperty("x") === false) {
+ // Property list API used:
+ var immediate = (item.immediate === true)
+ item = item.item
+ } else {
+ immediate = (arguments[1] === true)
+ }
+
+ if (item === __currentItem)
+ return
+
+ if (__recursionGuard(true))
+ return
+
+ var outElement = JSArray.pop()
+ var inElement = JSArray.current()
+
+ if (__depth > 1 && item !== undefined && item !== inElement.item) {
+ // Pop from the top until we find 'item', and return the corresponding
+ // element. Skip all non-loaded items (except the first), since no one
+ // has any references to such items anyway:
+ while (__depth > 1 && !JSArray.current().loaded)
+ JSArray.pop()
+ inElement = JSArray.current()
+ while (__depth > 1 && item !== inElement.item) {
+ JSArray.pop()
+ __cleanup(inElement)
+ while (__depth > 1 && !JSArray.current().loaded)
+ JSArray.pop()
+ inElement = JSArray.current()
+ }
+ }
+
+ var transition = {
+ inElement: inElement,
+ outElement: outElement,
+ immediate: immediate,
+ replace: false,
+ push: false
+ }
+ __performTransition(transition)
+ __recursionGuard(false)
+ return outElement.item;
+ }
+
+ /*! Remove all items from the stack. No animations will be applied. */
+ function clear() {
+ if (__recursionGuard(true))
+ return
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __currentItem = null
+ var count = __depth
+ for (var i=0; i<count; ++i) {
+ var element = JSArray.pop()
+ if (element.item)
+ __cleanup(element);
+ }
+ __recursionGuard(false)
+ }
+
+ /*! Search for a specific item inside the stack. \a func will
+ be called for each item in the stack (with the item as argument)
+ until the function returns true. Return value will be the item found. For
+ example:
+ find(function(item, index) { return item.isTheOne })
+ Set \a onlySearchLoadedItems to \c true to not load items that are
+ not loaded into memory */
+ function find(func, onlySearchLoadedItems) {
+ for (var i=__depth-1; i>=0; --i) {
+ var element = JSArray.stackView[i];
+ if (onlySearchLoadedItems !== true)
+ __loadElement(element)
+ else if (!element.item)
+ continue
+ if (func(element.item))
+ return element.item
+ }
+ return null;
+ }
+
+ /*! Returns the item at position \a index in
+ the stack. If \a dontLoad is true, the
+ item will not be forced to load (and \c null
+ will be returned if not yet loaded) */
+ function get(index, dontLoad)
+ {
+ if (index < 0 || index >= JSArray.stackView.length)
+ return null
+ var element = JSArray.stackView[index]
+ if (dontLoad !== true) {
+ __loadElement(element)
+ return element.item
+ } else if (element.item) {
+ return element.item
+ } else {
+ return null
+ }
+ }
+
+ /*! Immediately completes any ongoing transition.
+ /sa Animation.complete
+ */
+ function completeTransition()
+ {
+ if (__recursionGuard(true))
+ return
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __recursionGuard(false)
+ }
+
+ /********* DEPRECATED API *********/
+
+ /*! \internal
+ \deprecated Use Push() instead */
+ function replace(item, properties, immediate) {
+ push(item, properties, immediate, true)
+ }
+
+ /********* PRIVATE API *********/
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ /*! \internal The currently top-most item on the stack. */
+ property Item __currentItem: null
+ /*! \internal The number of items currently pushed onto the stack. */
+ property int __depth: 0
+ /*! \internal Stores the transition info while a transition is ongoing */
+ property var __currentTransition: null
+ /*! \internal Stops the user from pushing items while preparing a transition */
+ property bool __guard: false
+
+ Component.onCompleted: {
+ if (initialItem)
+ push(initialItem)
+ }
+
+ Component.onDestruction: {
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __currentItem = null
+ }
+
+ /*! \internal */
+ function __recursionGuard(use)
+ {
+ if (use && __guard) {
+ console.warn("Warning: StackView: You cannot push/pop recursively!")
+ console.trace()
+ return true
+ }
+ __guard = use
+ }
+
+ /*! \internal */
+ function __loadElement(element)
+ {
+ if (element.loaded) {
+ if (!element.item) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: The item has been deleted outside StackView!"
+ }
+ return
+ }
+ if (!element.itemComponent) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: Invalid item (item was 'null'). "
+ + "This might indicate that the item was deleted outside StackView!"
+ return
+ }
+
+ var comp = __resolveComponent(element.itemComponent, element)
+
+ // Assign properties to item:
+ if (!element.properties)
+ element.properties = {}
+
+ if (comp.hasOwnProperty("createObject")) {
+ if (comp.status === Component.Error) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: Could not load: " + comp.errorString()
+ } else {
+ element.item = comp.createObject(root, element.properties)
+ // Destroy items we create unless the user specified something else:
+ if (!element.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = true
+ }
+ } else {
+ // comp is already an Item, so just re-parent it into the StackView:
+ element.item = comp
+ element.originalParent = parent
+ element.item.parent = root
+ for (var prop in element.properties) {
+ if (element.item.hasOwnProperty(prop))
+ element.item[prop] = element.properties[prop];
+ }
+ // Do not destroy items we didn't create, unless the user specified something else:
+ if (!element.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = false
+ }
+
+ element.item.Stack.__index = element.index
+ element.item.Stack.__view = root
+ // Let item fill all available space by default:
+ element.item.width = Qt.binding(function() { return root.width })
+ element.item.height = Qt.binding(function() { return root.height })
+ element.loaded = true
+ }
+
+ /*! \internal */
+ function __resolveComponent(unknownObjectType, element)
+ {
+ // We need this extra resolve function since we dont really
+ // know what kind of object the user pushed. So we try to
+ // figure it out by inspecting the object:
+ if (unknownObjectType.hasOwnProperty("createObject")) {
+ return unknownObjectType
+ } else if (typeof unknownObjectType == "string") {
+ return Qt.createComponent(unknownObjectType)
+ } else if (unknownObjectType.hasOwnProperty("x")) {
+ return unknownObjectType
+ } else if (unknownObjectType.hasOwnProperty("item")) {
+ // INVARIANT: user pushed a JS-object
+ element.properties = unknownObjectType.properties
+ if (!unknownObjectType.item)
+ unknownObjectType.item = invalidItemReplacement
+ if (unknownObjectType.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = unknownObjectType.destroyOnPop
+ return __resolveComponent(unknownObjectType.item, element)
+ } else {
+ // We cannot determine the type, so assume its a URL:
+ return Qt.createComponent(unknownObjectType)
+ }
+ }
+
+ /*! \internal */
+ function __cleanup(element) {
+ // INVARIANT: element has been removed from JSArray. Destroy its
+ // item, or re-parent it back to the parent it had before it was pushed:
+ var item = element.item
+ if (element.destroyOnPop) {
+ item.destroy()
+ } else {
+ // Mark the item as no longer part of the StackView. It
+ // might reenter on pop if pushed several times:
+ item.visible = false
+ __setStatus(item, Stack.Inactive)
+ item.Stack.__view = null
+ item.Stack.__index = -1
+ if (element.originalParent)
+ item.parent = element.originalParent
+ }
+ }
+
+ /*! \internal */
+ function __setStatus(item, status) {
+ item.Stack.__status = status
+ }
+
+ /*! \internal */
+ function __performTransition(transition)
+ {
+ // Animate item in "outElement" out, and item in "inElement" in. Set a guard to protect
+ // the user from pushing new items on signals that will fire while preparing for the transition
+ // (e.g Stack.onCompleted, Stack.onStatusChanged, Stack.onIndexChanged etc). Otherwise, we will enter
+ // this function several times, which causes the items to be updated half-way.
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __loadElement(transition.inElement)
+
+ transition.name = transition.replace ? "replaceTransition" : (transition.push ? "pushTransition" : "popTransition")
+ var enterItem = transition.inElement.item
+ transition.enterItem = enterItem
+
+ // Since an item can be pushed several times, we need to update its properties:
+ enterItem.parent = root
+ enterItem.Stack.__view = root
+ enterItem.Stack.__index = transition.inElement.index
+ __currentItem = enterItem
+
+ if (!transition.outElement) {
+ // A transition consists of two items, but we got just one. So just show the item:
+ enterItem.visible = true
+ __setStatus(enterItem, Stack.Activating)
+ __setStatus(enterItem, Stack.Active)
+ return
+ }
+
+ var exitItem = transition.outElement.item
+ transition.exitItem = exitItem
+ if (enterItem === exitItem)
+ return
+
+ if (root.delegate) {
+ transition.properties = {
+ "name":transition.name,
+ "enterItem":transition.enterItem,
+ "exitItem":transition.exitItem,
+ "immediate":transition.immediate }
+ var anim = root.delegate.getTransition(transition.properties)
+ if (anim.createObject) {
+ anim = anim.createObject(null, transition.properties)
+ anim.runningChanged.connect(function(){ if (anim.running === false) anim.destroy() })
+ }
+ transition.animation = anim
+ }
+
+ if (!transition.animation) {
+ console.warn("Warning: StackView: no", transition.name, "found!")
+ return
+ }
+ if (enterItem.anchors.fill || exitItem.anchors.fill)
+ console.warn("Warning: StackView: cannot transition an item that is anchored!")
+
+ __currentTransition = transition
+ __setStatus(exitItem, Stack.Deactivating)
+ enterItem.visible = true
+ __setStatus(enterItem, Stack.Activating)
+ transition.animation.runningChanged.connect(animationFinished)
+ transition.animation.start()
+ // NB! For empty animations, "animationFinished" is already
+ // executed at this point, leaving __animation === null:
+ if (transition.immediate === true && transition.animation)
+ transition.animation.complete()
+ }
+
+ /*! \internal */
+ function animationFinished()
+ {
+ if (!__currentTransition || __currentTransition.animation.running)
+ return
+
+ __currentTransition.animation.runningChanged.disconnect(animationFinished)
+ __currentTransition.exitItem.visible = false
+ __setStatus(__currentTransition.exitItem, Stack.Inactive);
+ __setStatus(__currentTransition.enterItem, Stack.Active);
+ __currentTransition.properties.animation = __currentTransition.animation
+ root.delegate.transitionFinished(__currentTransition.properties)
+
+ if (!__currentTransition.push || __currentTransition.replace)
+ __cleanup(__currentTransition.outElement)
+
+ __currentTransition = null
+ }
+
+ /*! \internal */
+ property Component invalidItemReplacement: Component {
+ Text {
+ width: parent.width
+ height: parent.height
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewDelegate.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewDelegate.qml
new file mode 100644
index 0000000000..e77b823527
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewDelegate.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+/*!
+ \qmltype StackViewDelegate
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+
+ \brief A delegate used by StackView for loading transitions.
+
+ See the documentation for the \l {QtQuick.Controls1::StackView} {StackView}
+ component.
+
+*/
+QtObject {
+ id: root
+
+ function getTransition(properties)
+ {
+ return root[properties.name]
+ }
+
+ function transitionFinished(properties)
+ {
+ }
+
+ property Component pushTransition: StackViewTransition {}
+ property Component popTransition: root["pushTransition"]
+ property Component replaceTransition: root["pushTransition"]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewTransition.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewTransition.qml
new file mode 100644
index 0000000000..e58ad3f34e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewTransition.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+ParallelAnimation {
+ id: root
+ /*! The name of the animation that is running. Can be one of the following:
+ \list
+ \li 'PushTransition'
+ \li 'PopTransition'
+ \li 'ReplaceTransition'
+ \endlist
+ */
+ property string name
+ /*! The page that is transitioning in. */
+ property Item enterItem
+ /*! The page that is transitioning out */
+ property Item exitItem
+ /*! Set to \c true if the transition is told to
+ fast-forward directly to its end-state */
+ property bool immediate
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StatusBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StatusBar.qml
new file mode 100644
index 0000000000..cf41a2dc76
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StatusBar.qml
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StatusBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup applicationwindow
+ \brief Contains status information in your app.
+
+ The common way of using StatusBar is in relation to \l ApplicationWindow.
+
+ Note that the StatusBar does not provide a layout of its own, but requires
+ you to position its contents, for instance by creating a \l RowLayout.
+
+ If only a single item is used within the StatusBar, it will resize to fit the implicitHeight
+ of its contained item. This makes it particularly suitable for use together with layouts.
+ Otherwise the height is platform dependent.
+
+ \code
+ import QtQuick.Controls 1.1
+ import QtQuick.Layouts 1.0
+
+ ApplicationWindow {
+ statusBar: StatusBar {
+ RowLayout {
+ Label { text: "Read Only" }
+ }
+ }
+ }
+ \endcode
+*/
+
+Item {
+ id: statusbar
+
+ activeFocusOnTab: false
+ Accessible.role: Accessible.StatusBar
+
+ width: parent ? parent.width : implicitWidth
+ implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
+ implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(),
+ loader.item ? loader.item.implicitHeight : 19)
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/StatusBarStyle.qml", statusbar)
+
+ /*! \internal */
+ property alias __style: styleLoader.item
+
+ /*! \internal */
+ default property alias __content: container.data
+
+ /*!
+ \qmlproperty Item StatusBar::contentItem
+
+ This property holds the content Item of the status bar.
+
+ Items declared as children of a StatusBar are automatically parented to the StatusBar's contentItem.
+ Items created dynamically need to be explicitly parented to the contentItem:
+
+ \note The implicit size of the StatusBar is calculated based on the size of its content. If you want to anchor
+ items inside the status bar, you must specify an explicit width and height on the StatusBar itself.
+ */
+ readonly property alias contentItem: container
+
+ data: [
+ Loader {
+ id: loader
+ anchors.fill: parent
+ sourceComponent: styleLoader.item ? styleLoader.item.panel : null
+ onLoaded: item.z = -1
+ Loader {
+ id: styleLoader
+ property alias __control: statusbar
+ sourceComponent: style
+ }
+ },
+ Item {
+ id: container
+ z: 1
+ focus: true
+ anchors.fill: parent
+
+ anchors.topMargin: topMargin
+ anchors.leftMargin: leftMargin
+ anchors.rightMargin: rightMargin
+ anchors.bottomMargin: bottomMargin
+
+ property int topMargin: __style ? __style.padding.top : 0
+ property int bottomMargin: __style ? __style.padding.bottom : 0
+ property int leftMargin: __style ? __style.padding.left : 0
+ property int rightMargin: __style ? __style.padding.right : 0
+
+ property Item layoutItem: container.children.length === 1 ? container.children[0] : null
+ function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) :
+ loader.item ? loader.item.implicitWidth: 0) }
+ function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) : loader.item ? loader.item.implicitHeight : 0) }
+ }]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml
new file mode 100644
index 0000000000..d53ccb2925
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype BusyIndicatorStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.2
+ \ingroup controlsstyling
+ \brief Provides custom styling for BusyIndicatorStyle
+
+ You can create a busy indicator by replacing the "indicator" delegate
+ of the BusyIndicatorStyle with a custom design.
+
+ Example:
+ \qml
+ BusyIndicator {
+ style: BusyIndicatorStyle
+ indicator: Image {
+ visible: control.running
+ source: "spinner.png"
+ NumberAnimation on rotation {
+ running: control.running
+ loops: Animation.Infinite
+ duration: 2000
+ from: 0 ; to: 360
+ }
+ }
+ }
+ }
+ \endqml
+*/
+Style {
+ id: indicatorstyle
+
+ /*! The \l BusyIndicator attached to this style. */
+ readonly property BusyIndicator control: __control
+
+ /*! This defines the appearance of the busy indicator. */
+ property Component indicator: Item {
+ implicitWidth: 48
+ implicitHeight: 48
+
+ opacity: control.running ? 1 : 0
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
+
+ Image {
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ width: Math.min(parent.width, parent.height)
+ height: width
+ source: width <= 32 ? "images/spinner_small.png" :
+ width >= 48 ? "images/spinner_large.png" :
+ "images/spinner_medium.png"
+ RotationAnimator on rotation {
+ duration: 800
+ loops: Animation.Infinite
+ from: 0
+ to: 360
+ }
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ anchors.fill: parent
+ implicitWidth: indicatorLoader.implicitWidth
+ implicitHeight: indicatorLoader.implicitHeight
+
+ Loader {
+ id: indicatorLoader
+ sourceComponent: indicator
+ anchors.centerIn: parent
+ width: Math.min(parent.width, parent.height)
+ height: width
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ButtonStyle.qml
new file mode 100644
index 0000000000..ad14095c59
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ButtonStyle.qml
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ButtonStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for Button
+
+ You can create a custom button by replacing the "background" delegate
+ of the ButtonStyle with a custom design.
+
+ Example:
+ \qml
+ Button {
+ text: "A button"
+ style: ButtonStyle {
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 25
+ border.width: control.activeFocus ? 2 : 1
+ border.color: "#888"
+ radius: 4
+ gradient: Gradient {
+ GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
+ GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
+ }
+ }
+ }
+ }
+ \endqml
+ If you need a custom label, you can replace the label item.
+*/
+
+Style {
+ id: buttonstyle
+
+ /*! The \l Button attached to this style. */
+ readonly property Button control: __control
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ /*! The padding between the background and the label components. */
+ padding {
+ top: 4
+ left: 4
+ right: control.menu !== null ? Math.round(TextSingleton.implicitHeight * 0.5) : 4
+ bottom: 4
+ }
+
+ /*! This defines the background of the button. */
+ property Component background: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: control.pressed ? 0 : -1
+ color: "#10000000"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: control.pressed ? "#aaa" : "#fefefe" ; position: 0}
+ GradientStop {color: control.pressed ? "#ccc" : "#e3e3e3" ; position: control.pressed ? 0.1: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ Rectangle {
+ anchors.fill: parent
+ radius: parent.radius
+ color: control.activeFocus ? "#47b" : "white"
+ opacity: control.hovered || control.activeFocus ? 0.1 : 0
+ Behavior on opacity {NumberAnimation{ duration: 100 }}
+ }
+ }
+ Image {
+ id: imageItem
+ visible: control.menu !== null
+ source: "images/arrow-down.png"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: padding.right
+ opacity: control.enabled ? 0.6 : 0.5
+ }
+ }
+
+ /*! This defines the label of the button. */
+ property Component label: Item {
+ implicitWidth: row.implicitWidth
+ implicitHeight: row.implicitHeight
+ Row {
+ id: row
+ anchors.centerIn: parent
+ spacing: 2
+ Image {
+ source: control.iconSource
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Text {
+ renderType: Text.NativeRendering
+ anchors.verticalCenter: parent.verticalCenter
+ text: control.text
+ color: __syspal.text
+ }
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ anchors.fill: parent
+ implicitWidth: Math.max(labelLoader.implicitWidth + padding.left + padding.right, backgroundLoader.implicitWidth)
+ implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight)
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ }
+
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ anchors.fill: parent
+ anchors.leftMargin: padding.left
+ anchors.topMargin: padding.top
+ anchors.rightMargin: padding.right
+ anchors.bottomMargin: padding.bottom
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml
new file mode 100644
index 0000000000..8fb58207cb
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml
@@ -0,0 +1,196 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Window 2.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype CheckBoxStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for CheckBox
+
+ Example:
+ \qml
+ CheckBox {
+ text: "Check Box"
+ style: CheckBoxStyle {
+ indicator: Rectangle {
+ implicitWidth: 16
+ implicitHeight: 16
+ radius: 3
+ border.color: control.activeFocus ? "darkblue" : "gray"
+ border.width: 1
+ Rectangle {
+ visible: control.checked
+ color: "#555"
+ border.color: "#333"
+ radius: 1
+ anchors.margins: 4
+ anchors.fill: parent
+ }
+ }
+ }
+ }
+ \endqml
+*/
+Style {
+ id: checkboxStyle
+
+ /*! The \l CheckBox attached to this style. */
+ readonly property CheckBox control: __control
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ /*! This defines the text label. */
+ property Component label: Item {
+ implicitWidth: text.implicitWidth + 2
+ implicitHeight: text.implicitHeight
+ Rectangle {
+ anchors.fill: text
+ anchors.margins: -1
+ anchors.leftMargin: -3
+ anchors.rightMargin: -3
+ visible: control.activeFocus
+ height: 6
+ radius: 3
+ color: "#224f9fef"
+ border.color: "#47b"
+ opacity: 0.6
+ }
+ Text {
+ id: text
+ text: control.text
+ anchors.centerIn: parent
+ color: __syspal.text
+ renderType: Text.NativeRendering
+ }
+ }
+ /*! The background under indicator and label. */
+ property Component background
+
+ /*! The spacing between indicator and label. */
+ property int spacing: Math.round(TextSingleton.implicitHeight/4)
+
+ /*! This defines the indicator button. */
+ property Component indicator: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight)
+ height: width
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: "#eee" ; position: 0}
+ GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ }
+
+ Image {
+ source: "images/check.png"
+ opacity: control.checkedState === Qt.Checked ? control.enabled ? 1 : 0.5 : 0
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 1
+ Behavior on opacity {NumberAnimation {duration: 80}}
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: Math.round(baserect.radius)
+ antialiasing: true
+ gradient: Gradient {
+ GradientStop {color: control.pressed ? "#555" : "#999" ; position: 0}
+ GradientStop {color: "#555" ; position: 1}
+ }
+ radius: baserect.radius - 1
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ border.color: "#222"
+ Behavior on opacity {NumberAnimation {duration: 80}}
+ opacity: control.checkedState === Qt.PartiallyChecked ? control.enabled ? 1 : 0.5 : 0
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ implicitWidth: Math.max(backgroundLoader.implicitWidth, row.implicitWidth + padding.left + padding.right)
+ implicitHeight: Math.max(backgroundLoader.implicitHeight, labelLoader.implicitHeight + padding.top + padding.bottom,indicatorLoader.implicitHeight + padding.top + padding.bottom)
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: background
+ anchors.fill: parent
+ }
+ Row {
+ id: row
+ anchors.fill: parent
+
+ anchors.leftMargin: padding.left
+ anchors.rightMargin: padding.right
+ anchors.topMargin: padding.top
+ anchors.bottomMargin: padding.bottom
+
+ spacing: checkboxStyle.spacing
+ Loader {
+ id: indicatorLoader
+ sourceComponent: indicator
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml
new file mode 100644
index 0000000000..2b4b237d20
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ComboBoxStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for ComboBox
+*/
+
+Style {
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l ComboBox attached to this style. */
+ readonly property ComboBox control: __control
+
+ /*! The padding between the background and the label components. */
+ padding { top: 4 ; left: 6 ; right: 6 ; bottom:4 }
+
+ /*! The size of the drop down button when the combobox is editable. */
+ property int drowDownButtonWidth: Math.round(TextSingleton.implicitHeight)
+
+ /*! This defines the background of the button. */
+ property Component background: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: control.pressed ? 0 : -1
+ color: "#10000000"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: control.pressed ? "#bababa" : "#fefefe" ; position: 0}
+ GradientStop {color: control.pressed ? "#ccc" : "#e3e3e3" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ Rectangle {
+ anchors.fill: parent
+ radius: parent.radius
+ color: control.activeFocus ? "#47b" : "white"
+ opacity: control.hovered || control.activeFocus ? 0.1 : 0
+ Behavior on opacity {NumberAnimation{ duration: 100 }}
+ }
+ }
+ Image {
+ id: imageItem
+ visible: control.menu !== null
+ source: "images/arrow-down.png"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: drowDownButtonWidth / 2
+ opacity: control.enabled ? 0.6 : 0.3
+ }
+ }
+
+ /*! \internal */
+ property Component __editor: Item {
+ implicitWidth: 100
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ clip: true
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: 0
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ anchors.rightMargin: -radius
+ anchors.bottomMargin: 1
+ gradient: Gradient {
+ GradientStop {color: "#e0e0e0" ; position: 0}
+ GradientStop {color: "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ }
+ Rectangle {
+ color: "#aaa"
+ anchors.bottomMargin: 2
+ anchors.topMargin: 1
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ width: 1
+ }
+ }
+
+ /*! This defines the label of the button. */
+ property Component label: Item {
+ implicitWidth: textitem.implicitWidth + 20
+ Text {
+ id: textitem
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: 4
+ anchors.rightMargin: 10
+ anchors.verticalCenter: parent.verticalCenter
+ text: control.currentText
+ renderType: Text.NativeRendering
+ color: __syspal.text
+ elide: Text.ElideRight
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ property bool popup: false
+ anchors.centerIn: parent
+ anchors.fill: parent
+ implicitWidth: backgroundLoader.implicitWidth
+ implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight)
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+
+ }
+
+ Loader {
+ id: editorLoader
+ anchors.fill: parent
+ anchors.rightMargin: drowDownButtonWidth + padding.right
+ anchors.bottomMargin: -1
+ sourceComponent: control.editable ? __editor : null
+ }
+
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ visible: !control.editable
+ anchors.fill: parent
+ anchors.leftMargin: padding.left
+ anchors.topMargin: padding.top
+ anchors.rightMargin: padding.right
+ anchors.bottomMargin: padding.bottom
+ }
+ }
+
+ /*! \internal */
+ property Component __dropDownStyle: MenuStyle {
+ maxPopupHeight: 600
+ __menuItemType: "comboboxitem"
+ scrollerStyle: ScrollViewStyle {
+ property bool useScrollers: false
+ }
+ }
+
+ /*! \internal */
+ property Component __popupStyle: Style {
+
+ property Component frame: Rectangle {
+ width: (parent ? parent.contentWidth : 0)
+ height: (parent ? parent.contentHeight : 0) + 2
+ border.color: "white"
+ property real maxHeight: 500
+ property int margin: 1
+ }
+
+ property Component menuItem: Text {
+ text: "NOT IMPLEMENTED"
+ color: "red"
+ font {
+ pixelSize: 14
+ bold: true
+ }
+ }
+
+ property Component scrollerStyle: Style {
+ padding { left: 0; right: 0; top: 0; bottom: 0 }
+ property bool scrollToClickedPosition: false
+ property Component frame: Item { visible: false }
+ property Component corner: Item { visible: false }
+ property Component __scrollbar: Item { visible: false }
+ property bool useScrollers: true
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml
new file mode 100644
index 0000000000..27edf11c5c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype FocusFrameStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+Item {
+ property int margin: -3
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml
new file mode 100644
index 0000000000..c0c08d5623
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype GroupBoxStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+ \ingroup controlsstyling
+ \since 5.1
+*/
+Style {
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l GroupBox attached to this style. */
+ readonly property GroupBox control: __control
+
+ /*! The margin from the content item to the groupbox. */
+ padding {
+ top: (control.title.length > 0 || control.checkable ? TextSingleton.implicitHeight : 0) + 10
+ left: 8
+ right: 8
+ bottom: 6
+ }
+
+ /*! The title text color. */
+ property color textColor: __syspal.text
+
+ /*! The check box. */
+ property Component checkbox: Item {
+ implicitWidth: 18
+ implicitHeight: 18
+ BorderImage {
+ anchors.fill: parent
+ source: "images/editbox.png"
+ border.top: 6
+ border.bottom: 6
+ border.left: 6
+ border.right: 6
+ }
+ Rectangle {
+ height: 16
+ width: 16
+ antialiasing: true
+ visible: control.checked
+ color: "#666"
+ radius: 1
+ anchors.margins: 4
+ anchors.fill: parent
+ anchors.topMargin: 3
+ anchors.bottomMargin: 5
+ border.color: "#222"
+ opacity: control.enabled ? 1 : 0.5
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ border.color: "#33ffffff"
+ }
+ }
+ BorderImage {
+ anchors.fill: parent
+ anchors.margins: -1
+ source: "images/focusframe.png"
+ visible: control.activeFocus
+ border.left: 4
+ border.right: 4
+ border.top: 4
+ border.bottom: 4
+ }
+ }
+
+ /*! The groupbox frame. */
+ property Component panel: Item {
+ anchors.fill: parent
+ Loader {
+ id: checkboxloader
+ anchors.left: parent.left
+ sourceComponent: control.checkable ? checkbox : null
+ anchors.verticalCenter: label.verticalCenter
+ width: item ? item.implicitWidth : 0
+ }
+
+ Text {
+ id: label
+ anchors.top: parent.top
+ anchors.left: checkboxloader.right
+ anchors.margins: 4
+ text: control.title
+ color: textColor
+ renderType: Text.NativeRendering
+ }
+
+ BorderImage {
+ anchors.fill: parent
+ anchors.topMargin: padding.top - 7
+ source: "images/groupbox.png"
+ border.left: 4
+ border.right: 4
+ border.top: 4
+ border.bottom: 4
+ visible: !control.flat
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuBarStyle.qml
new file mode 100644
index 0000000000..3a3b552dd6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuBarStyle.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype MenuBarStyle
+ \internal
+ \ingroup applicationwindowstyling
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+
+Style {
+ readonly property color __backgroundColor: "#dcdcdc"
+
+ property Component frame: Rectangle {
+ width: control.__contentItem.width
+ height: contentHeight
+ color: __backgroundColor
+ }
+
+ property Component menuItem: Rectangle {
+ width: text.width + 12
+ height: text.height + 4
+ color: sunken ? "#49d" :__backgroundColor
+
+ SystemPalette { id: syspal }
+
+ Text {
+ id: text
+ text: StyleHelpers.stylizeMnemonics(menuItem.title)
+ anchors.centerIn: parent
+ renderType: Text.NativeRendering
+ color: sunken ? "white" : syspal.windowText
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuStyle.qml
new file mode 100644
index 0000000000..c05c6a6d10
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuStyle.qml
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype MenuStyle
+ \internal
+ \ingroup menusstyling
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+
+Style {
+ id: styleRoot
+
+ property string __menuItemType: "menuitem"
+ property real maxPopupHeight: 600 // ### FIXME Screen.desktopAvailableHeight * 0.99
+
+ property Component frame: Rectangle {
+ width: (parent ? parent.contentWidth : 0) + 2
+ height: (parent ? parent.contentHeight : 0) + 2
+
+ color: "lightgray"
+ border { width: 1; color: "darkgray" }
+
+ property int subMenuOverlap: -1
+ property real maxHeight: maxPopupHeight
+ property int margin: 1
+ }
+
+ property Component menuItem: Rectangle {
+ x: 1
+ y: 1
+ implicitWidth: Math.max((parent ? parent.width : 0),
+ 18 + text.paintedWidth + (rightDecoration.visible ? rightDecoration.width + 40 : 12))
+ implicitHeight: isSeparator ? text.font.pixelSize / 2 : !!scrollerDirection ? text.font.pixelSize * 0.75 : text.paintedHeight + 4
+ color: selected && enabled ? "" : backgroundColor
+ gradient: selected && enabled ? selectedGradient : undefined
+ border.width: 1
+ border.color: selected && enabled ? Qt.darker(selectedColor, 1) : color
+ readonly property int leftMargin: __menuItemType === "menuitem" ? 18 : 0
+
+ readonly property color backgroundColor: "#dcdcdc"
+ readonly property color selectedColor: "#49d"
+ Gradient {
+ id: selectedGradient
+ GradientStop {color: Qt.lighter(selectedColor, 1.3) ; position: -0.2}
+ GradientStop {color: selectedColor; position: 1.4}
+ }
+ antialiasing: true
+
+ SystemPalette {
+ id: syspal
+ colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ readonly property string itemText: parent ? parent.text : ""
+ readonly property bool mirrored: Qt.application.layoutDirection === Qt.RightToLeft
+
+ Loader {
+ id: checkMark
+ x: mirrored ? parent.width - width - 4 : 4
+ y: 6
+ active: __menuItemType === "menuitem" && !!menuItem && !!menuItem["checkable"]
+ sourceComponent: exclusive ? exclusiveCheckMark : nonExclusiveCheckMark
+
+ readonly property bool checked: !!menuItem && !!menuItem.checked
+ readonly property bool exclusive: !!menuItem && !!menuItem["exclusiveGroup"]
+
+ Component {
+ id: nonExclusiveCheckMark
+ BorderImage {
+ width: 12
+ height: 12
+ source: "images/editbox.png"
+ border.top: 6
+ border.bottom: 6
+ border.left: 6
+ border.right: 6
+
+ Rectangle {
+ antialiasing: true
+ visible: checkMark.checked
+ color: "#666"
+ radius: 1
+ anchors.margins: 4
+ anchors.fill: parent
+ anchors.topMargin: 3
+ anchors.bottomMargin: 5
+ border.color: "#222"
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ border.color: "#33ffffff"
+ }
+ }
+ }
+ }
+
+ Component {
+ id: exclusiveCheckMark
+ Rectangle {
+ x: 1
+ width: 10
+ height: 10
+ color: "white"
+ border.color: "gray"
+ antialiasing: true
+ radius: height/2
+
+ Rectangle {
+ anchors.centerIn: parent
+ visible: checkMark.checked
+ width: 4
+ height: 4
+ color: "#666"
+ border.color: "#222"
+ antialiasing: true
+ radius: height/2
+ }
+ }
+ }
+ }
+
+ Text {
+ id: text
+ visible: !isSeparator
+ text: StyleHelpers.stylizeMnemonics(itemText)
+ readonly property real offset: __menuItemType === "menuitem" ? 24 : 6
+ x: mirrored ? parent.width - width - offset : offset
+ anchors.verticalCenter: parent.verticalCenter
+ renderType: Text.NativeRendering
+ color: selected && enabled ? "white" : syspal.text
+ }
+
+ Text {
+ id: rightDecoration
+ readonly property string shortcut: !!menuItem && menuItem["shortcut"] || ""
+ visible: isSubmenu || shortcut !== ""
+ text: isSubmenu ? mirrored ? "\u25c2" : "\u25b8" // BLACK LEFT/RIGHT-POINTING SMALL TRIANGLE
+ : shortcut
+ LayoutMirroring.enabled: mirrored
+ anchors {
+ right: parent.right
+ rightMargin: 6
+ baseline: isSubmenu ? undefined : text.baseline
+ }
+ font.pixelSize: isSubmenu ? text.font.pixelSize : text.font.pixelSize * 0.9
+ color: text.color
+ renderType: Text.NativeRendering
+ style: selected || !isSubmenu ? Text.Normal : Text.Raised; styleColor: Qt.lighter(color, 4)
+ }
+
+ Image {
+ id: scrollerDecoration
+ visible: !!scrollerDirection
+ anchors.centerIn: parent
+ source: scrollerDirection === "up" ? "images/arrow-up.png" : "images/arrow-down.png"
+ }
+
+ Rectangle {
+ visible: isSeparator
+ width: parent.width - 2
+ height: 1
+ x: 1
+ anchors.verticalCenter: parent.verticalCenter
+ color: "darkgray"
+ }
+ }
+
+ property Component scrollerStyle: Style {
+ padding { left: 0; right: 0; top: 0; bottom: 0 }
+ property bool scrollToClickedPosition: false
+ property Component frame: Item { visible: false }
+ property Component corner: Item { visible: false }
+ property Component __scrollbar: Item { visible: false }
+ property bool useScrollers: true
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml
new file mode 100644
index 0000000000..d8ff8140eb
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ProgressBarStyle
+
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for ProgressBar
+
+ Example:
+ \qml
+ ProgressBar {
+ value: slider.value
+ style: ProgressBarStyle {
+ background: Rectangle {
+ radius: 2
+ color: "lightgray"
+ border.color: "gray"
+ border.width: 1
+ implicitWidth: 200
+ implicitHeight: 24
+ }
+ progress: Rectangle {
+ color: "lightsteelblue"
+ border.color: "steelblue"
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+ id: progressBarStyle
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l ProgressBar attached to this style. */
+ readonly property ProgressBar control: __control
+
+ /*! A value in the range [0-1] indicating the current progress. */
+ readonly property real currentProgress: control.indeterminate ? 1.0 :
+ control.value / control.maximumValue
+
+ /*! This property holds the visible contents of the progress bar
+ You can access the Slider through the \c control property.
+
+ For convenience, you can also access the readonly property \c styleData.progress
+ which provides the current progress as a \c real in the range [0-1]
+ */
+ padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 }
+
+ /*! \qmlproperty Component ProgressBarStyle::progress
+ The progress component for this style.
+ */
+ property Component progress: Item {
+ property color progressColor: "#49d"
+ anchors.fill: parent
+ clip: true
+ Rectangle {
+ id: base
+ width: control.width
+ height: control.height
+ radius: TextSingleton.implicitHeight * 0.16
+ antialiasing: true
+ gradient: Gradient {
+ GradientStop {color: Qt.lighter(progressColor, 1.3) ; position: 0}
+ GradientStop {color: progressColor ; position: 1.4}
+ }
+ border.width: 1
+ border.color: Qt.darker(progressColor, 1.2)
+ Rectangle {
+ color: "transparent"
+ radius: 1.5
+ clip: true
+ antialiasing: true
+ anchors.fill: parent
+ anchors.margins: 1
+ border.color: Qt.rgba(1,1,1,0.1)
+ Image {
+ visible: control.indeterminate
+ height: parent.height
+ NumberAnimation on x {
+ from: -39
+ to: 0
+ running: control.indeterminate
+ duration: 800
+ loops: Animation.Infinite
+ }
+ fillMode: Image.Tile
+ width: parent.width + 25
+ source: "images/progress-indeterminate.png"
+ }
+ }
+ }
+ Rectangle {
+ height: parent.height - 2
+ width: 1
+ y: 1
+ anchors.right: parent.right
+ anchors.rightMargin: 1
+ color: Qt.rgba(1,1,1,0.1)
+ visible: splitter.visible
+ }
+ Rectangle {
+ id: splitter
+ height: parent.height - 2
+ width: 1
+ y: 1
+ anchors.right: parent.right
+ color: Qt.darker(progressColor, 1.2)
+ property int offset: currentProgress * control.width
+ visible: offset > base.radius && offset < control.width - base.radius + 1
+ }
+ }
+
+ /*! \qmlproperty Component ProgressBarStyle::background
+ The background component for this style.
+
+ \note The implicitWidth and implicitHeight of the background component
+ must be set.
+ */
+ property Component background: Item {
+ implicitWidth: 200
+ implicitHeight: Math.max(17, Math.round(TextSingleton.implicitHeight * 0.7))
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: control.pressed ? 0 : -1
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: "#eee" ; position: 0}
+ GradientStop {color: "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ Rectangle {
+ anchors.fill: parent
+ radius: parent.radius
+ color: control.activeFocus ? "#47b" : "white"
+ opacity: control.hovered || control.activeFocus ? 0.1 : 0
+ Behavior on opacity {NumberAnimation{ duration: 100 }}
+ }
+ }
+ }
+
+ /*! \qmlproperty Component ProgressBarStyle::panel
+ The panel component for this style.
+ */
+ property Component panel: Item{
+ property bool horizontal: control.orientation == Qt.Horizontal
+ implicitWidth: horizontal ? backgroundLoader.implicitWidth : backgroundLoader.implicitHeight
+ implicitHeight: horizontal ? backgroundLoader.implicitHeight : backgroundLoader.implicitWidth
+
+ Item {
+ width: horizontal ? parent.width : parent.height
+ height: !horizontal ? parent.width : parent.height
+ y: horizontal ? 0 : width
+ rotation: horizontal ? 0 : -90
+ transformOrigin: Item.TopLeft
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ }
+
+ Loader {
+ sourceComponent: progressBarStyle.progress
+ anchors.topMargin: padding.top
+ anchors.leftMargin: padding.left
+ anchors.rightMargin: padding.right
+ anchors.bottomMargin: padding.bottom
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ width: currentProgress * (parent.width - padding.left - padding.right)
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml
new file mode 100644
index 0000000000..78f423ace4
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype RadioButtonStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for RadioButton
+
+ Example:
+ \qml
+ RadioButton {
+ text: "Radio Button"
+ style: RadioButtonStyle {
+ indicator: Rectangle {
+ implicitWidth: 16
+ implicitHeight: 16
+ radius: 9
+ border.color: control.activeFocus ? "darkblue" : "gray"
+ border.width: 1
+ Rectangle {
+ anchors.fill: parent
+ visible: control.checked
+ color: "#555"
+ radius: 9
+ anchors.margins: 4
+ }
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+ id: radiobuttonStyle
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l RadioButton attached to this style. */
+ readonly property RadioButton control: __control
+
+ /*! This defines the text label. */
+ property Component label: Item {
+ implicitWidth: text.implicitWidth + 2
+ implicitHeight: text.implicitHeight
+ Rectangle {
+ anchors.fill: text
+ anchors.margins: -1
+ anchors.leftMargin: -3
+ anchors.rightMargin: -3
+ visible: control.activeFocus
+ height: 6
+ radius: 3
+ color: "#224f9fef"
+ border.color: "#47b"
+ opacity: 0.6
+ }
+ Text {
+ id: text
+ text: control.text
+ anchors.centerIn: parent
+ color: __syspal.text
+ renderType: Text.NativeRendering
+ }
+ }
+
+ /*! The background under indicator and label. */
+ property Component background
+
+ /*! The spacing between indicator and label. */
+ property int spacing: Math.round(TextSingleton.implicitHeight/4)
+
+ /*! This defines the indicator button. */
+ property Component indicator: Rectangle {
+ width: Math.round(TextSingleton.implicitHeight)
+ height: width
+ gradient: Gradient {
+ GradientStop {color: "#eee" ; position: 0}
+ GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.4}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ border.color: control.activeFocus ? "#16c" : "gray"
+ antialiasing: true
+ radius: height/2
+ Rectangle {
+ anchors.centerIn: parent
+ width: Math.round(parent.width * 0.5)
+ height: width
+ gradient: Gradient {
+ GradientStop {color: "#999" ; position: 0}
+ GradientStop {color: "#555" ; position: 1}
+ }
+ border.color: "#222"
+ antialiasing: true
+ radius: height/2
+ Behavior on opacity {NumberAnimation {duration: 80}}
+ opacity: control.checked ? control.enabled ? 1 : 0.5 : 0
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ implicitWidth: Math.max(backgroundLoader.implicitWidth, row.implicitWidth + padding.left + padding.right)
+ implicitHeight: Math.max(backgroundLoader.implicitHeight, labelLoader.implicitHeight + padding.top + padding.bottom,indicatorLoader.implicitHeight + padding.top + padding.bottom)
+
+ Loader {
+ id:backgroundLoader
+ sourceComponent: background
+ anchors.fill: parent
+ }
+ Row {
+ id: row
+ anchors.fill: parent
+
+ anchors.leftMargin: padding.left
+ anchors.rightMargin: padding.right
+ anchors.topMargin: padding.top
+ anchors.bottomMargin: padding.bottom
+
+ spacing: radiobuttonStyle.spacing
+ Loader {
+ id: indicatorLoader
+ sourceComponent: indicator
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml
new file mode 100644
index 0000000000..a7dbcc520e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml
@@ -0,0 +1,398 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ScrollViewStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup viewsstyling
+ \brief Provides custom styling for ScrollView
+*/
+Style {
+ id: root
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l ScrollView attached to this style. */
+ readonly property ScrollView control: __control
+
+ /*! This property controls the frame border padding of the scrollView. */
+ padding {left: 1; top: 1; right: 1; bottom: 1}
+
+ /*! This Component paints the corner area between scroll bars */
+ property Component corner: Rectangle { color: "#ccc" }
+
+ /*! This component determines if the flickable should reposition itself at the
+ mouse location when clicked. */
+ property bool scrollToClickedPosition: true
+
+ /*! This property holds whether the scroll bars are transient. Transient scroll bars
+ appear when the content is scrolled and disappear when they are no longer needed.
+
+ The default value is platform dependent. */
+ property bool transientScrollBars: Settings.hasTouchScreen
+
+ /*! This Component paints the frame around scroll bars. */
+ property Component frame: Rectangle {
+ color: control["backgroundVisible"] ? "white": "transparent"
+ border.color: "#999"
+ border.width: 1
+ radius: 1
+ visible: control.frameVisible
+ }
+
+ /*! This is the minimum extent of the scroll bar handle.
+
+ The default value is \c 30.
+ */
+
+ property int minimumHandleLength: 30
+
+ /*! This property controls the edge overlap
+ between the handle and the increment/decrement buttons.
+
+ The default value is \c 30.
+ */
+
+ property int handleOverlap: 1
+
+ /*! This component controls the appearance of the
+ scroll bar background.
+
+ You can access the following state properties:
+
+ \table
+ \row \li property bool \b styleData.hovered
+ \row \li property bool \b styleData.horizontal
+ \endtable
+ */
+
+ property Component scrollBarBackground: Item {
+ property bool sticky: false
+ property bool hovered: styleData.hovered
+ implicitWidth: Math.round(TextSingleton.implicitHeight)
+ implicitHeight: Math.round(TextSingleton.implicitHeight)
+ clip: true
+ opacity: transientScrollBars ? 0.5 : 1.0
+ visible: !transientScrollBars || sticky
+ Rectangle {
+ anchors.fill: parent
+ color: "#ddd"
+ border.color: "#aaa"
+ anchors.rightMargin: styleData.horizontal ? -2 : -1
+ anchors.leftMargin: styleData.horizontal ? -2 : 0
+ anchors.topMargin: styleData.horizontal ? 0 : -2
+ anchors.bottomMargin: styleData.horizontal ? -1 : -2
+ }
+ onHoveredChanged: if (hovered) sticky = true
+ onVisibleChanged: if (!visible) sticky = false
+ }
+
+ /*! This component controls the appearance of the
+ scroll bar handle.
+
+ You can access the following state properties:
+
+ \table
+ \row \li property bool \b styleData.hovered
+ \row \li property bool \b styleData.pressed
+ \row \li property bool \b styleData.horizontal
+ \endtable
+ */
+
+ property Component handle: Item {
+ property bool sticky: false
+ property bool hovered: __activeControl !== "none"
+ implicitWidth: Math.round(TextSingleton.implicitHeight) + 1
+ implicitHeight: Math.round(TextSingleton.implicitHeight) + 1
+ BorderImage {
+ id: img
+ opacity: styleData.pressed && !transientScrollBars ? 0.5 : styleData.hovered ? 1 : 0.8
+ source: "images/scrollbar-handle-" + (transientScrollBars ? "transient" : styleData.horizontal ? "horizontal" : "vertical") + ".png"
+ border.left: transientScrollBars ? 5 : 2
+ border.top: transientScrollBars ? 5 : 2
+ border.right: transientScrollBars ? 5 : 2
+ border.bottom: transientScrollBars ? 5 : 2
+ anchors.top: !styleData.horizontal ? parent.top : undefined
+ anchors.margins: transientScrollBars ? 2 : 0
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.left: styleData.horizontal ? parent.left : undefined
+ width: !styleData.horizontal && transientScrollBars ? sticky ? 13 : 10 : parent.width
+ height: styleData.horizontal && transientScrollBars ? sticky ? 13 : 10 : parent.height
+ Behavior on width { enabled: !styleData.horizontal && transientScrollBars; NumberAnimation { duration: 100 } }
+ Behavior on height { enabled: styleData.horizontal && transientScrollBars; NumberAnimation { duration: 100 } }
+ }
+ onHoveredChanged: if (hovered) sticky = true
+ onVisibleChanged: if (!visible) sticky = false
+ }
+
+ /*! This component controls the appearance of the
+ scroll bar increment button.
+
+ You can access the following state properties:
+
+ \table
+ \row \li property bool \b styleData.hovered
+ \row \li property bool \b styleData.pressed
+ \row \li property bool \b styleData.horizontal
+ \endtable
+ */
+ property Component incrementControl: Rectangle {
+ visible: !transientScrollBars
+ implicitWidth: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight)
+ implicitHeight: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight)
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ anchors.rightMargin: -1
+ border.color: "#aaa"
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ border.color: "#44ffffff"
+ }
+ Image {
+ source: styleData.horizontal ? "images/arrow-right.png" : "images/arrow-down.png"
+ anchors.centerIn: parent
+ opacity: control.enabled ? 0.6 : 0.5
+ }
+ gradient: Gradient {
+ GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0}
+ GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1}
+ }
+ }
+ }
+
+ /*! This component controls the appearance of the
+ scroll bar decrement button.
+
+ You can access the following state properties:
+
+ \table
+ \row \li property bool \b styleData.hovered
+ \row \li property bool \b styleData.pressed
+ \row \li property bool \b styleData.horizontal
+ \endtable
+ */
+ property Component decrementControl: Rectangle {
+ visible: !transientScrollBars
+ implicitWidth: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight)
+ implicitHeight: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight)
+ Rectangle {
+ anchors.fill: parent
+ anchors.topMargin: styleData.horizontal ? 0 : -1
+ anchors.leftMargin: styleData.horizontal ? -1 : 0
+ anchors.bottomMargin: styleData.horizontal ? -1 : 0
+ anchors.rightMargin: styleData.horizontal ? 0 : -1
+ color: "lightgray"
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ border.color: "#44ffffff"
+ }
+ Image {
+ source: styleData.horizontal ? "images/arrow-left.png" : "images/arrow-up.png"
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: styleData.horizontal ? 0 : -1
+ anchors.horizontalCenterOffset: styleData.horizontal ? -1 : 0
+ opacity: control.enabled ? 0.6 : 0.5
+ }
+ gradient: Gradient {
+ GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0}
+ GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1}
+ }
+ border.color: "#aaa"
+ }
+ }
+
+ /*! \internal */
+ property Component __scrollbar: Item {
+ id: panel
+ property string activeControl: "none"
+ property bool scrollToClickPosition: true
+ property bool isTransient: transientScrollBars
+
+ property bool on: false
+ property bool raised: false
+ property bool sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed
+
+ states: State {
+ name: "out"
+ when: isTransient && panel.activeControl === "none" && !panel.on && !panel.raised
+ PropertyChanges { target: panel; opacity: 0 }
+ }
+
+ transitions: Transition {
+ to: "out"
+ SequentialAnimation {
+ PauseAnimation { duration: 450 }
+ NumberAnimation { properties: "opacity"; duration: 200 }
+ PropertyAction { target: panel; property: "visible"; value: false }
+ }
+ }
+
+ implicitWidth: __styleData.horizontal ? 200 : bg.implicitWidth
+ implicitHeight: __styleData.horizontal ? bg.implicitHeight : 200
+
+ function pixelMetric(arg) {
+ if (arg === "scrollbarExtent")
+ return (__styleData.horizontal ? bg.height : bg.width);
+ return 0;
+ }
+
+ function styleHint(arg) {
+ return false;
+ }
+
+ function hitTest(argX, argY) {
+ if (itemIsHit(handleControl, argX, argY))
+ return "handle"
+ else if (itemIsHit(incrementLoader, argX, argY))
+ return "up";
+ else if (itemIsHit(decrementLoader, argX, argY))
+ return "down";
+ else if (itemIsHit(bg, argX, argY)) {
+ if (__styleData.horizontal && argX < handleControl.x || !__styleData.horizontal && argY < handleControl.y)
+ return "upPage"
+ else
+ return "downPage"
+ }
+
+ return "none";
+ }
+
+ function subControlRect(arg) {
+ if (arg === "handle") {
+ return Qt.rect(handleControl.x, handleControl.y, handleControl.width, handleControl.height);
+ } else if (arg === "groove") {
+ if (__styleData.horizontal) {
+ return Qt.rect(incrementLoader.width - handleOverlap,
+ 0,
+ __control.width - (incrementLoader.width + decrementLoader.width - handleOverlap * 2),
+ __control.height);
+ } else {
+ return Qt.rect(0,
+ incrementLoader.height - handleOverlap,
+ __control.width,
+ __control.height - (incrementLoader.height + decrementLoader.height - handleOverlap * 2));
+ }
+ }
+ return Qt.rect(0,0,0,0);
+ }
+
+ function itemIsHit(argItem, argX, argY) {
+ var pos = argItem.mapFromItem(__control, argX, argY);
+ return (pos.x >= 0 && pos.x <= argItem.width && pos.y >= 0 && pos.y <= argItem.height);
+ }
+
+ Loader {
+ id: incrementLoader
+ anchors.top: parent.top
+ anchors.left: parent.left
+ sourceComponent: decrementControl
+ property QtObject styleData: QtObject {
+ readonly property bool hovered: activeControl === "up"
+ readonly property bool pressed: __styleData.upPressed
+ readonly property bool horizontal: __styleData.horizontal
+ }
+ }
+
+ Loader {
+ id: bg
+ anchors.top: __styleData.horizontal ? undefined : incrementLoader.bottom
+ anchors.bottom: __styleData.horizontal ? undefined : decrementLoader.top
+ anchors.left: __styleData.horizontal ? incrementLoader.right : undefined
+ anchors.right: __styleData.horizontal ? decrementLoader.left : undefined
+ sourceComponent: scrollBarBackground
+ property QtObject styleData: QtObject {
+ readonly property bool horizontal: __styleData.horizontal
+ readonly property bool hovered: activeControl !== "none"
+ }
+ }
+
+ Loader {
+ id: decrementLoader
+ anchors.bottom: __styleData.horizontal ? undefined : parent.bottom
+ anchors.right: __styleData.horizontal ? parent.right : undefined
+ sourceComponent: incrementControl
+ property QtObject styleData: QtObject {
+ readonly property bool hovered: activeControl === "down"
+ readonly property bool pressed: __styleData.downPressed
+ readonly property bool horizontal: __styleData.horizontal
+ }
+ }
+
+ property var flickableItem: control.flickableItem
+ property int extent: Math.max(minimumHandleLength, __styleData.horizontal ?
+ (flickableItem ? flickableItem.width/flickableItem.contentWidth : 0 ) * bg.width :
+ (flickableItem ? flickableItem.height/flickableItem.contentHeight : 0) * bg.height)
+
+ Loader {
+ id: handleControl
+ height: __styleData.horizontal ? implicitHeight : extent
+ width: __styleData.horizontal ? extent : implicitWidth
+ anchors.top: bg.top
+ anchors.left: bg.left
+ anchors.topMargin: __styleData.horizontal ? 0 : -handleOverlap + (__control.value / __control.maximumValue) * (bg.height + 2 * handleOverlap- height)
+ anchors.leftMargin: __styleData.horizontal ? -handleOverlap + (__control.value / __control.maximumValue) * (bg.width + 2 * handleOverlap - width) : 0
+ sourceComponent: handle
+ property QtObject styleData: QtObject {
+ readonly property bool hovered: activeControl === "handle"
+ readonly property bool pressed: __styleData.handlePressed
+ readonly property bool horizontal: __styleData.horizontal
+ }
+ readonly property alias __activeControl: panel.activeControl
+ }
+ }
+
+ /*! \internal */
+ property bool __externalScrollBars: false
+ /*! \internal */
+ property int __scrollBarSpacing: 4
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SliderStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SliderStyle.qml
new file mode 100644
index 0000000000..a62230bcf5
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SliderStyle.qml
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype SliderStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for Slider
+
+ The slider style allows you to create a custom appearance for
+ a \l Slider control.
+
+ The implicit size of the slider is calculated based on the
+ maximum implicit size of the \c background and \c handle
+ delegates combined.
+
+ Example:
+ \qml
+ Slider {
+ anchors.centerIn: parent
+ style: SliderStyle {
+ groove: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 8
+ color: "gray"
+ radius: 8
+ }
+ handle: Rectangle {
+ anchors.centerIn: parent
+ color: control.pressed ? "white" : "lightgray"
+ border.color: "gray"
+ border.width: 2
+ width: 34
+ height: 34
+ radius: 12
+ }
+ }
+ }
+ \endqml
+*/
+Style {
+ id: styleitem
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l Slider attached to this style. */
+ readonly property Slider control: __control
+
+ padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 }
+
+ /*! This property holds the item for the slider handle.
+ You can access the slider through the \c control property
+ */
+ property Component handle: Item{
+ implicitWidth: implicitHeight
+ implicitHeight: TextSingleton.implicitHeight * 1.2
+
+ FastGlow {
+ source: handle
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ anchors.topMargin: 1
+ smooth: true
+ color: "#11000000"
+ spread: 0.8
+ transparentBorder: true
+ blur: 0.1
+
+ }
+ Rectangle {
+ id: handle
+ anchors.fill: parent
+
+ radius: width/2
+ gradient: Gradient {
+ GradientStop { color: control.pressed ? "#e0e0e0" : "#fff" ; position: 1 }
+ GradientStop { color: "#eee" ; position: 0 }
+ }
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ radius: width/2
+ border.color: "#99ffffff"
+ color: control.activeFocus ? "#224f7fbf" : "transparent"
+ }
+ border.color: control.activeFocus ? "#47b" : "#777"
+ }
+
+ }
+ /*! This property holds the background groove of the slider.
+
+ You can access the handle position through the \c styleData.handlePosition property.
+ */
+ property Component groove: Item {
+ property color fillColor: "#49d"
+ anchors.verticalCenter: parent.verticalCenter
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
+ implicitHeight: Math.max(6, Math.round(TextSingleton.implicitHeight * 0.3))
+ Rectangle {
+ radius: height/2
+ anchors.fill: parent
+ border.width: 1
+ border.color: "#888"
+ gradient: Gradient {
+ GradientStop { color: "#bbb" ; position: 0 }
+ GradientStop { color: "#ccc" ; position: 0.6 }
+ GradientStop { color: "#ccc" ; position: 1 }
+ }
+ }
+ Item {
+ clip: true
+ width: styleData.handlePosition
+ height: parent.height
+ Rectangle {
+ anchors.fill: parent
+ border.color: Qt.darker(fillColor, 1.2)
+ radius: height/2
+ gradient: Gradient {
+ GradientStop {color: Qt.lighter(fillColor, 1.3) ; position: 0}
+ GradientStop {color: fillColor ; position: 1.4}
+ }
+ }
+ }
+ }
+
+ /*! This property holds the tick mark labels
+ \since QtQuick.Controls.Styles 1.1
+
+ You can access the handle width through the \c styleData.handleWidth property.
+ */
+ property Component tickmarks: Repeater {
+ id: repeater
+ model: control.stepSize > 0 ? 1 + (control.maximumValue - control.minimumValue) / control.stepSize : 0
+ Rectangle {
+ color: "#777"
+ width: 1 ; height: 3
+ y: repeater.height
+ x: styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))
+ }
+ }
+
+ /*! This property holds the slider style panel.
+
+ Note that it is generally not recommended to override this.
+ */
+ property Component panel: Item {
+ id: root
+ property int handleWidth: handleLoader.width
+ property int handleHeight: handleLoader.height
+
+ property bool horizontal : control.orientation === Qt.Horizontal
+ property int horizontalSize: grooveLoader.implicitWidth + padding.left + padding.right
+ property int verticalSize: Math.max(handleLoader.implicitHeight, grooveLoader.implicitHeight) + padding.top + padding.bottom
+
+ implicitWidth: horizontal ? horizontalSize : verticalSize
+ implicitHeight: horizontal ? verticalSize : horizontalSize
+
+ y: horizontal ? 0 : height
+ rotation: horizontal ? 0 : -90
+ transformOrigin: Item.TopLeft
+
+ Item {
+
+ anchors.fill: parent
+
+ Loader {
+ id: grooveLoader
+ property QtObject styleData: QtObject {
+ readonly property int handlePosition: handleLoader.x + handleLoader.width/2
+ }
+ x: padding.left
+ sourceComponent: groove
+ width: (horizontal ? parent.width : parent.height) - padding.left - padding.right
+ y: Math.round(padding.top + (Math.round(horizontal ? parent.height : parent.width - padding.top - padding.bottom) - grooveLoader.item.height)/2)
+ }
+ Loader {
+ id: tickMarkLoader
+ anchors.fill: parent
+ sourceComponent: control.tickmarksEnabled ? tickmarks : null
+ property QtObject styleData: QtObject { readonly property int handleWidth: control.__panel.handleWidth }
+ }
+ Loader {
+ id: handleLoader
+ sourceComponent: handle
+ anchors.verticalCenter: grooveLoader.verticalCenter
+ x: Math.round((control.__handlePos - control.minimumValue) / (control.maximumValue - control.minimumValue) * ((horizontal ? root.width : root.height) - item.width))
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml
new file mode 100644
index 0000000000..9f1b565d32
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype SpinBoxStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.2
+ \ingroup controlsstyling
+ \brief Provides custom styling for SpinBox
+
+ Example:
+ \qml
+ SpinBox {
+ style: SpinBoxStyle{
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 20
+ border.color: "gray"
+ radius: 2
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+ id: spinboxStyle
+
+ /*! The \l SpinBox attached to this style. */
+ readonly property SpinBox control: __control
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ /*! The content margins of the text field. */
+ padding { top: 1 ; left: Math.round(TextSingleton.implicitHeight/2) ; right: Math.round(TextSingleton.implicitHeight) ; bottom: 0 }
+
+ /*! \qmlproperty enumeration horizontalAlignment
+
+ This property defines the default text aligment.
+
+ The supported values are:
+ \list
+ \li Qt.AlignLeft
+ \li Qt.AlignHCenter
+ \li Qt.AlignRight
+ \endlist
+
+ The default value is Qt.AlignRight
+ */
+ property int horizontalAlignment: Qt.AlignRight
+
+ /*! The text color. */
+ property color textColor: __syspal.text
+
+ /*! The text highlight color, used behind selections. */
+ property color selectionColor: __syspal.highlight
+
+ /*! The highlighted text color, used in selections. */
+ property color selectedTextColor: __syspal.highlightedText
+
+ /*!
+ \qmlproperty enumeration renderType
+
+ Override the default rendering type for the control.
+
+ Supported render types are:
+ \list
+ \li Text.QtRendering
+ \li Text.NativeRendering - the default
+ \endlist
+
+ \sa Text::renderType
+ */
+ property int renderType: Text.NativeRendering
+
+ /*! The button used to increment the value. */
+ property Component incrementControl: Item {
+ implicitWidth: padding.right
+ Image {
+ source: "images/arrow-up.png"
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 1
+ opacity: control.enabled ? (styleData.upPressed ? 1 : 0.6) : 0.5
+ }
+ }
+
+ /*! The button used to decrement the value. */
+ property Component decrementControl: Item {
+ implicitWidth: padding.right
+ Image {
+ source: "images/arrow-down.png"
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -2
+ opacity: control.enabled ? (styleData.downPressed ? 1 : 0.6) : 0.5
+ }
+ }
+
+ /*! The background of the SpinBox. */
+ property Component background: Item {
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ implicitWidth: styleData.contentWidth + 26
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: "#eee" ; position: 0}
+ GradientStop {color: "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ id: styleitem
+ implicitWidth: backgroundLoader.implicitWidth
+ implicitHeight: backgroundLoader.implicitHeight
+
+ property color foregroundColor: spinboxStyle.textColor
+ property color selectionColor: spinboxStyle.selectionColor
+ property color selectedTextColor: spinboxStyle.selectedTextColor
+
+ property var margins: spinboxStyle.padding
+
+ property rect upRect: Qt.rect(width - incrementControlLoader.implicitWidth, 0, incrementControlLoader.implicitWidth, height / 2 + 1)
+ property rect downRect: Qt.rect(width - decrementControlLoader.implicitWidth, height / 2, decrementControlLoader.implicitWidth, height / 2)
+
+ property int horizontalAlignment: spinboxStyle.horizontalAlignment
+ property int verticalAlignment: Qt.AlignVCenter
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ }
+
+ Loader {
+ id: incrementControlLoader
+ x: upRect.x
+ y: upRect.y
+ width: upRect.width
+ height: upRect.height
+ sourceComponent: incrementControl
+ }
+
+ Loader {
+ id: decrementControlLoader
+ x: downRect.x
+ y: downRect.y
+ width: downRect.width
+ height: downRect.height
+ sourceComponent: decrementControl
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/StatusBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/StatusBarStyle.qml
new file mode 100644
index 0000000000..aa8f6d6e9f
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/StatusBarStyle.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StatusBarStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \ingroup controlsstyling
+ \since 5.2
+ \brief Provides custom styling for StatusBar
+
+ The status bar can be defined by overriding the background component and
+ setting the content padding.
+
+ Example:
+ \qml
+ StatusBar {
+ style: StatusBarStyle {
+ padding {
+ left: 8
+ right: 8
+ top: 3
+ bottom: 3
+ }
+ background: Rectangle {
+ implicitHeight: 16
+ implicitWidth: 200
+ gradient: Gradient{
+ GradientStop{color: "#eee" ; position: 0}
+ GradientStop{color: "#ccc" ; position: 1}
+ }
+ Rectangle {
+ anchors.top: parent.top
+ width: parent.width
+ height: 1
+ color: "#999"
+ }
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+
+ /*! The content padding inside the status bar. */
+ padding {
+ left: 3
+ right: 3
+ top: 3
+ bottom: 2
+ }
+
+ /*! This defines the background of the tool bar. */
+ property Component background: Rectangle {
+ implicitHeight: 16
+ implicitWidth: 200
+
+ gradient: Gradient{
+ GradientStop{color: "#eee" ; position: 0}
+ GradientStop{color: "#ccc" ; position: 1}
+ }
+
+ Rectangle {
+ anchors.top: parent.top
+ width: parent.width
+ height: 1
+ color: "#999"
+ }
+ }
+
+ property Component panel: Loader {
+ sourceComponent: background
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SwitchStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SwitchStyle.qml
new file mode 100644
index 0000000000..687966453e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SwitchStyle.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype SwitchStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.2
+ \ingroup controlsstyling
+ \brief Provides custom styling for Switch
+
+ Example:
+ \qml
+ Switch {
+ style: SwitchStyle {
+ groove: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 20
+ radius: 9
+ border.color: control.activeFocus ? "darkblue" : "gray"
+ border.width: 1
+ }
+ }
+ }
+ \endqml
+*/
+Style {
+ id: switchstyle
+
+ /*! The content padding. */
+ padding {
+ top: 0
+ left: 0
+ right: 0
+ bottom: 0
+ }
+
+ /*! This defines the switch handle. */
+ property Component handle: Rectangle {
+ opacity: control.enabled ? 1.0 : 0.5
+ implicitWidth: Math.round((parent.parent.width - padding.left - padding.right)/2)
+ implicitHeight: control.height - padding.top - padding.bottom
+
+ border.color: control.activeFocus ? Qt.darker(__syspal.highlight, 2) : Qt.darker(__syspal.button, 2)
+ property color bg: control.activeFocus ? Qt.darker(__syspal.highlight, 1.2) : __syspal.button
+ gradient: Gradient {
+ GradientStop {color: Qt.lighter(bg, 1.4) ; position: 0}
+ GradientStop {color: bg ; position: 1}
+ }
+
+ radius: 2
+ }
+
+ /*! This property holds the background groove of the switch. */
+ property Component groove: Rectangle {
+ property color shadow: control.checked ? Qt.darker(__syspal.highlight, 1.2): "#999"
+ property color bg: control.checked ? __syspal.highlight:"#bbb"
+
+ implicitWidth: Math.round(implicitHeight * 3)
+ implicitHeight: Math.max(16, Math.round(TextSingleton.implicitHeight))
+
+ border.color: "gray"
+ color: "red"
+
+ radius: 2
+ Behavior on shadow {ColorAnimation{ duration: 80 }}
+ Behavior on bg {ColorAnimation{ duration: 80 }}
+ gradient: Gradient {
+ GradientStop {color: shadow; position: 0}
+ GradientStop {color: bg ; position: 0.2}
+ GradientStop {color: bg ; position: 1}
+ }
+ Rectangle {
+ color: "#44ffffff"
+ height: 1
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: -1
+ width: parent.width - 2
+ x: 1
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+
+ implicitWidth: Math.round(grooveLoader.width + padding.left + padding.right)
+ implicitHeight: grooveLoader.implicitHeight + padding.top + padding.bottom
+
+ property var __groove: grooveLoader
+ property var __handle: handleLoader
+ property bool enableAnimation: false
+
+ Loader {
+ id: grooveLoader
+ y: padding.top
+ x: padding.left
+
+ sourceComponent: groove
+ anchors.verticalCenter: parent.verticalCenter
+
+
+ Loader {
+ id: handleLoader
+
+ z:1
+ anchors.top: grooveLoader.top
+ anchors.bottom: grooveLoader.bottom
+ anchors.topMargin: padding.top
+ anchors.bottomMargin: padding.bottom
+
+ Behavior on x {
+ id: behavior
+ enabled: enableAnimation
+ NumberAnimation {
+ duration: 150
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ sourceComponent: handle
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TabViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TabViewStyle.qml
new file mode 100644
index 0000000000..430dd02fa4
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TabViewStyle.qml
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TabViewStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup viewsstyling
+ \brief Provides custom styling for TabView
+
+\qml
+ TabView {
+ id: frame
+ anchors.fill: parent
+ anchors.margins: 4
+ Tab { title: "Tab 1" }
+ Tab { title: "Tab 2" }
+ Tab { title: "Tab 3" }
+
+ style: TabViewStyle {
+ frameOverlap: 1
+ tab: Rectangle {
+ color: styleData.selected ? "steelblue" :"lightsteelblue"
+ border.color: "steelblue"
+ implicitWidth: Math.max(text.width + 4, 80)
+ implicitHeight: 20
+ radius: 2
+ Text {
+ id: text
+ anchors.centerIn: parent
+ text: styleData.title
+ color: styleData.selected ? "white" : "black"
+ }
+ }
+ frame: Rectangle { color: "steelblue" }
+ }
+ }
+\endqml
+
+*/
+
+Style {
+
+ /*! The \l ScrollView attached to this style. */
+ readonly property TabView control: __control
+
+ /*! This property holds whether the user can move the tabs.
+ Tabs are not movable by default. */
+ property bool tabsMovable: false
+
+ /*! This property holds the horizontal alignment of
+ the tab buttons. Supported values are:
+ \list
+ \li Qt.AlignLeft (default)
+ \li Qt.AlignHCenter
+ \li Qt.AlignRight
+ \endlist
+ */
+ property int tabsAlignment: Qt.AlignLeft
+
+ /*! This property holds the amount of overlap there are between
+ individual tab buttons. */
+ property int tabOverlap: 1
+
+ /*! This property holds the amount of overlap there are between
+ individual tab buttons and the frame. */
+ property int frameOverlap: 2
+
+ /*! This defines the tab frame. */
+ property Component frame: Rectangle {
+ color: "#dcdcdc"
+ border.color: "#aaa"
+
+ Rectangle {
+ anchors.fill: parent
+ color: "transparent"
+ border.color: "#66ffffff"
+ anchors.margins: 1
+ }
+ }
+
+ /*! This defines the tab. You can access the tab state through the
+ \c styleData property, with the following properties:
+
+ \table
+ \row \li readonly property int \b styleData.index \li This is the current tab index.
+ \row \li readonly property bool \b styleData.selected \li This is the active tab.
+ \row \li readonly property string \b styleData.title \li Tab title text.
+ \row \li readonly property bool \b styleData.nextSelected \li The next tab is selected.
+ \row \li readonly property bool \b styleData.previousSelected \li The previous tab is selected.
+ \row \li readonly property bool \b styleData.hovered \li The tab is being hovered.
+ \row \li readonly property bool \b styleData.activeFocus \li The tab button has keyboard focus.
+ \row \li readonly property bool \b styleData.availableWidth \li The available width for the tabs.
+ \endtable
+ */
+ property Component tab: Item {
+ scale: control.tabPosition === Qt.TopEdge ? 1 : -1
+
+ property int totalOverlap: tabOverlap * (control.count - 1)
+ property real maxTabWidth: (styleData.availableWidth + totalOverlap) / control.count
+
+ implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20))
+ implicitHeight: Math.round(textitem.implicitHeight + 10)
+
+ clip: true
+ Item {
+ anchors.fill: parent
+ anchors.bottomMargin: styleData.selected ? 0 : 2
+ clip: true
+ BorderImage {
+ anchors.fill: parent
+ source: styleData.selected ? "images/tab_selected.png" : "images/tab.png"
+ border.top: 6
+ border.bottom: 6
+ border.left: 6
+ border.right: 6
+ anchors.topMargin: styleData.selected ? 0 : 1
+ }
+ }
+ Rectangle {
+ anchors.fill: textitem
+ anchors.margins: -1
+ anchors.leftMargin: -3
+ anchors.rightMargin: -3
+ visible: (styleData.activeFocus && styleData.selected)
+ height: 6
+ radius: 3
+ color: "#224f9fef"
+ border.color: "#47b"
+ }
+ Text {
+ id: textitem
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ text: styleData.title
+ renderType: Text.NativeRendering
+ scale: control.tabPosition === Qt.TopEdge ? 1 : -1
+ color: __syspal.text
+ }
+ }
+
+ /*! This defines the left corner. */
+ property Component leftCorner: null
+
+ /*! This defines the right corner. */
+ property Component rightCorner: null
+
+ /*! This defines the tab bar background. */
+ property Component tabBar: null
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TableViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TableViewStyle.qml
new file mode 100644
index 0000000000..512b0cfef7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TableViewStyle.qml
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TableViewStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup viewsstyling
+ \brief Provides custom styling for TableView
+
+ Note that this class derives from \l ScrollViewStyle
+ and supports all of the properties defined there.
+*/
+ScrollViewStyle {
+ id: root
+
+ /*! The \l TableView attached to this style. */
+ readonly property TableView control: __control
+
+ /*! The text color. */
+ property color textColor: __syspal.text
+
+ /*! The background color. */
+ property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
+
+ /*! The alternate background color. */
+ property color alternateBackgroundColor: "#f5f5f5"
+
+ /*! The text highlight color, used within selections. */
+ property color highlightedTextColor: "white"
+
+ /*! Activates items on single click. */
+ property bool activateItemOnSingleClick: false
+
+ padding.top: control.headerVisible ? 0 : 1
+
+ /*! \qmlproperty Component TableViewStyle::headerDelegate
+ Delegate for header. This delegate is described in \l {TableView::headerDelegate}
+ */
+ property Component headerDelegate: BorderImage {
+ height: textItem.implicitHeight * 1.2
+ source: "images/header.png"
+ border.left: 4
+ border.bottom: 2
+ border.top: 2
+ Text {
+ id: textItem
+ anchors.fill: parent
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignLeft
+ anchors.leftMargin: 12
+ text: styleData.value
+ elide: Text.ElideRight
+ color: textColor
+ renderType: Text.NativeRendering
+ }
+ Rectangle {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 1
+ anchors.topMargin: 1
+ width: 1
+ color: "#ccc"
+ }
+ }
+
+ /*! \qmlproperty Component TableViewStyle::rowDelegate
+ Delegate for header. This delegate is described in \l {TableView::rowDelegate}
+ */
+ property Component rowDelegate: Rectangle {
+ height: Math.round(TextSingleton.implicitHeight * 1.2)
+ property color selectedColor: styleData.hasActiveFocus ? "#07c" : "#999"
+ color: styleData.selected ? selectedColor :
+ !styleData.alternate ? alternateBackgroundColor : backgroundColor
+ }
+
+ /*! \qmlproperty Component TableViewStyle::itemDelegate
+ Delegate for item. This delegate is described in \l {TableView::itemDelegate}
+ */
+ property Component itemDelegate: Item {
+ height: Math.max(16, label.implicitHeight)
+ property int implicitWidth: label.implicitWidth + 20
+
+ Text {
+ id: label
+ objectName: "label"
+ width: parent.width
+ anchors.leftMargin: 12
+ anchors.left: parent.left
+ anchors.right: parent.right
+ horizontalAlignment: styleData.textAlignment
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: 1
+ elide: styleData.elideMode
+ text: styleData.value !== undefined ? styleData.value : ""
+ color: styleData.textColor
+ renderType: Text.NativeRendering
+ }
+ }
+}
+
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextAreaStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextAreaStyle.qml
new file mode 100644
index 0000000000..c974c01dac
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextAreaStyle.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TextAreaStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.2
+ \ingroup controlsstyling
+ \brief Provides custom styling for TextArea.
+
+ Example:
+ \qml
+ TextArea {
+ style: TextAreaStyle {
+ textColor: "#333"
+ selectionColor: "steelblue"
+ selectedTextColor: "#eee"
+ backgroundColor: "#eee"
+ }
+ }
+ \endqml
+*/
+
+ScrollViewStyle {
+ id: style
+
+ /*! The \l TextArea attached to this style. */
+ readonly property TextArea control: __control
+
+ /*! The current font. */
+ property font font
+
+ /*! The text color. */
+ property color textColor: __syspal.text
+
+ /*! The text highlight color, used behind selections. */
+ property color selectionColor: __syspal.highlight
+
+ /*! The highlighted text color, used in selections. */
+ property color selectedTextColor: __syspal.highlightedText
+
+ /*! The background color. */
+ property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
+
+ /*!
+ \qmlproperty enumeration renderType
+
+ Override the default rendering type for the control.
+
+ Supported render types are:
+ \list
+ \li Text.QtRendering
+ \li Text.NativeRendering - the default
+ \endlist
+
+ \sa Text::renderType
+ */
+ property int renderType: Text.NativeRendering
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextFieldStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextFieldStyle.qml
new file mode 100644
index 0000000000..8b4494d186
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextFieldStyle.qml
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TextFieldStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for TextField.
+
+ Example:
+ \qml
+ TextField {
+ style: TextFieldStyle {
+ textColor: "black"
+ background: Rectangle {
+ radius: 2
+ implicitWidth: 100
+ implicitHeight: 24
+ border.color: "#333"
+ border.width: 1
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+ id: style
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l TextField attached to this style. */
+ readonly property TextField control: __control
+
+ /*! The content margins of the text field. */
+ padding { top: 4 ; left: TextSingleton.implicitHeight/3 ; right: TextSingleton.implicitHeight/3 ; bottom:4 }
+
+ /*! The current font. */
+ property font font
+
+ /*! The text color. */
+ property color textColor: __syspal.text
+
+ /*! The text highlight color, used behind selections. */
+ property color selectionColor: __syspal.highlight
+
+ /*! The highlighted text color, used in selections. */
+ property color selectedTextColor: __syspal.highlightedText
+
+ /*!
+ \qmlproperty enumeration renderType
+
+ Override the default rendering type for the control.
+
+ Supported render types are:
+ \list
+ \li Text.QtRendering
+ \li Text.NativeRendering - the default
+ \endlist
+
+ \sa Text::renderType
+ */
+ property int renderType: Text.NativeRendering
+
+ /*! The placeholder text color, used when the text field is empty.
+ \since 5.2
+ */
+ property color placeholderTextColor: Qt.rgba(0, 0, 0, 0.5)
+
+ /*! The background of the text field. */
+ property Component background: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 8)
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: "#e0e0e0" ; position: 0}
+ GradientStop {color: "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ anchors.fill: parent
+
+ property int topMargin: padding.top
+ property int leftMargin: padding.left
+ property int rightMargin: padding.right
+ property int bottomMargin: padding.bottom
+
+ property color textColor: style.textColor
+ property color selectionColor: style.selectionColor
+ property color selectedTextColor: style.selectedTextColor
+
+ implicitWidth: backgroundLoader.implicitWidth ? backgroundLoader.implicitWidth : 100
+ implicitHeight: backgroundLoader.implicitHeight ? backgroundLoader.implicitHeight : 20
+
+ property color placeholderTextColor: style.placeholderTextColor
+ property font font: style.font
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: background
+ anchors.fill: parent
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolBarStyle.qml
new file mode 100644
index 0000000000..ca5d93fbae
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolBarStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ToolBarStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \ingroup controlsstyling
+ \since 5.2
+ \brief Provides custom styling for ToolBar
+
+ The tool bar can be defined by overriding the background component and
+ setting the content padding.
+
+ Example:
+ \qml
+ ToolBar {
+ style: ToolBarStyle {
+ padding {
+ left: 8
+ right: 8
+ top: 3
+ bottom: 3
+ }
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ border.color: "#999"
+ gradient: Gradient {
+ GradientStop { position: 0 ; color: "#fff" }
+ GradientStop { position: 1 ; color: "#eee" }
+ }
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+
+ /*! The content padding inside the tool bar. */
+ padding {
+ left: 6
+ right: 6
+ top: 3
+ bottom: 3
+ }
+
+ /*! This defines the background of the tool bar. */
+ property Component background: Item {
+ implicitHeight: 40
+ implicitWidth: 200
+ Rectangle {
+ anchors.fill: parent
+ gradient: Gradient{
+ GradientStop{color: "#eee" ; position: 0}
+ GradientStop{color: "#ccc" ; position: 1}
+ }
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: parent.width
+ height: 1
+ color: "#999"
+ }
+ }
+ }
+
+ property Component panel: Loader {
+ sourceComponent: background
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml
new file mode 100644
index 0000000000..dcdfe4dee8
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ToolButtonStyle
+ \internal
+ \ingroup controlsstyling
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+Style {
+ readonly property ToolButton control: __control
+ property Component panel: Item {
+ id: styleitem
+ implicitWidth: (hasIcon ? 36 : Math.max(label.implicitWidth + frame.border.left + frame.border.right, 36))
+ + (arrow.visible ? 10 : 0)
+ implicitHeight: hasIcon ? 36 : Math.max(label.implicitHeight, 36)
+
+ readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
+
+ Rectangle {
+ anchors.fill: parent
+ visible: control.pressed || (control.checkable && control.checked)
+ color: "lightgray"
+ radius:4
+ border.color: "#aaa"
+ }
+ Item {
+ anchors.left: parent.left
+ anchors.right: arrow.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ clip: true
+ Text {
+ id: label
+ visible: !hasIcon
+ anchors.centerIn: parent
+ text: control.text
+ }
+ Image {
+ id: icon
+ anchors.centerIn: parent
+ source: control.iconSource
+ }
+ }
+
+ BorderImage {
+ id: frame
+ anchors.fill: parent
+ anchors.margins: -1
+ anchors.topMargin: -2
+ anchors.rightMargin: 0
+ source: "images/focusframe.png"
+ visible: control.activeFocus
+ border.left: 4
+ border.right: 4
+ border.top: 4
+ border.bottom: 4
+ }
+
+ Image {
+ id: arrow
+ visible: control.menu !== null
+ source: visible ? "images/arrow-down.png" : ""
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: visible ? 3 : 0
+ opacity: control.enabled ? 0.7 : 0.5
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml
new file mode 100644
index 0000000000..99f37919f9
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Controls.Styles 1.1
+
+BusyIndicatorStyle { }
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml
new file mode 100644
index 0000000000..33e8f0eeda
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property Component panel: StyleItem {
+ id: styleitem
+ elementType: "button"
+ sunken: control.pressed || (control.checkable && control.checked)
+ raised: !(control.pressed || (control.checkable && control.checked))
+ hover: control.hovered
+ text: control.iconSource === "" ? "" : control.text
+ hasFocus: control.activeFocus
+ hints: control.styleHints
+ // If no icon, let the style do the drawing
+ activeControl: control.isDefault ? "default" : "f"
+
+ properties: {
+ "icon": control.__iconAction.__icon,
+ "menu": control.menu
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml
new file mode 100644
index 0000000000..819c6a8198
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property Component panel: Item {
+ anchors.fill: parent
+
+ implicitWidth: styleitem.implicitWidth
+ implicitHeight: styleitem.implicitHeight
+ baselineOffset: styleitem.baselineOffset
+ StyleItem {
+ id: styleitem
+ elementType: "checkbox"
+ sunken: control.pressed
+ on: control.checked || control.pressed
+ hover: control.hovered
+ enabled: control.enabled
+ hasFocus: control.activeFocus && styleitem.style == "mac"
+ hints: control.styleHints
+ properties: {"partiallyChecked": (control.checkedState === Qt.PartiallyChecked) }
+ contentHeight: textitem.implicitHeight
+ contentWidth: textitem.implicitWidth + indicatorWidth
+ property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4)
+ property bool macStyle: (style === "mac")
+
+ Text {
+ id: textitem
+ text: control.text
+ anchors.left: parent.left
+ anchors.leftMargin: parent.indicatorWidth
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: parent.macStyle ? 1 : 0
+ anchors.right: parent.right
+ renderType: Text.NativeRendering
+ elide: Text.ElideRight
+ enabled: control.enabled
+ color: __syspal.windowText
+ StyleItem {
+ elementType: "focusrect"
+ anchors.margins: -1
+ anchors.leftMargin: -2
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ width: textitem.implicitWidth + 3
+ visible: control.activeFocus
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml
new file mode 100644
index 0000000000..b36b4c1ddc
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+import "." as Desktop
+
+Style {
+ readonly property ComboBox control: __control
+ property int drowDownButtonWidth: 24
+ property Component panel: Item {
+ property bool popup: !!styleItem.styleHint("comboboxpopup")
+
+ implicitWidth: 125
+ implicitHeight: styleItem.implicitHeight
+ baselineOffset: styleItem.baselineOffset
+ anchors.fill: parent
+ StyleItem {
+ id: styleItem
+
+ height: parent.height
+ width: parent.width
+ elementType: "combobox"
+ sunken: control.pressed
+ raised: !sunken
+ hover: control.hovered
+ enabled: control.enabled
+ // The style makes sure the text rendering won't overlap the decoration.
+ // In that case, 35 pixels margin in this case looks good enough. Worst
+ // case, the ellipsis will be truncated (2nd worst, not visible at all).
+ text: elidedText(control.currentText, Text.ElideRight, parent.width - 35)
+ hasFocus: control.activeFocus
+ // contentHeight as in QComboBox
+ contentHeight: Math.max(Math.ceil(textHeight("")), 14) + 2
+
+ hints: control.styleHints
+ properties: {
+ "popup": control.__popup,
+ "editable" : control.editable
+ }
+ }
+ }
+
+ property Component __popupStyle: MenuStyle {
+ __menuItemType: "comboboxitem"
+ }
+
+ property Component __dropDownStyle: Style {
+ property Component frame: StyleItem {
+ elementType: "frame"
+
+ width: (parent ? parent.contentWidth : 0)
+ height: (parent ? parent.contentHeight : 0) + 2 * pixelMetric("defaultframewidth")
+ property real maxHeight: 600
+ property int margin: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth")
+ }
+
+ property Component menuItem: StyleItem {
+ elementType: "itemrow"
+ selected: parent ? parent.selected : false
+
+ x: pixelMetric("defaultframewidth")
+ y: pixelMetric("defaultframewidth")
+
+ implicitWidth: textItem.contentWidth
+ implicitHeight: textItem.contentHeight
+
+ StyleItem {
+ id: textItem
+ elementType: "item"
+ contentWidth: textWidth(text)
+ contentHeight: textHeight(text)
+ text: parent && parent.parent ? parent.parent.text : ""
+ selected: parent ? parent.selected : false
+ }
+ }
+
+ property Component scrollerStyle: Desktop.ScrollViewStyle {
+ property bool useScrollers: false
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml
new file mode 100644
index 0000000000..0bea860eee
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype FocusFrameStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+StyleItem {
+ property int margin: -3
+ anchors.fill: parent
+ elementType: "focusframe"
+}
+
+
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml
new file mode 100644
index 0000000000..cfe02d3f17
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+
+Style {
+ readonly property GroupBox control: __control
+
+ property var __style: StyleItem { id: style }
+ property int titleHeight: 18
+
+ Component.onCompleted: {
+ var stylename = __style.style
+ if (stylename.indexOf("windows") > -1)
+ titleHeight = 9
+ }
+
+ padding {
+ top: Math.round(Settings.dpiScaleFactor * (control.title.length > 0 || control.checkable ? titleHeight : 0) + (style.style == "mac" ? 9 : 6))
+ left: Math.round(Settings.dpiScaleFactor * 8)
+ right: Math.round(Settings.dpiScaleFactor * 8)
+ bottom: Math.round(Settings.dpiScaleFactor * 7 + (style.style.indexOf("windows") > -1 ? 2 : 0))
+ }
+
+ property Component panel: StyleItem {
+ anchors.fill: parent
+ id: styleitem
+ elementType: "groupbox"
+ text: control.title
+ on: control.checked
+ hasFocus: control.__checkbox.activeFocus
+ activeControl: control.checkable ? "checkbox" : ""
+ properties: { "checkable" : control.checkable , "sunken" : !control.flat}
+ textureHeight: 128
+ border {top: 32 ; bottom: 8}
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml
new file mode 100644
index 0000000000..a8b389c1a7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+
+Style {
+ property Component frame: StyleItem {
+ elementType: "menubar"
+ contentWidth: control.__contentItem.width
+ contentHeight: parent ? parent.contentHeight : 0
+ width: implicitWidth + 2 * (pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth"))
+ height: implicitHeight + 2 * (pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth"))
+ + pixelMetric("spacebelowmenubar")
+
+ Accessible.role: Accessible.MenuBar
+ }
+
+ property Component menuItem: StyleItem {
+ elementType: "menubaritem"
+ x: pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth")
+ y: pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth")
+
+ text: menuItem.title
+ contentWidth: textWidth(text)
+ contentHeight: textHeight(text)
+ width: implicitWidth + pixelMetric("menubaritemspacing")
+
+ enabled: menuItem.enabled
+ selected: (parent && parent.selected) || sunken
+ sunken: parent && parent.sunken
+
+ hints: { "showUnderlined": showUnderlined }
+
+ Accessible.role: Accessible.MenuItem
+ Accessible.name: StyleHelpers.removeMnemonics(text)
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuStyle.qml
new file mode 100644
index 0000000000..ad04281de8
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuStyle.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ id: styleRoot
+
+ property string __menuItemType: "menuitem"
+
+ property Component frame: StyleItem {
+ elementType: "menu"
+
+ contentWidth: parent ? parent.contentWidth : 0
+ contentHeight: parent ? parent.contentHeight : 0
+ width: implicitWidth
+ height: implicitHeight
+
+ property int subMenuOverlap: -2 * pixelMetric("menupanelwidth")
+ property real maxHeight: Screen.desktopAvailableHeight * 0.99
+ property int margin: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth")
+
+ Rectangle {
+ visible: anchors.margins > 0
+ anchors {
+ fill: parent
+ margins: pixelMetric("menupanelwidth")
+ }
+ color: __syspal.window
+ }
+
+ Accessible.role: Accessible.PopupMenu
+ }
+
+ property Component menuItem: StyleItem {
+ elementType: __menuItemType
+ x: pixelMetric("menuhmargin") + pixelMetric("menupanelwidth")
+ y: pixelMetric("menuvmargin")
+
+ text: !!parent && parent.text
+ property string textAndShorcut: text + (properties.shortcut ? "\t" + properties.shortcut : "")
+ contentWidth: textWidth(textAndShorcut)
+ contentHeight: textHeight(textAndShorcut)
+
+ enabled: !!parent && parent.enabled
+ selected: !!parent && parent.selected
+ on: !!menuItem && !!menuItem["checkable"] && menuItem.checked
+
+ hints: { "showUnderlined": showUnderlined }
+
+ properties: {
+ "checkable": !!menuItem && !!menuItem["checkable"],
+ "exclusive": !!menuItem && !!menuItem["exclusiveGroup"],
+ "shortcut": !!menuItem && menuItem["shortcut"] || "",
+ "isSubmenu": isSubmenu,
+ "scrollerDirection": scrollerDirection,
+ "icon": !!menuItem && menuItem.__icon
+ }
+
+ Accessible.role: Accessible.MenuItem
+ Accessible.name: StyleHelpers.removeMnemonics(text)
+ }
+
+ property Component scrollerStyle: Style {
+ padding { left: 0; right: 0; top: 0; bottom: 0 }
+ property bool scrollToClickedPosition: false
+ property Component frame: Item { visible: false }
+ property Component corner: Item { visible: false }
+ property Component __scrollbar: Item { visible: false }
+ property bool useScrollers: true
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml
new file mode 100644
index 0000000000..70fa040247
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property Component panel: StyleItem {
+ anchors.fill: parent
+ elementType: "progressbar"
+ // XXX: since desktop uses int instead of real, the progressbar
+ // range [0..1] must be stretched to a good precision
+ property int factor : 1000
+ property int decimals: 3
+ value: indeterminate ? 0 : control.value.toFixed(decimals) * factor // does indeterminate value need to be 1 on windows?
+ minimum: indeterminate ? 0 : control.minimumValue.toFixed(decimals) * factor
+ maximum: indeterminate ? 0 : control.maximumValue.toFixed(decimals) * factor
+ enabled: control.enabled
+ horizontal: control.orientation === Qt.Horizontal
+ hints: control.styleHints
+ contentWidth: horizontal ? 200 : 23
+ contentHeight: horizontal ? 23 : 200
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml
new file mode 100644
index 0000000000..4a00ee22a6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ readonly property RadioButton control: __control
+ property Component panel: Item {
+ anchors.fill: parent
+
+ implicitWidth: styleitem.implicitWidth
+ implicitHeight: styleitem.implicitHeight
+ baselineOffset: styleitem.baselineOffset
+
+ StyleItem {
+ id: styleitem
+ elementType: "radiobutton"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: macStyle ? -1 : 0
+ sunken: control.pressed
+ on: control.checked || control.pressed
+ hover: control.hovered
+ enabled: control.enabled
+ hasFocus: control.activeFocus && styleitem.style == "mac"
+ hints: control.styleHints
+ contentHeight: textitem.implicitHeight
+ contentWidth: textitem.implicitWidth + indicatorWidth
+ property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4)
+ property bool macStyle: (style === "mac")
+
+ Text {
+ id: textitem
+ text: control.text
+ anchors.left: parent.left
+ anchors.leftMargin: parent.indicatorWidth
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: parent.macStyle ? 2 : 0
+ anchors.right: parent.right
+ renderType: Text.NativeRendering
+ elide: Text.ElideRight
+ enabled: control.enabled
+ color: __syspal.windowText
+ StyleItem {
+ elementType: "focusrect"
+ anchors.margins: -1
+ anchors.leftMargin: -2
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ width: textitem.implicitWidth + 3
+ visible: control.activeFocus
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml
new file mode 100644
index 0000000000..b78fc04335
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick.Controls.Private 1.0
+StyleItem {
+ elementType: "itemrow"
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml
new file mode 100644
index 0000000000..22c2844164
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ id: root
+
+ padding {
+ property int frameWidth: __styleitem.pixelMetric("defaultframewidth")
+ left: frameWidth
+ top: frameWidth
+ bottom: frameWidth
+ right: frameWidth
+ }
+
+ property StyleItem __styleitem: StyleItem { elementType: "frame" }
+
+ property Component frame: StyleItem {
+ id: styleitem
+ elementType: "frame"
+ sunken: true
+ visible: control.frameVisible
+ textureHeight: 64
+ textureWidth: 64
+ border {
+ top: 16
+ left: 16
+ right: 16
+ bottom: 16
+ }
+ }
+
+ property Component corner: StyleItem { elementType: "scrollareacorner" }
+
+ readonly property bool __externalScrollBars: __styleitem.styleHint("externalScrollBars")
+ readonly property int __scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing")
+ readonly property bool scrollToClickedPosition: __styleitem.styleHint("scrollToClickPosition") !== 0
+
+ property Component __scrollbar: StyleItem {
+ anchors.fill:parent
+ elementType: "scrollbar"
+ hover: activeControl != "none"
+ activeControl: "none"
+ sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed
+ minimum: __control.minimumValue
+ maximum: __control.maximumValue
+ value: __control.value
+ horizontal: __styleData.horizontal
+ enabled: __control.enabled
+
+ implicitWidth: horizontal ? 200 : pixelMetric("scrollbarExtent")
+ implicitHeight: horizontal ? pixelMetric("scrollbarExtent") : 200
+ }
+
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SliderStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SliderStyle.qml
new file mode 100644
index 0000000000..fd426e35b7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SliderStyle.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ readonly property Item control: __control
+ property Component panel: StyleItem {
+ elementType: "slider"
+ sunken: control.pressed
+ implicitWidth: 200
+ contentHeight: horizontal ? 22 : 200
+ contentWidth: horizontal ? 200 : 22
+
+ maximum: control.maximumValue*100
+ minimum: control.minimumValue*100
+ step: control.stepSize*100
+ value: control.__handlePos*100
+ horizontal: control.orientation === Qt.Horizontal
+ enabled: control.enabled
+ hasFocus: control.activeFocus
+ hints: control.styleHints
+ activeControl: control.tickmarksEnabled ? "ticks" : ""
+ property int handleWidth: 15
+ property int handleHeight: 15
+ }
+ padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml
new file mode 100644
index 0000000000..5cf13ea8fa
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ readonly property SpinBox control: __control
+
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ padding {
+ top: control.__panel ? control.__panel.topPadding + (styleitem.style === "mac" ? 2 : 0) : 0
+ left: control.__panel ? control.__panel.leftPadding : 0
+ right: control.__panel ? control.__panel.rightPadding : 0
+ bottom: control.__panel ? control.__panel.bottomPadding : 0
+ }
+ StyleItem {id: styleitem ; visible: false}
+
+ property int renderType: Text.NativeRendering
+
+ property Component panel: Item {
+ id: style
+
+ property rect upRect
+ property rect downRect
+
+ property int horizontalAlignment: Qt.platform.os === "osx" ? Qt.AlignRight : Qt.AlignLeft
+ property int verticalAlignment: Qt.AlignVCenter
+
+ property color foregroundColor: __syspal.text
+ property color backgroundColor: __syspal.base
+ property color selectionColor: __syspal.highlight
+ property color selectedTextColor: __syspal.highlightedText
+
+ property int topPadding: edit.anchors.topMargin
+ property int leftPadding: 3 + edit.anchors.leftMargin
+ property int rightPadding: 3 + edit.anchors.rightMargin
+ property int bottomPadding: edit.anchors.bottomMargin
+
+ width: 100
+ height: styleitem.implicitHeight
+
+ implicitWidth: 2 + styleitem.implicitWidth
+ implicitHeight: styleitem.implicitHeight
+ baselineOffset: styleitem.baselineOffset
+
+ Item {
+ id: edit
+ anchors.fill: parent
+ Rectangle {
+ color: "white"
+ anchors.fill: parent
+ anchors.margins: -1
+ }
+ FocusFrame {
+ anchors.fill: parent
+ focusMargin:-6
+ visible: spinbox.activeFocus && styleitem.styleHint("focuswidget")
+ }
+ }
+
+ function updateRect() {
+ style.upRect = styleitem.subControlRect("up");
+ style.downRect = styleitem.subControlRect("down");
+ var inputRect = styleitem.subControlRect("edit");
+ edit.anchors.topMargin = inputRect.y
+ edit.anchors.leftMargin = inputRect.x
+ edit.anchors.rightMargin = style.width - inputRect.width - edit.anchors.leftMargin
+ edit.anchors.bottomMargin = style.height - inputRect.height - edit.anchors.topMargin
+ }
+
+ Component.onCompleted: updateRect()
+ onWidthChanged: updateRect()
+ onHeightChanged: updateRect()
+
+ StyleItem {
+ id: styleitem
+ elementType: "spinbox"
+ anchors.fill: parent
+ sunken: (styleData.downEnabled && styleData.downPressed) || (styleData.upEnabled && styleData.upPressed)
+ hover: control.hovered
+ hints: control.styleHints
+ hasFocus: control.activeFocus
+ enabled: control.enabled
+ value: (styleData.upPressed ? 1 : 0) |
+ (styleData.downPressed ? 1<<1 : 0) |
+ (styleData.upEnabled ? (1<<2) : 0) |
+ (styleData.downEnabled ? (1<<3) : 0)
+ contentWidth: styleData.contentWidth
+ contentHeight: styleData.contentHeight
+ textureHeight: implicitHeight
+ border {top: 6 ; bottom: 6}
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml
new file mode 100644
index 0000000000..1a1c687ea4
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StatusBarStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+Style {
+
+ padding.left: 4
+ padding.right: 4
+ padding.top: 3
+ padding.bottom: 2
+
+ property Component panel: StyleItem {
+ implicitHeight: 16
+ implicitWidth: 200
+ anchors.fill: parent
+ elementType: "statusbar"
+ textureWidth: 64
+ border {left: 16 ; right: 16}
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml
new file mode 100644
index 0000000000..df9dd5bf96
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+
+SwitchStyle {
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml
new file mode 100644
index 0000000000..cf61a4d16e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+Style {
+ id: root
+
+ property bool tabsMovable: false
+ property int tabsAlignment: __barstyle.styleHint("tabbaralignment") === "center" ? Qt.AlignHCenter : Qt.AlignLeft;
+ property int tabOverlap: __barstyle.pixelMetric("taboverlap");
+ property int frameOverlap: __barstyle.pixelMetric("tabbaseoverlap");
+
+ property StyleItem __barstyle: StyleItem {
+ elementType: "tab"
+ properties: { "tabposition" : (control.tabPosition === Qt.TopEdge ? "Top" : "Bottom") }
+ visible: false
+ }
+
+ property Component frame: StyleItem {
+ id: styleitem
+ anchors.fill: parent
+ anchors.topMargin: 1//stack.baseOverlap
+ z: style == "oxygen" ? 1 : 0
+ elementType: "tabframe"
+ value: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).x : 0
+ minimum: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).width : 0
+ maximum: tabbarItem && tabsVisible ? tabbarItem.width : width
+ properties: { "selectedTabRect" : tabbarItem.__selectedTabRect, "orientation" : control.tabPosition }
+ hints: control.styleHints
+ Component.onCompleted: {
+ stack.frameWidth = styleitem.pixelMetric("defaultframewidth");
+ stack.style = style;
+ }
+ border{
+ top: 16
+ bottom: 16
+ }
+ textureHeight: 64
+ }
+
+ property Component tab: Item {
+ id: item
+ property string tabpos: control.count === 1 ? "only" : index === 0 ? "beginning" : index === control.count - 1 ? "end" : "middle"
+ property string selectedpos: styleData.nextSelected ? "next" : styleData.previousSelected ? "previous" : ""
+ property string orientation: control.tabPosition === Qt.TopEdge ? "Top" : "Bottom"
+ property int tabHSpace: __barstyle.pixelMetric("tabhspace");
+ property int tabVSpace: __barstyle.pixelMetric("tabvspace");
+ property int totalOverlap: tabOverlap * (control.count - 1)
+ property real maxTabWidth: (control.width + totalOverlap) / control.count
+ implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(styleData.title)) + tabHSpace + 2)
+ implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0)
+
+ StyleItem {
+ id: styleitem
+
+ elementType: "tab"
+ paintMargins: style === "mac" ? 0 : 2
+
+ anchors.fill: parent
+ anchors.topMargin: style === "mac" ? 2 : 0
+ anchors.rightMargin: -paintMargins
+ anchors.bottomMargin: -1
+ anchors.leftMargin: -paintMargins + (style === "mac" && selected ? -1 : 0)
+ properties: { "hasFrame" : true, "orientation": orientation, "tabpos": tabpos, "selectedpos": selectedpos }
+ hints: control.styleHints
+
+ selected: styleData.selected
+ text: elidedText(styleData.title, tabbarItem.elide, item.width - item.tabHSpace)
+ hover: styleData.hovered
+ hasFocus: tabbarItem.activeFocus && selected
+ }
+ }
+
+ property Component leftCorner: null
+ property Component rightCorner: null
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml
new file mode 100644
index 0000000000..88611ab5c7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import "."
+
+ScrollViewStyle {
+ id: root
+
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ readonly property TableView control: __control
+ property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick")
+ property color textColor: __styleitem.textColor
+ property color backgroundColor: __syspal.base
+ property color highlightedTextColor: __styleitem.highlightedTextColor
+
+ property StyleItem __styleitem: StyleItem{
+ property color textColor: styleHint("textColor")
+ property color highlightedTextColor: styleHint("highlightedTextColor")
+ elementType: "item"
+ visible: false
+ active: control.activeFocus
+ onActiveChanged: {
+ highlightedTextColor = styleHint("highlightedTextColor")
+ textColor = styleHint("textColor")
+ }
+ }
+
+ property Component headerDelegate: StyleItem {
+ elementType: "header"
+ activeControl: itemSort
+ raised: true
+ sunken: styleData.pressed
+ text: styleData.value
+ hover: styleData.containsMouse
+ hints: control.styleHints
+ properties: {"headerpos": headerPosition}
+ property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : "";
+ property string headerPosition: control.columnCount === 1 ? "only" :
+ styleData.column === control.columnCount-1 ? "end" :
+ styleData.column === 0 ? "beginning" : ""
+ }
+
+ property Component rowDelegate: BorderImage {
+ visible: styleData.selected || styleData.alternate
+ source: "image://__tablerow/" + (styleData.alternate ? "alternate_" : "")
+ + (styleData.selected ? "selected_" : "")
+ + (styleData.hasActiveFocus ? "active" : "")
+ height: Math.max(16, RowItemSingleton.implicitHeight)
+ border.left: 4 ; border.right: 4
+ }
+
+ property Component itemDelegate: Item {
+ height: Math.max(16, label.implicitHeight)
+ property int implicitWidth: label.implicitWidth + 16
+
+ Text {
+ id: label
+ objectName: "label"
+ width: parent.width
+ anchors.leftMargin: 8
+ font: __styleitem.font
+ anchors.left: parent.left
+ anchors.right: parent.right
+ horizontalAlignment: styleData.textAlignment
+ anchors.verticalCenter: parent.verticalCenter
+ elide: styleData.elideMode
+ text: styleData.value !== undefined ? styleData.value : ""
+ color: styleData.textColor
+ renderType: Text.NativeRendering
+ }
+ }
+}
+
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml
new file mode 100644
index 0000000000..3f2904a350
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+ScrollViewStyle {
+ property font font: __styleitem.font
+ property color textColor: __styleitem.textColor
+ property color selectionColor: __syspal.highlight
+ property color selectedTextColor: __syspal.highlightedText
+ property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
+
+ property StyleItem __styleitem: StyleItem{
+ property color textColor: styleHint("textColor")
+ elementType: "edit"
+ visible: false
+ active: control.activeFocus
+ onActiveChanged: textColor = styleHint("textColor")
+ }
+
+ property int renderType: Text.NativeRendering
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml
new file mode 100644
index 0000000000..0ca0d743d6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property int renderType: Text.NativeRendering
+
+ property Component panel: StyleItem {
+ id: textfieldstyle
+ elementType: "edit"
+ anchors.fill: parent
+
+ sunken: true
+ hasFocus: control.activeFocus
+ hover: hovered
+ hints: control.styleHints
+
+ SystemPalette {
+ id: syspal
+ colorGroup: control.enabled ?
+ SystemPalette.Active :
+ SystemPalette.Disabled
+ }
+
+ property color textColor: syspal.text
+ property color placeholderTextColor: "darkGray"
+ property color selectionColor: syspal.highlight
+ property color selectedTextColor: syspal.highlightedText
+
+
+ property bool rounded: !!hints["rounded"]
+ property int topMargin: style === "mac" ? 3 : 2
+ property int leftMargin: rounded ? 12 : 4
+ property int rightMargin: leftMargin
+ property int bottomMargin: 2
+
+ contentWidth: 100
+ // Form QLineEdit::sizeHint
+ contentHeight: Math.max(control.__contentHeight, 16)
+
+ FocusFrame {
+ anchors.fill: parent
+ visible: textfield.activeFocus && textfieldstyle.styleHint("focuswidget") && !rounded
+ }
+ textureHeight: implicitHeight
+ textureWidth: 32
+ border {top: 8 ; bottom: 8 ; left: 8 ; right: 8}
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml
new file mode 100644
index 0000000000..4f4b451e10
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StatusBarStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+Style {
+
+ padding.left: 6
+ padding.right: 6
+ padding.top: 1
+ padding.bottom: style.style === "mac" ? 1 : style.style === "fusion" ? 3 : 2
+
+ StyleItem { id: style ; visible: false}
+
+ property Component panel: StyleItem {
+ id: toolbar
+ anchors.fill: parent
+ elementType: "toolbar"
+ textureWidth: 64
+ border {left: 16 ; right: 16}
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml
new file mode 100644
index 0000000000..d690a5775e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property Component panel: StyleItem {
+ id: styleitem
+
+ anchors.fill: parent
+ elementType: "toolbutton"
+ on: control.checkable && control.checked
+ sunken: control.pressed
+ raised: !(control.checkable && control.checked) && control.hovered
+ hover: control.hovered
+ hasFocus: control.activeFocus
+ hints: control.styleHints
+ text: control.text
+
+ properties: {
+ "icon": control.__iconAction.__icon,
+ "position": control.__position,
+ "menu" : control.menu !== null
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/qmldir b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/qmldir
new file mode 100644
index 0000000000..ac80635cc2
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/qmldir
@@ -0,0 +1,2 @@
+singleton RowItemSingleton 1.0 RowItemSingleton.qml
+
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/qmldir b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/qmldir
new file mode 100644
index 0000000000..5cd368ac88
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/qmldir
@@ -0,0 +1,17 @@
+module QtQuick.Controls.Styles
+ButtonStyle 1.0 Base/ButtonStyle.qml
+BusyIndicatorStyle 1.1 Base/BusyIndicatorStyle.qml
+CheckBoxStyle 1.0 Base/CheckBoxStyle.qml
+ComboBoxStyle 1.0 Base/ComboBoxStyle.qml
+ProgressBarStyle 1.0 Base/ProgressBarStyle.qml
+RadioButtonStyle 1.0 Base/RadioButtonStyle.qml
+ScrollViewStyle 1.0 Base/ScrollViewStyle.qml
+SliderStyle 1.0 Base/SliderStyle.qml
+SpinBoxStyle 1.1 Base/SpinBoxStyle.qml
+SwitchStyle 1.1 Base/SwitchStyle.qml
+TabViewStyle 1.0 Base/TabViewStyle.qml
+TableViewStyle 1.0 Base/TableViewStyle.qml
+TextAreaStyle 1.1 Base/TextAreaStyle.qml
+TextFieldStyle 1.0 Base/TextFieldStyle.qml
+ToolBarStyle 1.0 Base/ToolBarStyle.qml
+StatusBarStyle 1.0 Base/StatusBarStyle.qml
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Switch.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Switch.qml
new file mode 100644
index 0000000000..bed46a8449
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Switch.qml
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Switch
+ \inqmlmodule QtQuick.Controls
+ \since 5.2
+ \ingroup controls
+ \brief A switch.
+
+ A Switch is an option button that can be switched on (checked) or off
+ (unchecked). Switches are typically used to represent features in an
+ application that can be enabled or disabled without affecting others.
+
+ On mobile platforms, switches are commonly used to enable or disable
+ features.
+
+ \qml
+ Column {
+ Switch { checked: true }
+ Switch { checked: false }
+ }
+ \endqml
+
+ You can create a custom appearance for a Switch by
+ assigning a \l {QtQuick.Controls.Styles::SwitchStyle}{SwitchStyle}.
+*/
+
+Control {
+ id: root
+
+ /*!
+ This property is \c true if the control is checked.
+ The default value is \c false.
+ */
+ property bool checked: false
+
+ /*!
+ This property is \c true if the control takes the focus when it is
+ pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be
+ called on the control.
+ */
+ property bool activeFocusOnPress: false
+
+ /*!
+ This property stores the ExclusiveGroup that the control belongs to.
+ */
+ property ExclusiveGroup exclusiveGroup: null
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat)
+ checked = !checked;
+ }
+
+ /*! \internal */
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup)
+ exclusiveGroup.bindCheckable(root)
+ }
+
+ MouseArea {
+ id: internal
+
+ property Item handle: __panel ? __panel.__handle : null
+ property int min: __style ? __style.padding.left : 0
+ property int max: handle.parent.width - (handle ? handle.width : 0) -
+ ( __style ? __style.padding.right : 0)
+ focus: true
+ anchors.fill: parent
+ drag.threshold: 0
+ drag.target: handle
+ drag.axis: Drag.XAxis
+ drag.minimumX: min
+ drag.maximumX: max
+
+ onPressed: {
+ if (activeFocusOnPress)
+ root.forceActiveFocus()
+ }
+
+ onReleased: {
+ if (drag.active) {
+ checked = (handle.x < max/2) ? false : true;
+ internal.handle.x = checked ? internal.max : internal.min
+ } else {
+ checked = (handle.x === max) ? false : true
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ internal.handle.x = checked ? internal.max : internal.min
+ __panel.enableAnimation = true
+ }
+
+ onCheckedChanged: {
+ if (internal.handle)
+ internal.handle.x = checked ? internal.max : internal.min
+ }
+
+ activeFocusOnTab: true
+ Accessible.role: Accessible.CheckBox
+ Accessible.name: "switch"
+
+ /*!
+ The style that should be applied to the switch. Custom style
+ components can be created with:
+
+ \codeline Qt.createComponent("path/to/style.qml", switchId);
+ */
+ style: Qt.createComponent(Settings.style + "/SwitchStyle.qml", root)
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Tab.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Tab.qml
new file mode 100644
index 0000000000..cfd757c972
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Tab.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+/*!
+ \qmltype Tab
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup viewaddons
+ \brief Tab represents the content of a tab in a TabView.
+
+ A Tab item inherits from Loader and provides a similar
+ api.
+*/
+
+Loader {
+ id: tab
+ anchors.fill: parent
+
+ /*! This property holds the title of the tab. */
+ property string title
+
+ /*! \internal */
+ property bool __inserted: false
+
+ Accessible.role: Accessible.LayeredPane
+ active: false
+ visible: false
+
+ activeFocusOnTab: false
+
+ onVisibleChanged: if (visible) active = true
+
+ /*! \internal */
+ default property alias component: tab.sourceComponent
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TabView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TabView.qml
new file mode 100644
index 0000000000..e20bcf224f
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TabView.qml
@@ -0,0 +1,270 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TabView
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup views
+ \brief A control that allows the user to select one of multiple stacked items.
+
+ You can create a custom appearance for a TabView by
+ assigning a \l {QtQuick.Controls.Styles::TabViewStyle}{TabViewStyle}.
+*/
+
+FocusScope {
+ id: root
+
+ implicitWidth: 240
+ implicitHeight: 150
+
+ /*! The current tab index */
+ property int currentIndex: 0
+
+ /*! The current tab count */
+ property int count: 0
+
+ /*! The visibility of the tab frame around contents */
+ property bool frameVisible: true
+
+ /*! The visibility of the tab bar */
+ property bool tabsVisible: true
+
+ /*!
+ \qmlproperty enumeration TabView::tabPosition
+
+ \list
+ \li Qt.TopEdge (default)
+ \li Qt.BottomEdge
+ \endlist
+ */
+ property int tabPosition: Qt.TopEdge
+
+ /*! \internal */
+ default property alias data: stack.data
+
+ /*! Adds a new tab page with title with and optional Component.
+ Returns the newly added tab.
+ */
+ function addTab(title, component) {
+ return insertTab(__tabs.count, title, component)
+ }
+
+ /*! Inserts a new tab with title at index, with an optional Component.
+ Returns the newly added tab.
+ */
+ function insertTab(index, title, component) {
+ // 'loader' parent is a pending workaround while waiting for:
+ // https://codereview.qt-project.org/#change,65788
+ var tab = tabcomp.createObject(loader)
+ tab.sourceComponent = component
+ tab.title = title
+ // insert at appropriate index first, then set the parent to
+ // avoid onChildrenChanged appending it to the end of the list
+ __tabs.insert(index, {tab: tab})
+ tab.__inserted = true
+ tab.parent = stack
+ __setOpacities()
+ return tab
+ }
+
+ /*! Removes and destroys a tab at the given \a index. */
+ function removeTab(index) {
+ var tab = __tabs.get(index).tab
+ __tabs.remove(index, 1)
+ tab.destroy()
+ if (currentIndex > 0)
+ currentIndex--
+ __setOpacities()
+ }
+
+ /*! Moves a tab \a from index \a to another. */
+ function moveTab(from, to) {
+ __tabs.move(from, to, 1)
+
+ if (currentIndex == from) {
+ currentIndex = to
+ } else {
+ var start = Math.min(from, to)
+ var end = Math.max(from, to)
+ if (currentIndex >= start && currentIndex <= end) {
+ if (from < to)
+ --currentIndex
+ else
+ ++currentIndex
+ }
+ }
+ }
+
+ /*! Returns the \l Tab item at \a index. */
+ function getTab(index) {
+ return __tabs.get(index).tab
+ }
+
+ /*! \internal */
+ property ListModel __tabs: ListModel { }
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/TabViewStyle.qml", root)
+
+ /*! \internal */
+ property var __styleItem: loader.item
+
+ onCurrentIndexChanged: __setOpacities()
+
+ /*! \internal */
+ function __setOpacities() {
+ for (var i = 0; i < __tabs.count; ++i) {
+ var child = __tabs.get(i).tab
+ child.visible = (i == currentIndex ? true : false)
+ }
+ count = __tabs.count
+ }
+
+ activeFocusOnTab: false
+
+ Component {
+ id: tabcomp
+ Tab {}
+ }
+
+ TabBar {
+ id: tabbarItem
+ objectName: "tabbar"
+ tabView: root
+ style: loader.item
+ anchors.top: parent.top
+ anchors.left: root.left
+ anchors.right: root.right
+ }
+
+ Loader {
+ id: loader
+ z: tabbarItem.z - 1
+ sourceComponent: style
+ property var __control: root
+ }
+
+ Loader {
+ id: frameLoader
+ z: tabbarItem.z - 1
+
+ anchors.fill: parent
+ anchors.topMargin: tabPosition === Qt.TopEdge && tabbarItem && tabsVisible ? Math.max(0, tabbarItem.height - baseOverlap) : 0
+ anchors.bottomMargin: tabPosition === Qt.BottomEdge && tabbarItem && tabsVisible ? Math.max(0, tabbarItem.height -baseOverlap) : 0
+ sourceComponent: frameVisible && loader.item ? loader.item.frame : null
+
+ property int baseOverlap: __styleItem ? __styleItem.frameOverlap : 0
+
+ Item {
+ id: stack
+
+ anchors.fill: parent
+ anchors.margins: (frameVisible ? frameWidth : 0)
+ anchors.topMargin: anchors.margins + (style =="mac" ? 6 : 0)
+ anchors.bottomMargin: anchors.margins
+
+ property int frameWidth
+ property string style
+ property bool completed: false
+
+ Component.onCompleted: {
+ addTabs(stack.children)
+ completed = true
+ }
+
+ onChildrenChanged: {
+ if (completed)
+ stack.addTabs(stack.children)
+ }
+
+ function addTabs(tabs) {
+ var tabAdded = false
+ for (var i = 0 ; i < tabs.length ; ++i) {
+ var tab = tabs[i]
+ if (!tab.__inserted && tab.Accessible.role === Accessible.LayeredPane) {
+ tab.__inserted = true
+ // reparent tabs created dynamically by createObject(tabView)
+ tab.parent = stack
+ // a dynamically added tab should also get automatically removed when destructed
+ if (completed)
+ tab.Component.onDestruction.connect(stack.onDynamicTabDestroyed.bind(tab))
+ __tabs.append({tab: tab})
+ tabAdded = true
+ }
+ }
+ if (tabAdded)
+ __setOpacities()
+ }
+
+ function onDynamicTabDestroyed() {
+ for (var i = 0; i < __tabs.count; ++i) {
+ if (__tabs.get(i).tab === this) {
+ __tabs.remove(i, 1)
+ __setOpacities()
+ break
+ }
+ }
+ }
+ }
+ onLoaded: { item.z = -1 }
+ }
+
+ onChildrenChanged: stack.addTabs(root.children)
+
+ states: [
+ State {
+ name: "Bottom"
+ when: tabPosition === Qt.BottomEdge && tabbarItem != undefined
+ PropertyChanges {
+ target: tabbarItem
+ anchors.topMargin: -frameLoader.baseOverlap
+ }
+ AnchorChanges {
+ target: tabbarItem
+ anchors.top: frameLoader.bottom
+ }
+ }
+ ]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml
new file mode 100644
index 0000000000..586f1211df
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml
@@ -0,0 +1,1016 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+
+/*!
+ \qmltype TableView
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup views
+ \brief Provides a list view with scroll bars, styling and header sections.
+
+ \image tableview.png
+
+ A TableView is similar to \l ListView, and adds scroll bars, selection, and
+ resizable header sections. As with \l ListView, data for each row is provided through a \l model:
+
+ \code
+ ListModel {
+ id: libraryModel
+ ListElement{ title: "A Masterpiece" ; author: "Gabriel" }
+ ListElement{ title: "Brilliance" ; author: "Jens" }
+ ListElement{ title: "Outstanding" ; author: "Frederik" }
+ }
+ \endcode
+
+ You provide title and size of a column header
+ by adding a \l TableViewColumn as demonstrated below.
+ \code
+
+ TableView {
+ TableViewColumn{ role: "title" ; title: "Title" ; width: 100 }
+ TableViewColumn{ role: "author" ; title: "Author" ; width: 200 }
+ model: libraryModel
+ }
+ \endcode
+
+ The header sections are attached to values in the \l model by defining
+ the model role they attach to. Each property in the model will
+ then be shown in their corresponding column.
+
+ You can customize the look by overriding the \l itemDelegate,
+ \l rowDelegate, or \l headerDelegate properties.
+
+ The view itself does not provide sorting. This has to
+ be done on the model itself. However you can provide sorting
+ on the model, and enable sort indicators on headers.
+
+\list
+ \li int sortIndicatorColumn - The index of the current sort column
+ \li bool sortIndicatorVisible - Whether the sort indicator should be enabled
+ \li enum sortIndicatorOrder - Qt.AscendingOrder or Qt.DescendingOrder depending on state
+\endlist
+
+ You can create a custom appearance for a TableView by
+ assigning a \l {QtQuick.Controls.Styles::TableViewStyle}{TableViewStyle}.
+*/
+
+ScrollView {
+ id: root
+
+ /*! \qmlproperty model TableView::model
+ This property holds the model providing data for the table view.
+
+ The model provides the set of data that is used to create the items in the view.
+ Models can be created directly in QML using ListModel, XmlListModel or VisualItemModel,
+ or provided by C++ model classes. \sa ListView::model
+
+ Example model:
+
+ \code
+ model: ListModel {
+ ListElement{ column1: "value 1" ; column2: "value 2" }
+ ListElement{ column1: "value 3" ; column2: "value 4" }
+ }
+ \endcode
+ \sa {qml-data-models}{Data Models}
+ */
+ property var model
+
+ /*! This property is set to \c true if the view alternates the row color.
+ The default value is \c true. */
+ property bool alternatingRowColors: true
+
+ /*! This property determines if the header is visible.
+ The default value is \c true. */
+ property bool headerVisible: true
+
+ /*! \qmlproperty bool TableView::backgroundVisible
+
+ This property determines if the background should be filled or not.
+
+ The default value is \c true.
+
+ \note The rowDelegate is not affected by this property
+ */
+ property alias backgroundVisible: colorRect.visible
+
+ /*! This property defines a delegate to draw a specific cell.
+
+ In the item delegate you have access to the following special properties:
+ \list
+ \li styleData.selected - if the item is currently selected
+ \li styleData.value - the value or text for this item
+ \li styleData.textColor - the default text color for an item
+ \li styleData.row - the index of the row
+ \li styleData.column - the index of the column
+ \li styleData.elideMode - the elide mode of the column
+ \li styleData.textAlignment - the horizontal text alignment of the column
+ \endlist
+
+ Example:
+ \code
+ itemDelegate: Item {
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ color: styleData.textColor
+ elide: styleData.elideMode
+ text: styleData.value
+ }
+ }
+ \endcode */
+ property Component itemDelegate: __style ? __style.itemDelegate : null
+
+ /*! This property defines a delegate to draw a row.
+
+ In the row delegate you have access to the following special properties:
+ \list
+ \li styleData.alternate - true when the row uses the alternate background color
+ \li styleData.selected - true when the row is currently selected
+ \li styleData.row - the index of the row
+ \endlist
+ */
+ property Component rowDelegate: __style ? __style.rowDelegate : null
+
+ /*! This property defines a delegate to draw a header.
+
+ In the header delegate you have access to the following special properties:
+ \list
+ \li styleData.value - the value or text for this item
+ \li styleData.column - the index of the column
+ \li styleData.pressed - true when the column is being pressed
+ \li styleData.containsMouse - true when the column is under the mouse
+ \li styleData.textAlignment - the horizontal text alignment of the column (since QtQuickControls 1.1)
+ \endlist
+ */
+ property Component headerDelegate: __style ? __style.headerDelegate : null
+
+ /*! Index of the current sort column.
+ The default value is \c {0}. */
+ property int sortIndicatorColumn
+
+ /*! This property shows or hides the sort indicator
+ The default value is \c false.
+ \note The view itself does not sort the data. */
+ property bool sortIndicatorVisible: false
+
+ /*!
+ \qmlproperty enumeration TableView::sortIndicatorOrder
+
+ This sets the sorting order of the sort indicator
+ The allowed values are:
+ \list
+ \li Qt.AscendingOrder - the default
+ \li Qt.DescendingOrder
+ \endlist
+ */
+ property int sortIndicatorOrder: Qt.AscendingOrder
+
+ /*! \internal */
+ default property alias __columns: root.data
+
+ /*! \qmlproperty Component TableView::contentHeader
+ This is the content header of the TableView */
+ property alias contentHeader: listView.header
+
+ /*! \qmlproperty Component TableView::contentFooter
+ This is the content footer of the TableView */
+ property alias contentFooter: listView.footer
+
+ /*! \qmlproperty int TableView::rowCount
+ The current number of rows */
+ readonly property alias rowCount: listView.count
+
+ /*! \qmlproperty int TableView::columnCount
+ The current number of columns */
+ readonly property alias columnCount: columnModel.count
+
+ /*! \qmlproperty string TableView::section.property
+ \qmlproperty enumeration TableView::section.criteria
+ \qmlproperty Component TableView::section.delegate
+ \qmlproperty enumeration TableView::section.labelPositioning
+ These properties determine the section labels.
+ \sa ListView::section */
+ property alias section: listView.section
+
+ /*! \qmlproperty int TableView::currentRow
+ The current row index of the view.
+ The default value is \c -1 to indicate that no row is selected.
+ */
+ property alias currentRow: listView.currentIndex
+
+ /*! \internal */
+ property alias __currentRowItem: listView.currentItem
+
+ /*! \qmlsignal TableView::activated(int row)
+
+ Emitted when the user activates an item by mouse or keyboard interaction.
+ Mouse activation is triggered by single- or double-clicking, depending on the platform.
+
+ \a row int provides access to the activated row index.
+
+ \note This signal is only emitted for mouse interaction that is not blocked in the row or item delegate.
+ */
+ signal activated(int row)
+
+ /*! \qmlsignal TableView::clicked(int row)
+
+ Emitted when the user clicks a valid row by single clicking
+
+ \a row int provides access to the clicked row index.
+
+ \note This signal is only emitted if the row or item delegate does not accept mouse events.
+ */
+ signal clicked(int row)
+
+ /*! \qmlsignal TableView::doubleClicked(int row)
+
+ Emitted when the user double clicks a valid row.
+
+ \a row int provides access to the clicked row index.
+
+ \note This signal is only emitted if the row or item delegate does not accept mouse events.
+ */
+ signal doubleClicked(int row)
+
+ /*!
+ \qmlmethod TableView::positionViewAtRow( int row, PositionMode mode )
+
+ Positions the view such that the specified \a row is at the position defined by \a mode:
+ \list
+ \li ListView.Beginning - position item at the top of the view.
+ \li ListView.Center - position item in the center of the view.
+ \li ListView.End - position item at bottom of the view.
+ \li ListView.Visible - if any part of the item is visible then take no action, otherwise bring the item into view.
+ \li ListView.Contain - ensure the entire item is visible. If the item is larger than the view the item is positioned
+ at the top of the view.
+ \endlist
+
+ If positioning the \a row creates an empty space at the beginning
+ or end of the view, then the view is positioned at the boundary.
+
+ For example, to position the view at the end at startup:
+
+ \code
+ Component.onCompleted: table.positionViewAtRow(rowCount -1, ListView.Contain)
+ \endcode
+
+ Depending on how the model is populated, the model may not be ready when
+ TableView Component.onCompleted is called. In that case you may need to
+ delay the call to positionViewAtRow by using a \l {QtQml::Timer}{Timer}.
+
+ \note This method should only be called after the component has completed.
+ */
+
+ function positionViewAtRow(row, mode) {
+ listView.positionViewAtIndex(row, mode)
+ }
+
+ /*!
+ \qmlmethod int TableView::rowAt( int x, int y )
+
+ Returns the index of the visible row at the point \a x, \a y in content
+ coordinates. If there is no visible row at the point specified, \c -1 is returned.
+
+ \note This method should only be called after the component has completed.
+ */
+
+ function rowAt(x, y) {
+ var obj = root.mapToItem(listView.contentItem, x, y)
+ return listView.indexAt(obj.x, obj.y)
+ }
+
+ /*! Adds a \a column and returns the added column.
+
+ The \a column argument can be an instance of TableViewColumn,
+ or a Component. The component has to contain a TableViewColumn.
+ Otherwise \c null is returned.
+ */
+ function addColumn(column) {
+ return insertColumn(columnCount, column)
+ }
+
+ /*! Inserts a \a column at the given \a index and returns the inserted column.
+
+ The \a column argument can be an instance of TableViewColumn,
+ or a Component. The component has to contain a TableViewColumn.
+ Otherwise \c null is returned.
+ */
+ function insertColumn(index, column) {
+ var object = column
+ if (typeof column['createObject'] === 'function')
+ object = column.createObject(root)
+
+ else if (object.__view) {
+ console.warn("TableView::insertColumn(): you cannot add a column to multiple views")
+ return null
+ }
+ if (index >= 0 && index <= columnCount && object.Accessible.role === Accessible.ColumnHeader) {
+ object.__view = root
+ columnModel.insert(index, {columnItem: object})
+ return object
+ }
+
+ if (object !== column)
+ object.destroy()
+ console.warn("TableView::insertColumn(): invalid argument")
+ return null
+ }
+
+ /*! Removes and destroys a column at the given \a index. */
+ function removeColumn(index) {
+ if (index < 0 || index >= columnCount) {
+ console.warn("TableView::removeColumn(): invalid argument")
+ return
+ }
+ var column = columnModel.get(index).columnItem
+ columnModel.remove(index, 1)
+ column.destroy()
+ }
+
+ /*! Moves a column \a from index \a to another. */
+ function moveColumn(from, to) {
+ if (from < 0 || from >= columnCount || to < 0 || to >= columnCount) {
+ console.warn("TableView::moveColumn(): invalid argument")
+ return
+ }
+ columnModel.move(from, to, 1)
+ }
+
+ /*! Returns the column at the given \a index
+ or \c null if the \a index is invalid. */
+ function getColumn(index) {
+ if (index < 0 || index >= columnCount)
+ return null
+ return columnModel.get(index).columnItem
+ }
+
+ /*! \qmlproperty Selection TableView::selection
+ \since QtQuick.Controls 1.1
+
+ This property contains the current row-selection of the \l TableView.
+ The selection allows you to select, deselect or iterate over selected rows.
+
+ \list
+ \li function \b clear() - deselects all rows
+ \li function \b selectAll() - selects all rows
+ \li function \b select(from, to) - select a range
+ \li functton \b deselect(from, to) - de-selects a range
+ \li function \b forEach(callback) - Allows you to iterate over selected rows
+ \li function \b contains(index) - Allows you to iterate over selected rows
+ \li signal \b selectionChanged() - The current row selection changed
+ \li readonly property int \b count - The number of selected rows
+ \endlist
+
+ \b Example:
+ \code
+ tableview.selection.select(0) // select row index 0
+
+ tableview.selection.select(1, 3) // select row indexes 1, 2 and 3
+
+ tableview.selection.deselect(0, 1) // deselects row index 0 and 1
+
+ tableview.selection.deselect(2) // deselects row index 2
+ \endcode
+
+ \b Example: To iterate over selected indexes, you can pass a callback function.
+ \a rowIndex is passed as as an argument to the callback function.
+ \code
+ tableview.selection.forEach( function(rowIndex) {console.log(rowIndex)} )
+ \endcode
+
+ */
+
+ readonly property alias selection: selectionObject
+
+ /*!
+ \qmlproperty enumeration TableView::selectionMode
+ \since QtQuick.Controls 1.1
+
+ This enum indicates how the view responds to user selections:
+
+ The possible modes are:
+
+ \list
+
+ \li SelectionMode.NoSelection - Items cannot be selected.
+
+ \li SelectionMode.SingleSelection - When the user selects an item,
+ any already-selected item becomes unselected, and the user cannot
+ unselect the selected item. (Default)
+
+ \li SelectionMode.MultiSelection - When the user selects an item in the usual way,
+ the selection status of that item is toggled and the other items are left alone.
+
+ \li SelectionMode.ExtendedSelection - When the user selects an item in the usual way,
+ the selection is cleared and the new item selected. However, if the user presses the
+ Ctrl key when clicking on an item, the clicked item gets toggled and all other items
+ are left untouched. If the user presses the Shift key while clicking
+ on an item, all items between the current item and the clicked item are selected or unselected,
+ depending on the state of the clicked item. Multiple items can be selected by dragging the
+ mouse over them.
+
+ \li SelectionMode.ContiguousSelection - When the user selects an item in the usual way,
+ the selection is cleared and the new item selected. However, if the user presses the Shift key while
+ clicking on an item, all items between the current item and the clicked item are selected.
+
+ \endlist
+ */
+ property int selectionMode: SelectionMode.SingleSelection
+
+ Component.onCompleted: {
+ for (var i = 0; i < __columns.length; ++i) {
+ var column = __columns[i]
+ if (column.Accessible.role === Accessible.ColumnHeader)
+ addColumn(column)
+ }
+ }
+
+ style: Qt.createComponent(Settings.style + "/TableViewStyle.qml", root)
+
+
+ Accessible.role: Accessible.Table
+
+ implicitWidth: 200
+ implicitHeight: 150
+
+ frameVisible: true
+ __scrollBarTopMargin: (__style && __style.transientScrollBars || Qt.platform.os === "osx") ? headerrow.height : 0
+ __viewTopMargin: headerrow.height
+
+ /*! \internal */
+ property bool __activateItemOnSingleClick: __style ? __style.activateItemOnSingleClick : false
+
+ /*! \internal */
+ function __decrementCurrentIndex() {
+ __scroller.blockUpdates = true;
+ listView.decrementCurrentIndex();
+ __scroller.blockUpdates = false;
+
+ var newIndex = listView.indexAt(0, listView.contentY)
+ if (newIndex !== -1) {
+ if (selectionMode > SelectionMode.SingleSelection)
+ mousearea.dragRow = newIndex
+ else if (selectionMode === SelectionMode.SingleSelection)
+ selection.__selectOne(newIndex)
+ }
+ }
+
+ /*! \internal */
+ function __incrementCurrentIndex() {
+ __scroller.blockUpdates = true;
+ listView.incrementCurrentIndex();
+ __scroller.blockUpdates = false;
+
+ var newIndex = Math.max(0, listView.indexAt(0, listView.height + listView.contentY))
+ if (newIndex !== -1) {
+ if (selectionMode > SelectionMode.SingleSelection)
+ mousearea.dragRow = newIndex
+ else if (selectionMode === SelectionMode.SingleSelection)
+ selection.__selectOne(newIndex)
+ }
+ }
+
+ onModelChanged: selection.clear()
+
+ ListView {
+ id: listView
+ focus: true
+ activeFocusOnTab: true
+ anchors.topMargin: tableHeader.height
+ anchors.fill: parent
+ currentIndex: -1
+ visible: columnCount > 0
+ interactive: Settings.hasTouchScreen
+
+ SystemPalette {
+ id: palette
+ colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ Rectangle {
+ id: colorRect
+ parent: viewport
+ anchors.fill: parent
+ color: __style ? __style.backgroundColor : palette.base
+ z: -2
+ }
+
+ MouseArea {
+ id: mousearea
+
+ z: -1
+ anchors.fill: listView
+ propagateComposedEvents: true
+
+ property bool autoincrement: false
+ property bool autodecrement: false
+ property int mouseModifiers: 0
+ property int previousRow: 0
+ property int clickedRow: -1
+ property int dragRow: -1
+ property int firstKeyRow: -1
+
+ onReleased: {
+ autoincrement = false
+ autodecrement = false
+ var clickIndex = listView.indexAt(0, mouseY + listView.contentY)
+ if (clickIndex > -1) {
+ if (Settings.hasTouchScreen) {
+ listView.currentIndex = clickIndex
+ mouseSelect(clickIndex, mouse.modifiers)
+ }
+ previousRow = clickIndex
+ }
+
+ if (mousearea.dragRow >= 0) {
+ selection.__select(selection.contains(mousearea.clickedRow), mousearea.clickedRow, mousearea.dragRow)
+ mousearea.dragRow = -1
+ }
+ }
+
+ // Handle vertical scrolling whem dragging mouse outside boundraries
+ Timer { running: mousearea.autoincrement && __verticalScrollBar.visible; repeat: true; interval: 20 ; onTriggered: __incrementCurrentIndex()}
+ Timer { running: mousearea.autodecrement && __verticalScrollBar.visible; repeat: true; interval: 20 ; onTriggered: __decrementCurrentIndex()}
+
+ onPositionChanged: {
+ if (mouseY > listView.height && pressed) {
+ if (autoincrement) return;
+ autodecrement = false;
+ autoincrement = true;
+ } else if (mouseY < 0 && pressed) {
+ if (autodecrement) return;
+ autoincrement = false;
+ autodecrement = true;
+ } else {
+ autoincrement = false;
+ autodecrement = false;
+ }
+
+ if (pressed && !Settings.hasTouchScreen) {
+ var newIndex = Math.max(0, listView.indexAt(0, mouseY + listView.contentY))
+ if (newIndex >= 0 && newIndex != currentRow) {
+ listView.currentIndex = newIndex;
+ if (selectionMode === SelectionMode.SingleSelection) {
+ selection.__selectOne(newIndex)
+ } else if (selectionMode > 1) {
+ dragRow = newIndex
+ }
+ }
+ }
+ mouseModifiers = mouse.modifiers
+ }
+
+ onClicked: {
+ var clickIndex = listView.indexAt(0, mouseY + listView.contentY)
+ if (clickIndex > -1) {
+ if (root.__activateItemOnSingleClick)
+ root.activated(clickIndex)
+ root.clicked(clickIndex)
+ }
+ }
+
+ onPressed: {
+ var newIndex = listView.indexAt(0, mouseY + listView.contentY)
+ listView.forceActiveFocus()
+ if (newIndex > -1 && !Settings.hasTouchScreen) {
+ listView.currentIndex = newIndex
+ mouseSelect(newIndex, mouse.modifiers)
+ mousearea.clickedRow = newIndex
+ }
+ mouseModifiers = mouse.modifiers
+ }
+
+ function mouseSelect(index, modifiers) {
+ if (selectionMode) {
+ if (modifiers & Qt.ShiftModifier && (selectionMode === SelectionMode.ExtendedSelection)) {
+ selection.select(previousRow, index)
+ } else if (selectionMode === SelectionMode.MultiSelection ||
+ (selectionMode === SelectionMode.ExtendedSelection && modifiers & Qt.ControlModifier)) {
+ selection.__select(!selection.contains(index) , index)
+ } else {
+ selection.__selectOne(index)
+ }
+ }
+ }
+
+ onDoubleClicked: {
+ var clickIndex = listView.indexAt(0, mouseY + listView.contentY)
+ if (clickIndex > -1) {
+ if (!root.__activateItemOnSingleClick)
+ root.activated(clickIndex)
+ root.doubleClicked(clickIndex)
+ }
+ }
+
+ // Note: with boolean preventStealing we are keeping the flickable from
+ // eating our mouse press events
+ preventStealing: !Settings.hasTouchScreen
+
+ TableViewSelection { id: selectionObject }
+ }
+
+ // Fills extra rows with alternate color
+ Column {
+ id: rowfiller
+ Loader {
+ id: rowSizeItem
+ sourceComponent: root.rowDelegate
+ visible: false
+ property QtObject styleData: QtObject {
+ property bool alternate: false
+ property bool selected: false
+ property bool hasActiveFocus: false
+ }
+ }
+ property int rowHeight: rowSizeItem.implicitHeight
+ property int paddedRowCount: height/rowHeight
+ property int count: listView.count
+ y: listView.contentHeight
+ width: parent.width
+ visible: alternatingRowColors
+ height: viewport.height - listView.contentHeight
+ Repeater {
+ model: visible ? parent.paddedRowCount : 0
+ Loader {
+ width: rowfiller.width
+ height: rowfiller.rowHeight
+ sourceComponent: root.rowDelegate
+ property QtObject styleData: QtObject {
+ readonly property bool alternate: (index + rowCount) % 2 === 1
+ readonly property bool selected: false
+ readonly property bool hasActiveFocus: root.activeFocus
+ }
+ readonly property var model: listView.model
+ readonly property var modelData: null
+ }
+ }
+ }
+
+ ListModel {
+ id: columnModel
+ }
+
+ highlightFollowsCurrentItem: true
+ model: root.model
+
+ function keySelect(shiftPressed, row) {
+ if (row < 0 || row === rowCount - 1)
+ return
+ if (shiftPressed && (selectionMode >= SelectionMode.ExtendedSelection)) {
+ selection.__ranges = new Array()
+ selection.select(mousearea.firstKeyRow, row)
+ } else {
+ selection.__selectOne(row)
+ }
+ }
+
+ Keys.onUpPressed: {
+ event.accepted = false
+ __scroller.blockUpdates = true;
+ listView.decrementCurrentIndex();
+ __scroller.blockUpdates = false;
+ if (selectionMode)
+ keySelect(event.modifiers & Qt.ShiftModifier, currentRow)
+ }
+
+ Keys.onDownPressed: {
+ event.accepted = false
+ __scroller.blockUpdates = true;
+ listView.incrementCurrentIndex();
+ __scroller.blockUpdates = false;
+ if (selectionMode)
+ keySelect(event.modifiers & Qt.ShiftModifier, currentRow)
+ }
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_PageUp) {
+ __verticalScrollBar.value = __verticalScrollBar.value - listView.height
+ } else if (event.key === Qt.Key_PageDown)
+ __verticalScrollBar.value = __verticalScrollBar.value + listView.height
+
+ if (event.key === Qt.Key_Shift) {
+ mousearea.firstKeyRow = currentRow
+ }
+
+ if (event.key === Qt.Key_A && event.modifiers & Qt.ControlModifier) {
+ if (selectionMode > 1)
+ selection.selectAll()
+ }
+ }
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Shift)
+ mousearea.firstKeyRow = -1
+ }
+
+ Keys.onReturnPressed: {
+ event.accepted = false
+ if (currentRow > -1)
+ root.activated(currentRow);
+ }
+
+ delegate: FocusScope {
+ id: rowitem
+ width: itemrow.width
+ height: rowstyle.height
+
+ function selected() {
+ if (mousearea.dragRow > -1 && (rowIndex >= mousearea.clickedRow && rowIndex <= mousearea.dragRow
+ || rowIndex <= mousearea.clickedRow && rowIndex >=mousearea.dragRow))
+ return selection.contains(mousearea.clickedRow)
+
+ return selection.count && selection.contains(rowIndex)
+ }
+ readonly property int rowIndex: model.index
+ readonly property bool alternate: alternatingRowColors && rowIndex % 2 == 1
+ readonly property var itemModelData: typeof modelData == "undefined" ? null : modelData
+ readonly property var itemModel: model
+ readonly property bool itemSelected: selected()
+ readonly property color itemTextColor: itemSelected ? __style.highlightedTextColor : __style.textColor
+
+ onActiveFocusChanged: {
+ if (activeFocus)
+ listView.currentIndex = rowIndex
+ }
+
+ Loader {
+ id: rowstyle
+ // row delegate
+ sourceComponent: root.rowDelegate
+ // Row fills the view width regardless of item size
+ // But scrollbar should not adjust to it
+ height: item ? item.height : 16
+ width: parent.width + __horizontalScrollBar.width
+ x: listView.contentX
+
+ // these properties are exposed to the row delegate
+ // Note: these properties should be mirrored in the row filler as well
+ property QtObject styleData: QtObject {
+ readonly property int row: rowitem.rowIndex
+ readonly property bool alternate: rowitem.alternate
+ readonly property bool selected: rowitem.itemSelected
+ readonly property bool hasActiveFocus: root.activeFocus
+ }
+ readonly property var model: listView.model
+ readonly property var modelData: rowitem.itemModelData
+ }
+ Row {
+ id: itemrow
+ height: parent.height
+ Repeater {
+ id: repeater
+ model: columnModel
+
+ Loader {
+ id: itemDelegateLoader
+ width: columnItem.width
+ height: parent ? parent.height : 0
+ visible: columnItem.visible
+ sourceComponent: columnItem.delegate ? columnItem.delegate : itemDelegate
+
+ // these properties are exposed to the item delegate
+ readonly property var model: listView.model
+ readonly property var modelData: itemModelData
+
+ property QtObject styleData: QtObject {
+ readonly property int row: rowitem.rowIndex
+ readonly property int column: index
+ readonly property int elideMode: columnItem.elideMode
+ readonly property int textAlignment: columnItem.horizontalAlignment
+ readonly property bool selected: rowitem.itemSelected
+ readonly property color textColor: rowitem.itemTextColor
+ readonly property string role: columnItem.role
+ readonly property var value: itemModel.hasOwnProperty(role)
+ ? itemModel[role] // Qml ListModel and QAbstractItemModel
+ : modelData && modelData.hasOwnProperty(role)
+ ? modelData[role] // QObjectList / QObject
+ : modelData != undefined ? modelData : "" // Models without role
+ }
+ }
+ }
+ onWidthChanged: listView.contentWidth = width
+ }
+ }
+
+ Text{ id:text }
+
+ Item {
+ id: tableHeader
+ clip: true
+ parent: __scroller
+ visible: headerVisible
+ anchors.top: parent.top
+ anchors.topMargin: viewport.anchors.topMargin
+ anchors.leftMargin: viewport.anchors.leftMargin
+ anchors.margins: viewport.anchors.margins
+ anchors.rightMargin: (frameVisible ? __scroller.rightMargin : 0) +
+ (__scroller.outerFrame && __scrollBarTopMargin ? 0 : __verticalScrollBar.width
+ + __scroller.scrollBarSpacing + root.__style.padding.right)
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ height: headerrow.height
+
+ Row {
+ id: headerrow
+ x: -listView.contentX
+
+ Repeater {
+ id: repeater
+
+ property int targetIndex: -1
+ property int dragIndex: -1
+
+ model: columnModel
+
+ delegate: Item {
+ z:-index
+ width: columnCount == 1 ? viewport.width + __verticalScrollBar.width : modelData.width
+ visible: modelData.visible
+ height: headerVisible ? headerStyle.height : 0
+
+ Loader {
+ id: headerStyle
+ sourceComponent: root.headerDelegate
+ anchors.left: parent.left
+ anchors.right: parent.right
+ property QtObject styleData: QtObject {
+ readonly property string value: modelData.title
+ readonly property bool pressed: headerClickArea.pressed
+ readonly property bool containsMouse: headerClickArea.containsMouse
+ readonly property int column: index
+ readonly property int textAlignment: modelData.horizontalAlignment
+ }
+ }
+ Rectangle{
+ id: targetmark
+ width: parent.width
+ height:parent.height
+ opacity: (index == repeater.targetIndex && repeater.targetIndex != repeater.dragIndex) ? 0.5 : 0
+ Behavior on opacity { NumberAnimation{duration:160}}
+ color: palette.highlight
+ visible: modelData.movable
+ }
+
+ MouseArea{
+ id: headerClickArea
+ drag.axis: Qt.YAxis
+ hoverEnabled: true
+ anchors.fill: parent
+ onClicked: {
+ if (sortIndicatorColumn == index)
+ sortIndicatorOrder = sortIndicatorOrder == Qt.AscendingOrder ? Qt.DescendingOrder : Qt.AscendingOrder
+ sortIndicatorColumn = index
+ }
+ // Here we handle moving header sections
+ // NOTE: the direction is different from the master branch
+ // so this indicates that I am using an invalid assumption on item ordering
+ onPositionChanged: {
+ if (modelData.movable && pressed && columnCount > 1) { // only do this while dragging
+ for (var h = columnCount-1 ; h >= 0 ; --h) {
+ if (drag.target.x > headerrow.children[h].x) {
+ repeater.targetIndex = h
+ break
+ }
+ }
+ }
+ }
+
+ onPressed: {
+ repeater.dragIndex = index
+ draghandle.x = parent.x
+ }
+
+ onReleased: {
+ if (repeater.targetIndex >= 0 && repeater.targetIndex != index ) {
+ var targetColumn = columnModel.get(repeater.targetIndex).columnItem
+ if (targetColumn.movable) {
+ columnModel.move(index, repeater.targetIndex, 1)
+ if (sortIndicatorColumn == index)
+ sortIndicatorColumn = repeater.targetIndex
+ }
+ }
+ repeater.targetIndex = -1
+ }
+ drag.maximumX: 1000
+ drag.minimumX: -1000
+ drag.target: modelData.movable && columnCount > 1 ? draghandle : null
+ }
+
+ Loader {
+ id: draghandle
+ property QtObject styleData: QtObject{
+ readonly property string value: modelData.title
+ readonly property bool pressed: headerClickArea.pressed
+ readonly property bool containsMouse: headerClickArea.containsMouse
+ readonly property int column: index
+ readonly property int textAlignment: modelData.horizontalAlignment
+ }
+
+ parent: tableHeader
+ width: modelData.width
+ height: parent.height
+ sourceComponent: root.headerDelegate
+ visible: headerClickArea.pressed
+ opacity: 0.5
+ }
+
+
+ MouseArea {
+ id: headerResizeHandle
+ property int offset: 0
+ property int minimumSize: 20
+ anchors.rightMargin: -width/2
+ width: 16 ; height: parent.height
+ anchors.right: parent.right
+ enabled: modelData.resizable && columnCount > 1
+ onPositionChanged: {
+ var newHeaderWidth = modelData.width + (mouseX - offset)
+ modelData.width = Math.max(minimumSize, newHeaderWidth)
+ }
+ property bool found:false
+
+ onDoubleClicked: {
+ var row
+ var minWidth = 0
+ var listdata = listView.children[0]
+ for (row = 0 ; row < listdata.children.length ; ++row){
+ var item = listdata.children[row+1]
+ if (item && item.children[1] && item.children[1].children[index] &&
+ item.children[1].children[index].children[0].hasOwnProperty("implicitWidth"))
+ minWidth = Math.max(minWidth, item.children[1].children[index].children[0].implicitWidth)
+ }
+ if (minWidth)
+ modelData.width = minWidth
+ }
+ onPressedChanged: if (pressed) offset=mouseX
+ cursorShape: enabled ? Qt.SplitHCursor : Qt.ArrowCursor
+ }
+ }
+ }
+ }
+ Loader {
+ id: loader
+ property QtObject styleData: QtObject{
+ readonly property string value: ""
+ readonly property bool pressed: false
+ readonly property bool containsMouse: false
+ readonly property int column: -1
+ readonly property int textAlignment: Text.AlignLeft
+ }
+
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: headerrow.bottom
+ anchors.rightMargin: -2
+ sourceComponent: root.headerDelegate
+ width: root.width - headerrow.width + 2
+ visible: root.columnCount
+ z:-1
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableViewColumn.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableViewColumn.qml
new file mode 100644
index 0000000000..cbf2094563
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableViewColumn.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+/*!
+ \qmltype TableViewColumn
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup viewitems
+ \brief Used to define columns in a \l TableView.
+*/
+
+QtObject {
+
+ /*! \internal */
+ property Item __view: null
+
+ /*! The title text of the column. */
+ property string title
+
+ /*! The model \c role of the column. */
+ property string role
+
+ /*! The current width of the column
+ The default value depends on platform. If only one
+ column is defined, the width expands to the viewport.
+ */
+ property int width: (__view && __view.columnCount === 1) ? __view.viewport.width : 160
+
+ /*! The visible status of the column. */
+ property bool visible: true
+
+ /*! Determines if the column should be resizable.
+ \since QtQuick.Controls 1.1 */
+ property bool resizable: true
+
+ /*! Determines if the column should be movable.
+ The default value is \c true.
+ \note A non-movable column may get indirectly moved if adjacent columns are movable.
+ \since QtQuick.Controls 1.1 */
+ property bool movable: true
+
+ /*! \qmlproperty enumeration TableViewColumn::elideMode
+ The text elide mode of the column.
+ Allowed values are:
+ \list
+ \li Text.ElideNone
+ \li Text.ElideLeft
+ \li Text.ElideMiddle
+ \li Text.ElideRight - the default
+ \endlist
+ \sa {QtQuick2::}{Text::elide} */
+ property int elideMode: Text.ElideRight
+
+ /*! \qmlproperty enumeration TableViewColumn::horizontalAlignment
+ The horizontal text alignment of the column.
+ Allowed values are:
+ \list
+ \li Text.AlignLeft - the default
+ \li Text.AlignRight
+ \li Text.AlignHCenter
+ \li Text.AlignJustify
+ \endlist
+ \sa {QtQuick2::}{Text::horizontalAlignment} */
+ property int horizontalAlignment: Text.AlignLeft
+
+ /*! The delegate of the column. This can be used to set the
+ \l TableView::itemDelegate for a specific column.
+
+ In the delegate you have access to the following special properties:
+ \list
+ \li styleData.selected - if the item is currently selected
+ \li styleData.value - the value or text for this item
+ \li styleData.textColor - the default text color for an item
+ \li styleData.row - the index of the row
+ \li styleData.column - the index of the column
+ \li styleData.elideMode - the elide mode of the column
+ \li styleData.textAlignment - the horizontal text alignment of the column
+ \endlist
+ */
+ property Component delegate
+
+ Accessible.role: Accessible.ColumnHeader
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextArea.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextArea.qml
new file mode 100644
index 0000000000..7269791962
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextArea.qml
@@ -0,0 +1,764 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+/*!
+ \qmltype TextArea
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Displays multiple lines of editable formatted text.
+
+ It can display both plain and rich text. For example:
+
+ \qml
+ TextArea {
+ width: 240
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ \endqml
+
+ Clipboard support is provided by the cut(), copy(), and paste() functions, and the selection can
+ be handled in a traditional "mouse" mechanism by setting selectByMouse, or handled completely
+ from QML by manipulating selectionStart and selectionEnd, or using selectAll() or selectWord().
+
+ You can translate between cursor positions (characters from the start of the document) and pixel
+ points using positionAt() and positionToRectangle().
+
+ You can create a custom appearance for a TextArea by
+ assigning a \l{QtQuick.Controls.Styles::TextAreaStyle}{TextAreaStyle}.
+
+ \sa TextField, TextEdit
+*/
+
+ScrollView {
+ id: area
+
+ /*!
+ \qmlproperty bool TextArea::activeFocusOnPress
+
+ Whether the TextEdit should gain active focus on a mouse press. By default this is
+ set to true.
+ */
+ property alias activeFocusOnPress: edit.activeFocusOnPress
+
+ /*!
+ \qmlproperty url TextArea::baseUrl
+
+ This property specifies a base URL which is used to resolve relative URLs
+ within the text.
+
+ The default value is the url of the QML file instantiating the TextArea item.
+ */
+ property alias baseUrl: edit.baseUrl
+
+ /*!
+ \qmlproperty bool TextArea::canPaste
+
+ Returns true if the TextArea is writable and the content of the clipboard is
+ suitable for pasting into the TextArea.
+ */
+ readonly property alias canPaste: edit.canPaste
+
+ /*!
+ \qmlproperty bool TextArea::canRedo
+
+ Returns true if the TextArea is writable and there are \l {undo}{undone}
+ operations that can be redone.
+ */
+ readonly property alias canRedo: edit.canRedo
+
+ /*!
+ \qmlproperty bool TextArea::canUndo
+
+ Returns true if the TextArea is writable and there are previous operations
+ that can be undone.
+ */
+ readonly property alias canUndo: edit.canUndo
+
+ /*!
+ \qmlproperty color TextArea::textColor
+
+ The text color.
+
+ \qml
+ TextArea { textColor: "orange" }
+ \endqml
+ */
+ property alias textColor: edit.color
+
+ /*!
+ \qmlproperty int TextArea::cursorPosition
+ The position of the cursor in the TextArea.
+ */
+ property alias cursorPosition: edit.cursorPosition
+
+ /*! \qmlproperty font TextArea::font
+
+ The font of the TextArea.
+ */
+ property alias font: edit.font
+
+ /*!
+ \qmlproperty enumeration TextArea::horizontalAlignment
+
+ Sets the alignment of the text within the TextArea item's width.
+
+ By default, the horizontal text alignment follows the natural alignment of the text,
+ for example, text that is read from left to right will be aligned to the left.
+
+ The valid values for \c horizontalAlignment are:
+ \list
+ \li TextEdit.AlignLeft (Default)
+ \li TextEdit.AlignRight
+ \li TextEdit.AlignHCenter
+ \endlist
+
+ When using the attached property LayoutMirroring::enabled to mirror application
+ layouts, the horizontal alignment of text will also be mirrored. However, the property
+ \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment
+ of TextArea, use the read-only property \c effectiveHorizontalAlignment.
+ */
+ property alias horizontalAlignment: edit.horizontalAlignment
+
+ /*!
+ \qmlproperty enumeration TextArea::effectiveHorizontalAlignment
+
+ Gets the effective horizontal alignment of the text within the TextArea item's width.
+
+ To set/get the default horizontal alignment of TextArea, use the property \c horizontalAlignment.
+
+ */
+ readonly property alias effectiveHorizontalAlignment: edit.effectiveHorizontalAlignment
+
+ /*!
+ \qmlproperty enumeration TextArea::verticalAlignment
+
+ Sets the alignment of the text within the TextArea item's height.
+
+ The valid values for \c verticalAlignment are:
+ \list
+ \li TextEdit.AlignTop
+ \li TextEdit.AlignBottom
+ \li TextEdit.AlignVCenter (Default)
+ \endlist
+ */
+ property alias verticalAlignment: edit.verticalAlignment
+
+ /*!
+ \qmlproperty enumeration TextArea::inputMethodHints
+
+ Provides hints to the input method about the expected content of the text edit, and how it
+ should operate.
+
+ The value is a bit-wise combination of flags or Qt.ImhNone if no hints are set.
+
+ The default value is \c Qt.ImhNone.
+
+ Flags that alter behavior are:
+
+ \list
+ \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.
+ \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method
+ in any persistent storage like predictive user dictionary.
+ \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case
+ when a sentence ends.
+ \li Qt.ImhPreferNumbers - Numbers are preferred (but not required).
+ \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required).
+ \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required).
+ \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing.
+
+ \li Qt.ImhDate - The text editor functions as a date field.
+ \li Qt.ImhTime - The text editor functions as a time field.
+ \endlist
+
+ Flags that restrict input (exclusive flags) are:
+
+ \list
+ \li Qt.ImhDigitsOnly - Only digits are allowed.
+ \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.
+ \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed.
+ \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed.
+ \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.
+ \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.
+ \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.
+ \endlist
+
+ Masks:
+
+ \list
+ \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
+ \endlist
+ */
+ property alias inputMethodHints: edit.inputMethodHints
+
+ /*!
+ \qmlproperty int TextArea::length
+
+ Returns the total number of plain text characters in the TextArea item.
+
+ As this number doesn't include any formatting markup, it may not be the same as the
+ length of the string returned by the \l text property.
+
+ This property can be faster than querying the length the \l text property as it doesn't
+ require any copying or conversion of the TextArea's internal string data.
+ */
+ readonly property alias length: edit.length
+
+ /*!
+ \qmlproperty int TextArea::lineCount
+
+ Returns the total number of lines in the TextArea item.
+ */
+ readonly property alias lineCount: edit.lineCount
+
+ /*!
+ \qmlproperty bool TextArea::readOnly
+
+ Whether the user can interact with the TextArea item.
+
+ The difference from a disabled text field is that it will appear
+ to be active, and text can be selected and copied.
+
+ If this property is set to \c true, the text cannot be edited by user interaction.
+
+ By default this property is \c false.
+ */
+ property alias readOnly: edit.readOnly
+
+ /*!
+ \qmlproperty string TextArea::selectedText
+
+ This read-only property provides the text currently selected in the
+ text edit.
+ */
+ readonly property alias selectedText: edit.selectedText
+
+ /*!
+ \qmlproperty int TextArea::selectionEnd
+
+ The cursor position after the last character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionStart, cursorPosition, selectedText
+ */
+ readonly property alias selectionEnd: edit.selectionEnd
+
+ /*!
+ \qmlproperty int TextArea::selectionStart
+
+ The cursor position before the first character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionEnd, cursorPosition, selectedText
+ */
+ readonly property alias selectionStart: edit.selectionStart
+
+ /*!
+ \qmlproperty bool TextArea::tabChangesFocus
+
+ This property holds whether Tab changes focus, or is accepted as input.
+
+ Defaults to \c false.
+ */
+ property bool tabChangesFocus: false
+
+ /*!
+ \qmlproperty string TextArea::text
+
+ The text to display. If the text format is AutoText the text edit will
+ automatically determine whether the text should be treated as
+ rich text. This determination is made using Qt::mightBeRichText().
+ */
+ property alias text: edit.text
+
+ /*!
+ \qmlproperty enumeration TextArea::textFormat
+
+ The way the text property should be displayed.
+
+ \list
+ \li TextEdit.AutoText
+ \li TextEdit.PlainText
+ \li TextEdit.RichText
+ \endlist
+
+ The default is TextEdit.PlainText. If the text format is TextEdit.AutoText the text edit
+ will automatically determine whether the text should be treated as
+ rich text. This determination is made using Qt::mightBeRichText().
+ */
+ property alias textFormat: edit.textFormat
+
+ /*!
+ \qmlproperty enumeration TextArea::wrapMode
+
+ Set this property to wrap the text to the TextArea item's width.
+ The text will only wrap if an explicit width has been set.
+
+ \list
+ \li TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.
+ \li TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.
+ \li TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
+ \li TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
+ \endlist
+
+ The default is \c TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap.
+ */
+ property alias wrapMode: edit.wrapMode
+
+ /*!
+ \qmlproperty bool TextArea::selectByMouse
+
+ This property determines if the user can select the text with the
+ mouse.
+
+ The default value is \c true.
+ */
+ property alias selectByMouse: edit.selectByMouse
+
+ /*!
+ \qmlproperty bool TextArea::selectByKeyboard
+
+ This property determines if the user can select the text with the
+ keyboard.
+
+ If set to \c true, the user can use the keyboard to select the text
+ even if the editor is read-only. If set to \c false, the user cannot
+ use the keyboard to select the text even if the editor is editable.
+
+ The default value is \c true when the editor is editable,
+ and \c false when read-only.
+
+ \sa readOnly
+ */
+ property alias selectByKeyboard: edit.selectByKeyboard
+
+ /*!
+ \qmlsignal TextArea::linkActivated(string link)
+
+ This signal is emitted when the user clicks on a link embedded in the text.
+ The link must be in rich text or HTML format and the
+ \a link string provides access to the particular link.
+ */
+ signal linkActivated(string link)
+
+ /*!
+ \qmlsignal TextArea::linkHovered(string link)
+ \since 5.2
+
+ This signal is emitted when the user hovers a link embedded in the text.
+ The link must be in rich text or HTML format and the
+ \a link string provides access to the particular link.
+
+ \sa hoveredLink
+ */
+ signal linkHovered(string link)
+
+ /*!
+ \qmlproperty string TextArea::hoveredLink
+ \since QtQuick.Controls 1.1
+
+ This property contains the link string when user hovers a link
+ embedded in the text. The link must be in rich text or HTML format
+ and the link string provides access to the particular link.
+
+ \sa onLinkHovered
+ */
+ readonly property alias hoveredLink: edit.hoveredLink
+
+ /*!
+ \qmlmethod TextArea::append(string)
+
+ Appends \a string as a new line to the end of the text area.
+ */
+ function append (string) {
+ edit.append(string)
+ __verticalScrollBar.value = __verticalScrollBar.maximumValue
+ }
+
+ /*!
+ \qmlmethod TextArea::copy()
+
+ Copies the currently selected text to the system clipboard.
+ */
+ function copy() {
+ edit.copy();
+ }
+
+ /*!
+ \qmlmethod TextArea::cut()
+
+ Moves the currently selected text to the system clipboard.
+ */
+ function cut() {
+ edit.cut();
+ }
+
+ /*!
+ \qmlmethod TextArea::deselect()
+
+ Removes active text selection.
+ */
+ function deselect() {
+ edit.deselect();
+ }
+
+ /*!
+ \qmlmethod string TextArea::getFormattedText(int start, int end)
+
+ Returns the section of text that is between the \a start and \a end positions.
+
+ The returned text will be formatted according to the \l textFormat property.
+ */
+ function getFormattedText(start, end) {
+ return edit.getFormattedText(start, end);
+ }
+
+ /*!
+ \qmlmethod string TextArea::getText(int start, int end)
+
+ Returns the section of text that is between the \a start and \a end positions.
+
+ The returned text does not include any rich text formatting.
+ */
+ function getText(start, end) {
+ return edit.getText(start, end);
+ }
+
+ /*!
+ \qmlmethod TextArea::insert(int position, string text)
+
+ Inserts \a text into the TextArea at position.
+ */
+ function insert(position, text) {
+ edit.insert(position, text);
+ }
+
+ /*!
+ \qmlmethod TextArea::isRightToLeft(int start, int end)
+
+ Returns true if the natural reading direction of the editor text
+ found between positions \a start and \a end is right to left.
+ */
+ function isRightToLeft(start, end) {
+ return edit.isRightToLeft(start, end);
+ }
+
+ /*!
+ \qmlmethod TextArea::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters)
+
+ Moves the cursor to \a position and updates the selection according to the optional \a mode
+ parameter. (To only move the cursor, set the \l cursorPosition property.)
+
+ When this method is called it additionally sets either the
+ selectionStart or the selectionEnd (whichever was at the previous cursor position)
+ to the specified position. This allows you to easily extend and contract the selected
+ text range.
+
+ The selection mode specifies whether the selection is updated on a per character or a per word
+ basis. If not specified the selection mode will default to TextEdit.SelectCharacters.
+
+ \list
+ \li TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
+ the previous cursor position) to the specified position.
+ \li TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all
+ words between the specified position and the previous cursor position. Words partially in the
+ range are included.
+ \endlist
+
+ For example, take this sequence of calls:
+
+ \code
+ cursorPosition = 5
+ moveCursorSelection(9, TextEdit.SelectCharacters)
+ moveCursorSelection(7, TextEdit.SelectCharacters)
+ \endcode
+
+ This moves the cursor to the 5th position, extends the selection end from 5 to 9,
+ and then retracts the selection end from 9 to 7, leaving the text from the 5th
+ position to the 7th position selected (the 6th and 7th characters).
+
+ The same sequence with TextEdit.SelectWords will extend the selection start to a word boundary
+ before or on the 5th position, and extend the selection end to a word boundary on or past the 9th position.
+ */
+ function moveCursorSelection(position, mode) {
+ edit.moveCursorSelection(position, mode);
+ }
+
+ /*!
+ \qmlmethod TextArea::paste()
+
+ Replaces the currently selected text by the contents of the system clipboard.
+ */
+ function paste() {
+ edit.paste();
+ }
+
+ /*!
+ \qmlmethod int TextArea::positionAt(int x, int y)
+
+ Returns the text position closest to pixel position (\a x, \a y).
+
+ Position 0 is before the first character, position 1 is after the first character
+ but before the second, and so on until position \l {text}.length, which is after all characters.
+ */
+ function positionAt(x, y) {
+ return edit.positionAt(x, y);
+ }
+
+ /*!
+ \qmlmethod rectangle TextArea::positionToRectangle(position)
+
+ Returns the rectangle at the given \a position in the text. The x, y,
+ and height properties correspond to the cursor that would describe
+ that position.
+ */
+ function positionToRectangle(position) {
+ return edit.positionToRectangle(position);
+ }
+
+ /*!
+ \qmlmethod TextArea::redo()
+
+ Redoes the last operation if redo is \l {canRedo}{available}.
+ */
+ function redo() {
+ edit.redo();
+ }
+
+ /*!
+ \qmlmethod string TextArea::remove(int start, int end)
+
+ Removes the section of text that is between the \a start and \a end positions from the TextArea.
+ */
+ function remove(start, end) {
+ return edit.remove(start, end);
+ }
+
+ /*!
+ \qmlmethod TextArea::select(int start, int end)
+
+ Causes the text from \a start to \a end to be selected.
+
+ If either start or end is out of range, the selection is not changed.
+
+ After calling this, selectionStart will become the lesser
+ and selectionEnd will become the greater (regardless of the order passed
+ to this method).
+
+ \sa selectionStart, selectionEnd
+ */
+ function select(start, end) {
+ edit.select(start, end);
+ }
+
+ /*!
+ \qmlmethod TextArea::selectAll()
+
+ Causes all text to be selected.
+ */
+ function selectAll() {
+ edit.selectAll();
+ }
+
+ /*!
+ \qmlmethod TextArea::selectWord()
+
+ Causes the word closest to the current cursor position to be selected.
+ */
+ function selectWord() {
+ edit.selectWord();
+ }
+
+ /*!
+ \qmlmethod TextArea::undo()
+
+ Undoes the last operation if undo is \l {canUndo}{available}. Deselects any
+ current selection, and updates the selection start to the current cursor
+ position.
+ */
+ function undo() {
+ edit.undo();
+ }
+
+ /*! \qmlproperty bool TextArea::backgroundVisible
+
+ This property determines if the background should be filled or not.
+
+ The default value is \c true.
+ */
+ property alias backgroundVisible: colorRect.visible
+
+ /*! \internal */
+ default property alias data: area.data
+
+ /*! \qmlproperty real TextArea::textMargin
+ \since QtQuick.Controls 1.1
+
+ The margin, in pixels, around the text in the TextArea.
+ */
+ property alias textMargin: edit.textMargin
+
+ frameVisible: true
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.EditableText
+
+ style: Qt.createComponent(Settings.style + "/TextAreaStyle.qml", area)
+
+ /*!
+ \qmlproperty TextDocument TextArea::textDocument
+
+ This property exposes the \l QQuickTextDocument of this TextArea.
+ \sa TextEdit::textDocument
+ */
+ property alias textDocument: edit.textDocument
+
+ Flickable {
+ id: flickable
+
+ interactive: false
+ anchors.fill: parent
+
+ TextEdit {
+ id: edit
+ focus: true
+
+ Rectangle {
+ id: colorRect
+ parent: viewport
+ anchors.fill: parent
+ color: __style ? __style.backgroundColor : "white"
+ z: -1
+ }
+
+ property int layoutRecursionDepth: 0
+
+ function doLayout() {
+ // scrollbars affect the document/viewport size and vice versa, so we
+ // must allow the layout loop to recurse twice until the sizes stabilize
+ if (layoutRecursionDepth <= 2) {
+ layoutRecursionDepth++
+
+ if (wrapMode == TextEdit.NoWrap) {
+ __horizontalScrollBar.visible = edit.contentWidth > viewport.width
+ edit.width = Math.max(viewport.width, edit.contentWidth)
+ } else {
+ __horizontalScrollBar.visible = false
+ edit.width = viewport.width
+ }
+ edit.height = Math.max(viewport.height, edit.contentHeight)
+
+ flickable.contentWidth = edit.contentWidth
+ flickable.contentHeight = edit.contentHeight
+
+ layoutRecursionDepth--
+ }
+ }
+
+ Connections {
+ target: area.viewport
+ onWidthChanged: edit.doLayout()
+ onHeightChanged: edit.doLayout()
+ }
+ onContentWidthChanged: edit.doLayout()
+ onContentHeightChanged: edit.doLayout()
+ onWrapModeChanged: edit.doLayout()
+
+ renderType: __style ? __style.renderType : Text.NativeRendering
+ font: __style ? __style.font : font
+ color: __style ? __style.textColor : "darkgray"
+ selectionColor: __style ? __style.selectionColor : "darkred"
+ selectedTextColor: __style ? __style.selectedTextColor : "white"
+ wrapMode: TextEdit.WordWrap
+ textMargin: 4
+
+ selectByMouse: true
+ readOnly: false
+
+ KeyNavigation.priority: KeyNavigation.BeforeItem
+ KeyNavigation.tab: area.tabChangesFocus ? area.KeyNavigation.tab : null
+ KeyNavigation.backtab: area.tabChangesFocus ? area.KeyNavigation.backtab : null
+
+ // keep textcursor within scroll view
+ onCursorPositionChanged: {
+ if (cursorRectangle.y >= flickableItem.contentY + viewport.height - cursorRectangle.height - textMargin) {
+ // moving down
+ flickableItem.contentY = cursorRectangle.y - viewport.height + cursorRectangle.height + textMargin
+ } else if (cursorRectangle.y < flickableItem.contentY) {
+ // moving up
+ flickableItem.contentY = cursorRectangle.y - textMargin
+ }
+
+ if (cursorRectangle.x >= flickableItem.contentX + viewport.width - textMargin) {
+ // moving right
+ flickableItem.contentX = cursorRectangle.x - viewport.width + textMargin
+ } else if (cursorRectangle.x < flickableItem.contentX) {
+ // moving left
+ flickableItem.contentX = cursorRectangle.x - textMargin
+ }
+ }
+ onLinkActivated: area.linkActivated(link)
+ onLinkHovered: area.linkHovered(link)
+
+ MouseArea {
+ parent: area.viewport
+ anchors.fill: parent
+ cursorShape: edit.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
+ acceptedButtons: Qt.NoButton
+ }
+ }
+ }
+
+ Keys.onPressed: {
+ if (event.key == Qt.Key_PageUp) {
+ __verticalScrollBar.value -= area.height
+ } else if (event.key == Qt.Key_PageDown)
+ __verticalScrollBar.value += area.height
+ }
+
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextField.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextField.qml
new file mode 100644
index 0000000000..0961430d52
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextField.qml
@@ -0,0 +1,609 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TextField
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Displays a single line of editable plain text.
+
+ TextField is used to accept a line of text input. Input constraints can be
+ placed on a TextField item (for example, through a \l validator or \l
+ inputMask). Setting \l echoMode to an appropriate value enables
+ TextField to be used for a password input field.
+
+ You can create a custom appearance for a TextField by
+ assigning a \l {QtQuick.Controls.Styles::TextFieldStyle}{TextFieldStyle}.
+
+ \sa TextArea, TextInput
+*/
+
+Control {
+ id: textfield
+
+ /*!
+ \qmlproperty bool TextField::acceptableInput
+
+ Returns \c true if the text field contains acceptable
+ text.
+
+ If a validator or input mask was set, this property will return \c
+ true if the current text satisfies the validator or mask as
+ a final string (not as an intermediate string).
+
+ The default value is \c true.
+
+ \sa validator, inputMask, accepted
+
+ */
+ readonly property alias acceptableInput: textInput.acceptableInput // read only
+
+ /*!
+ \qmlproperty bool TextField::activeFocusOnPress
+
+ This property is set to \c true if the TextField should gain active
+ focus on a mouse press.
+
+ The default value is \c true.
+ */
+ property alias activeFocusOnPress: textInput.activeFocusOnPress
+
+ /*!
+ \qmlproperty bool TextField::canPaste
+
+ Returns \c true if the TextField is writable and the content of the
+ clipboard is suitable for pasting into the TextField.
+ */
+ readonly property alias canPaste: textInput.canPaste
+
+ /*!
+ \qmlproperty bool TextField::canRedo
+
+ Returns \c true if the TextField is writable and there are \l
+ {undo}{undone} operations that can be redone.
+ */
+ readonly property alias canRedo: textInput.canRedo
+
+ /*!
+ \qmlproperty bool TextField::canUndo
+
+ Returns \c true if the TextField is writable and there are previous
+ operations that can be undone.
+ */
+ readonly property alias canUndo: textInput.canUndo
+
+ /*!
+ \qmlproperty color TextField::textColor
+
+ This property holds the text color.
+ */
+ property alias textColor: textInput.color
+
+ /*!
+ \qmlproperty int TextField::cursorPosition
+
+ This property holds the position of the cursor in the TextField.
+ */
+ property alias cursorPosition: textInput.cursorPosition
+
+ /*!
+ \qmlproperty string TextField::displayText
+
+ This property holds the text displayed in the TextField.
+
+ If \l echoMode is set to TextInput::Normal, this holds the
+ same value as the TextField::text property. Otherwise,
+ this property holds the text visible to the user, while
+ the \l text property holds the actual entered text.
+ */
+ readonly property alias displayText: textInput.displayText
+
+ /*!
+ \qmlproperty enumeration TextField::echoMode
+
+ Specifies how the text should be displayed in the
+ TextField.
+
+ The possible modes are:
+ \list
+ \li TextInput.Normal - Displays the text as it is. (Default)
+ \li TextInput.Password - Displays asterisks instead of characters.
+ \li TextInput.NoEcho - Displays nothing.
+ \li TextInput.PasswordEchoOnEdit - Displays characters as they are
+ entered while editing, otherwise displays asterisks.
+ \endlist
+ */
+ property alias echoMode: textInput.echoMode
+
+ /*!
+ \qmlproperty font TextField::font
+
+ Sets the font of the TextField.
+ */
+ property alias font: textInput.font
+
+ /*!
+ \qmlproperty enumeration TextField::horizontalAlignment
+
+ Sets the alignment of the text within the TextField item's width.
+
+ By default, the horizontal text alignment follows the natural alignment
+ of the text, for example text that is read from left to right will be
+ aligned to the left.
+
+ The possible alignment values are:
+ \list
+ \li TextInput.AlignLeft
+ \li TextInput.AlignRight
+ \li TextInput.AlignHCenter
+ \endlist
+
+ When using the attached property, LayoutMirroring::enabled, to mirror
+ application layouts, the horizontal alignment of text will also be
+ mirrored. However, the property \c horizontalAlignment will remain
+ unchanged. To query the effective horizontal alignment of TextField, use
+ the read-only property \c effectiveHorizontalAlignment.
+ */
+ property alias horizontalAlignment: textInput.horizontalAlignment
+
+ /*!
+ \qmlproperty enumeration TextField::effectiveHorizontalAlignment
+
+ Gets the effective horizontal alignment of the text within the TextField
+ item's width.
+
+ \l horizontalAlignment contains the default horizontal alignment.
+
+ \sa horizontalAlignment
+
+ */
+ readonly property alias effectiveHorizontalAlignment: textInput.effectiveHorizontalAlignment
+
+ /*!
+ \qmlproperty enumeration TextField::verticalAlignment
+
+ Sets the alignment of the text within the TextField item's height.
+
+ The possible alignment values are:
+ \list
+ \li TextInput.AlignTop
+ \li TextInput.AlignBottom
+ \li TextInput.AlignVCenter (default).
+ \endlist
+ */
+ property alias verticalAlignment: textInput.verticalAlignment
+
+ /*!
+ \qmlproperty string TextField::inputMask
+
+ Sets an input mask on the TextField, restricting the allowable text
+ inputs. See QLineEdit::inputMask for further details, as the exact same
+ mask strings are used by TextField.
+
+ \sa acceptableInput, validator
+ */
+ property alias inputMask: textInput.inputMask
+
+ /*!
+ \qmlproperty enumeration TextField::inputMethodHints
+
+ Provides hints to the input method about the expected content of the
+ text field and how it should operate.
+
+ The value is a bit-wise combination of flags, or \c Qt.ImhNone if no
+ hints are set.
+
+ The default value is \c Qt.ImhNone.
+
+ Flags that alter behavior are:
+
+ \list
+ \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.
+ This is automatically set when setting echoMode to \c TextInput.Password.
+ \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method
+ in any persistent storage like predictive user dictionary.
+ \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case
+ when a sentence ends.
+ \li Qt.ImhPreferNumbers - Numbers are preferred (but not required).
+ \li Qt.ImhPreferUppercase - Uppercase letters are preferred (but not required).
+ \li Qt.ImhPreferLowercase - Lowercase letters are preferred (but not required).
+ \li Qt.ImhNoPredictiveText - Do not use predictive text (for example, dictionary lookup) while typing.
+
+ \li Qt.ImhDate - The text editor functions as a date field.
+ \li Qt.ImhTime - The text editor functions as a time field.
+ \endlist
+
+ Flags that restrict input (exclusive flags) are:
+
+ \list
+ \li Qt.ImhDigitsOnly - Only digits are allowed.
+ \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.
+ \li Qt.ImhUppercaseOnly - Only uppercase letter input is allowed.
+ \li Qt.ImhLowercaseOnly - Only lowercase letter input is allowed.
+ \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.
+ \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.
+ \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.
+ \endlist
+
+ Masks:
+ \list
+ \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
+ \endlist
+ */
+ property alias inputMethodHints: textInput.inputMethodHints
+
+ /*!
+ \qmlproperty int TextField::length
+
+ Returns the total number of characters in the TextField item.
+
+ If the TextField has an input mask, the length will include mask
+ characters and may differ from the length of the string returned by the
+ \l text property.
+
+ This property can be faster than querying the length of the \l text
+ property as it doesn't require any copying or conversion of the
+ TextField's internal string data.
+ */
+ readonly property alias length: textInput.length
+
+ /*!
+ \qmlproperty int TextField::maximumLength
+
+ This property holds the maximum permitted length of the text in the
+ TextField.
+
+ If the text is too long, it is truncated at the limit.
+ */
+ property alias maximumLength: textInput.maximumLength
+
+ /*!
+ \qmlproperty string TextField::placeholderText
+
+ This property contains the text that is shown in the text field when the
+ text field is empty and has no focus.
+ */
+ property alias placeholderText: placeholderTextComponent.text
+
+ /*!
+ \qmlproperty bool TextField::readOnly
+
+ Sets whether user input can modify the contents of the TextField. Read-
+ only is different from a disabled text field in that the text field will
+ appear to be active and text can still be selected and copied.
+
+ If readOnly is set to \c true, then user input will not affect the text.
+ Any bindings or attempts to set the text property will still
+ work, however.
+ */
+ property alias readOnly: textInput.readOnly
+
+ /*!
+ \qmlproperty string TextField::selectedText
+
+ Provides the text currently selected in the text input.
+
+ It is equivalent to the following snippet, but is faster and easier
+ to use.
+
+ \code
+ myTextField.text.toString().substring(myTextField.selectionStart, myTextField.selectionEnd);
+ \endcode
+ */
+ readonly property alias selectedText: textInput.selectedText
+
+ /*!
+ \qmlproperty int TextField::selectionEnd
+
+ The cursor position after the last character in the current selection.
+
+ This property is read-only. To change the selection, use
+ select(start,end), selectAll(), or selectWord().
+
+ \sa selectionStart, cursorPosition, selectedText
+ */
+ readonly property alias selectionEnd: textInput.selectionEnd
+
+ /*!
+ \qmlproperty int TextField::selectionStart
+
+ The cursor position before the first character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionEnd, cursorPosition, selectedText
+ */
+ readonly property alias selectionStart: textInput.selectionStart
+
+ /*!
+ \qmlproperty string TextField::text
+
+ This property contains the text in the TextField.
+ */
+ property alias text: textInput.text
+
+ /*!
+ \qmlproperty Validator TextField::validator
+
+ Allows you to set a validator on the TextField. When a validator is set,
+ the TextField will only accept input which leaves the text property in
+ an intermediate state. The accepted signal will only be sent
+ if the text is in an acceptable state when enter is pressed.
+
+ Currently supported validators are \l{QtQuick2::IntValidator},
+ \l{QtQuick2::DoubleValidator}, and \l{QtQuick2::RegExpValidator}. An
+ example of using validators is shown below, which allows input of
+ integers between 11 and 31 into the text input:
+
+ \code
+ import QtQuick 2.1
+ import QtQuick.Controls 1.1
+
+ TextField {
+ validator: IntValidator {bottom: 11; top: 31;}
+ focus: true
+ }
+ \endcode
+
+ \sa acceptableInput, inputMask, accepted
+ */
+ property alias validator: textInput.validator
+
+ /*!
+ \qmlsignal TextField::accepted()
+
+ This signal is emitted when the Return or Enter key is pressed.
+ Note that if there is a \l validator or \l inputMask set on the text
+ field, the signal will only be emitted if the input is in an acceptable
+ state.
+ */
+ signal accepted()
+
+ /*!
+ \qmlsignal TextField::editingFinished()
+ \since 5.2
+
+ This signal is emitted when the Return or Enter key is pressed or
+ the text field loses focus. Note that if there is a validator or
+ inputMask set on the text field and enter/return is pressed, this
+ signal will only be emitted if the input follows
+ the inputMask and the validator returns an acceptable state.
+ */
+ signal editingFinished()
+
+ /*!
+ \qmlmethod TextField::copy()
+
+ Copies the currently selected text to the system clipboard.
+ */
+ function copy() {
+ textInput.copy()
+ }
+
+ /*!
+ \qmlmethod TextField::cut()
+
+ Moves the currently selected text to the system clipboard.
+ */
+ function cut() {
+ textInput.cut()
+ }
+
+ /*!
+ \qmlmethod TextField::deselect()
+
+ Removes active text selection.
+ */
+ function deselect() {
+ textInput.deselect();
+ }
+
+ /*!
+ \qmlmethod string TextField::getText(int start, int end)
+
+ Removes the section of text that is between the \a start and \a end
+ positions from the TextField.
+ */
+ function getText(start, end) {
+ return textInput.getText(start, end);
+ }
+
+ /*!
+ \qmlmethod TextField::insert(int position, string text)
+
+ Inserts \a text into the TextField at \a position.
+ */
+ function insert(position, text) {
+ textInput.insert(position, text);
+ }
+
+ /*!
+ \qmlmethod bool TextField::isRightToLeft(int start, int end)
+
+ Returns \c true if the natural reading direction of the editor text
+ found between positions \a start and \a end is right to left.
+ */
+ function isRightToLeft(start, end) {
+ return textInput.isRightToLeft(start, end);
+ }
+
+ /*!
+ \qmlmethod TextField::paste()
+
+ Replaces the currently selected text by the contents of the system
+ clipboard.
+ */
+ function paste() {
+ textInput.paste()
+ }
+
+ /*!
+ \qmlmethod TextField::redo()
+
+ Performs the last operation if redo is \l {canRedo}{available}.
+ */
+ function redo() {
+ textInput.redo();
+ }
+
+ /*!
+ \qmlmethod TextField::select(int start, int end)
+
+ Causes the text from \a start to \a end to be selected.
+
+ If either start or end is out of range, the selection is not changed.
+
+ After calling select, selectionStart will become the lesser
+ and selectionEnd will become the greater (regardless of the order passed
+ to this method).
+
+ \sa selectionStart, selectionEnd
+ */
+ function select(start, end) {
+ textInput.select(start, end)
+ }
+
+ /*!
+ \qmlmethod TextField::selectAll()
+
+ Causes all text to be selected.
+ */
+ function selectAll() {
+ textInput.selectAll()
+ }
+
+ /*!
+ \qmlmethod TextField::selectWord()
+
+ Causes the word closest to the current cursor position to be selected.
+ */
+ function selectWord() {
+ textInput.selectWord()
+ }
+
+ /*!
+ \qmlmethod TextField::undo()
+
+ Reverts the last operation if undo is \l {canUndo}{available}. undo()
+ deselects any current selection and updates the selection start to the
+ current cursor position.
+ */
+ function undo() {
+ textInput.undo();
+ }
+
+ /*! \qmlproperty bool TextField::hovered
+
+ This property holds whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*! \internal */
+ property alias __contentHeight: textInput.contentHeight
+
+ /*! \internal */
+ property alias __contentWidth: textInput.contentWidth
+
+ style: Qt.createComponent(Settings.style + "/TextFieldStyle.qml", textInput)
+
+ activeFocusOnTab: true
+
+ Accessible.name: text
+ Accessible.role: Accessible.EditableText
+ Accessible.description: placeholderText
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.IBeamCursor
+ onClicked: textfield.forceActiveFocus()
+ }
+
+ Text {
+ id: placeholderTextComponent
+ anchors.fill: textInput
+ font: textInput.font
+ horizontalAlignment: textInput.horizontalAlignment
+ verticalAlignment: textInput.verticalAlignment
+ opacity: !textInput.text.length && !textInput.inputMethodComposing ? 1 : 0
+ color: __panel ? __panel.placeholderTextColor : "darkgray"
+ clip: contentWidth > width;
+ elide: Text.ElideRight
+ renderType: __style ? __style.renderType : Text.NativeRendering
+ Behavior on opacity { NumberAnimation { duration: 90 } }
+ }
+
+ TextInput {
+ id: textInput
+ focus: true
+ selectByMouse: true
+ selectionColor: __panel ? __panel.selectionColor : "darkred"
+ selectedTextColor: __panel ? __panel.selectedTextColor : "white"
+
+ font: __panel ? __panel.font : font
+ anchors.leftMargin: __panel ? __panel.leftMargin : 0
+ anchors.topMargin: __panel ? __panel.topMargin : 0
+ anchors.rightMargin: __panel ? __panel.rightMargin : 0
+ anchors.bottomMargin: __panel ? __panel.bottomMargin : 0
+
+ anchors.fill: parent
+ verticalAlignment: Text.AlignVCenter
+
+ color: __panel ? __panel.textColor : "darkgray"
+ clip: contentWidth > width
+
+ renderType: __style ? __style.renderType : Text.NativeRendering
+
+ onAccepted: {
+ Qt.inputMethod.commit()
+ Qt.inputMethod.hide()
+ textfield.accepted()
+ }
+
+ onEditingFinished: textfield.editingFinished()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolBar.qml
new file mode 100644
index 0000000000..1a4c7cb65f
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolBar.qml
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ToolBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup applicationwindow
+ \brief Contains ToolButton and related controls.
+
+ The common way of using ToolBar is in relation to \l ApplicationWindow. It
+ provides styling and is generally designed to work well with ToolButton as
+ well as other controls.
+
+ Note that the ToolBar does not provide a layout of its own, but requires
+ you to position its contents, for instance by creating a \l RowLayout.
+
+ If only a single item is used within the ToolBar, it will resize to fit the implicitHeight
+ of its contained item. This makes it particularly suitable for use together with layouts.
+ Otherwise the height is platform dependent.
+
+ \code
+ import QtQuick.Controls 1.1
+ import QtQuick.Layouts 1.0
+
+ ApplicationWindow {
+ toolBar: ToolBar {
+ RowLayout {
+ ToolButton { ... }
+ ToolButton { ... }
+ ToolButton { ... }
+ }
+ }
+ }
+ \endcode
+*/
+
+Item {
+ id: toolbar
+
+ activeFocusOnTab: false
+ Accessible.role: Accessible.ToolBar
+ LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
+ LayoutMirroring.childrenInherit: true
+
+ width: parent ? parent.width : implicitWidth
+ implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
+ implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight()
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/ToolBarStyle.qml", toolbar)
+
+ /*! \internal */
+ property alias __style: styleLoader.item
+
+ /*! \internal */
+ default property alias __content: container.data
+
+ /*!
+ \qmlproperty Item ToolBar::contentItem
+
+ This property holds the content Item of the tool bar.
+
+ Items declared as children of a ToolBar are automatically parented to the ToolBar's contentItem.
+ Items created dynamically need to be explicitly parented to the contentItem:
+
+ \note The implicit size of the ToolBar is calculated based on the size of its content. If you want to anchor
+ items inside the tool bar, you must specify an explicit width and height on the ToolBar itself.
+ */
+ readonly property alias contentItem: container
+
+ data: [
+ Loader {
+ id: loader
+ anchors.fill: parent
+ sourceComponent: styleLoader.item ? styleLoader.item.panel : null
+ onLoaded: item.z = -1
+ Loader {
+ id: styleLoader
+ property alias __control: toolbar
+ sourceComponent: style
+ }
+ },
+ Item {
+ id: container
+ z: 1
+ focus: true
+ anchors.fill: parent
+
+ anchors.topMargin: topMargin
+ anchors.leftMargin: leftMargin
+ anchors.rightMargin: rightMargin
+ anchors.bottomMargin: bottomMargin
+
+ property int topMargin: __style ? __style.padding.top : 0
+ property int bottomMargin: __style ? __style.padding.bottom : 0
+ property int leftMargin: __style ? __style.padding.left : 0
+ property int rightMargin: __style ? __style.padding.right : 0
+
+ property Item layoutItem: container.children.length === 1 ? container.children[0] : null
+ function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) :
+ loader.item ? loader.item.implicitWidth : 0) }
+ function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) :
+ loader.item ? loader.item.implicitHeight : 0) }
+ }]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolButton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolButton.qml
new file mode 100644
index 0000000000..0ff62ec45a
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolButton.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ToolButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Provides a button type that is typically used within a ToolBar.
+
+ ToolButton is functionally similar to \l Button, but can provide a look that is more
+ suitable within a \l ToolBar.
+
+ \code
+ ToolButton {
+ iconSource: "edit-cut.png"
+ }
+ \endcode
+
+ You can create a custom appearance for a ToolButton by
+ assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}.
+*/
+
+Button {
+ id: button
+ style: Qt.createComponent(Settings.style + "/ToolButtonStyle.qml", button)
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/plugins.qmltypes
new file mode 100644
index 0000000000..eadb72efb7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/plugins.qmltypes
@@ -0,0 +1,1889 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated with the command 'qmlplugindump -nonrelocatable QtQuick.Controls 1.1'.
+
+Module {
+ Component {
+ name: "QQuickAbstractStyle"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/AbstractStyle 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "padding"; type: "QQuickPadding"; isReadonly: true; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickAction"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/Action 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "shortcut"; type: "QVariant" }
+ Signal { name: "triggered" }
+ Signal {
+ name: "toggled"
+ Parameter { name: "checked"; type: "bool" }
+ }
+ Signal {
+ name: "shortcutChanged"
+ Parameter { name: "shortcut"; type: "QVariant" }
+ }
+ Signal { name: "iconChanged" }
+ Signal {
+ name: "tooltipChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method { name: "trigger" }
+ }
+ Component {
+ name: "QQuickControlSettings"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/Settings 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "style"; type: "QUrl"; isReadonly: true }
+ Property { name: "styleName"; type: "string" }
+ Property { name: "stylePath"; type: "string" }
+ Property { name: "dpiScaleFactor"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickExclusiveGroup"
+ defaultProperty: "__actions"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/ExclusiveGroup 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "current"; type: "QObject"; isPointer: true }
+ Property { name: "__actions"; type: "QQuickAction"; isList: true; isReadonly: true }
+ Method {
+ name: "bindCheckable"
+ Parameter { name: "o"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "unbindCheckable"
+ Parameter { name: "o"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickMenu"
+ defaultProperty: "items"
+ prototype: "QQuickMenuText"
+ exports: ["QtQuick.Controls/MenuPrivate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "title"; type: "string" }
+ Property { name: "items"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__selectedIndex"; type: "int" }
+ Property { name: "__popupVisible"; type: "bool"; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__minimumWidth"; type: "int" }
+ Property { name: "__font"; type: "QFont" }
+ Property { name: "__xOffset"; type: "double" }
+ Property { name: "__yOffset"; type: "double" }
+ Signal { name: "__menuClosed" }
+ Signal { name: "popupVisibleChanged" }
+ Method { name: "__closeMenu" }
+ Method { name: "__dismissMenu" }
+ Method { name: "popup" }
+ Method {
+ name: "addItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "insertItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "int" }
+ Parameter { type: "string" }
+ }
+ Method { name: "addSeparator" }
+ Method {
+ name: "insertSeparator"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { type: "int" }
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ Parameter { name: "atActionIndex"; type: "int" }
+ }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickMenuBar"
+ defaultProperty: "menus"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/MenuBarPrivate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Signal { name: "contentItemChanged" }
+ }
+ Component {
+ name: "QQuickMenuBase"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/MenuBase 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "visible"; type: "bool" }
+ Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true }
+ Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickMenuItem"
+ prototype: "QQuickMenuText"
+ exports: ["QtQuick.Controls/MenuItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "shortcut"; type: "QVariant" }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Signal { name: "triggered" }
+ Signal {
+ name: "toggled"
+ Parameter { name: "checked"; type: "bool" }
+ }
+ Method { name: "trigger" }
+ }
+ Component {
+ name: "QQuickMenuItemType"
+ exports: ["QtQuick.Controls/MenuItemType 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "MenuItemType"
+ values: {
+ "Separator": 0,
+ "Item": 1,
+ "Menu": 2
+ }
+ }
+ }
+ Component {
+ name: "QQuickMenuSeparator"
+ prototype: "QQuickMenuBase"
+ exports: ["QtQuick.Controls/MenuSeparator 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickMenuText"
+ prototype: "QQuickMenuBase"
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Signal { name: "__textChanged" }
+ }
+ Component {
+ name: "QQuickPadding"
+ prototype: "QObject"
+ Property { name: "left"; type: "int" }
+ Property { name: "top"; type: "int" }
+ Property { name: "right"; type: "int" }
+ Property { name: "bottom"; type: "int" }
+ Method {
+ name: "setLeft"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setTop"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setRight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setBottom"
+ Parameter { name: "arg"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickRangeModel"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/RangeModel 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "position"; type: "double" }
+ Property { name: "positionAtMinimum"; type: "double" }
+ Property { name: "positionAtMaximum"; type: "double" }
+ Property { name: "inverted"; type: "bool" }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "value"; type: "double" }
+ }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "position"; type: "double" }
+ }
+ Signal {
+ name: "stepSizeChanged"
+ Parameter { name: "stepSize"; type: "double" }
+ }
+ Signal {
+ name: "invertedChanged"
+ Parameter { name: "inverted"; type: "bool" }
+ }
+ Signal {
+ name: "minimumChanged"
+ Parameter { name: "min"; type: "double" }
+ }
+ Signal {
+ name: "maximumChanged"
+ Parameter { name: "max"; type: "double" }
+ }
+ Signal {
+ name: "positionAtMinimumChanged"
+ Parameter { name: "min"; type: "double" }
+ }
+ Signal {
+ name: "positionAtMaximumChanged"
+ Parameter { name: "max"; type: "double" }
+ }
+ Method { name: "toMinimum" }
+ Method { name: "toMaximum" }
+ Method {
+ name: "setValue"
+ Parameter { name: "value"; type: "double" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "double" }
+ }
+ Method {
+ name: "valueForPosition"
+ type: "double"
+ Parameter { name: "position"; type: "double" }
+ }
+ Method {
+ name: "positionForValue"
+ type: "double"
+ Parameter { name: "value"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickSpinBoxValidator"
+ prototype: "QValidator"
+ exports: ["QtQuick.Controls.Private/SpinBoxValidator 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string"; isReadonly: true }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "decimals"; type: "int" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "prefix"; type: "string" }
+ Property { name: "suffix"; type: "string" }
+ Method { name: "increment" }
+ Method { name: "decrement" }
+ }
+ Component {
+ name: "QQuickStack"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/Stack 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "Inactive": 0,
+ "Deactivating": 1,
+ "Activating": 2,
+ "Active": 3
+ }
+ }
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "__index"; type: "int" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "__status"; type: "Status" }
+ Property { name: "view"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "__view"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickStyleItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.Private/StyleItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "sunken"; type: "bool" }
+ Property { name: "raised"; type: "bool" }
+ Property { name: "active"; type: "bool" }
+ Property { name: "selected"; type: "bool" }
+ Property { name: "hasFocus"; type: "bool" }
+ Property { name: "on"; type: "bool" }
+ Property { name: "hover"; type: "bool" }
+ Property { name: "horizontal"; type: "bool" }
+ Property { name: "transient"; type: "bool" }
+ Property { name: "elementType"; type: "string" }
+ Property { name: "text"; type: "string" }
+ Property { name: "activeControl"; type: "string" }
+ Property { name: "style"; type: "string"; isReadonly: true }
+ Property { name: "hints"; type: "QVariantMap" }
+ Property { name: "properties"; type: "QVariantMap" }
+ Property { name: "font"; type: "QFont"; isReadonly: true }
+ Property { name: "minimum"; type: "int" }
+ Property { name: "maximum"; type: "int" }
+ Property { name: "value"; type: "int" }
+ Property { name: "step"; type: "int" }
+ Property { name: "paintMargins"; type: "int" }
+ Property { name: "contentWidth"; type: "int" }
+ Property { name: "contentHeight"; type: "int" }
+ Signal { name: "infoChanged" }
+ Signal { name: "hintChanged" }
+ Signal {
+ name: "contentWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "contentHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "pixelMetric"
+ type: "int"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "styleHint"
+ type: "QVariant"
+ Parameter { type: "string" }
+ }
+ Method { name: "updateSizeHint" }
+ Method { name: "updateRect" }
+ Method { name: "updateItem" }
+ Method {
+ name: "hitTest"
+ type: "string"
+ Parameter { name: "x"; type: "int" }
+ Parameter { name: "y"; type: "int" }
+ }
+ Method {
+ name: "subControlRect"
+ type: "QRectF"
+ Parameter { name: "subcontrolString"; type: "string" }
+ }
+ Method {
+ name: "elidedText"
+ type: "string"
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "elideMode"; type: "int" }
+ Parameter { name: "width"; type: "int" }
+ }
+ Method {
+ name: "hasThemeIcon"
+ type: "bool"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "textWidth"
+ type: "double"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "textHeight"
+ type: "double"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickTooltip"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/Tooltip 1.0"]
+ exportMetaObjectRevisions: [0]
+ Method {
+ name: "showText"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ Parameter { name: "pos"; type: "QPointF" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method { name: "hideText" }
+ }
+ Component {
+ name: "QQuickWheelArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.Private/WheelArea 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "verticalDelta"; type: "double" }
+ Property { name: "horizontalDelta"; type: "double" }
+ Property { name: "horizontalMinimumValue"; type: "double" }
+ Property { name: "horizontalMaximumValue"; type: "double" }
+ Property { name: "verticalMinimumValue"; type: "double" }
+ Property { name: "verticalMaximumValue"; type: "double" }
+ Property { name: "horizontalValue"; type: "double" }
+ Property { name: "verticalValue"; type: "double" }
+ Property { name: "scrollSpeed"; type: "double" }
+ Property { name: "active"; type: "bool" }
+ Signal { name: "verticalWheelMoved" }
+ Signal { name: "horizontalWheelMoved" }
+ }
+ Component {
+ name: "QQuickWindow"
+ defaultProperty: "data"
+ prototype: "QWindow"
+ exports: ["QtQuick.Window/Window 2.0", "QtQuick.Window/Window 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property {
+ name: "activeFocusItem"
+ revision: 1
+ type: "QQuickItem"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal { name: "frameSwapped" }
+ Signal { name: "sceneGraphInitialized" }
+ Signal { name: "sceneGraphInvalidated" }
+ Signal { name: "beforeSynchronizing" }
+ Signal { name: "beforeRendering" }
+ Signal { name: "afterRendering" }
+ Signal {
+ name: "closing"
+ revision: 1
+ Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { type: "QColor" }
+ }
+ Signal { name: "activeFocusItemChanged"; revision: 1 }
+ Method { name: "update" }
+ Method { name: "releaseResources" }
+ }
+ Component {
+ name: "QWindow"
+ prototype: "QObject"
+ Enum {
+ name: "Visibility"
+ values: {
+ "Hidden": 0,
+ "AutomaticVisibility": 1,
+ "Windowed": 2,
+ "Minimized": 3,
+ "Maximized": 4,
+ "FullScreen": 5
+ }
+ }
+ Property { name: "title"; type: "string" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "minimumWidth"; revision: 1; type: "int" }
+ Property { name: "minimumHeight"; revision: 1; type: "int" }
+ Property { name: "maximumWidth"; revision: 1; type: "int" }
+ Property { name: "maximumHeight"; revision: 1; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
+ Signal {
+ name: "screenChanged"
+ Parameter { name: "screen"; type: "QScreen"; isPointer: true }
+ }
+ Signal {
+ name: "modalityChanged"
+ Parameter { name: "modality"; type: "Qt::WindowModality" }
+ }
+ Signal {
+ name: "windowStateChanged"
+ Parameter { name: "windowState"; type: "Qt::WindowState" }
+ }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumWidthChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumHeightChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumWidthChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumHeightChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
+ name: "contentOrientationChanged"
+ revision: 1
+ Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
+ }
+ Signal {
+ name: "focusObjectChanged"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
+ Method {
+ name: "setVisible"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method { name: "showMinimized" }
+ Method { name: "showMaximized" }
+ Method { name: "showFullScreen" }
+ Method { name: "showNormal" }
+ Method { name: "close"; type: "bool" }
+ Method { name: "raise" }
+ Method { name: "lower" }
+ Method {
+ name: "setTitle"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setMinimumWidth"
+ revision: 1
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMinimumHeight"
+ revision: 1
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setMaximumWidth"
+ revision: 1
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMaximumHeight"
+ revision: 1
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "alert"
+ Parameter { name: "msec"; type: "int" }
+ }
+ }
+ Component {
+ prototype: "QQuickWindow"
+ name: "QtQuick.Controls/ApplicationWindow"
+ exports: ["QtQuick.Controls/ApplicationWindow 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "menuBar"; type: "MenuBar_QMLTYPE_1"; isPointer: true }
+ Property { name: "toolBar"; type: "QQuickItem"; isPointer: true }
+ Property { name: "statusBar"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property {
+ name: "activeFocusItem"
+ revision: 1
+ type: "QQuickItem"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal { name: "frameSwapped" }
+ Signal { name: "sceneGraphInitialized" }
+ Signal { name: "sceneGraphInvalidated" }
+ Signal { name: "beforeSynchronizing" }
+ Signal { name: "beforeRendering" }
+ Signal { name: "afterRendering" }
+ Signal {
+ name: "closing"
+ revision: 1
+ Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { type: "QColor" }
+ }
+ Signal { name: "activeFocusItemChanged"; revision: 1 }
+ Method { name: "update" }
+ Method { name: "forcePolish" }
+ Method { name: "releaseResources" }
+ Property { name: "title"; type: "string" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "minimumWidth"; type: "int" }
+ Property { name: "minimumHeight"; type: "int" }
+ Property { name: "maximumWidth"; type: "int" }
+ Property { name: "maximumHeight"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
+ Signal {
+ name: "screenChanged"
+ Parameter { name: "screen"; type: "QScreen"; isPointer: true }
+ }
+ Signal {
+ name: "modalityChanged"
+ Parameter { name: "modality"; type: "Qt::WindowModality" }
+ }
+ Signal {
+ name: "windowStateChanged"
+ Parameter { name: "windowState"; type: "Qt::WindowState" }
+ }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
+ name: "contentOrientationChanged"
+ Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
+ }
+ Signal {
+ name: "focusObjectChanged"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
+ Method {
+ name: "setVisible"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method { name: "showMinimized" }
+ Method { name: "showMaximized" }
+ Method { name: "showFullScreen" }
+ Method { name: "showNormal" }
+ Method { name: "close"; type: "bool" }
+ Method { name: "raise" }
+ Method { name: "lower" }
+ Method {
+ name: "setTitle"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setMinimumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMinimumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setMaximumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMaximumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "alert"
+ revision: 1
+ Parameter { name: "msec"; type: "int" }
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/BusyIndicator"
+ exports: ["QtQuick.Controls/BusyIndicator 1.1"]
+ exportMetaObjectRevisions: [1]
+ defaultProperty: "data"
+ Property { name: "running"; type: "bool" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/Button"
+ exports: ["QtQuick.Controls/Button 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__textColor"; type: "QColor" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "isDefault"; type: "bool" }
+ Property { name: "menu"; type: "Menu_QMLTYPE_16"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/CheckBox"
+ exports: ["QtQuick.Controls/CheckBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checked"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "__cycleStatesHandler"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Property { name: "checkedState"; type: "int" }
+ Property { name: "partiallyCheckedEnabled"; type: "bool" }
+ Property { name: "__ignoreChecked"; type: "bool" }
+ Method { name: "__cycleCheckBoxStates"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ComboBox"
+ exports: ["QtQuick.Controls/ComboBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "textRole"; type: "string" }
+ Property { name: "editable"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "__popup"; type: "QVariant" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentText"; type: "string"; isReadonly: true }
+ Property { name: "editText"; type: "string" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Signal { name: "accepted" }
+ Signal {
+ name: "activated"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "textAt"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "find"
+ type: "QVariant"
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/GroupBox"
+ exports: ["QtQuick.Controls/GroupBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "title"; type: "string" }
+ Property { name: "flat"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "__checkbox"; type: "CheckBox_QMLTYPE_25"; isReadonly: true; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickText"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Text 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextStyle"
+ values: {
+ "Normal": 0,
+ "Outline": 1,
+ "Raised": 2,
+ "Sunken": 3
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2,
+ "StyledText": 4
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Enum {
+ name: "LineHeightMode"
+ values: {
+ "ProportionalHeight": 0,
+ "FixedHeight": 1
+ }
+ }
+ Enum {
+ name: "FontSizeMode"
+ values: {
+ "FixedSize": 0,
+ "HorizontalFit": 1,
+ "VerticalFit": 2,
+ "Fit": 3
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "linkColor"; type: "QColor" }
+ Property { name: "style"; type: "TextStyle" }
+ Property { name: "styleColor"; type: "QColor" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "truncated"; type: "bool"; isReadonly: true }
+ Property { name: "maximumLineCount"; type: "int" }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "elide"; type: "TextElideMode" }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "lineHeight"; type: "double" }
+ Property { name: "lineHeightMode"; type: "LineHeightMode" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "minimumPixelSize"; type: "int" }
+ Property { name: "minimumPointSize"; type: "int" }
+ Property { name: "fontSizeMode"; type: "FontSizeMode" }
+ Property { name: "renderType"; type: "RenderType" }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "styleChanged"
+ Parameter { name: "style"; type: "TextStyle" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "elideModeChanged"
+ Parameter { name: "mode"; type: "TextElideMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "lineHeightChanged"
+ Parameter { name: "lineHeight"; type: "double" }
+ }
+ Signal {
+ name: "lineHeightModeChanged"
+ Parameter { name: "mode"; type: "LineHeightMode" }
+ }
+ Signal {
+ name: "lineLaidOut"
+ Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
+ }
+ Method { name: "doLayout" }
+ }
+
+ Component {
+ prototype: "QQuickText"
+ name: "QtQuick.Controls/Label"
+ exports: ["QtQuick.Controls/Label 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickMenu"
+ name: "QtQuick.Controls/Menu"
+ exports: ["QtQuick.Controls/Menu 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "items"
+ Property { name: "__selfComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__currentIndex"; type: "int" }
+ Property { name: "__menuComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__menuBar"; type: "QVariant" }
+ Method {
+ name: "addMenu"
+ type: "QVariant"
+ Parameter { name: "title"; type: "QVariant" }
+ }
+ Method {
+ name: "insertMenu"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "title"; type: "QVariant" }
+ }
+ Property { name: "title"; type: "string" }
+ Property { name: "items"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__selectedIndex"; type: "int" }
+ Property { name: "__popupVisible"; type: "bool"; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__minimumWidth"; type: "int" }
+ Property { name: "__font"; type: "QFont" }
+ Property { name: "__xOffset"; type: "double" }
+ Property { name: "__yOffset"; type: "double" }
+ Signal { name: "__menuClosed" }
+ Signal { name: "popupVisibleChanged" }
+ Method { name: "__closeMenu" }
+ Method { name: "__dismissMenu" }
+ Method { name: "popup" }
+ Method {
+ name: "addItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "insertItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "int" }
+ Parameter { type: "string" }
+ }
+ Method { name: "addSeparator" }
+ Method {
+ name: "insertSeparator"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { type: "int" }
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ Parameter { name: "atActionIndex"; type: "int" }
+ }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true }
+ Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Signal { name: "__textChanged" }
+ }
+ Component {
+ prototype: "QQuickMenuBar"
+ name: "QtQuick.Controls/MenuBar"
+ exports: ["QtQuick.Controls/MenuBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "menus"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__menuBarComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Signal { name: "contentItemChanged" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ProgressBar"
+ exports: ["QtQuick.Controls/ProgressBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "indeterminate"; type: "bool" }
+ Property { name: "orientation"; type: "int" }
+ Property { name: "__initialized"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Method {
+ name: "setValue"
+ type: "QVariant"
+ Parameter { name: "v"; type: "QVariant" }
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/RadioButton"
+ exports: ["QtQuick.Controls/RadioButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checked"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "__cycleStatesHandler"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ScrollView"
+ exports: ["QtQuick.Controls/ScrollView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "contentItem"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/Slider"
+ exports: ["QtQuick.Controls/Slider 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "orientation"; type: "int" }
+ Property { name: "updateValueWhileDragging"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "tickmarksEnabled"; type: "bool" }
+ Property { name: "__horizontal"; type: "bool" }
+ Property { name: "__handlePos"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "value"; type: "double" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/SpinBox"
+ exports: ["QtQuick.Controls/SpinBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "suffix"; type: "string" }
+ Property { name: "prefix"; type: "string" }
+ Property { name: "decimals"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "__text"; type: "string" }
+ Method { name: "__increment"; type: "QVariant" }
+ Method { name: "__decrement"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/SplitView"
+ exports: ["QtQuick.Controls/SplitView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__contents"
+ Property { name: "orientation"; type: "int" }
+ Property { name: "handleDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "resizing"; type: "bool" }
+ Property { name: "__contents"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__items"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "__handles"; type: "QQuickItem"; isList: true; isReadonly: true }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/StackView"
+ exports: ["QtQuick.Controls/StackView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "busy"; type: "bool"; isReadonly: true }
+ Property { name: "delegate"; type: "StackViewDelegate_QMLTYPE_97"; isPointer: true }
+ Property { name: "__currentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__depth"; type: "int" }
+ Property { name: "__guard"; type: "bool" }
+ Property { name: "invalidItemReplacement"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "initialItem"; type: "QVariant" }
+ Property { name: "__currentTransition"; type: "QVariant" }
+ Property { name: "depth"; type: "int"; isReadonly: true }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Method {
+ name: "push"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ }
+ Method {
+ name: "pop"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ }
+ Method { name: "clear"; type: "QVariant" }
+ Method {
+ name: "find"
+ type: "QVariant"
+ Parameter { name: "func"; type: "QVariant" }
+ Parameter { name: "onlySearchLoadedItems"; type: "QVariant" }
+ }
+ Method {
+ name: "get"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "dontLoad"; type: "QVariant" }
+ }
+ Method { name: "completeTransition"; type: "QVariant" }
+ Method {
+ name: "replace"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ Parameter { name: "properties"; type: "QVariant" }
+ Parameter { name: "immediate"; type: "QVariant" }
+ }
+ Method {
+ name: "__recursionGuard"
+ type: "QVariant"
+ Parameter { name: "use"; type: "QVariant" }
+ }
+ Method {
+ name: "__loadElement"
+ type: "QVariant"
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__resolveComponent"
+ type: "QVariant"
+ Parameter { name: "unknownObjectType"; type: "QVariant" }
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__cleanup"
+ type: "QVariant"
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__setStatus"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ Parameter { name: "status"; type: "QVariant" }
+ }
+ Method {
+ name: "__performTransition"
+ type: "QVariant"
+ Parameter { name: "transition"; type: "QVariant" }
+ }
+ Method { name: "animationFinished"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Controls/StackViewDelegate"
+ exports: ["QtQuick.Controls/StackViewDelegate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "pushTransition"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "popTransition"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "replaceTransition"; type: "QQmlComponent"; isPointer: true }
+ Method {
+ name: "getTransition"
+ type: "QVariant"
+ Parameter { name: "properties"; type: "QVariant" }
+ }
+ Method {
+ name: "transitionFinished"
+ type: "QVariant"
+ Parameter { name: "properties"; type: "QVariant" }
+ }
+ }
+ Component {
+ prototype: "QQuickParallelAnimation"
+ name: "QtQuick.Controls/StackViewTransition"
+ exports: ["QtQuick.Controls/StackViewTransition 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "animations"
+ Property { name: "name"; type: "string" }
+ Property { name: "enterItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "exitItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "immediate"; type: "bool" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/StatusBar"
+ exports: ["QtQuick.Controls/StatusBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickLoader"
+ name: "QtQuick.Controls/Tab"
+ exports: ["QtQuick.Controls/Tab 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "component"
+ Property { name: "title"; type: "string" }
+ Property { name: "__inserted"; type: "bool" }
+ Property { name: "component"; type: "QQmlComponent"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TabView"
+ exports: ["QtQuick.Controls/TabView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "count"; type: "int" }
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "tabsVisible"; type: "bool" }
+ Property { name: "tabPosition"; type: "int" }
+ Property { name: "__tabs"; type: "QQmlListModel"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__styleItem"; type: "QVariant" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Method {
+ name: "addTab"
+ type: "QVariant"
+ Parameter { name: "title"; type: "QVariant" }
+ Parameter { name: "component"; type: "QVariant" }
+ }
+ Method {
+ name: "insertTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "title"; type: "QVariant" }
+ Parameter { name: "component"; type: "QVariant" }
+ }
+ Method {
+ name: "removeTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "moveTab"
+ type: "QVariant"
+ Parameter { name: "from"; type: "QVariant" }
+ Parameter { name: "to"; type: "QVariant" }
+ }
+ Method {
+ name: "getTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method { name: "__setOpacities"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TableView"
+ exports: ["QtQuick.Controls/TableView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__columns"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "alternatingRowColors"; type: "bool" }
+ Property { name: "headerVisible"; type: "bool" }
+ Property { name: "itemDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "rowDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "headerDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "sortIndicatorColumn"; type: "int" }
+ Property { name: "sortIndicatorVisible"; type: "bool" }
+ Property { name: "sortIndicatorOrder"; type: "int" }
+ Property { name: "__activateItemOnSingleClick"; type: "bool" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "backgroundVisible"; type: "bool" }
+ Property { name: "__columns"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentHeader"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "contentFooter"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "rowCount"; type: "int"; isReadonly: true }
+ Property { name: "columnCount"; type: "int"; isReadonly: true }
+ Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true }
+ Property { name: "currentRow"; type: "int" }
+ Property { name: "__currentRowItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "activated"
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "doubleClicked"
+ Parameter { name: "row"; type: "int" }
+ }
+ Method {
+ name: "positionViewAtRow"
+ type: "QVariant"
+ Parameter { name: "row"; type: "QVariant" }
+ Parameter { name: "mode"; type: "QVariant" }
+ }
+ Method {
+ name: "rowAt"
+ type: "QVariant"
+ Parameter { name: "x"; type: "QVariant" }
+ Parameter { name: "y"; type: "QVariant" }
+ }
+ Method {
+ name: "addColumn"
+ type: "QVariant"
+ Parameter { name: "column"; type: "QVariant" }
+ }
+ Method {
+ name: "insertColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "column"; type: "QVariant" }
+ }
+ Method {
+ name: "removeColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "moveColumn"
+ type: "QVariant"
+ Parameter { name: "from"; type: "QVariant" }
+ Parameter { name: "to"; type: "QVariant" }
+ }
+ Method {
+ name: "getColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method { name: "__decrementCurrentIndex"; type: "QVariant" }
+ Method { name: "__incrementCurrentIndex"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Controls/TableViewColumn"
+ exports: ["QtQuick.Controls/TableViewColumn 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "__view"; type: "QQuickItem"; isPointer: true }
+ Property { name: "title"; type: "string" }
+ Property { name: "role"; type: "string" }
+ Property { name: "width"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "resizable"; type: "bool" }
+ Property { name: "movable"; type: "bool" }
+ Property { name: "elideMode"; type: "int" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TextArea"
+ exports: ["QtQuick.Controls/TextArea 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "tabChangesFocus"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "textColor"; type: "QColor" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "int" }
+ Property { name: "inputMethodHints"; type: "int" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "textFormat"; type: "int" }
+ Property { name: "wrapMode"; type: "int" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "selectByKeyboard"; type: "bool" }
+ Property { name: "hoveredLink"; type: "string"; isReadonly: true }
+ Property { name: "backgroundVisible"; type: "bool" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "textMargin"; type: "double" }
+ Property { name: "textDocument"; type: "QQuickTextDocument"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ Parameter { name: "link"; type: "string" }
+ }
+ Method {
+ name: "append"
+ type: "QVariant"
+ Parameter { name: "string"; type: "QVariant" }
+ }
+ Method { name: "copy"; type: "QVariant" }
+ Method { name: "cut"; type: "QVariant" }
+ Method { name: "deselect"; type: "QVariant" }
+ Method {
+ name: "getFormattedText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "getText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "insert"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method {
+ name: "isRightToLeft"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "mode"; type: "QVariant" }
+ }
+ Method { name: "paste"; type: "QVariant" }
+ Method {
+ name: "positionAt"
+ type: "QVariant"
+ Parameter { name: "x"; type: "QVariant" }
+ Parameter { name: "y"; type: "QVariant" }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ }
+ Method { name: "redo"; type: "QVariant" }
+ Method {
+ name: "remove"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "select"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Method { name: "selectWord"; type: "QVariant" }
+ Method { name: "undo"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TextField"
+ exports: ["QtQuick.Controls/TextField 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "textColor"; type: "QColor" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "displayText"; type: "string"; isReadonly: true }
+ Property { name: "echoMode"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "int" }
+ Property { name: "inputMask"; type: "string" }
+ Property { name: "inputMethodHints"; type: "int" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "maximumLength"; type: "int" }
+ Property { name: "placeholderText"; type: "string" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "__contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "__contentWidth"; type: "double"; isReadonly: true }
+ Signal { name: "accepted" }
+ Method { name: "copy"; type: "QVariant" }
+ Method { name: "cut"; type: "QVariant" }
+ Method { name: "deselect"; type: "QVariant" }
+ Method {
+ name: "getText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "insert"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method {
+ name: "isRightToLeft"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "paste"; type: "QVariant" }
+ Method { name: "redo"; type: "QVariant" }
+ Method {
+ name: "select"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Method { name: "selectWord"; type: "QVariant" }
+ Method { name: "undo"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/ToolBar"
+ exports: ["QtQuick.Controls/ToolBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ToolButton"
+ exports: ["QtQuick.Controls/ToolButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__textColor"; type: "QColor" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/qmldir b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/qmldir
new file mode 100644
index 0000000000..f51b055323
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.Controls
+plugin qtquickcontrolsplugin
+classname QtQuickControlsPlugin
+typeinfo plugins.qmltypes
diff --git a/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/plugins.qmltypes
new file mode 100644
index 0000000000..eadb72efb7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/plugins.qmltypes
@@ -0,0 +1,1889 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated with the command 'qmlplugindump -nonrelocatable QtQuick.Controls 1.1'.
+
+Module {
+ Component {
+ name: "QQuickAbstractStyle"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/AbstractStyle 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "padding"; type: "QQuickPadding"; isReadonly: true; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickAction"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/Action 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "shortcut"; type: "QVariant" }
+ Signal { name: "triggered" }
+ Signal {
+ name: "toggled"
+ Parameter { name: "checked"; type: "bool" }
+ }
+ Signal {
+ name: "shortcutChanged"
+ Parameter { name: "shortcut"; type: "QVariant" }
+ }
+ Signal { name: "iconChanged" }
+ Signal {
+ name: "tooltipChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method { name: "trigger" }
+ }
+ Component {
+ name: "QQuickControlSettings"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/Settings 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "style"; type: "QUrl"; isReadonly: true }
+ Property { name: "styleName"; type: "string" }
+ Property { name: "stylePath"; type: "string" }
+ Property { name: "dpiScaleFactor"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickExclusiveGroup"
+ defaultProperty: "__actions"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/ExclusiveGroup 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "current"; type: "QObject"; isPointer: true }
+ Property { name: "__actions"; type: "QQuickAction"; isList: true; isReadonly: true }
+ Method {
+ name: "bindCheckable"
+ Parameter { name: "o"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "unbindCheckable"
+ Parameter { name: "o"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickMenu"
+ defaultProperty: "items"
+ prototype: "QQuickMenuText"
+ exports: ["QtQuick.Controls/MenuPrivate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "title"; type: "string" }
+ Property { name: "items"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__selectedIndex"; type: "int" }
+ Property { name: "__popupVisible"; type: "bool"; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__minimumWidth"; type: "int" }
+ Property { name: "__font"; type: "QFont" }
+ Property { name: "__xOffset"; type: "double" }
+ Property { name: "__yOffset"; type: "double" }
+ Signal { name: "__menuClosed" }
+ Signal { name: "popupVisibleChanged" }
+ Method { name: "__closeMenu" }
+ Method { name: "__dismissMenu" }
+ Method { name: "popup" }
+ Method {
+ name: "addItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "insertItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "int" }
+ Parameter { type: "string" }
+ }
+ Method { name: "addSeparator" }
+ Method {
+ name: "insertSeparator"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { type: "int" }
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ Parameter { name: "atActionIndex"; type: "int" }
+ }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickMenuBar"
+ defaultProperty: "menus"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/MenuBarPrivate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Signal { name: "contentItemChanged" }
+ }
+ Component {
+ name: "QQuickMenuBase"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/MenuBase 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "visible"; type: "bool" }
+ Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true }
+ Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickMenuItem"
+ prototype: "QQuickMenuText"
+ exports: ["QtQuick.Controls/MenuItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "shortcut"; type: "QVariant" }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Signal { name: "triggered" }
+ Signal {
+ name: "toggled"
+ Parameter { name: "checked"; type: "bool" }
+ }
+ Method { name: "trigger" }
+ }
+ Component {
+ name: "QQuickMenuItemType"
+ exports: ["QtQuick.Controls/MenuItemType 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "MenuItemType"
+ values: {
+ "Separator": 0,
+ "Item": 1,
+ "Menu": 2
+ }
+ }
+ }
+ Component {
+ name: "QQuickMenuSeparator"
+ prototype: "QQuickMenuBase"
+ exports: ["QtQuick.Controls/MenuSeparator 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickMenuText"
+ prototype: "QQuickMenuBase"
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Signal { name: "__textChanged" }
+ }
+ Component {
+ name: "QQuickPadding"
+ prototype: "QObject"
+ Property { name: "left"; type: "int" }
+ Property { name: "top"; type: "int" }
+ Property { name: "right"; type: "int" }
+ Property { name: "bottom"; type: "int" }
+ Method {
+ name: "setLeft"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setTop"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setRight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setBottom"
+ Parameter { name: "arg"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickRangeModel"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/RangeModel 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "position"; type: "double" }
+ Property { name: "positionAtMinimum"; type: "double" }
+ Property { name: "positionAtMaximum"; type: "double" }
+ Property { name: "inverted"; type: "bool" }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "value"; type: "double" }
+ }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "position"; type: "double" }
+ }
+ Signal {
+ name: "stepSizeChanged"
+ Parameter { name: "stepSize"; type: "double" }
+ }
+ Signal {
+ name: "invertedChanged"
+ Parameter { name: "inverted"; type: "bool" }
+ }
+ Signal {
+ name: "minimumChanged"
+ Parameter { name: "min"; type: "double" }
+ }
+ Signal {
+ name: "maximumChanged"
+ Parameter { name: "max"; type: "double" }
+ }
+ Signal {
+ name: "positionAtMinimumChanged"
+ Parameter { name: "min"; type: "double" }
+ }
+ Signal {
+ name: "positionAtMaximumChanged"
+ Parameter { name: "max"; type: "double" }
+ }
+ Method { name: "toMinimum" }
+ Method { name: "toMaximum" }
+ Method {
+ name: "setValue"
+ Parameter { name: "value"; type: "double" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "double" }
+ }
+ Method {
+ name: "valueForPosition"
+ type: "double"
+ Parameter { name: "position"; type: "double" }
+ }
+ Method {
+ name: "positionForValue"
+ type: "double"
+ Parameter { name: "value"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickSpinBoxValidator"
+ prototype: "QValidator"
+ exports: ["QtQuick.Controls.Private/SpinBoxValidator 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string"; isReadonly: true }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "decimals"; type: "int" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "prefix"; type: "string" }
+ Property { name: "suffix"; type: "string" }
+ Method { name: "increment" }
+ Method { name: "decrement" }
+ }
+ Component {
+ name: "QQuickStack"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/Stack 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "Inactive": 0,
+ "Deactivating": 1,
+ "Activating": 2,
+ "Active": 3
+ }
+ }
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "__index"; type: "int" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "__status"; type: "Status" }
+ Property { name: "view"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "__view"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickStyleItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.Private/StyleItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "sunken"; type: "bool" }
+ Property { name: "raised"; type: "bool" }
+ Property { name: "active"; type: "bool" }
+ Property { name: "selected"; type: "bool" }
+ Property { name: "hasFocus"; type: "bool" }
+ Property { name: "on"; type: "bool" }
+ Property { name: "hover"; type: "bool" }
+ Property { name: "horizontal"; type: "bool" }
+ Property { name: "transient"; type: "bool" }
+ Property { name: "elementType"; type: "string" }
+ Property { name: "text"; type: "string" }
+ Property { name: "activeControl"; type: "string" }
+ Property { name: "style"; type: "string"; isReadonly: true }
+ Property { name: "hints"; type: "QVariantMap" }
+ Property { name: "properties"; type: "QVariantMap" }
+ Property { name: "font"; type: "QFont"; isReadonly: true }
+ Property { name: "minimum"; type: "int" }
+ Property { name: "maximum"; type: "int" }
+ Property { name: "value"; type: "int" }
+ Property { name: "step"; type: "int" }
+ Property { name: "paintMargins"; type: "int" }
+ Property { name: "contentWidth"; type: "int" }
+ Property { name: "contentHeight"; type: "int" }
+ Signal { name: "infoChanged" }
+ Signal { name: "hintChanged" }
+ Signal {
+ name: "contentWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "contentHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "pixelMetric"
+ type: "int"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "styleHint"
+ type: "QVariant"
+ Parameter { type: "string" }
+ }
+ Method { name: "updateSizeHint" }
+ Method { name: "updateRect" }
+ Method { name: "updateItem" }
+ Method {
+ name: "hitTest"
+ type: "string"
+ Parameter { name: "x"; type: "int" }
+ Parameter { name: "y"; type: "int" }
+ }
+ Method {
+ name: "subControlRect"
+ type: "QRectF"
+ Parameter { name: "subcontrolString"; type: "string" }
+ }
+ Method {
+ name: "elidedText"
+ type: "string"
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "elideMode"; type: "int" }
+ Parameter { name: "width"; type: "int" }
+ }
+ Method {
+ name: "hasThemeIcon"
+ type: "bool"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "textWidth"
+ type: "double"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "textHeight"
+ type: "double"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickTooltip"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/Tooltip 1.0"]
+ exportMetaObjectRevisions: [0]
+ Method {
+ name: "showText"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ Parameter { name: "pos"; type: "QPointF" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method { name: "hideText" }
+ }
+ Component {
+ name: "QQuickWheelArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.Private/WheelArea 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "verticalDelta"; type: "double" }
+ Property { name: "horizontalDelta"; type: "double" }
+ Property { name: "horizontalMinimumValue"; type: "double" }
+ Property { name: "horizontalMaximumValue"; type: "double" }
+ Property { name: "verticalMinimumValue"; type: "double" }
+ Property { name: "verticalMaximumValue"; type: "double" }
+ Property { name: "horizontalValue"; type: "double" }
+ Property { name: "verticalValue"; type: "double" }
+ Property { name: "scrollSpeed"; type: "double" }
+ Property { name: "active"; type: "bool" }
+ Signal { name: "verticalWheelMoved" }
+ Signal { name: "horizontalWheelMoved" }
+ }
+ Component {
+ name: "QQuickWindow"
+ defaultProperty: "data"
+ prototype: "QWindow"
+ exports: ["QtQuick.Window/Window 2.0", "QtQuick.Window/Window 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property {
+ name: "activeFocusItem"
+ revision: 1
+ type: "QQuickItem"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal { name: "frameSwapped" }
+ Signal { name: "sceneGraphInitialized" }
+ Signal { name: "sceneGraphInvalidated" }
+ Signal { name: "beforeSynchronizing" }
+ Signal { name: "beforeRendering" }
+ Signal { name: "afterRendering" }
+ Signal {
+ name: "closing"
+ revision: 1
+ Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { type: "QColor" }
+ }
+ Signal { name: "activeFocusItemChanged"; revision: 1 }
+ Method { name: "update" }
+ Method { name: "releaseResources" }
+ }
+ Component {
+ name: "QWindow"
+ prototype: "QObject"
+ Enum {
+ name: "Visibility"
+ values: {
+ "Hidden": 0,
+ "AutomaticVisibility": 1,
+ "Windowed": 2,
+ "Minimized": 3,
+ "Maximized": 4,
+ "FullScreen": 5
+ }
+ }
+ Property { name: "title"; type: "string" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "minimumWidth"; revision: 1; type: "int" }
+ Property { name: "minimumHeight"; revision: 1; type: "int" }
+ Property { name: "maximumWidth"; revision: 1; type: "int" }
+ Property { name: "maximumHeight"; revision: 1; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
+ Signal {
+ name: "screenChanged"
+ Parameter { name: "screen"; type: "QScreen"; isPointer: true }
+ }
+ Signal {
+ name: "modalityChanged"
+ Parameter { name: "modality"; type: "Qt::WindowModality" }
+ }
+ Signal {
+ name: "windowStateChanged"
+ Parameter { name: "windowState"; type: "Qt::WindowState" }
+ }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumWidthChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumHeightChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumWidthChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumHeightChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
+ name: "contentOrientationChanged"
+ revision: 1
+ Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
+ }
+ Signal {
+ name: "focusObjectChanged"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
+ Method {
+ name: "setVisible"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method { name: "showMinimized" }
+ Method { name: "showMaximized" }
+ Method { name: "showFullScreen" }
+ Method { name: "showNormal" }
+ Method { name: "close"; type: "bool" }
+ Method { name: "raise" }
+ Method { name: "lower" }
+ Method {
+ name: "setTitle"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setMinimumWidth"
+ revision: 1
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMinimumHeight"
+ revision: 1
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setMaximumWidth"
+ revision: 1
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMaximumHeight"
+ revision: 1
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "alert"
+ Parameter { name: "msec"; type: "int" }
+ }
+ }
+ Component {
+ prototype: "QQuickWindow"
+ name: "QtQuick.Controls/ApplicationWindow"
+ exports: ["QtQuick.Controls/ApplicationWindow 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "menuBar"; type: "MenuBar_QMLTYPE_1"; isPointer: true }
+ Property { name: "toolBar"; type: "QQuickItem"; isPointer: true }
+ Property { name: "statusBar"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property {
+ name: "activeFocusItem"
+ revision: 1
+ type: "QQuickItem"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal { name: "frameSwapped" }
+ Signal { name: "sceneGraphInitialized" }
+ Signal { name: "sceneGraphInvalidated" }
+ Signal { name: "beforeSynchronizing" }
+ Signal { name: "beforeRendering" }
+ Signal { name: "afterRendering" }
+ Signal {
+ name: "closing"
+ revision: 1
+ Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { type: "QColor" }
+ }
+ Signal { name: "activeFocusItemChanged"; revision: 1 }
+ Method { name: "update" }
+ Method { name: "forcePolish" }
+ Method { name: "releaseResources" }
+ Property { name: "title"; type: "string" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "minimumWidth"; type: "int" }
+ Property { name: "minimumHeight"; type: "int" }
+ Property { name: "maximumWidth"; type: "int" }
+ Property { name: "maximumHeight"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
+ Signal {
+ name: "screenChanged"
+ Parameter { name: "screen"; type: "QScreen"; isPointer: true }
+ }
+ Signal {
+ name: "modalityChanged"
+ Parameter { name: "modality"; type: "Qt::WindowModality" }
+ }
+ Signal {
+ name: "windowStateChanged"
+ Parameter { name: "windowState"; type: "Qt::WindowState" }
+ }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
+ name: "contentOrientationChanged"
+ Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
+ }
+ Signal {
+ name: "focusObjectChanged"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
+ Method {
+ name: "setVisible"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method { name: "showMinimized" }
+ Method { name: "showMaximized" }
+ Method { name: "showFullScreen" }
+ Method { name: "showNormal" }
+ Method { name: "close"; type: "bool" }
+ Method { name: "raise" }
+ Method { name: "lower" }
+ Method {
+ name: "setTitle"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setMinimumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMinimumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setMaximumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMaximumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "alert"
+ revision: 1
+ Parameter { name: "msec"; type: "int" }
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/BusyIndicator"
+ exports: ["QtQuick.Controls/BusyIndicator 1.1"]
+ exportMetaObjectRevisions: [1]
+ defaultProperty: "data"
+ Property { name: "running"; type: "bool" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/Button"
+ exports: ["QtQuick.Controls/Button 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__textColor"; type: "QColor" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "isDefault"; type: "bool" }
+ Property { name: "menu"; type: "Menu_QMLTYPE_16"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/CheckBox"
+ exports: ["QtQuick.Controls/CheckBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checked"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "__cycleStatesHandler"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Property { name: "checkedState"; type: "int" }
+ Property { name: "partiallyCheckedEnabled"; type: "bool" }
+ Property { name: "__ignoreChecked"; type: "bool" }
+ Method { name: "__cycleCheckBoxStates"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ComboBox"
+ exports: ["QtQuick.Controls/ComboBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "textRole"; type: "string" }
+ Property { name: "editable"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "__popup"; type: "QVariant" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentText"; type: "string"; isReadonly: true }
+ Property { name: "editText"; type: "string" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Signal { name: "accepted" }
+ Signal {
+ name: "activated"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "textAt"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "find"
+ type: "QVariant"
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/GroupBox"
+ exports: ["QtQuick.Controls/GroupBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "title"; type: "string" }
+ Property { name: "flat"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "__checkbox"; type: "CheckBox_QMLTYPE_25"; isReadonly: true; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickText"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Text 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextStyle"
+ values: {
+ "Normal": 0,
+ "Outline": 1,
+ "Raised": 2,
+ "Sunken": 3
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2,
+ "StyledText": 4
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Enum {
+ name: "LineHeightMode"
+ values: {
+ "ProportionalHeight": 0,
+ "FixedHeight": 1
+ }
+ }
+ Enum {
+ name: "FontSizeMode"
+ values: {
+ "FixedSize": 0,
+ "HorizontalFit": 1,
+ "VerticalFit": 2,
+ "Fit": 3
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "linkColor"; type: "QColor" }
+ Property { name: "style"; type: "TextStyle" }
+ Property { name: "styleColor"; type: "QColor" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "truncated"; type: "bool"; isReadonly: true }
+ Property { name: "maximumLineCount"; type: "int" }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "elide"; type: "TextElideMode" }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "lineHeight"; type: "double" }
+ Property { name: "lineHeightMode"; type: "LineHeightMode" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "minimumPixelSize"; type: "int" }
+ Property { name: "minimumPointSize"; type: "int" }
+ Property { name: "fontSizeMode"; type: "FontSizeMode" }
+ Property { name: "renderType"; type: "RenderType" }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "styleChanged"
+ Parameter { name: "style"; type: "TextStyle" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "elideModeChanged"
+ Parameter { name: "mode"; type: "TextElideMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "lineHeightChanged"
+ Parameter { name: "lineHeight"; type: "double" }
+ }
+ Signal {
+ name: "lineHeightModeChanged"
+ Parameter { name: "mode"; type: "LineHeightMode" }
+ }
+ Signal {
+ name: "lineLaidOut"
+ Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
+ }
+ Method { name: "doLayout" }
+ }
+
+ Component {
+ prototype: "QQuickText"
+ name: "QtQuick.Controls/Label"
+ exports: ["QtQuick.Controls/Label 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickMenu"
+ name: "QtQuick.Controls/Menu"
+ exports: ["QtQuick.Controls/Menu 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "items"
+ Property { name: "__selfComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__currentIndex"; type: "int" }
+ Property { name: "__menuComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__menuBar"; type: "QVariant" }
+ Method {
+ name: "addMenu"
+ type: "QVariant"
+ Parameter { name: "title"; type: "QVariant" }
+ }
+ Method {
+ name: "insertMenu"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "title"; type: "QVariant" }
+ }
+ Property { name: "title"; type: "string" }
+ Property { name: "items"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__selectedIndex"; type: "int" }
+ Property { name: "__popupVisible"; type: "bool"; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__minimumWidth"; type: "int" }
+ Property { name: "__font"; type: "QFont" }
+ Property { name: "__xOffset"; type: "double" }
+ Property { name: "__yOffset"; type: "double" }
+ Signal { name: "__menuClosed" }
+ Signal { name: "popupVisibleChanged" }
+ Method { name: "__closeMenu" }
+ Method { name: "__dismissMenu" }
+ Method { name: "popup" }
+ Method {
+ name: "addItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "insertItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "int" }
+ Parameter { type: "string" }
+ }
+ Method { name: "addSeparator" }
+ Method {
+ name: "insertSeparator"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { type: "int" }
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ Parameter { name: "atActionIndex"; type: "int" }
+ }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true }
+ Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Signal { name: "__textChanged" }
+ }
+ Component {
+ prototype: "QQuickMenuBar"
+ name: "QtQuick.Controls/MenuBar"
+ exports: ["QtQuick.Controls/MenuBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "menus"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__menuBarComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Signal { name: "contentItemChanged" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ProgressBar"
+ exports: ["QtQuick.Controls/ProgressBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "indeterminate"; type: "bool" }
+ Property { name: "orientation"; type: "int" }
+ Property { name: "__initialized"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Method {
+ name: "setValue"
+ type: "QVariant"
+ Parameter { name: "v"; type: "QVariant" }
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/RadioButton"
+ exports: ["QtQuick.Controls/RadioButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checked"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "__cycleStatesHandler"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ScrollView"
+ exports: ["QtQuick.Controls/ScrollView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "contentItem"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/Slider"
+ exports: ["QtQuick.Controls/Slider 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "orientation"; type: "int" }
+ Property { name: "updateValueWhileDragging"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "tickmarksEnabled"; type: "bool" }
+ Property { name: "__horizontal"; type: "bool" }
+ Property { name: "__handlePos"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "value"; type: "double" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/SpinBox"
+ exports: ["QtQuick.Controls/SpinBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "suffix"; type: "string" }
+ Property { name: "prefix"; type: "string" }
+ Property { name: "decimals"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "__text"; type: "string" }
+ Method { name: "__increment"; type: "QVariant" }
+ Method { name: "__decrement"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/SplitView"
+ exports: ["QtQuick.Controls/SplitView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__contents"
+ Property { name: "orientation"; type: "int" }
+ Property { name: "handleDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "resizing"; type: "bool" }
+ Property { name: "__contents"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__items"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "__handles"; type: "QQuickItem"; isList: true; isReadonly: true }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/StackView"
+ exports: ["QtQuick.Controls/StackView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "busy"; type: "bool"; isReadonly: true }
+ Property { name: "delegate"; type: "StackViewDelegate_QMLTYPE_97"; isPointer: true }
+ Property { name: "__currentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__depth"; type: "int" }
+ Property { name: "__guard"; type: "bool" }
+ Property { name: "invalidItemReplacement"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "initialItem"; type: "QVariant" }
+ Property { name: "__currentTransition"; type: "QVariant" }
+ Property { name: "depth"; type: "int"; isReadonly: true }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Method {
+ name: "push"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ }
+ Method {
+ name: "pop"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ }
+ Method { name: "clear"; type: "QVariant" }
+ Method {
+ name: "find"
+ type: "QVariant"
+ Parameter { name: "func"; type: "QVariant" }
+ Parameter { name: "onlySearchLoadedItems"; type: "QVariant" }
+ }
+ Method {
+ name: "get"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "dontLoad"; type: "QVariant" }
+ }
+ Method { name: "completeTransition"; type: "QVariant" }
+ Method {
+ name: "replace"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ Parameter { name: "properties"; type: "QVariant" }
+ Parameter { name: "immediate"; type: "QVariant" }
+ }
+ Method {
+ name: "__recursionGuard"
+ type: "QVariant"
+ Parameter { name: "use"; type: "QVariant" }
+ }
+ Method {
+ name: "__loadElement"
+ type: "QVariant"
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__resolveComponent"
+ type: "QVariant"
+ Parameter { name: "unknownObjectType"; type: "QVariant" }
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__cleanup"
+ type: "QVariant"
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__setStatus"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ Parameter { name: "status"; type: "QVariant" }
+ }
+ Method {
+ name: "__performTransition"
+ type: "QVariant"
+ Parameter { name: "transition"; type: "QVariant" }
+ }
+ Method { name: "animationFinished"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Controls/StackViewDelegate"
+ exports: ["QtQuick.Controls/StackViewDelegate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "pushTransition"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "popTransition"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "replaceTransition"; type: "QQmlComponent"; isPointer: true }
+ Method {
+ name: "getTransition"
+ type: "QVariant"
+ Parameter { name: "properties"; type: "QVariant" }
+ }
+ Method {
+ name: "transitionFinished"
+ type: "QVariant"
+ Parameter { name: "properties"; type: "QVariant" }
+ }
+ }
+ Component {
+ prototype: "QQuickParallelAnimation"
+ name: "QtQuick.Controls/StackViewTransition"
+ exports: ["QtQuick.Controls/StackViewTransition 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "animations"
+ Property { name: "name"; type: "string" }
+ Property { name: "enterItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "exitItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "immediate"; type: "bool" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/StatusBar"
+ exports: ["QtQuick.Controls/StatusBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickLoader"
+ name: "QtQuick.Controls/Tab"
+ exports: ["QtQuick.Controls/Tab 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "component"
+ Property { name: "title"; type: "string" }
+ Property { name: "__inserted"; type: "bool" }
+ Property { name: "component"; type: "QQmlComponent"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TabView"
+ exports: ["QtQuick.Controls/TabView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "count"; type: "int" }
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "tabsVisible"; type: "bool" }
+ Property { name: "tabPosition"; type: "int" }
+ Property { name: "__tabs"; type: "QQmlListModel"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__styleItem"; type: "QVariant" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Method {
+ name: "addTab"
+ type: "QVariant"
+ Parameter { name: "title"; type: "QVariant" }
+ Parameter { name: "component"; type: "QVariant" }
+ }
+ Method {
+ name: "insertTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "title"; type: "QVariant" }
+ Parameter { name: "component"; type: "QVariant" }
+ }
+ Method {
+ name: "removeTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "moveTab"
+ type: "QVariant"
+ Parameter { name: "from"; type: "QVariant" }
+ Parameter { name: "to"; type: "QVariant" }
+ }
+ Method {
+ name: "getTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method { name: "__setOpacities"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TableView"
+ exports: ["QtQuick.Controls/TableView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__columns"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "alternatingRowColors"; type: "bool" }
+ Property { name: "headerVisible"; type: "bool" }
+ Property { name: "itemDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "rowDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "headerDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "sortIndicatorColumn"; type: "int" }
+ Property { name: "sortIndicatorVisible"; type: "bool" }
+ Property { name: "sortIndicatorOrder"; type: "int" }
+ Property { name: "__activateItemOnSingleClick"; type: "bool" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "backgroundVisible"; type: "bool" }
+ Property { name: "__columns"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentHeader"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "contentFooter"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "rowCount"; type: "int"; isReadonly: true }
+ Property { name: "columnCount"; type: "int"; isReadonly: true }
+ Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true }
+ Property { name: "currentRow"; type: "int" }
+ Property { name: "__currentRowItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "activated"
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "doubleClicked"
+ Parameter { name: "row"; type: "int" }
+ }
+ Method {
+ name: "positionViewAtRow"
+ type: "QVariant"
+ Parameter { name: "row"; type: "QVariant" }
+ Parameter { name: "mode"; type: "QVariant" }
+ }
+ Method {
+ name: "rowAt"
+ type: "QVariant"
+ Parameter { name: "x"; type: "QVariant" }
+ Parameter { name: "y"; type: "QVariant" }
+ }
+ Method {
+ name: "addColumn"
+ type: "QVariant"
+ Parameter { name: "column"; type: "QVariant" }
+ }
+ Method {
+ name: "insertColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "column"; type: "QVariant" }
+ }
+ Method {
+ name: "removeColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "moveColumn"
+ type: "QVariant"
+ Parameter { name: "from"; type: "QVariant" }
+ Parameter { name: "to"; type: "QVariant" }
+ }
+ Method {
+ name: "getColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method { name: "__decrementCurrentIndex"; type: "QVariant" }
+ Method { name: "__incrementCurrentIndex"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Controls/TableViewColumn"
+ exports: ["QtQuick.Controls/TableViewColumn 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "__view"; type: "QQuickItem"; isPointer: true }
+ Property { name: "title"; type: "string" }
+ Property { name: "role"; type: "string" }
+ Property { name: "width"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "resizable"; type: "bool" }
+ Property { name: "movable"; type: "bool" }
+ Property { name: "elideMode"; type: "int" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TextArea"
+ exports: ["QtQuick.Controls/TextArea 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "tabChangesFocus"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "textColor"; type: "QColor" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "int" }
+ Property { name: "inputMethodHints"; type: "int" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "textFormat"; type: "int" }
+ Property { name: "wrapMode"; type: "int" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "selectByKeyboard"; type: "bool" }
+ Property { name: "hoveredLink"; type: "string"; isReadonly: true }
+ Property { name: "backgroundVisible"; type: "bool" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "textMargin"; type: "double" }
+ Property { name: "textDocument"; type: "QQuickTextDocument"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ Parameter { name: "link"; type: "string" }
+ }
+ Method {
+ name: "append"
+ type: "QVariant"
+ Parameter { name: "string"; type: "QVariant" }
+ }
+ Method { name: "copy"; type: "QVariant" }
+ Method { name: "cut"; type: "QVariant" }
+ Method { name: "deselect"; type: "QVariant" }
+ Method {
+ name: "getFormattedText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "getText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "insert"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method {
+ name: "isRightToLeft"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "mode"; type: "QVariant" }
+ }
+ Method { name: "paste"; type: "QVariant" }
+ Method {
+ name: "positionAt"
+ type: "QVariant"
+ Parameter { name: "x"; type: "QVariant" }
+ Parameter { name: "y"; type: "QVariant" }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ }
+ Method { name: "redo"; type: "QVariant" }
+ Method {
+ name: "remove"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "select"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Method { name: "selectWord"; type: "QVariant" }
+ Method { name: "undo"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TextField"
+ exports: ["QtQuick.Controls/TextField 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "textColor"; type: "QColor" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "displayText"; type: "string"; isReadonly: true }
+ Property { name: "echoMode"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "int" }
+ Property { name: "inputMask"; type: "string" }
+ Property { name: "inputMethodHints"; type: "int" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "maximumLength"; type: "int" }
+ Property { name: "placeholderText"; type: "string" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "__contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "__contentWidth"; type: "double"; isReadonly: true }
+ Signal { name: "accepted" }
+ Method { name: "copy"; type: "QVariant" }
+ Method { name: "cut"; type: "QVariant" }
+ Method { name: "deselect"; type: "QVariant" }
+ Method {
+ name: "getText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "insert"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method {
+ name: "isRightToLeft"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "paste"; type: "QVariant" }
+ Method { name: "redo"; type: "QVariant" }
+ Method {
+ name: "select"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Method { name: "selectWord"; type: "QVariant" }
+ Method { name: "undo"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/ToolBar"
+ exports: ["QtQuick.Controls/ToolBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ToolButton"
+ exports: ["QtQuick.Controls/ToolButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__textColor"; type: "QColor" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/qmldir b/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/qmldir
new file mode 100644
index 0000000000..f51b055323
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.Controls
+plugin qtquickcontrolsplugin
+classname QtQuickControlsPlugin
+typeinfo plugins.qmltypes
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ApplicationWindow.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ApplicationWindow.qml
new file mode 100644
index 0000000000..6e0160df27
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ApplicationWindow.qml
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick.Window 2.1
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Layouts 1.0
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ApplicationWindow
+ \since 5.1
+ \inqmlmodule QtQuick.Controls
+ \ingroup applicationwindow
+ \brief Provides a top-level application window.
+
+ ApplicationWindow is a \l Window that adds convenience for positioning items,
+ such as \l MenuBar, \l ToolBar, and \l StatusBar in a platform independent
+ manner.
+
+ \code
+ ApplicationWindow {
+ id: window
+ menuBar: MenuBar {
+ Menu { MenuItem {...} }
+ Menu { MenuItem {...} }
+ }
+
+ toolBar: ToolBar {
+ RowLayout {
+ anchors.fill: parent
+ ToolButton {...}
+ }
+ }
+
+ TabView {
+ id: myContent
+ anchors.fill: parent
+ ...
+ }
+ }
+ \endcode
+*/
+
+Window {
+ id: root
+
+ /*!
+ \qmlproperty MenuBar ApplicationWindow::menuBar
+
+ This property holds the \l MenuBar.
+
+ By default, this value is not set.
+ */
+ property MenuBar menuBar: null
+
+ /*!
+ \qmlproperty Item ApplicationWindow::toolBar
+
+ This property holds the toolbar \l Item.
+
+ It can be set to any Item type, but is generally used with \l ToolBar.
+
+ By default, this value is not set. When you set the toolbar item, it will
+ be anchored automatically into the application window.
+ */
+ property Item toolBar
+
+ /*!
+ \qmlproperty Item ApplicationWindow::statusBar
+
+ This property holds the status bar \l Item.
+
+ It can be set to any Item type, but is generally used with \l StatusBar.
+
+ By default, this value is not set. When you set the status bar item, it
+ will be anchored automatically into the application window.
+ */
+ property Item statusBar
+
+ onToolBarChanged: { if (toolBar) { toolBar.parent = toolBarArea } }
+
+ onStatusBarChanged: { if (statusBar) { statusBar.parent = statusBarArea } }
+
+ onVisibleChanged: { if (visible && menuBar) { menuBar.__parentWindow = root } }
+
+ /*! \internal */
+ default property alias data: contentArea.data
+
+ color: syspal.window
+
+ flags: Qt.Window | Qt.WindowFullscreenButtonHint |
+ Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint |
+ Qt.WindowCloseButtonHint | Qt.WindowFullscreenButtonHint
+ // QTBUG-35049: Windows is removing features we didn't ask for, even though Qt::CustomizeWindowHint is not set
+ // Otherwise Qt.Window | Qt.WindowFullscreenButtonHint would be enough
+
+ SystemPalette {id: syspal}
+
+ Item {
+ id: backgroundItem
+ anchors.fill: parent
+
+ Keys.forwardTo: menuBar ? [menuBar.__contentItem] : []
+
+ Item {
+ id: contentArea
+ anchors.top: toolBarArea.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: statusBarArea.top
+ }
+
+ Item {
+ id: toolBarArea
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ implicitHeight: childrenRect.height
+ height: visibleChildren.length > 0 ? implicitHeight: 0
+ }
+
+ Item {
+ id: statusBarArea
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ implicitHeight: childrenRect.height
+ height: visibleChildren.length > 0 ? implicitHeight: 0
+ }
+
+ onVisibleChanged: if (visible && menuBar) menuBar.__parentWindow = root
+
+ states: State {
+ name: "hasMenuBar"
+ when: menuBar && !menuBar.__isNative
+
+ ParentChange {
+ target: menuBar.__contentItem
+ parent: backgroundItem
+ }
+
+ PropertyChanges {
+ target: menuBar.__contentItem
+ x: 0
+ y: 0
+ width: backgroundItem.width
+ }
+
+ AnchorChanges {
+ target: toolBarArea
+ anchors.top: menuBar.__contentItem.bottom
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/BusyIndicator.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/BusyIndicator.qml
new file mode 100644
index 0000000000..01820bb820
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/BusyIndicator.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype BusyIndicator
+ \inqmlmodule QtQuick.Controls
+ \since 5.2
+ \ingroup controls
+ \brief A busy indicator.
+
+ The busy indicator should be used to indicate activity while content is
+ being loaded or the UI is blocked waiting for a resource to become available.
+
+ You can create a custom appearance for a Busy Indicator by
+ assigning a \l {QtQuick.Controls.Styles::BusyIndicatorStyle}{BusyIndicatorStyle}.
+ */
+Control {
+ id: indicator
+
+ /*! \qmlproperty bool BusyIndicator::running
+
+ This property holds whether the busy indicator is currently indicating
+ activity.
+
+ \note The indicator is only visible when this property is set to \c true.
+
+ The default value is \c true.
+ */
+ property bool running: true
+
+ Accessible.role: Accessible.Indicator
+ Accessible.name: "busy"
+
+ style: Qt.createComponent(Settings.style + "/BusyIndicatorStyle.qml", indicator)
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Button.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Button.qml
new file mode 100644
index 0000000000..1875e423a6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Button.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Button
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A push button with a text label.
+
+ The push button is perhaps the most commonly used widget in any graphical
+ user interface. Pushing (or clicking) a button commands the computer to
+ perform some action or answer a question. Common examples of buttons are
+ OK, Apply, Cancel, Close, Yes, No, and Help buttons.
+
+ Button is similar to the QPushButton widget.
+
+ You can create a custom appearance for a Button by
+ assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}.
+ */
+BasicButton {
+ id: button
+
+ /*! This property holds whether the push button is the default button.
+ Default buttons decide what happens when the user presses enter in a
+ dialog without giving a button explicit focus. \note This property only
+ changes the appearance of the button. The expected behavior needs to be
+ implemented by the user.
+
+ The default value is \c false.
+ */
+ property bool isDefault: false
+
+ /*! Assign a \l Menu to this property to get a pull-down menu button.
+
+ The default value is \c null.
+ */
+ property Menu menu: null
+
+ __effectivePressed: __behavior.effectivePressed || menu && menu.__popupVisible
+
+ activeFocusOnTab: true
+
+ Accessible.name: text
+
+ style: Qt.createComponent(Settings.style + "/ButtonStyle.qml", button)
+
+ Binding {
+ target: menu
+ property: "__minimumWidth"
+ value: button.__panel.width
+ }
+
+ Binding {
+ target: menu
+ property: "__visualItem"
+ value: button
+ }
+
+ Connections {
+ target: __behavior
+ onEffectivePressedChanged: {
+ if (__behavior.effectivePressed && menu)
+ popupMenuTimer.start()
+ }
+ }
+
+ Timer {
+ id: popupMenuTimer
+ interval: 10
+ onTriggered: {
+ __behavior.keyPressed = false
+ if (Qt.application.layoutDirection === Qt.RightToLeft)
+ menu.__popup(button.width, button.height, 0)
+ else
+ menu.__popup(0, button.height, 0)
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/CheckBox.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/CheckBox.qml
new file mode 100644
index 0000000000..00671755c7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/CheckBox.qml
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype CheckBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A checkbox with a text label.
+
+ A CheckBox is an option button that can be toggled on (checked) or off
+ (unchecked). Checkboxes are typically used to represent features in an
+ application that can be enabled or disabled without affecting others.
+
+ The state of the checkbox can be set with the \l {AbstractCheckable::checked}{checked} property.
+
+ In addition to the checked and unchecked states, there is a third state:
+ partially checked. This state indicates that the
+ regular checked/unchecked state can not be determined; generally because of
+ other states that affect the checkbox. This state is useful when several
+ child nodes are selected in a treeview, for example.
+
+ The partially checked state can be made available to the user by setting
+ \l partiallyCheckedEnabled to \c true, or set directly by setting
+ \l checkedState to \c Qt.PartiallyChecked. \l checkedState behaves
+ identically to \l {AbstractCheckable::checked}{checked} when \l partiallyCheckedEnabled
+ is \c false; setting one will appropriately set the other.
+
+ The label is shown next to the checkbox, and you can set the label text using its
+ \l {AbstractCheckable::text}{text} property.
+
+ \qml
+ Column {
+ CheckBox {
+ text: qsTr("Breakfast")
+ }
+ CheckBox {
+ text: qsTr("Lunch")
+ }
+ CheckBox {
+ text: qsTr("Dinner")
+ }
+ }
+ \endqml
+
+ Whenever a CheckBox is clicked, it emits the \l {AbstractCheckable::clicked}{clicked()} signal.
+
+ You can create a custom appearance for a CheckBox by
+ assigning a \l {QtQuick.Controls.Styles::CheckBoxStyle}{CheckBoxStyle}.
+*/
+
+AbstractCheckable {
+ id: checkBox
+
+ /*!
+ \qmlproperty enumeration CheckBox::checkedState
+
+ This property indicates the current checked state of the checkbox.
+
+ Possible values:
+ \c Qt.UnChecked - The checkbox is not checked (default).
+ \c Qt.Checked - The checkbox is checked.
+ \c Qt.PartiallyChecked - The checkbox is in a partially checked (or
+ "mixed") state.
+
+ The \l {AbstractCheckable::checked}{checked} property also determines whether
+ this property is \c Qt.Checked or \c Qt.UnChecked, and vice versa.
+ */
+ property int checkedState: checked ? Qt.Checked : Qt.Unchecked
+
+ /*!
+ This property determines whether the \c Qt.PartiallyChecked state is
+ available.
+
+ A checkbox may be in a partially checked state when the regular checked
+ state can not be determined.
+
+ Setting \l checkedState to \c Qt.PartiallyChecked will implicitly set
+ this property to \c true.
+
+ If this property is \c true, \l {AbstractCheckable::checked}{checked} will be \c false.
+
+ By default, this property is \c false.
+ */
+ property bool partiallyCheckedEnabled: false
+
+ /*!
+ \internal
+ True if onCheckedChanged should be ignored because we were reacting
+ to onCheckedStateChanged.
+ */
+ property bool __ignoreChecked: false
+
+ style: Qt.createComponent(Settings.style + "/CheckBoxStyle.qml", checkBox)
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.CheckBox
+ Accessible.name: text
+
+ __cycleStatesHandler: __cycleCheckBoxStates
+
+ onCheckedChanged: {
+ if (!__ignoreChecked)
+ checkedState = checked ? Qt.Checked : Qt.Unchecked;
+ }
+
+ onCheckedStateChanged: {
+ __ignoreChecked = true;
+ if (checkedState === Qt.PartiallyChecked) {
+ partiallyCheckedEnabled = true;
+ checked = false;
+ } else {
+ checked = checkedState === Qt.Checked;
+ }
+ __ignoreChecked = false;
+ }
+
+ onPartiallyCheckedEnabledChanged: {
+ if (exclusiveGroup && partiallyCheckedEnabled) {
+ console.warn("Cannot have partially checked boxes in an ExclusiveGroup.");
+ }
+ }
+
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup && partiallyCheckedEnabled) {
+ console.warn("Cannot have partially checked boxes in an ExclusiveGroup.");
+ }
+ }
+
+ /*! \internal */
+ function __cycleCheckBoxStates() {
+ if (!partiallyCheckedEnabled) {
+ checked = !checked;
+ } else {
+ switch (checkedState) {
+ case Qt.Unchecked: checkedState = Qt.Checked; break;
+ case Qt.Checked: checkedState = Qt.PartiallyChecked; break;
+ case Qt.PartiallyChecked: checkedState = Qt.Unchecked; break;
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ComboBox.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ComboBox.qml
new file mode 100644
index 0000000000..db39f579fe
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ComboBox.qml
@@ -0,0 +1,562 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ComboBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Provides a drop-down list functionality.
+
+ Add items to the comboBox by assigning it a ListModel, or a list of strings to the \l model property.
+
+ \qml
+ ComboBox {
+ width: 200
+ model: [ "Banana", "Apple", "Coconut" ]
+ }
+ \endqml
+
+ In this example we are demonstrating how to use a ListModel with a combo box.
+
+ \qml
+ ComboBox {
+ currentIndex: 2
+ model: ListModel {
+ id: cbItems
+ ListElement { text: "Banana"; color: "Yellow" }
+ ListElement { text: "Apple"; color: "Green" }
+ ListElement { text: "Coconut"; color: "Brown" }
+ }
+ width: 200
+ onCurrentIndexChanged: console.debug(cbItems.get(currentIndex).text + ", " + cbItems.get(currentIndex).color)
+ }
+ \endqml
+
+ You can make a combo box editable by setting the \l editable property. An editable combo box will
+ autocomplete its text based on what is available in the model.
+
+ In the next example we demonstrate how you can append content to an editable combo box by
+ reacting to the \l accepted signal. Note that you have to explicitly prevent duplicates.
+
+ \qml
+ ComboBox {
+ editable: true
+ model: ListModel {
+ id: model
+ ListElement { text: "Banana"; color: "Yellow" }
+ ListElement { text: "Apple"; color: "Green" }
+ ListElement { text: "Coconut"; color: "Brown" }
+ }
+ onAccepted: {
+ if (editableCombo.find(currentText) === -1) {
+ model.append({text: editText})
+ currentIndex = editableCombo.find(editText)
+ }
+ }
+ }
+ \endqml
+
+
+ You can create a custom appearance for a ComboBox by
+ assigning a \l {QtQuick.Controls.Styles::ComboBoxStyle}{ComboBoxStyle}.
+*/
+
+Control {
+ id: comboBox
+
+ /*! \qmlproperty model ComboBox::model
+ The model to populate the ComboBox from.
+
+ Changing the model after initialization will reset \l currentIndex to \c 0.
+ */
+ property alias model: popupItems.model
+
+ /*! The model role used for populating the ComboBox. */
+ property string textRole: ""
+
+ /*! \qmlproperty int ComboBox::currentIndex
+ The index of the currently selected item in the ComboBox.
+
+ \sa model
+ */
+ property alias currentIndex: popup.__selectedIndex
+
+ /*! \qmlproperty string ComboBox::currentText
+ The text of the currently selected item in the ComboBox.
+
+ \note Since \c currentText depends on \c currentIndex, there's no way to ensure \c currentText
+ will be up to date whenever a \c onCurrentIndexChanged handler is called.
+ */
+ readonly property alias currentText: popup.currentText
+
+ /*! This property holds whether the combo box can be edited by the user.
+ The default value is \c false.
+ \since QtQuick.Controls 1.1
+ */
+ property bool editable: false
+
+ /*! \qmlproperty string ComboBox::editText
+ \since QtQuick.Controls 1.1
+ This property specifies text being manipulated by the user for an editable combo box.
+ */
+ property alias editText: input.text
+
+ /*! This property specifies whether the combobox should gain active focus when pressed.
+ The default value is \c false. */
+ property bool activeFocusOnPress: false
+
+ /*! \qmlproperty bool ComboBox::pressed
+
+ This property holds whether the button is being pressed. */
+ readonly property bool pressed: mouseArea.pressed && mouseArea.containsMouse || popup.__popupVisible
+
+ /*! \qmlproperty bool ComboBox::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*! \qmlproperty int ComboBox::count
+ \since QtQuick.Controls 1.1
+ This property holds the number of items in the combo box.
+ */
+ readonly property alias count: popupItems.count
+
+ /*! Returns the text for a given \a index.
+ If an invalid index is provided, \c null is returned
+ \since QtQuick.Controls 1.1
+ */
+ function textAt (index) {
+ if (index >= count || index < 0)
+ return null;
+ return popupItems.objectAt(index).text;
+ }
+
+ /*! Finds and returns the index of a given \a text
+ If no match is found, \c -1 is returned. The search is case sensitive.
+ \since QtQuick.Controls 1.1
+ */
+ function find (text) {
+ return input.find(text, Qt.MatchExactly)
+ }
+
+ /*!
+ \qmlproperty Validator ComboBox::validator
+ \since QtQuick.Controls 1.1
+
+ Allows you to set a text validator for an editable ComboBox.
+ When a validator is set,
+ the text field will only accept input which leaves the text property in
+ an intermediate state. The accepted signal will only be sent
+ if the text is in an acceptable state when enter is pressed.
+
+ Currently supported validators are \l{QtQuick2::IntValidator},
+ \l{QtQuick2::DoubleValidator}, and \l{QtQuick2::RegExpValidator}. An
+ example of using validators is shown below, which allows input of
+ integers between 11 and 31 into the text field:
+
+ \note This property is only applied when \l editable is \c true
+
+ \qml
+ import QtQuick 2.1
+ import QtQuick.Controls 1.1
+
+ ComboBox {
+ editable: true
+ model: 10
+ validator: IntValidator {bottom: 0; top: 10;}
+ focus: true
+ }
+ \endqml
+
+ \sa acceptableInput, accepted, editable
+ */
+ property alias validator: input.validator
+
+ /*!
+ \qmlproperty bool ComboBox::acceptableInput
+ \since QtQuick.Controls 1.1
+
+ Returns \c true if the combo box contains acceptable
+ text in the editable text field.
+
+ If a validator was set, this property will return \c
+ true if the current text satisfies the validator or mask as
+ a final string (not as an intermediate string).
+
+ \sa validator, accepted
+
+ */
+ readonly property alias acceptableInput: input.acceptableInput
+
+ /*!
+ \qmlsignal ComboBox::accepted()
+ \since QtQuick.Controls 1.1
+
+ This signal is emitted when the Return or Enter key is pressed on an
+ \l editable combo box. If the confirmed string is not currently in the model,
+ the currentIndex will be set to -1 and the \l currentText will be updated
+ accordingly.
+
+ \note If there is a \l validator set on the combobox,
+ the signal will only be emitted if the input is in an acceptable state.
+ */
+ signal accepted
+
+ /*!
+ \qmlsignal ComboBox::activated(int index)
+ \since QtQuick.Controls 1.1
+
+ \a index is the triggered model index or -1 if a new string is accepted
+
+ This signal is similar to currentIndex changed, but will only
+ be emitted if the combo box index was changed by the user and not
+ when set programatically.
+ */
+ signal activated(int index)
+
+ /*!
+ \qmlmethod ComboBox::selectAll()
+ \since QtQuick.Controls 1.1
+
+ Causes all \l editText to be selected.
+ */
+ function selectAll() {
+ input.selectAll()
+ }
+
+ /*! \internal */
+ property var __popup: popup
+
+ style: Qt.createComponent(Settings.style + "/ComboBoxStyle.qml", comboBox)
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.ComboBox
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ onPressed: {
+ if (comboBox.activeFocusOnPress)
+ forceActiveFocus()
+ popup.show()
+ }
+ }
+
+ Component.onCompleted: {
+ if (currentIndex === -1)
+ currentIndex = 0
+
+ popup.ready = true
+ popup.resolveTextValue(textRole)
+ }
+
+ Keys.onPressed: {
+ // Perform one-character based lookup for non-editable combo box
+ if (!editable && event.text.length > 0) {
+ var index = input.find(event.text, Qt.MatchStartsWith);
+ if (index >= 0 && index !== currentIndex) {
+ currentIndex = index;
+ activated(currentIndex);
+ }
+ }
+ }
+
+ TextInput {
+ id: input
+
+ visible: editable
+ enabled: editable
+ focus: true
+ clip: contentWidth > width
+ text: currentText
+
+ anchors.fill: parent
+ anchors.leftMargin: 8
+ anchors.rightMargin: __style.drowDownButtonWidth
+
+ verticalAlignment: Text.AlignVCenter
+
+ renderType: Text.NativeRendering
+ selectByMouse: true
+ selectionColor: syspal.highlight
+ selectedTextColor: syspal.highlightedText
+ onAccepted: {
+ var idx = input.find(editText)
+ if (idx > -1) {
+ var string = textAt(idx);
+ if (string.length === editText.length) {
+ currentIndex = idx;
+ editText = string;
+ }
+ } else {
+ currentIndex = -1;
+ popup.currentText = editText;
+ }
+ comboBox.accepted();
+ }
+
+ SystemPalette { id: syspal }
+
+ property bool blockUpdate: false
+ property string prevText
+
+ function find (text, searchType) {
+ for (var i = 0 ; i < popupItems.count ; ++i) {
+ var currentString = popupItems.objectAt(i).text
+ if (searchType === Qt.MatchExactly) {
+ if (text === currentString)
+ return i;
+ } else if (searchType === Qt.CaseSensitive) {
+ if (currentString.indexOf(text) === 0)
+ return i;
+ } else if (currentString.toLowerCase().indexOf(text.toLowerCase()) === 0) {
+ return i
+ }
+ }
+ return -1;
+ }
+
+ // Finds first entry and shortest entry. Used by editable combo
+ function tryComplete (inputText) {
+ var candidate = "";
+ var shortestString = "";
+ for (var i = 0 ; i < popupItems.count ; ++i) {
+ var currentString = popupItems.objectAt(i).text;
+
+ if (currentString.toLowerCase().indexOf(inputText.toLowerCase()) === 0) {
+ if (candidate.length) { // Find smallest possible match
+ var cmp = 0;
+
+ // We try to complete the shortest string that matches our search
+ if (currentString.length < candidate.length)
+ candidate = currentString
+
+ while (cmp < Math.min(currentString.length, shortestString.length)
+ && shortestString[cmp].toLowerCase() === currentString[cmp].toLowerCase())
+ cmp++;
+ shortestString = shortestString.substring(0, cmp);
+ } else { // First match, select as current index and find other matches
+ candidate = currentString;
+ shortestString = currentString;
+ }
+ }
+ }
+
+ if (candidate.length)
+ return inputText + candidate.substring(inputText.length, candidate.length);
+ return inputText;
+ }
+
+ property bool allowComplete: false
+ Keys.onPressed: allowComplete = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete);
+
+ onTextChanged: {
+ if (editable && !blockUpdate && allowComplete) {
+ var completed = input.tryComplete(text)
+ if (completed.length > text.length) {
+ var oldtext = input.text;
+ input.text = completed;
+ input.select(text.length, oldtext.length);
+ }
+ }
+ prevText = text
+ }
+ }
+
+ onTextRoleChanged: popup.resolveTextValue(textRole)
+
+ Menu {
+ id: popup
+ objectName: "popup"
+
+ style: isPopup ? __style.__popupStyle : __style.__dropDownStyle
+
+ property string currentText: selectedText
+ onSelectedTextChanged: if (selectedText) popup.currentText = selectedText
+
+ property string selectedText
+ on__SelectedIndexChanged: updateSelectedText()
+ property string textRole: ""
+
+ property bool ready: false
+ property bool isPopup: !editable && !!__panel && __panel.popup
+
+ property int y: isPopup ? (comboBox.__panel.height - comboBox.__panel.implicitHeight) / 2.0 : comboBox.__panel.height
+ __minimumWidth: comboBox.width
+ __visualItem: comboBox
+
+ property ExclusiveGroup eg: ExclusiveGroup { id: eg }
+
+ property bool __modelIsArray: popupItems.model ? popupItems.model.constructor === Array : false
+
+ Instantiator {
+ id: popupItems
+ active: false
+
+ property bool updatingModel: false
+ onModelChanged: {
+ if (active) {
+ if (updatingModel && popup.__selectedIndex === 0) {
+ // We still want to update the currentText
+ popup.updateSelectedText()
+ } else {
+ updatingModel = true
+ popup.__selectedIndex = 0
+ }
+ }
+ }
+
+ MenuItem {
+ text: popup.textRole === '' ?
+ modelData :
+ ((popup.__modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '')
+ onTriggered: {
+ if (index !== currentIndex)
+ activated(index)
+ comboBox.editText = text
+ }
+ checkable: true
+ exclusiveGroup: eg
+ }
+ onObjectAdded: {
+ popup.insertItem(index, object)
+ if (!updatingModel && index === popup.__selectedIndex)
+ popup.selectedText = object["text"]
+ }
+ onObjectRemoved: popup.removeItem(object)
+
+ }
+
+ function resolveTextValue(initialTextRole) {
+ if (!ready || !model) {
+ popupItems.active = false
+ return;
+ }
+
+ var get = model['get'];
+ if (!get && popup.__modelIsArray) {
+ if (model[0].constructor !== String && model[0].constructor !== Number)
+ get = function(i) { return model[i]; }
+ }
+
+ var modelMayHaveRoles = get !== undefined
+ textRole = initialTextRole
+ if (textRole === "" && modelMayHaveRoles && get(0)) {
+ // No text role set, check whether model has a suitable role
+ // If 'text' is found, or there's only one role, pick that.
+ var listElement = get(0)
+ var roleName = ""
+ var roleCount = 0
+ for (var role in listElement) {
+ if (listElement[role].constructor === Function)
+ continue;
+ if (role === "text") {
+ roleName = role
+ break
+ } else if (!roleName) {
+ roleName = role
+ }
+ ++roleCount
+ }
+ if (roleCount > 1 && roleName !== "text") {
+ console.warn("No suitable 'textRole' found for ComboBox.")
+ } else {
+ textRole = roleName
+ }
+ }
+
+ if (!popupItems.active)
+ popupItems.active = true
+ else
+ updateSelectedText()
+ }
+
+ function show() {
+ if (items[__selectedIndex])
+ items[__selectedIndex].checked = true
+ __currentIndex = comboBox.currentIndex
+ if (Qt.application.layoutDirection === Qt.RightToLeft)
+ __popup(comboBox.width, y, isPopup ? __selectedIndex : 0)
+ else
+ __popup(0, y, isPopup ? __selectedIndex : 0)
+ }
+
+ function updateSelectedText() {
+ var selectedItem;
+ if (__selectedIndex !== -1 && (selectedItem = items[__selectedIndex]))
+ selectedText = selectedItem.text
+ }
+ }
+
+ // The key bindings below will only be in use when popup is
+ // not visible. Otherwise, native popup key handling will take place:
+ Keys.onSpacePressed: {
+ if (!popup.popupVisible)
+ popup.show()
+ }
+
+ Keys.onUpPressed: {
+ input.blockUpdate = true
+ if (currentIndex > 0) {
+ currentIndex--;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+
+ Keys.onDownPressed: {
+ input.blockUpdate = true;
+ if (currentIndex < popupItems.count - 1) {
+ currentIndex++;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/GroupBox.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/GroupBox.qml
new file mode 100644
index 0000000000..12959d16ff
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/GroupBox.qml
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Layouts 1.0
+
+/*!
+ \qmltype GroupBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief GroupBox provides a group box frame with a title.
+
+ A group box provides a frame, a title on top and displays various other controls inside itself. Group boxes can also be checkable.
+
+ Child controls in checkable group boxes are enabled or disabled depending on whether or not the group box is checked.
+
+ You can minimize the space consumption of a group box by enabling the flat property.
+ In most styles, enabling this property results in the removal of the left, right and bottom edges of the frame.
+
+ To add content to a group box, you can reparent it to its contentItem property.
+
+ The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor
+ items inside the group box, you must specify an explicit width and height on the GroupBox itself.
+
+ The following example shows how we use a GroupBox with a column:
+
+ \qml
+ GroupBox {
+ title: qsTr("Package selection")
+ Column {
+ spacing: 2
+ CheckBox {
+ text: qsTr("Update system")
+ }
+ CheckBox {
+ text: qsTr("Update applications")
+ }
+ CheckBox {
+ text: qsTr("Update documentation")
+ }
+ }
+ }
+ \endqml
+
+ \sa CheckBox, RadioButton, Layout
+
+*/
+
+FocusScope {
+ id: groupbox
+
+ /*!
+ This property holds the group box title text.
+
+ There is no default title text.
+ */
+ property string title
+
+ /*!
+ This property holds whether the group box is painted flat or has a frame.
+
+ A group box usually consists of a surrounding frame with a title at the top.
+ If this property is enabled, only the top part of the frame is drawn in most styles;
+ otherwise, the whole frame is drawn.
+
+ By default, this property is disabled, so group boxes are not flat unless explicitly specified.
+
+ \note In some styles, flat and non-flat group boxes have similar representations and may not be as
+ distinguishable as they are in other styles.
+ */
+ property bool flat: false
+
+ /*!
+ This property holds whether the group box has a checkbox in its title.
+
+ If this property is true, the group box displays its title using a checkbox in place of an ordinary label.
+ If the checkbox is checked, the group box's children are enabled; otherwise, they are disabled and inaccessible.
+
+ By default, group boxes are not checkable.
+ */
+ property bool checkable: false
+
+ /*!
+ \qmlproperty bool GroupBox::checked
+
+ This property holds whether the group box is checked.
+
+ If the group box is checkable, it is displayed with a check box. If the check box is checked, the group
+ box's children are enabled; otherwise, the children are disabled and are inaccessible to the user.
+
+ By default, checkable group boxes are also checked.
+ */
+ property alias checked: check.checked
+
+
+ /*! \internal */
+ default property alias __content: container.data
+
+ /*!
+ \qmlproperty Item GroupBox::contentItem
+
+ This property holds the content Item of the group box.
+
+ Items declared as children of a GroupBox are automatically parented to the GroupBox's contentItem.
+ Items created dynamically need to be explicitly parented to the contentItem:
+
+ \note The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor
+ items inside the group box, you must specify an explicit width and height on the GroupBox itself.
+ */
+ readonly property alias contentItem: container
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/GroupBoxStyle.qml", groupbox)
+
+ /*! \internal */
+ property alias __checkbox: check
+
+ /*! \internal */
+ property alias __style: styleLoader.item
+
+ implicitWidth: Math.max((!anchors.fill ? container.calcWidth() : 0) + loader.leftMargin + loader.rightMargin,
+ sizeHint.implicitWidth + (checkable ? 24 : 6))
+ implicitHeight: (!anchors.fill ? container.calcHeight() : 0) + loader.topMargin + loader.bottomMargin
+
+ Layout.minimumWidth: implicitWidth
+ Layout.minimumHeight: implicitHeight
+
+ Accessible.role: Accessible.Grouping
+ Accessible.name: title
+
+ activeFocusOnTab: false
+
+
+ data: [
+ Loader {
+ id: loader
+ anchors.fill: parent
+ property int topMargin: __style ? __style.padding.top : 0
+ property int bottomMargin: __style ? __style.padding.bottom : 0
+ property int leftMargin: __style ? __style.padding.left : 0
+ property int rightMargin: __style ? __style.padding.right : 0
+ sourceComponent: styleLoader.item ? styleLoader.item.panel : null
+ onLoaded: item.z = -1
+ Text { id: sizeHint ; visible: false ; text: title }
+ Loader {
+ id: styleLoader
+ property alias __control: groupbox
+ sourceComponent: groupbox.style
+ }
+ },
+ CheckBox {
+ id: check
+ objectName: "check"
+ checked: true
+ text: groupbox.title
+ visible: checkable
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: loader.topMargin
+ activeFocusOnTab: groupbox.checkable
+ style: CheckBoxStyle { panel: Item{} }
+ },
+ Item {
+ id: container
+ objectName: "container"
+ z: 1
+ focus: true
+ anchors.fill: parent
+
+ anchors.topMargin: loader.topMargin
+ anchors.leftMargin: loader.leftMargin
+ anchors.rightMargin: loader.rightMargin
+ anchors.bottomMargin: loader.bottomMargin
+ enabled: (!groupbox.checkable || groupbox.checked)
+
+ property Item layoutItem: container.children.length === 1 ? container.children[0] : null
+ function calcWidth () { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) : container.childrenRect.width) }
+ function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) : container.childrenRect.height) }
+ }]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Label.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Label.qml
new file mode 100644
index 0000000000..01f2a1629c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Label.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+/*!
+ \qmltype Label
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A text label.
+
+ In addition to the normal \l Text element, Label follows the font and
+ color scheme of the system.
+ Use the \c text property to assign a text to the label. For other properties
+ check \l Text.
+
+ A simple label looks like this:
+ \qml
+ Label {
+ text: "Hello world"
+ }
+ \endqml
+
+ You can use the properties of \l Text to change the appearance
+ of the text as desired:
+ \qml
+ Label {
+ text: "Hello world"
+ font.pixelSize: 22
+ font.italic: true
+ color: "steelblue"
+ }
+ \endqml
+
+ \sa Text, TextField, TextEdit
+*/
+
+Text {
+ /*!
+ \qmlproperty string Label::text
+
+ The text to display. Use this property to get and set it.
+ */
+
+ id: label
+ color: pal.text
+ activeFocusOnTab: false
+ renderType: Text.NativeRendering
+ SystemPalette {
+ id: pal
+ colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Menu.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Menu.qml
new file mode 100644
index 0000000000..9c76684605
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Menu.qml
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Menu
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup menus
+ \brief Provides a menu component for use in menu bars, as context menu,
+ and other popup menus.
+
+ \code
+ Menu {
+ title: "Edit"
+
+ MenuItem {
+ text: "Cut"
+ shortcut: "Ctrl+X"
+ onTriggered: ...
+ }
+
+ MenuItem {
+ text: "Copy"
+ shortcut: "Ctrl+C"
+ onTriggered: ...
+ }
+
+ MenuItem {
+ text: "Paste"
+ shortcut: "Ctrl+V"
+ onTriggered: ...
+ }
+
+ MenuSeparator { }
+
+ Menu {
+ title: "More Stuff"
+
+ MenuItem {
+ text: "Do Nothing"
+ }
+ }
+ }
+ \endcode
+
+ The main uses for menus:
+ \list
+ \li
+ as a \e top-level menu in a \l MenuBar
+ \li
+ as a \e submenu inside another menu
+ \li
+ as a standalone or \e context menu
+ \endlist
+
+ Note that some properties, such as \c enabled, \c text, or \c iconSource,
+ only make sense in a particular use case of the menu.
+
+ \sa MenuBar, MenuItem, MenuSeparator
+*/
+
+MenuPrivate {
+ id: root
+
+ /*! \internal
+ \omit
+ Documented in qqquickmenu.cpp.
+ \endomit
+ */
+ function addMenu(title) {
+ return root.insertMenu(items.length, title)
+ }
+
+ /*! \internal
+ \omit
+ Documented in qquickmenu.cpp.
+ \endomit
+ */
+ function insertMenu(index, title) {
+ if (!__selfComponent)
+ __selfComponent = Qt.createComponent("Menu.qml", root)
+ var submenu = __selfComponent.createObject(__selfComponent, { "title": title })
+ root.insertItem(index, submenu)
+ return submenu
+ }
+
+ /*! \internal */
+ property Component __selfComponent: null
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/MenuStyle.qml", root)
+
+ /*! \internal */
+ property var __parentContentItem: __parentMenu.__contentItem
+ /*! \internal */
+ property int __currentIndex: -1
+ /*! \internal */
+ on__MenuClosed: __currentIndex = -1
+
+ /*! \internal */
+ __contentItem: Loader {
+ sourceComponent: MenuContentItem {
+ menu: root
+ }
+ active: !root.__isNative && root.__popupVisible
+ focus: true
+ Keys.forwardTo: item ? [item, root.__parentContentItem] : []
+ property bool altPressed: root.__parentContentItem ? root.__parentContentItem.altPressed : false
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/MenuBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/MenuBar.qml
new file mode 100644
index 0000000000..42b3f39aad
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/MenuBar.qml
@@ -0,0 +1,276 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype MenuBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup applicationwindow
+ \brief Provides a horizontal menu bar.
+
+ \code
+ MenuBar {
+ Menu {
+ title: "File"
+ MenuItem { text: "Open..." }
+ MenuItem { text: "Close" }
+ }
+
+ Menu {
+ title: "Edit"
+ MenuItem { text: "Cut" }
+ MenuItem { text: "Copy" }
+ MenuItem { text: "Paste" }
+ }
+ }
+ \endcode
+
+ \sa ApplicationWindow::menuBar
+*/
+
+MenuBarPrivate {
+ id: root
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/MenuBarStyle.qml", root)
+
+ /*! \internal */
+ __contentItem: Loader {
+ id: topLoader
+ sourceComponent: __menuBarComponent
+ active: !root.__isNative
+ focus: true
+ Keys.forwardTo: [item]
+ property bool altPressed: item ? item.altPressed : false
+ }
+
+ /*! \internal */
+ property Component __menuBarComponent: Loader {
+ id: menuBarLoader
+
+ property Style __style: styleLoader.item
+ property Component menuItemStyle: __style ? __style.menuItem : null
+
+ property var control: root
+ onStatusChanged: if (status === Loader.Error) console.error("Failed to load panel for", root)
+
+ visible: status === Loader.Ready
+ sourceComponent: __style ? __style.frame : undefined
+
+ Loader {
+ id: styleLoader
+ property alias __control: menuBarLoader
+ sourceComponent: root.style
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", root)
+ }
+ }
+
+ property int openedMenuIndex: -1
+ property bool preselectMenuItem: false
+ property alias contentHeight: row.height
+
+ Binding {
+ // Make sure the styled menu bar is in the background
+ target: menuBarLoader.item
+ property: "z"
+ value: menuMouseArea.z - 1
+ }
+
+ focus: true
+
+ property bool altPressed: false
+ property bool altPressedAgain: false
+ property var mnemonicsMap: ({})
+
+ Keys.onPressed: {
+ var action = null
+ if (event.key === Qt.Key_Alt) {
+ if (!altPressed)
+ altPressed = true
+ else
+ altPressedAgain = true
+ } else if (altPressed && (action = mnemonicsMap[event.text.toUpperCase()])) {
+ preselectMenuItem = true
+ action.trigger()
+ event.accepted = true
+ }
+ }
+
+ function dismissActiveFocus(event, reason) {
+ if (reason) {
+ altPressedAgain = false
+ altPressed = false
+ openedMenuIndex = -1
+ root.__contentItem.parent.forceActiveFocus()
+ } else {
+ event.accepted = false
+ }
+ }
+
+ Keys.onReleased: dismissActiveFocus(event, altPressedAgain && openedMenuIndex === -1)
+ Keys.onEscapePressed: dismissActiveFocus(event, openedMenuIndex === -1)
+
+ function maybeOpenFirstMenu(event) {
+ if (altPressed && openedMenuIndex === -1) {
+ preselectMenuItem = true
+ openedMenuIndex = 0
+ } else {
+ event.accepted = false
+ }
+ }
+
+ Keys.onUpPressed: maybeOpenFirstMenu(event)
+ Keys.onDownPressed: maybeOpenFirstMenu(event)
+
+ Keys.onLeftPressed: {
+ if (openedMenuIndex > 0) {
+ preselectMenuItem = true
+ openedMenuIndex--
+ }
+ }
+
+ Keys.onRightPressed: {
+ if (openedMenuIndex !== -1 && openedMenuIndex < root.menus.length - 1) {
+ preselectMenuItem = true
+ openedMenuIndex++
+ }
+ }
+
+ MouseArea {
+ id: menuMouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+
+ onPositionChanged: updateCurrentItem(mouse, false)
+ onPressed: {
+ if (updateCurrentItem(mouse)) {
+ menuBarLoader.preselectMenuItem = false
+ menuBarLoader.openedMenuIndex = currentItem.menuItemIndex
+ }
+ }
+ onExited: hoveredItem = null
+
+ property Item currentItem: null
+ property Item hoveredItem: null
+ function updateCurrentItem(mouse) {
+ var pos = mapToItem(row, mouse.x, mouse.y)
+ if (!hoveredItem || !hoveredItem.contains(Qt.point(pos.x - currentItem.x, pos.y - currentItem.y))) {
+ hoveredItem = row.childAt(pos.x, pos.y)
+ if (!hoveredItem)
+ return false;
+ currentItem = hoveredItem
+ if (menuBarLoader.openedMenuIndex !== -1) {
+ menuBarLoader.preselectMenuItem = false
+ menuBarLoader.openedMenuIndex = currentItem.menuItemIndex
+ }
+ }
+ return true;
+ }
+
+ Row {
+ id: row
+ width: parent.width
+ LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
+
+ Repeater {
+ id: itemsRepeater
+ model: root.menus
+ Loader {
+ id: menuItemLoader
+
+ property var menuItem: modelData
+ property bool selected: menuMouseArea.hoveredItem === menuItemLoader
+ property bool sunken: menuItem.__popupVisible || menuBarLoader.openedMenuIndex === index
+ property bool showUnderlined: menuBarLoader.altPressed
+
+ sourceComponent: menuBarLoader.menuItemStyle
+ property int menuItemIndex: index
+ visible: menuItem.visible
+
+ Connections {
+ target: menuBarLoader
+ onOpenedMenuIndexChanged: {
+ if (menuBarLoader.openedMenuIndex === index) {
+ if (row.LayoutMirroring.enabled)
+ menuItem.__popup(menuItemLoader.width, menuBarLoader.height, 0)
+ else
+ menuItem.__popup(0, menuBarLoader.height, 0)
+ if (menuBarLoader.preselectMenuItem)
+ menuItem.__currentIndex = 0
+ } else {
+ menuItem.__closeMenu()
+ }
+ }
+ }
+
+ Connections {
+ target: menuItem
+ onPopupVisibleChanged: {
+ if (!menuItem.__popupVisible && menuBarLoader.openedMenuIndex === index)
+ menuBarLoader.openedMenuIndex = -1
+ }
+ }
+
+ Connections {
+ target: menuItem.__action
+ onTriggered: menuBarLoader.openedMenuIndex = menuItemIndex
+ }
+
+ Component.onCompleted: {
+ menuItem.__visualItem = menuItemLoader
+
+ var title = menuItem.title
+ var ampersandPos = title.indexOf("&")
+ if (ampersandPos !== -1)
+ menuBarLoader.mnemonicsMap[title[ampersandPos + 1].toUpperCase()] = menuItem.__action
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/AbstractCheckable.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/AbstractCheckable.qml
new file mode 100644
index 0000000000..858569e8f5
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/AbstractCheckable.qml
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+
+/*!
+ \qmltype AbstractCheckable
+ \inqmlmodule QtQuick.Controls
+ \ingroup controls
+ \brief An abstract representation of a checkable control with a label
+ \qmlabstract
+ \internal
+
+ A checkable control is one that has two states: checked (on) and
+ unchecked (off). AbstractCheckable encapsulates the basic behavior and
+ states that are required by checkable controls.
+
+ Examples of checkable controls are RadioButton and
+ CheckBox. CheckBox extends AbstractCheckable's behavior by adding a third
+ state: partially checked.
+*/
+
+Control {
+ id: abstractCheckable
+
+ /*!
+ Emitted whenever the control is clicked.
+ */
+ signal clicked
+
+ /*!
+ \qmlproperty bool AbstractCheckable::pressed
+
+ This property is \c true if the control is being pressed.
+ Set this property to manually invoke a mouse click.
+ */
+ property alias pressed: mouseArea.effectivePressed
+
+ /*! \qmlproperty bool AbstractCheckcable::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*!
+ This property is \c true if the control is checked.
+ */
+ property bool checked: false
+
+ /*!
+ This property is \c true if the control takes the focus when it is
+ pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be
+ called on the control.
+ */
+ property bool activeFocusOnPress: false
+
+ /*!
+ This property stores the ExclusiveGroup that the control belongs to.
+ */
+ property ExclusiveGroup exclusiveGroup: null
+
+ /*!
+ This property holds the text that the label should display.
+ */
+ property string text
+
+ /*! \internal */
+ property var __cycleStatesHandler: cycleRadioButtonStates
+
+ activeFocusOnTab: true
+
+ MouseArea {
+ id: mouseArea
+ focus: true
+ anchors.fill: parent
+ hoverEnabled: true
+ enabled: !keyPressed
+
+ property bool keyPressed: false
+ property bool effectivePressed: pressed && containsMouse || keyPressed
+
+ onClicked: abstractCheckable.clicked();
+
+ onPressed: if (activeFocusOnPress) forceActiveFocus();
+
+ onReleased: {
+ if (containsMouse && (!exclusiveGroup || !checked))
+ __cycleStatesHandler();
+ }
+ }
+
+ /*! \internal */
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup)
+ exclusiveGroup.bindCheckable(abstractCheckable)
+ }
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && !mouseArea.pressed)
+ mouseArea.keyPressed = true;
+ }
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && mouseArea.keyPressed) {
+ mouseArea.keyPressed = false;
+ if (!exclusiveGroup || !checked)
+ __cycleStatesHandler();
+ clicked();
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/BasicButton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/BasicButton.qml
new file mode 100644
index 0000000000..4c1eeb042c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/BasicButton.qml
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+
+/*!
+ \qmltype BasicButton
+ \internal
+ \qmlabstract
+ \inqmlmodule QtQuick.Controls.Private
+*/
+
+Control {
+ id: button
+
+ /*! This signal is emitted when the button is clicked. */
+ signal clicked
+
+ /*! \qmlproperty bool BasicButton::pressed
+
+ This property holds whether the button is being pressed. */
+ readonly property alias pressed: button.__effectivePressed
+
+ /*! \qmlproperty bool BasicButton::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: behavior.containsMouse
+
+ /*! This property holds whether the button is checkable.
+
+ The default value is \c false. */
+ property bool checkable: false
+
+ /*! This property holds whether the button is checked.
+
+ Only checkable buttons can be checked.
+
+ The default value is \c false. */
+ property bool checked: false
+
+ /*! This property holds the ExclusiveGroup that the button belongs to.
+
+ The default value is \c null. */
+ property ExclusiveGroup exclusiveGroup: null
+
+ /*! This property holds the associated button action.
+
+ If a button has an action associated, the action defines the
+ button's properties like checked, text, tooltip etc.
+
+ When an action is set, it's still possible to override the \l text,
+ \l tooltip, \l iconSource, and \l iconName properties.
+
+ The default value is \c null. */
+ property Action action: null
+
+ /*! This property specifies whether the button should gain active focus when pressed.
+
+ The default value is \c false. */
+ property bool activeFocusOnPress: false
+
+ /*! This property holds the text shown on the button. If the button has no
+ text, the \l text property will be an empty string.
+
+ The default value is the empty string.
+ */
+ property string text: action ? action.text : ""
+
+ /*! This property holds the button tooltip. */
+ property string tooltip: action ? (action.tooltip || StyleHelpers.removeMnemonics(action.text)) : ""
+
+ /*! This property holds the icon shown on the button. If the button has no
+ icon, the iconSource property will be an empty string.
+
+ The default value is the empty string.
+ */
+ property url iconSource: action ? action.iconSource : ""
+
+ /*! The image label source as theme name.
+ When an icon from the platform icon theme is found, this takes
+ precedence over iconSource.
+ */
+ property string iconName: action ? action.iconName : ""
+
+ /*! \internal */
+ property color __textColor: syspal.text
+ /*! \internal */
+ property string __position: "only"
+ /*! \internal */
+ readonly property bool __iconOverriden: button.action && (button.action.iconSource !== button.iconSource || button.action.iconName !== button.iconName)
+ /*! \internal */
+ property Action __action: action || ownAction
+ /*! \internal */
+ readonly property Action __iconAction: __iconOverriden ? ownAction : __action
+
+ /*! \internal */
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup)
+ exclusiveGroup.bindCheckable(button)
+ }
+
+ Accessible.role: Accessible.Button
+ Accessible.description: tooltip
+
+ /*! \internal */
+ function accessiblePressAction() {
+ __action.trigger(button)
+ }
+
+ Action {
+ id: ownAction
+ iconSource: !button.action || __iconOverriden ? button.iconSource : ""
+ iconName: !button.action || __iconOverriden ? button.iconName : ""
+ }
+
+ Connections {
+ target: __action
+ onTriggered: button.clicked()
+ }
+
+ activeFocusOnTab: true
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && !behavior.pressed)
+ behavior.keyPressed = true;
+ }
+
+ onFocusChanged: if (!focus) behavior.keyPressed = false
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && behavior.keyPressed) {
+ behavior.keyPressed = false;
+ __action.trigger(button)
+ behavior.toggle()
+ }
+ }
+
+ MouseArea {
+ id: behavior
+ property bool keyPressed: false
+ property bool effectivePressed: pressed && containsMouse || keyPressed
+
+ anchors.fill: parent
+ hoverEnabled: true
+ enabled: !keyPressed
+
+ function toggle() {
+ if (button.checkable && !button.action && !(button.checked && button.exclusiveGroup))
+ button.checked = !button.checked
+ }
+
+ onReleased: {
+ if (containsMouse) {
+ toggle()
+ __action.trigger(button)
+ }
+ }
+ onExited: Tooltip.hideText()
+ onCanceled: Tooltip.hideText()
+ onPressed: {
+ if (activeFocusOnPress)
+ button.forceActiveFocus()
+ }
+
+ Timer {
+ interval: 1000
+ running: behavior.containsMouse && !pressed && tooltip.length
+ onTriggered: Tooltip.showText(behavior, Qt.point(behavior.mouseX, behavior.mouseY), tooltip)
+ }
+ }
+
+ /*! \internal */
+ property var __behavior: behavior
+
+ /*! \internal */
+ property bool __effectivePressed: behavior.effectivePressed
+
+ SystemPalette { id: syspal }
+
+ states: [
+ State {
+ name: "boundAction"
+ when: action !== null
+ PropertyChanges {
+ target: button
+ enabled: action.enabled
+ checkable: action.checkable
+ checked: action.checked
+ }
+ }
+ ]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ColumnMenuContent.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ColumnMenuContent.qml
new file mode 100644
index 0000000000..bb21dcb9ce
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ColumnMenuContent.qml
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+
+Item {
+ id: content
+
+ property Component menuItemDelegate
+ property Component scrollerStyle
+ property var itemsModel
+ property int minWidth: 100
+ property real maxHeight: 800
+ property int margin: 1
+
+ signal triggered(var item)
+
+ function menuItemAt(index) {
+ list.currentIndex = index
+ return list.currentItem
+ }
+
+ width: Math.max(list.contentWidth, minWidth)
+ height: Math.min(list.contentHeight, fittedMaxHeight) + 2 * margin
+
+ readonly property int currentIndex: menu.__currentIndex
+ property Item currentItem: null
+ readonly property int itemHeight: (list.count > 0 && list.contentItem.children[0]) ? list.contentItem.children[0].height : 23
+ readonly property int fittingItems: Math.floor((maxHeight - downScroller.height) / itemHeight)
+ readonly property real fittedMaxHeight: itemHeight * fittingItems + downScroller.height
+ readonly property bool shouldUseScrollers: scrollView.__style.useScrollers && itemsModel.length > fittingItems
+ readonly property real upScrollerHeight: upScroller.visible ? upScroller.height : 0
+ readonly property real downScrollerHeight: downScroller.visible ? downScroller.height : 0
+
+ function updateCurrentItem(mouse) {
+ var pos = mapToItem(list.contentItem, mouse.x, mouse.y)
+ if (!currentItem || !currentItem.contains(Qt.point(pos.x - currentItem.x, pos.y - currentItem.y))) {
+ if (currentItem && !hoverArea.pressed && currentItem.isSubmenu)
+ currentItem.closeSubMenu()
+ currentItem = list.itemAt(pos.x, pos.y)
+ if (currentItem) {
+ menu.__currentIndex = currentItem.menuItemIndex
+ if (currentItem.isSubmenu && !currentItem.menuItem.__popupVisible)
+ currentItem.showSubMenu(false)
+ } else {
+ menu.__currentIndex = -1
+ }
+ }
+ }
+
+ ScrollView {
+ id: scrollView
+ anchors {
+ fill: parent
+ topMargin: content.margin + upScrollerHeight
+ bottomMargin: downScrollerHeight - content.margin - 1
+ rightMargin: -1
+ }
+
+ style: scrollerStyle
+ __wheelAreaScrollSpeed: itemHeight
+
+ ListView {
+ id: list
+ model: itemsModel
+ delegate: menuItemDelegate
+ snapMode: ListView.SnapToItem
+ boundsBehavior: Flickable.StopAtBounds
+ highlightFollowsCurrentItem: true
+ highlightMoveDuration: 0
+ }
+ }
+
+ MouseArea {
+ id: hoverArea
+ anchors.left: scrollView.left
+ width: scrollView.width - scrollView.__verticalScrollBar.width
+ height: parent.height
+
+ hoverEnabled: true
+ acceptedButtons: Qt.AllButtons
+
+ onPositionChanged: updateCurrentItem(mouse)
+ onReleased: content.triggered(currentItem)
+ onExited: {
+ if (currentItem && !currentItem.menuItem.__popupVisible) {
+ currentItem = null
+ menu.__currentIndex = -1
+ }
+ }
+
+ MenuContentScroller {
+ id: upScroller
+ direction: "up"
+ visible: shouldUseScrollers && !list.atYBeginning
+ x: margin
+ function scrollABit() { list.contentY -= itemHeight }
+ }
+
+ MenuContentScroller {
+ id: downScroller
+ direction: "down"
+ visible: shouldUseScrollers && !list.atYEnd
+ x: margin
+ function scrollABit() { list.contentY += itemHeight }
+ }
+ }
+
+ Timer {
+ interval: 1
+ running: true
+ repeat: false
+ onTriggered: list.positionViewAtIndex(currentIndex, scrollView.__style.useScrollers
+ ? ListView.Center : ListView.Beginning)
+ }
+
+ Binding {
+ target: scrollView.__verticalScrollBar
+ property: "singleStep"
+ value: itemHeight
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Control.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Control.qml
new file mode 100644
index 0000000000..0ce8908fb0
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Control.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls.Styles 1.1
+
+/*!
+ \qmltype Control
+ \internal
+ \qmlabstract
+ \inqmlmodule QtQuick.Controls.Private
+*/
+FocusScope {
+ id: root
+
+ /*! \qmlproperty Component Control::style
+
+ The style Component for this control.
+ \sa {Qt Quick Controls Styles QML Types}
+
+ */
+ property Component style
+
+ /*! \internal */
+ property QtObject __style: styleLoader.item
+
+ /*! \internal */
+ property Item __panel: panelLoader.item
+
+ /*! \internal */
+ property var styleHints
+
+ implicitWidth: __panel ? __panel.implicitWidth: 0
+ implicitHeight: __panel ? __panel.implicitHeight: 0
+ baselineOffset: __panel ? __panel.baselineOffset: 0
+ activeFocusOnTab: false
+
+ /*! \internal */
+ property alias __styleData: styleLoader.styleData
+
+ Loader {
+ id: panelLoader
+ anchors.fill: parent
+ sourceComponent: __style ? __style.panel : null
+ onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root)
+ Loader {
+ id: styleLoader
+ sourceComponent: style
+ property Item __control: root
+ property QtObject styleData: null
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", root)
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FastGlow.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FastGlow.qml
new file mode 100644
index 0000000000..f4bd2c7421
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FastGlow.qml
@@ -0,0 +1,393 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant source
+ property real spread: 0.0
+ property real blur: 0.0
+ property color color: "white"
+ property bool transparentBorder: false
+ property bool cached: false
+
+ SourceProxy {
+ id: sourceProxy
+ input: rootItem.source
+ }
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ property string __internalBlurVertexShader: "
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ uniform highp float yStep;
+ uniform highp float xStep;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ "
+
+ property string __internalBlurFragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 qt_TexCoord1;
+ varying highp vec2 qt_TexCoord2;
+ varying highp vec2 qt_TexCoord3;
+
+ void main() {
+ highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) +
+ texture2D(source, qt_TexCoord1) +
+ texture2D(source, qt_TexCoord2) +
+ texture2D(source, qt_TexCoord3)) * 0.25;
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+
+ ShaderEffect {
+ id: level0
+ property variant source: sourceProxy.output
+ anchors.fill: parent
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: level1
+ width: Math.ceil(shaderItem.width / 32) * 32
+ height: Math.ceil(shaderItem.height / 32) * 32
+ sourceItem: level0
+ hideSource: rootItem.visible
+ sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0)
+ smooth: true
+ visible: false
+ }
+
+ ShaderEffect {
+ id: effect1
+ property variant source: level1
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level2
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level2
+ width: level1.width / 2
+ height: level1.height / 2
+ sourceItem: effect1
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect2
+ property variant source: level2
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level3
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level3
+ width: level2.width / 2
+ height: level2.height / 2
+ sourceItem: effect2
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect3
+ property variant source: level3
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level4
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level4
+ width: level3.width / 2
+ height: level3.height / 2
+ sourceItem: effect3
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect4
+ property variant source: level4
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level5
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level5
+ width: level4.width / 2
+ height: level4.height / 2
+ sourceItem: effect4
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ ShaderEffect {
+ id: effect5
+ property variant source: level5
+ property real yStep: 1/height
+ property real xStep: 1/width
+ anchors.fill: level6
+ visible: false
+ smooth: true
+ vertexShader: __internalBlurVertexShader
+ fragmentShader: __internalBlurFragmentShader
+ }
+
+ ShaderEffectSource {
+ id: level6
+ width: level5.width / 2
+ height: level5.height / 2
+ sourceItem: effect5
+ hideSource: rootItem.visible
+ visible: false
+ smooth: true
+ }
+
+ Item {
+ id: dummysource
+ width: 1
+ height: 1
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: dummy
+ width: 1
+ height: 1
+ sourceItem: dummysource
+ visible: false
+ smooth: false
+ live: false
+ }
+
+ ShaderEffect {
+ id: shaderItem
+ x: transparentBorder ? -64 : 0
+ y: transparentBorder ? -64 : 0
+ width: transparentBorder ? parent.width + 128 : parent.width
+ height: transparentBorder ? parent.height + 128 : parent.height
+
+ property variant source1: level1
+ property variant source2: level2
+ property variant source3: level3
+ property variant source4: level4
+ property variant source5: level5
+ property variant source6: level6
+ property real lod: rootItem.blur
+
+ property real weight1;
+ property real weight2;
+ property real weight3;
+ property real weight4;
+ property real weight5;
+ property real weight6;
+
+ property real spread: 1.0 - (rootItem.spread * 0.98)
+ property alias color: rootItem.color
+
+ function weight(v) {
+ if (v <= 0.0)
+ return 1
+ if (v >= 0.5)
+ return 0
+
+ return 1.0 - v / 0.5
+ }
+
+ function calculateWeights() {
+
+ var w1 = weight(Math.abs(lod - 0.100))
+ var w2 = weight(Math.abs(lod - 0.300))
+ var w3 = weight(Math.abs(lod - 0.500))
+ var w4 = weight(Math.abs(lod - 0.700))
+ var w5 = weight(Math.abs(lod - 0.900))
+ var w6 = weight(Math.abs(lod - 1.100))
+
+ var sum = w1 + w2 + w3 + w4 + w5 + w6;
+ weight1 = w1 / sum;
+ weight2 = w2 / sum;
+ weight3 = w3 / sum;
+ weight4 = w4 / sum;
+ weight5 = w5 / sum;
+ weight6 = w6 / sum;
+
+ upateSources()
+ }
+
+ function upateSources() {
+ var sources = new Array();
+ var weights = new Array();
+
+ if (weight1 > 0) {
+ sources.push(level1)
+ weights.push(weight1)
+ }
+
+ if (weight2 > 0) {
+ sources.push(level2)
+ weights.push(weight2)
+ }
+
+ if (weight3 > 0) {
+ sources.push(level3)
+ weights.push(weight3)
+ }
+
+ if (weight4 > 0) {
+ sources.push(level4)
+ weights.push(weight4)
+ }
+
+ if (weight5 > 0) {
+ sources.push(level5)
+ weights.push(weight5)
+ }
+
+ if (weight6 > 0) {
+ sources.push(level6)
+ weights.push(weight6)
+ }
+
+ for (var j = sources.length; j < 6; j++) {
+ sources.push(dummy)
+ weights.push(0.0)
+ }
+
+ source1 = sources[0]
+ source2 = sources[1]
+ source3 = sources[2]
+ source4 = sources[3]
+ source5 = sources[4]
+ source6 = sources[5]
+
+ weight1 = weights[0]
+ weight2 = weights[1]
+ weight3 = weights[2]
+ weight4 = weights[3]
+ weight5 = weights[4]
+ weight6 = weights[5]
+ }
+
+ Component.onCompleted: calculateWeights()
+
+ onLodChanged: calculateWeights()
+
+ fragmentShader: "
+ uniform lowp sampler2D source1;
+ uniform lowp sampler2D source2;
+ uniform lowp sampler2D source3;
+ uniform lowp sampler2D source4;
+ uniform lowp sampler2D source5;
+ uniform mediump float weight1;
+ uniform mediump float weight2;
+ uniform mediump float weight3;
+ uniform mediump float weight4;
+ uniform mediump float weight5;
+ uniform highp vec4 color;
+ uniform highp float spread;
+ uniform lowp float qt_Opacity;
+ varying mediump vec2 qt_TexCoord0;
+
+ highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture2D(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture2D(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture2D(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture2D(source5, qt_TexCoord0) * weight5;
+ sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a));
+ gl_FragColor = sourceColor * qt_Opacity;
+ }
+ "
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FocusFrame.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FocusFrame.qml
new file mode 100644
index 0000000000..449d06b1a6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FocusFrame.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype FocusFrame
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+Item {
+ id: root
+ activeFocusOnTab: false
+ Accessible.role: Accessible.StatusBar
+
+ anchors.topMargin: focusMargin
+ anchors.leftMargin: focusMargin
+ anchors.rightMargin: focusMargin
+ anchors.bottomMargin: focusMargin
+
+ property int focusMargin: loader.item ? loader.item.margin : -3
+
+ Loader {
+ id: loader
+ z: 2
+ anchors.fill: parent
+ sourceComponent: Qt.createComponent(Settings.style + "/FocusFrameStyle.qml", root)
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentItem.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentItem.qml
new file mode 100644
index 0000000000..7056b4e1f0
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentItem.qml
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+
+Loader {
+ id: menuFrameLoader
+
+ readonly property Style __style: styleLoader.item
+ readonly property Component menuItemStyle: __style ? __style.menuItem : null
+
+ property var menu: root
+ property alias contentWidth: content.width
+ property alias contentHeight: content.height
+
+ readonly property int subMenuXPos: width + (item && item["subMenuOverlap"] || 0)
+
+ visible: status === Loader.Ready
+ sourceComponent: __style ? __style.frame : undefined
+
+ Loader {
+ id: styleLoader
+ active: !menu.isNative
+ sourceComponent: menu.style
+ property alias __control: menuFrameLoader
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", menu)
+ }
+ }
+
+ focus: true
+ property var mnemonicsMap: ({})
+
+ Keys.onPressed: {
+ var item = null
+ if (!(event.modifiers & Qt.AltModifier)
+ && (item = mnemonicsMap[event.text.toUpperCase()])) {
+ if (item.isSubmenu) {
+ menu.__currentIndex = item.menuItemIndex
+ item.showSubMenu(true)
+ item.menuItem.__currentIndex = 0
+ } else {
+ triggerAndDismiss(item)
+ }
+ event.accepted = true
+ } else {
+ event.accepted = false
+ }
+ }
+
+ Keys.onEscapePressed: menu.__dismissMenu()
+
+ Keys.onDownPressed: {
+ if (menu.__currentIndex < 0)
+ menu.__currentIndex = -1
+
+ for (var i = menu.__currentIndex + 1;
+ i < menu.items.length && !canBeHovered(i); i++)
+ ;
+ event.accepted = true
+ }
+
+ Keys.onUpPressed: {
+ for (var i = menu.__currentIndex - 1;
+ i >= 0 && !canBeHovered(i); i--)
+ ;
+ event.accepted = true
+ }
+
+ function canBeHovered(index) {
+ var item = content.menuItemAt(index)
+ if (item && !item["isSeparator"] && item.enabled) {
+ menu.__currentIndex = index
+ return true
+ }
+ return false
+ }
+
+ Keys.onLeftPressed: {
+ if ((event.accepted = menu.__parentMenu.hasOwnProperty("title")))
+ __closeMenu()
+ }
+
+ Keys.onRightPressed: {
+ var item = content.menuItemAt(menu.__currentIndex)
+ if ((event.accepted = (item && item.isSubmenu))) {
+ item.showSubMenu(true)
+ item.menuItem.__currentIndex = 0
+ }
+ }
+
+ Keys.onSpacePressed: triggerCurrent()
+ Keys.onReturnPressed: triggerCurrent()
+ Keys.onEnterPressed: triggerCurrent()
+
+ function triggerCurrent() {
+ var item = content.menuItemAt(menu.__currentIndex)
+ if (item)
+ content.triggered(item)
+ }
+
+ function triggerAndDismiss(item) {
+ if (item && !item.isSeparator) {
+ menu.__dismissMenu()
+ if (!item.isSubmenu)
+ item.menuItem.trigger()
+ }
+ }
+
+ Binding {
+ // Make sure the styled frame is in the background
+ target: item
+ property: "z"
+ value: content.z - 1
+ }
+
+ ColumnMenuContent {
+ id: content
+ menuItemDelegate: menuItemComponent
+ scrollerStyle: __style ? __style.scrollerStyle : undefined
+ itemsModel: menu.items
+ margin: menuFrameLoader.item ? menuFrameLoader.item.margin : 0
+ minWidth: menu.__minimumWidth
+ maxHeight: menuFrameLoader.item ? menuFrameLoader.item.maxHeight : 0
+ onTriggered: triggerAndDismiss(item)
+ }
+
+ Component {
+ id: menuItemComponent
+ Loader {
+ id: menuItemLoader
+
+ property var menuItem: modelData
+ readonly property bool isSeparator: !!menuItem && menuItem.type === MenuItemType.Separator
+ readonly property bool isSubmenu: !!menuItem && menuItem.type === MenuItemType.Menu
+ property bool selected: !(isSeparator || !!scrollerDirection) && menu.__currentIndex === index
+ property string text: isSubmenu ? menuItem.title : !(isSeparator || !!scrollerDirection) ? menuItem.text : ""
+ property bool showUnderlined: menu.__contentItem.altPressed
+ readonly property var scrollerDirection: menuItem["scrollerDirection"]
+
+ property int menuItemIndex: index
+
+ sourceComponent: menuFrameLoader.menuItemStyle
+ enabled: visible && !isSeparator && !!menuItem && menuItem.enabled
+ visible: !!menuItem && menuItem.visible
+ active: visible
+
+ function showSubMenu(immediately) {
+ if (immediately) {
+ if (menu.__currentIndex === menuItemIndex)
+ menuItem.__popup(menuFrameLoader.subMenuXPos, 0, -1)
+ } else {
+ openMenuTimer.start()
+ }
+ }
+
+ Timer {
+ id: openMenuTimer
+ interval: 50
+ onTriggered: menuItemLoader.showSubMenu(true)
+ }
+
+ function closeSubMenu() { closeMenuTimer.start() }
+
+ Timer {
+ id: closeMenuTimer
+ interval: 1
+ onTriggered: {
+ if (menu.__currentIndex !== menuItemIndex)
+ menuItem.__closeMenu()
+ }
+ }
+
+ onLoaded: {
+ menuItem.__visualItem = menuItemLoader
+
+ if (content.width < item.implicitWidth)
+ content.width = item.implicitWidth
+
+ var title = text
+ var ampersandPos = title.indexOf("&")
+ if (ampersandPos !== -1)
+ menuFrameLoader.mnemonicsMap[title[ampersandPos + 1].toUpperCase()] = menuItemLoader
+ }
+
+ Binding {
+ target: menuItemLoader.item
+ property: "width"
+ property alias menuItem: menuItemLoader.item
+ value: menuItem ? Math.max(menu.__minimumWidth, content.width) - 2 * menuItem.x : 0
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentScroller.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentScroller.qml
new file mode 100644
index 0000000000..30a8825af2
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentScroller.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+MouseArea {
+ property string direction
+
+ anchors {
+ top: direction === "up" ? parent.top : undefined
+ bottom: direction === "down" ? parent.bottom : undefined
+ }
+
+ hoverEnabled: visible
+ height: scrollerLoader.item.height
+ width: parent.width
+
+ Loader {
+ id: scrollerLoader
+
+ sourceComponent: menuItemDelegate
+ property int index: -1
+ property var modelData: {
+ "visible": true,
+ "scrollerDirection": direction,
+ "enabled": true
+ }
+ }
+
+ Timer {
+ interval: 100
+ repeat: true
+ triggeredOnStart: true
+ running: parent.containsMouse
+ onTriggered: scrollABit()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ModalPopupBehavior.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ModalPopupBehavior.qml
new file mode 100644
index 0000000000..8b78cb31b3
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ModalPopupBehavior.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+// KNOWN ISSUES
+// none
+
+/*!
+ \qmltype ModalPopupBehavior
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+Item {
+ id: popupBehavior
+
+ property bool showing: false
+ property bool whenAlso: true // modifier to the "showing" property
+ property bool consumeCancelClick: true
+ property int delay: 0 // delay before popout becomes visible
+ property int deallocationDelay: 3000 // 3 seconds
+
+ property Component popupComponent
+
+ property alias popup: popupLoader.item // read-only
+ property alias window: popupBehavior.root // read-only
+
+ signal prepareToShow
+ signal prepareToHide
+ signal cancelledByClick
+
+ // implementation
+
+ anchors.fill: parent
+
+ onShowingChanged: notifyChange()
+ onWhenAlsoChanged: notifyChange()
+ function notifyChange() {
+ if(showing && whenAlso) {
+ if(popupLoader.sourceComponent == undefined) {
+ popupLoader.sourceComponent = popupComponent;
+ }
+ } else {
+ mouseArea.enabled = false; // disable before opacity is changed in case it has fading behavior
+ if(Qt.isQtObject(popupLoader.item)) {
+ popupBehavior.prepareToHide();
+ popupLoader.item.opacity = 0;
+ }
+ }
+ }
+
+ property Item root: findRoot()
+ function findRoot() {
+ var p = parent;
+ while(p.parent != undefined)
+ p = p.parent;
+
+ return p;
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ enabled: false // enabled only when popout is showing
+ onPressed: {
+ popupBehavior.showing = false;
+ mouse.accepted = consumeCancelClick;
+ cancelledByClick();
+ }
+ }
+
+ Loader {
+ id: popupLoader
+ }
+
+ Timer { // visibility timer
+ running: Qt.isQtObject(popupLoader.item) && showing && whenAlso
+ interval: delay
+ onTriggered: {
+ popupBehavior.prepareToShow();
+ mouseArea.enabled = true;
+ popup.opacity = 1;
+ }
+ }
+
+ Timer { // deallocation timer
+ running: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity == 0
+ interval: deallocationDelay
+ onTriggered: popupLoader.sourceComponent = undefined
+ }
+
+ states: State {
+ name: "active"
+ when: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity > 0
+ ParentChange { target: popupBehavior; parent: root }
+ }
+ }
+
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollBar.qml
new file mode 100644
index 0000000000..65ed51cfce
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollBar.qml
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ScrollBar
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+Item {
+ id: scrollbar
+
+ property bool isTransient: false
+ property bool active: false
+ property int orientation: Qt.Horizontal
+ property alias minimumValue: slider.minimumValue
+ property alias maximumValue: slider.maximumValue
+ property alias value: slider.value
+ property int singleStep: 20
+
+ activeFocusOnTab: false
+
+ Accessible.role: Accessible.ScrollBar
+ implicitWidth: panelLoader.implicitWidth
+ implicitHeight: panelLoader.implicitHeight
+
+ property bool upPressed
+ property bool downPressed
+ property bool pageUpPressed
+ property bool pageDownPressed
+ property bool handlePressed
+
+
+ property Item __panel: panelLoader.item
+ Loader {
+ id: panelLoader
+ anchors.fill: parent
+ sourceComponent: __style ? __style.__scrollbar : null
+ onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root)
+ property alias __control: scrollbar
+ property QtObject __styleData: QtObject {
+ readonly property alias horizontal: internal.horizontal
+ readonly property alias upPressed: scrollbar.upPressed
+ readonly property alias downPressed: scrollbar.downPressed
+ readonly property alias handlePressed: scrollbar.handlePressed
+ }
+ }
+
+ MouseArea {
+ id: internal
+ property bool horizontal: orientation === Qt.Horizontal
+ property int pageStep: internal.horizontal ? width : height
+ property bool scrollToClickposition: internal.scrollToClickPosition
+ anchors.fill: parent
+ cursorShape: __panel.visible ? Qt.ArrowCursor : Qt.IBeamCursor // forces a cursor change
+
+ property bool autoincrement: false
+ property bool scrollToClickPosition: __style ? __style.scrollToClickedPosition : 0
+
+ // Update hover item
+ onEntered: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY)
+ onExited: if (!pressed) __panel.activeControl = "none"
+ onMouseXChanged: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY)
+ hoverEnabled: true
+
+ property var pressedX
+ property var pressedY
+ property int oldPosition
+ property int grooveSize
+
+ Timer {
+ running: upPressed || downPressed || pageUpPressed || pageDownPressed
+ interval: 350
+ onTriggered: internal.autoincrement = true
+ }
+
+ Timer {
+ running: internal.autoincrement
+ interval: 60
+ repeat: true
+ onTriggered: {
+ if (upPressed && internal.containsMouse)
+ internal.decrement();
+ else if (downPressed && internal.containsMouse)
+ internal.increment();
+ else if (pageUpPressed)
+ internal.decrementPage();
+ else if (pageDownPressed)
+ internal.incrementPage();
+ }
+ }
+
+ onPositionChanged: {
+ if (handlePressed) {
+ if (!horizontal)
+ slider.position = oldPosition + (mouseY - pressedY)
+ else
+ slider.position = oldPosition + (mouseX - pressedX)
+ }
+ }
+
+ onPressed: {
+ __panel.activeControl = __panel.hitTest(mouseX, mouseY)
+ scrollToClickposition = scrollToClickPosition
+ var handleRect = __panel.subControlRect("handle")
+ var grooveRect = __panel.subControlRect("groove")
+ grooveSize = horizontal ? grooveRect.width - handleRect.width:
+ grooveRect.height - handleRect.height;
+ if (__panel.activeControl === "handle") {
+ pressedX = mouseX;
+ pressedY = mouseY;
+ handlePressed = true;
+ oldPosition = slider.position;
+ } else if (__panel.activeControl === "up") {
+ decrement();
+ upPressed = Qt.binding(function() {return containsMouse});
+ } else if (__panel.activeControl === "down") {
+ increment();
+ downPressed = Qt.binding(function() {return containsMouse});
+ } else if (!scrollToClickposition){
+ if (__panel.activeControl === "upPage") {
+ decrementPage();
+ pageUpPressed = true;
+ } else if (__panel.activeControl === "downPage") {
+ incrementPage();
+ pageDownPressed = true;
+ }
+ } else { // scroll to click position
+ slider.position = horizontal ? mouseX - handleRect.width/2 - grooveRect.x
+ : mouseY - handleRect.height/2 - grooveRect.y
+ pressedX = mouseX;
+ pressedY = mouseY;
+ handlePressed = true;
+ oldPosition = slider.position;
+ }
+ }
+
+ onReleased: {
+ __panel.activeControl = __panel.hitTest(mouseX, mouseY);
+ autoincrement = false;
+ upPressed = false;
+ downPressed = false;
+ handlePressed = false;
+ pageUpPressed = false;
+ pageDownPressed = false;
+ }
+
+ onWheel: {
+ var stepCount = -(wheel.angleDelta.x ? wheel.angleDelta.x : wheel.angleDelta.y) / 120
+ if (stepCount != 0) {
+ if (wheel.modifiers & Qt.ControlModifier || wheel.modifiers & Qt.ShiftModifier)
+ incrementPage(stepCount)
+ else
+ increment(stepCount)
+ }
+ }
+
+ function incrementPage(stepCount) {
+ value = boundValue(value + getSteps(pageStep, stepCount))
+ }
+
+ function decrementPage(stepCount) {
+ value = boundValue(value - getSteps(pageStep, stepCount))
+ }
+
+ function increment(stepCount) {
+ value = boundValue(value + getSteps(singleStep, stepCount))
+ }
+
+ function decrement(stepCount) {
+ value = boundValue(value - getSteps(singleStep, stepCount))
+ }
+
+ function boundValue(val) {
+ return Math.min(Math.max(val, minimumValue), maximumValue)
+ }
+
+ function getSteps(step, count) {
+ if (count)
+ step *= count
+ return step
+ }
+
+ RangeModel {
+ id: slider
+ minimumValue: 0.0
+ maximumValue: 1.0
+ value: 0
+ stepSize: 0.0
+ inverted: false
+ positionAtMaximum: internal.grooveSize
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollViewHelper.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollViewHelper.qml
new file mode 100644
index 0000000000..3f1166f3e8
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollViewHelper.qml
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ScrollViewHeader
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+Item {
+ id: wheelarea
+
+ property alias horizontalScrollBar: hscrollbar
+ property alias verticalScrollBar: vscrollbar
+ property bool blockUpdates: false
+ property int availableHeight
+ property int availableWidth
+ property int contentHeight
+ property int contentWidth
+ property real originX
+ property real originY
+ property bool active
+
+ property int leftMargin: outerFrame ? root.__style.padding.left : 0
+ property int rightMargin: outerFrame ? root.__style.padding.right : 0
+ property int topMargin: outerFrame ? root.__style.padding.top : 0
+ property int bottomMargin: outerFrame ? root.__style.padding.bottom : 0
+
+ anchors.fill: parent
+
+ property bool recursionGuard: false
+
+ function doLayout() {
+ if (!recursionGuard) {
+ recursionGuard = true
+ wheelarea.availableWidth = viewport.width
+ wheelarea.availableHeight = viewport.height
+ wheelarea.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0
+ wheelarea.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0
+ wheelarea.originX = flickableItem !== null ? flickableItem.originX : 0
+ wheelarea.originY = flickableItem !== null ? flickableItem.originY : 0
+ recursionGuard = false
+ }
+ }
+
+ Connections {
+ target: viewport
+ onWidthChanged: doLayout()
+ onHeightChanged: doLayout()
+ }
+
+ Connections {
+ target: flickableItem
+ onContentWidthChanged: doLayout()
+ onContentHeightChanged: doLayout()
+ }
+
+ Connections {
+ target: flickableItem
+ onContentXChanged: {
+ hscrollbar.flash()
+ vscrollbar.flash()
+ }
+ onContentYChanged: {
+ hscrollbar.flash()
+ vscrollbar.flash()
+ }
+ }
+
+ Loader {
+ id: cornerFill
+ z: 1
+ sourceComponent: __style.corner
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: bottomMargin
+ anchors.rightMargin: rightMargin
+ width: visible ? vscrollbar.width : 0
+ height: visible ? hscrollbar.height : 0
+ visible: hscrollbar.visible && !hscrollbar.isTransient && vscrollbar.visible && !vscrollbar.isTransient
+ }
+
+ ScrollBar {
+ id: hscrollbar
+ isTransient: !!__panel && !!__panel.isTransient
+ active: !!__panel && (__panel.sunken || __panel.activeControl !== "none")
+ enabled: !isTransient || __panel.visible
+ orientation: Qt.Horizontal
+ visible: contentWidth > availableWidth
+ height: visible ? implicitHeight : 0
+ z: 1
+ maximumValue: contentWidth > availableWidth ? originX + contentWidth - availableWidth : 0
+ minimumValue: originX
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: cornerFill.left
+ anchors.leftMargin: leftMargin
+ anchors.bottomMargin: bottomMargin
+ onValueChanged: {
+ if (!blockUpdates) {
+ flickableItem.contentX = value
+ }
+ }
+ Binding {
+ target: hscrollbar.__panel
+ property: "raised"
+ value: vscrollbar.active || wheelarea.active
+ when: hscrollbar.isTransient
+ }
+ Binding {
+ target: hscrollbar.__panel
+ property: "visible"
+ value: true
+ when: !hscrollbar.isTransient || wheelarea.active
+ }
+ function flash() {
+ if (hscrollbar.isTransient) {
+ hscrollbar.__panel.on = true
+ hscrollbar.__panel.visible = true
+ hFlasher.start()
+ }
+ }
+ Timer {
+ id: hFlasher
+ interval: 10
+ onTriggered: hscrollbar.__panel.on = false
+ }
+ }
+
+ ScrollBar {
+ id: vscrollbar
+ isTransient: !!__panel && !!__panel.isTransient
+ active: !!__panel && (__panel.sunken || __panel.activeControl !== "none")
+ enabled: !isTransient || __panel.visible
+ orientation: Qt.Vertical
+ visible: contentHeight > availableHeight
+ width: visible ? implicitWidth : 0
+ z: 1
+ anchors.bottom: cornerFill.top
+ maximumValue: contentHeight > availableHeight ? originY + contentHeight - availableHeight + __viewTopMargin : 0
+ minimumValue: originY
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.topMargin: __scrollBarTopMargin + topMargin
+ anchors.rightMargin: rightMargin
+ onValueChanged: {
+ if (flickableItem && !blockUpdates && enabled) {
+ flickableItem.contentY = value
+ }
+ }
+ Binding {
+ target: vscrollbar.__panel
+ property: "raised"
+ value: hscrollbar.active || wheelarea.active
+ when: vscrollbar.isTransient
+ }
+ Binding {
+ target: vscrollbar.__panel
+ property: "visible"
+ value: true
+ when: !vscrollbar.isTransient || wheelarea.active
+ }
+ function flash() {
+ if (vscrollbar.isTransient) {
+ vscrollbar.__panel.on = true
+ vscrollbar.__panel.visible = true
+ vFlasher.start()
+ }
+ }
+ Timer {
+ id: vFlasher
+ interval: 10
+ onTriggered: vscrollbar.__panel.on = false
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/SourceProxy.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/SourceProxy.qml
new file mode 100644
index 0000000000..1cf03f313e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/SourceProxy.qml
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rootItem
+ property variant input
+ property variant output
+ property variant sourceRect
+ visible: false
+
+ Component.onCompleted: evaluateInput()
+
+ onInputChanged: evaluateInput()
+
+ onSourceRectChanged: evaluateInput()
+
+ function evaluateInput() {
+ if (input == undefined) {
+ output = input
+ }
+ else if (sourceRect != undefined && sourceRect != Qt.rect(0, 0, 0, 0) && !isQQuickShaderEffectSource(input)) {
+ proxySource.sourceItem = input
+ output = proxySource
+ proxySource.sourceRect = sourceRect
+ }
+ else if (isQQuickItemLayerEnabled(input)) {
+ output = input
+ }
+ else if ((isQQuickImage(input) && !hasTileMode(input) && !hasChildren(input))) {
+ output = input
+ }
+ else if (isQQuickShaderEffectSource(input)) {
+ output = input
+ }
+ else {
+ proxySource.sourceItem = input
+ output = proxySource
+ proxySource.sourceRect = Qt.rect(0, 0, 0, 0)
+ }
+ }
+
+ function isQQuickItemLayerEnabled(item) {
+ if (item.hasOwnProperty("layer")) {
+ var l = item["layer"]
+ if (l.hasOwnProperty("enabled") && l["enabled"].toString() == "true")
+ return true
+ }
+ return false
+ }
+
+ function isQQuickImage(item) {
+ var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ]
+ return hasProperties(item, imageProperties)
+ }
+
+ function isQQuickShaderEffectSource(item) {
+ var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ]
+ return hasProperties(item, shaderEffectSourceProperties)
+ }
+
+ function hasProperties(item, properties) {
+ var counter = 0
+ for (var j = 0; j < properties.length; j++) {
+ if (item.hasOwnProperty(properties [j]))
+ counter++
+ }
+ return properties.length == counter
+ }
+
+ function hasChildren(item) {
+ if (item.hasOwnProperty("childrenRect")) {
+ if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)")
+ return true
+ else
+ return false
+ }
+ return false
+ }
+
+ function hasTileMode(item) {
+ if (item.hasOwnProperty("fillMode")) {
+ if (item["fillMode"].toString() != "0")
+ return true
+ else
+ return false
+ }
+ return false
+ }
+
+ ShaderEffectSource {
+ id: proxySource
+ live: rootItem.input != rootItem.output
+ hideSource: false
+ smooth: true
+ visible: false
+ }
+}
+
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackView.js b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackView.js
new file mode 100644
index 0000000000..fa9bb08e8c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackView.js
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var stackView = [];
+
+function push(p)
+{
+ if (!p)
+ return
+ stackView.push(p)
+ __depth++
+ return p
+}
+
+function pop()
+{
+ if (stackView.length === 0)
+ return null
+ var p = stackView.pop()
+ __depth--
+ return p
+}
+
+function current()
+{
+ if (stackView.length === 0)
+ return null
+ return stackView[stackView.length-1]
+}
+
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackViewSlideDelegate.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackViewSlideDelegate.qml
new file mode 100644
index 0000000000..88530e696c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackViewSlideDelegate.qml
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+
+/*!
+ \qmltype StackViewSlideTransition
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+StackViewDelegate {
+ id: root
+
+ property bool horizontal: true
+
+ function getTransition(properties)
+ {
+ return root[horizontal ? "horizontalSlide" : "verticalSlide"][properties.name]
+ }
+
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.y = 0
+ }
+
+ property QtObject horizontalSlide: QtObject {
+ property Component pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: target.width
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: -target.width
+ duration: 300
+ }
+ }
+
+ property Component popTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: -target.width
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: target.width
+ duration: 300
+ }
+ }
+ property Component replaceTransition: pushTransition
+ }
+
+ property QtObject verticalSlide: QtObject {
+ property Component pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: -target.height
+ duration: 300
+ }
+ }
+
+ property Component popTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: -target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: target.height
+ duration: 300
+ }
+ property Component replaceTransition: pushTransition
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Style.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Style.qml
new file mode 100644
index 0000000000..ed31536dd7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Style.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Style
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+
+AbstractStyle {
+ /*! The control attached to this style */
+ readonly property Item control: __control
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TabBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TabBar.qml
new file mode 100644
index 0000000000..2e374f994e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TabBar.qml
@@ -0,0 +1,308 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+
+/*!
+ \qmltype TabBar
+ \internal
+ \inqmlmodule QtQuick.Controls.Private
+*/
+FocusScope {
+ id: tabbar
+ height: Math.max(tabrow.height, Math.max(leftCorner.height, rightCorner.height))
+ width: tabView.width
+
+ activeFocusOnTab: true
+
+ Keys.onRightPressed: {
+ if (tabView && tabView.currentIndex < tabView.count - 1)
+ tabView.currentIndex = tabView.currentIndex + 1
+ }
+ Keys.onLeftPressed: {
+ if (tabView && tabView.currentIndex > 0)
+ tabView.currentIndex = tabView.currentIndex - 1
+ }
+
+ onTabViewChanged: parent = tabView
+ visible: tabView ? tabView.tabsVisible : true
+
+ property var tabView
+ property var style
+ property var styleItem: tabView.__styleItem ? tabView.__styleItem : null
+
+ property bool tabsMovable: styleItem ? styleItem.tabsMovable : false
+
+ property int tabsAlignment: styleItem ? styleItem.tabsAlignment : Qt.AlignLeft
+
+ property int tabOverlap: styleItem ? styleItem.tabOverlap : 0
+
+ property int elide: Text.ElideRight
+
+ property real availableWidth: tabbar.width - leftCorner.width - rightCorner.width
+
+ property var __selectedTabRect
+
+ function tab(index) {
+ for (var i = 0; i < tabrow.children.length; ++i) {
+ if (tabrow.children[i].tabindex == index) {
+ return tabrow.children[i]
+ }
+ }
+ return null;
+ }
+
+ /*! \internal */
+ function __isAncestorOf(item, child) {
+ //TODO: maybe removed from 5.2 if the function was merged in qtdeclarative
+ if (child === item)
+ return false;
+
+ while (child) {
+ child = child.parent;
+ if (child === item)
+ return true;
+ }
+ return false;
+ }
+ Loader {
+ id: background
+ anchors.fill: parent
+ sourceComponent: styleItem ? styleItem.tabBar : undefined
+ }
+
+ ListView {
+ id: tabrow
+ objectName: "tabrow"
+ Accessible.role: Accessible.PageTabList
+ LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
+ spacing: -tabOverlap
+ orientation: Qt.Horizontal
+ interactive: false
+ focus: true
+
+ // Note this will silence the binding loop warnings caused by QTBUG-35038
+ // and should be removed when this issue is resolved.
+ property int contentWidthWorkaround: contentWidth > 0 ? contentWidth: 0
+ width: Math.min(availableWidth, count ? contentWidthWorkaround : availableWidth)
+ height: currentItem ? currentItem.height : 0
+
+ highlightMoveDuration: 0
+ currentIndex: tabView.currentIndex
+ onCurrentIndexChanged: tabrow.positionViewAtIndex(currentIndex, ListView.Contain)
+
+ moveDisplaced: Transition {
+ NumberAnimation {
+ property: "x"
+ duration: 125
+ easing.type: Easing.OutQuad
+ }
+ }
+
+ states: [
+ State {
+ name: "left"
+ when: tabsAlignment === Qt.AlignLeft
+ AnchorChanges { target:tabrow ; anchors.left: parent.left }
+ PropertyChanges { target:tabrow ; anchors.leftMargin: leftCorner.width }
+ },
+ State {
+ name: "center"
+ when: tabsAlignment === Qt.AlignHCenter
+ AnchorChanges { target:tabrow ; anchors.horizontalCenter: tabbar.horizontalCenter }
+ },
+ State {
+ name: "right"
+ when: tabsAlignment === Qt.AlignRight
+ AnchorChanges { target:tabrow ; anchors.right: parent.right }
+ PropertyChanges { target:tabrow ; anchors.rightMargin: rightCorner.width }
+ }
+ ]
+
+ model: tabView.__tabs
+
+ delegate: MouseArea {
+ id: tabitem
+ objectName: "mousearea"
+ hoverEnabled: true
+ focus: true
+
+ Binding {
+ target: tabbar
+ when: selected
+ property: "__selectedTabRect"
+ value: Qt.rect(x, y, width, height)
+ }
+
+ drag.target: tabsMovable ? tabloader : null
+ drag.axis: Drag.XAxis
+ drag.minimumX: drag.active ? 0 : -Number.MAX_VALUE
+ drag.maximumX: tabrow.width - tabitem.width
+
+ property int tabindex: index
+ property bool selected : tabView.currentIndex === index
+ property string title: modelData.title
+ property bool nextSelected: tabView.currentIndex === index + 1
+ property bool previousSelected: tabView.currentIndex === index - 1
+
+ z: selected ? 1 : -index
+ implicitWidth: tabloader.implicitWidth
+ implicitHeight: tabloader.implicitHeight
+
+ function changeTab() {
+ tabView.currentIndex = index;
+ var next = tabbar.nextItemInFocusChain(true);
+ if (__isAncestorOf(tabView.getTab(currentIndex), next))
+ next.forceActiveFocus();
+ }
+
+ onClicked: {
+ if (tabrow.interactive) {
+ changeTab()
+ }
+ }
+ onPressed: {
+ if (!tabrow.interactive) {
+ changeTab()
+ }
+ }
+
+ Loader {
+ id: tabloader
+
+ property Item control: tabView
+ property int index: tabindex
+
+ property QtObject styleData: QtObject {
+ readonly property alias index: tabitem.tabindex
+ readonly property alias selected: tabitem.selected
+ readonly property alias title: tabitem.title
+ readonly property alias nextSelected: tabitem.nextSelected
+ readonly property alias previsousSelected: tabitem.previousSelected
+ readonly property alias hovered: tabitem.containsMouse
+ readonly property bool activeFocus: tabbar.activeFocus
+ readonly property real availableWidth: tabbar.availableWidth
+ }
+
+ sourceComponent: loader.item ? loader.item.tab : null
+
+ Drag.keys: "application/x-tabbartab"
+ Drag.active: tabitem.drag.active
+ Drag.source: tabitem
+
+ property real __prevX: 0
+ property real __dragX: 0
+ onXChanged: {
+ if (Drag.active) {
+ // keep track for the snap back animation
+ __dragX = tabitem.mapFromItem(tabrow, tabloader.x, 0).x
+
+ // when moving to the left, the hot spot is the left edge and vice versa
+ Drag.hotSpot.x = x < __prevX ? 0 : width
+ __prevX = x
+ }
+ }
+
+ width: tabitem.width
+ state: Drag.active ? "drag" : ""
+
+ transitions: [
+ Transition {
+ to: "drag"
+ PropertyAction { target: tabloader; property: "parent"; value: tabrow }
+ },
+ Transition {
+ from: "drag"
+ SequentialAnimation {
+ PropertyAction { target: tabloader; property: "parent"; value: tabitem }
+ NumberAnimation {
+ target: tabloader
+ duration: 50
+ easing.type: Easing.OutQuad
+ property: "x"
+ from: tabloader.__dragX
+ to: 0
+ }
+ }
+ }
+ ]
+ }
+
+ Accessible.role: Accessible.PageTab
+ Accessible.name: modelData.title
+ }
+ }
+
+ Loader {
+ id: leftCorner
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ sourceComponent: styleItem ? styleItem.leftCorner : undefined
+ width: item ? item.implicitWidth : 0
+ height: item ? item.implicitHeight : 0
+ }
+
+ Loader {
+ id: rightCorner
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ sourceComponent: styleItem ? styleItem.rightCorner : undefined
+ width: item ? item.implicitWidth : 0
+ height: item ? item.implicitHeight : 0
+ }
+
+ DropArea {
+ anchors.fill: tabrow
+ keys: "application/x-tabbartab"
+ onPositionChanged: {
+ var source = drag.source
+ var target = tabrow.itemAt(drag.x, drag.y)
+ if (source && target && source !== target) {
+ source = source.drag.target
+ target = target.drag.target
+ var center = target.parent.x + target.width / 2
+ if ((source.index > target.index && source.x < center)
+ || (source.index < target.index && source.x + source.width > center))
+ tabView.moveTab(source.index, target.index)
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TableViewSelection.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TableViewSelection.qml
new file mode 100644
index 0000000000..181c19e779
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TableViewSelection.qml
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+QtObject {
+
+ property int count: 0
+ signal selectionChanged
+
+ property bool __dirty: false
+ property var __ranges: new Array()
+
+ function forEach (callback) {
+ if (!(callback instanceof Function)) {
+ console.warn("TableViewSelection.forEach: argument is not a function")
+ return;
+ }
+ __forEach(callback, -1)
+ }
+
+ function contains(index) {
+ for (var i = 0 ; i < __ranges.length ; ++i) {
+ if (__ranges[i][0] <= index && index <= __ranges[i][1])
+ return true;
+ else if (__ranges[i][0] > index)
+ return false;
+ }
+ return false;
+ }
+
+ function clear() {
+ __ranges = new Array()
+ __dirty = true
+ count = 0
+ selectionChanged()
+ }
+
+ function selectAll() { select(0, rowCount - 1) }
+ function select(first, last) { __select(true, first, last) }
+ function deselect(first, last) { __select(false, first, last) }
+
+ // --- private section ---
+
+ function __printRanges() {
+ var out = ""
+ for (var i = 0 ; i < __ranges.length ; ++ i)
+ out += ("{" + __ranges[i][0] + "," + __ranges[i][1] + "} ")
+ print(out)
+ }
+
+ function __count() {
+ var sum = 0
+ for (var i = 0 ; i < __ranges.length ; ++i) {
+ sum += (1 + __ranges[i][1] - __ranges[i][0])
+ }
+ return sum
+ }
+
+ function __forEach (callback, startIndex) {
+ __dirty = false
+ var i, j
+
+ for (i = 0 ; i < __ranges.length && !__dirty ; ++i) {
+ for (j = __ranges[i][0] ; !__dirty && j <= __ranges[i][1] ; ++j) {
+ if (j >= startIndex)
+ callback.call(this, j)
+ }
+ }
+
+ // Restart iteration at last index if selection changed
+ if (__dirty)
+ return __forEach(callback, j)
+ }
+
+ function __selectOne(index) {
+ __ranges = [[index, index]]
+ __dirty = true
+ count = 1
+ selectionChanged();
+ }
+
+ function __select(select, first, last) {
+
+ var i, range
+ var start = first
+ var stop = first
+ var startRangeIndex = -1
+ var stopRangeIndex = -1
+ var newRangePos = 0
+
+ if (first < 0 || last < 0 || first >= rowCount || last >=rowCount) {
+ console.warn("TableViewSelection: index out of range")
+ return
+ }
+
+ if (last !== undefined) {
+ start = first <= last ? first : last
+ stop = first <= last ? last : first
+ }
+
+ if (select) {
+
+ // Find beginning and end ranges
+ for (i = 0 ; i < __ranges.length; ++ i) {
+ range = __ranges[i]
+ if (range[0] > stop + 1) continue; // above range
+ if (range[1] < start - 1) { // below range
+ newRangePos = i + 1
+ continue;
+ }
+ if (startRangeIndex == -1)
+ startRangeIndex = i
+ stopRangeIndex = i
+ }
+
+ if (startRangeIndex !== -1)
+ start = Math.min(__ranges[startRangeIndex][0], start)
+ if (stopRangeIndex !== -1)
+ stop = Math.max(__ranges[stopRangeIndex][1], stop)
+
+ if (startRangeIndex == -1)
+ startRangeIndex = newRangePos
+
+ __ranges.splice(Math.max(0, startRangeIndex),
+ 1 + stopRangeIndex - startRangeIndex, [start, stop])
+
+ } else {
+
+ // Find beginning and end ranges
+ for (i = 0 ; i < __ranges.length; ++ i) {
+ range = __ranges[i]
+ if (range[1] < start) continue; // below range
+ if (range[0] > stop) continue; // above range
+ if (startRangeIndex == -1)
+ startRangeIndex = i
+ stopRangeIndex = i
+ }
+
+ // Slice ranges accordingly
+ if (startRangeIndex >= 0 && stopRangeIndex >= 0) {
+ var startRange = __ranges[startRangeIndex]
+ var stopRange = __ranges[stopRangeIndex]
+ var length = 1 + stopRangeIndex - startRangeIndex
+ if (start <= startRange[0] && stop >= stopRange[1]) { //remove
+ __ranges.splice(startRangeIndex, length)
+ } else if (start - 1 < startRange[0] && stop <= stopRange[1]) { //cut front
+ __ranges.splice(startRangeIndex, length, [stop + 1, stopRange[1]])
+ } else if (start - 1 < startRange[1] && stop >= stopRange[1]) { // cut back
+ __ranges.splice(startRangeIndex, length, [startRange[0], start - 1])
+ } else { //split
+ __ranges.splice(startRangeIndex, length, [startRange[0], start - 1], [stop + 1, stopRange[1]])
+ }
+ }
+ }
+ __dirty = true
+ count = __count() // forces a re-evaluation of indexes in the delegates
+ selectionChanged()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TextSingleton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TextSingleton.qml
new file mode 100644
index 0000000000..7a3f07cdd1
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TextSingleton.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.1
+Text {}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/qmldir b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/qmldir
new file mode 100644
index 0000000000..3513878067
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/qmldir
@@ -0,0 +1,22 @@
+module QtQuick.Controls.Private
+AbstractCheckable 1.0 AbstractCheckable.qml
+Control 1.0 Control.qml
+FocusFrame 1.0 FocusFrame.qml
+Margins 1.0 Margins.qml
+BasicButton 1.0 BasicButton.qml
+ScrollBar 1.0 ScrollBar.qml
+ScrollViewHelper 1.0 ScrollViewHelper.qml
+Style 1.0 Style.qml
+TabBar 1.0 TabBar.qml
+StackViewSlideDelegate 1.0 StackViewSlideDelegate.qml
+StyleHelpers 1.0 style.js
+JSArray 1.0 StackView.js
+TableViewSelection 1.0 TableViewSelection.qml
+FastGlow 1.0 FastGlow.qml
+SourceProxy 1.0 SourceProxy.qml
+GroupBoxStyle 1.0 ../Styles/Base/GroupBoxStyle.qml
+ToolButtonStyle 1.0 ../Styles/Base/ToolButtonStyle.qml
+MenuContentItem 1.0 MenuContentItem.qml
+MenuContentScroller 1.0 MenuContentScroller.qml
+ColumnMenuContent 1.0 ColumnMenuContent.qml
+singleton TextSingleton 1.0 TextSingleton.qml
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/style.js b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/style.js
new file mode 100644
index 0000000000..2c47ff0e72
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/style.js
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+function underlineAmpersands(match, p1, p2, p3) {
+ if (p2 === "&")
+ return p1.concat(p2, p3)
+ return p1.concat("<u>", p2, "</u>", p3)
+}
+
+function removeAmpersands(match, p1, p2, p3) {
+ return p1.concat(p2, p3)
+}
+
+function replaceAmpersands(text, replaceFunction) {
+ return text.replace(/([^&]*)&(.)([^&]*)/g, replaceFunction)
+}
+
+function stylizeMnemonics(text) {
+ return replaceAmpersands(text, underlineAmpersands)
+}
+
+function removeMnemonics(text) {
+ return replaceAmpersands(text, removeAmpersands)
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ProgressBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ProgressBar.qml
new file mode 100644
index 0000000000..523f3978e0
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ProgressBar.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ProgressBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A progress indicator.
+
+ The ProgressBar is used to give an indication of the progress of an operation.
+ \l value is updated regularly and must be between \l minimumValue and \l maximumValue.
+
+ You can create a custom appearance for a ProgressBar by
+ assigning a \l {QtQuick.Controls.Styles::ProgressBarStyle}{ProgressBarStyle}.
+*/
+
+Control {
+ id: progressbar
+
+ /*! This property holds the progress bar's current value.
+ Attempting to change the current value to one outside the minimum-maximum
+ range has no effect on the current value.
+
+ The default value is \c{0}.
+ */
+ property real value: 0
+
+ /*! This property is the progress bar's minimum value.
+ The \l value is clamped to this value.
+ The default value is \c{0}.
+ */
+ property real minimumValue: 0
+
+ /*! This property is the progress bar's maximum value.
+ The \l value is clamped to this value.
+ If maximumValue is smaller than \l minimumValue, \l minimumValue will be enforced.
+ The default value is \c{1}.
+ */
+ property real maximumValue: 1
+
+ /*! This property toggles indeterminate mode.
+ When the actual progress is unknown, use this option.
+ The progress bar will be animated as a busy indicator instead.
+ The default value is \c false.
+ */
+ property bool indeterminate: false
+
+ /*! \qmlproperty enumeration orientation
+
+ This property holds the orientation of the progress bar.
+
+ \list
+ \li Qt.Horizontal - Horizontal orientation. (Default)
+ \li Qt.Vertical - Vertical orientation.
+ \endlist
+ */
+ property int orientation: Qt.Horizontal
+
+ /*! \qmlproperty bool ProgressBar::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: hoverArea.containsMouse
+
+ /*! \internal */
+ style: Qt.createComponent(Settings.style + "/ProgressBarStyle.qml", progressbar)
+
+ /*! \internal */
+ property bool __initialized: false
+ /*! \internal */
+ onMaximumValueChanged: setValue(value)
+ /*! \internal */
+ onMinimumValueChanged: setValue(value)
+ /*! \internal */
+ onValueChanged: if (__initialized) setValue(value)
+ /*! \internal */
+ Component.onCompleted: {
+ __initialized = true;
+ setValue(value)
+ }
+
+ activeFocusOnTab: false
+
+ Accessible.role: Accessible.ProgressBar
+ Accessible.name: value
+
+ implicitWidth:(__panel ? __panel.implicitWidth : 0)
+ implicitHeight: (__panel ? __panel.implicitHeight: 0)
+
+ MouseArea {
+ id: hoverArea
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ /*! \internal */
+ function setValue(v) {
+ var newval = parseFloat(v)
+ if (!isNaN(newval)) {
+ // we give minimumValue priority over maximum if they are inconsistent
+ if (newval > maximumValue) {
+ if (maximumValue >= minimumValue)
+ newval = maximumValue;
+ else
+ newval = minimumValue
+ } else if (v < minimumValue) {
+ newval = minimumValue
+ }
+ if (value !== newval)
+ value = newval
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/RadioButton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/RadioButton.qml
new file mode 100644
index 0000000000..5ab7f68cb9
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/RadioButton.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype RadioButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief A radio button with a text label.
+
+ A RadioButton is an option button that can be switched on (checked) or off
+ (unchecked). Radio buttons typically present the user with a "one of many"
+ choice. In a group of radio buttons, only one radio button at a time can be
+ checked; if the user selects another button, the previously selected button
+ is switched off.
+
+ \qml
+ GroupBox {
+ title: qsTr("Search")
+ Column {
+ ExclusiveGroup { id: group }
+ RadioButton {
+ text: qsTr("From top")
+ exclusiveGroup: group
+ checked: true
+ }
+ RadioButton {
+ text: qsTr("From cursor")
+ exclusiveGroup: group
+ }
+ }
+ }
+ \endqml
+
+ You can create a custom appearance for a RadioButton by
+ assigning a \l {QtQuick.Controls.Styles::RadioButtonStyle}{RadioButtonStyle}.
+*/
+
+AbstractCheckable {
+ id: radioButton
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.RadioButton
+
+ /*!
+ The style that should be applied to the radio button. Custom style
+ components can be created with:
+
+ \codeline Qt.createComponent("path/to/style.qml", radioButtonId);
+ */
+ style: Qt.createComponent(Settings.style + "/RadioButtonStyle.qml", radioButton)
+
+ __cycleStatesHandler: function() { checked = !checked; }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ScrollView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ScrollView.qml
new file mode 100644
index 0000000000..6f1187ea50
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ScrollView.qml
@@ -0,0 +1,318 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+
+/*!
+ \qmltype ScrollView
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup views
+ \brief Provides a scrolling view within another Item.
+
+ A ScrollView can be used either to replace a \l Flickable or decorate an
+ existing \l Flickable. Depending on the platform, it will add scroll bars and
+ a content frame.
+
+ Only one Item can be a direct child of the ScrollView and the child is implicitly anchored
+ to fill the scroll view.
+
+ Example:
+ \code
+ ScrollView {
+ Image { imageSource: "largeImage.png" }
+ }
+ \endcode
+
+ In the previous example the Image item will implicitly get scroll behavior as if it was
+ used within a \l Flickable. The width and height of the child item will be used to
+ define the size of the content area.
+
+ Example:
+ \code
+ ScrollView {
+ ListView {
+ ...
+ }
+ }
+ \endcode
+
+ In this case the content size of the ScrollView will simply mirror that of its contained
+ \l flickableItem.
+
+ You can create a custom appearance for a ScrollView by
+ assigning a \l {QtQuick.Controls.Styles::ScrollViewStyle}{ScrollViewStyle}.
+*/
+
+FocusScope {
+ id: root
+
+ implicitWidth: 240
+ implicitHeight: 150
+
+ /*!
+ This property tells the ScrollView if it should render
+ a frame around its content.
+
+ The default value is \c false.
+ */
+ property bool frameVisible: false
+
+ /*!
+ This property controls if there should be a highlight
+ around the frame when the ScrollView has input focus.
+
+ The default value is \c false.
+
+ \note This property is only applicable on some platforms, such
+ as Mac OS.
+ */
+ property bool highlightOnFocus: false
+
+ /*!
+ \qmlproperty Item ScrollView::viewport
+
+ The viewport determines the current "window" on the contentItem.
+ In other words, it clips it and the size of the viewport tells you
+ how much of the content area is visible.
+ */
+ property alias viewport: viewportItem
+
+ /*!
+ \qmlproperty Item ScrollView::flickableItem
+
+ The flickableItem of the ScrollView. If the contentItem provided
+ to the ScrollView is a Flickable, it will be the \l contentItem.
+ */
+ readonly property alias flickableItem: internal.flickableItem
+
+ /*!
+ The contentItem of the ScrollView. This is set by the user.
+
+ Note that the definition of contentItem is somewhat different to that
+ of a Flickable, where the contentItem is implicitly created.
+ */
+ default property Item contentItem
+
+ /*! \internal */
+ property Item __scroller: scroller
+ /*! \internal */
+ property alias __wheelAreaScrollSpeed: wheelArea.scrollSpeed
+ /*! \internal */
+ property int __scrollBarTopMargin: 0
+ /*! \internal */
+ property int __viewTopMargin: 0
+ /*! \internal */
+ property alias __horizontalScrollBar: scroller.horizontalScrollBar
+ /*! \internal */
+ property alias __verticalScrollBar: scroller.verticalScrollBar
+ /*! \qmlproperty Component ScrollView::style
+
+ The style Component for this control.
+ \sa {Qt Quick Controls Styles QML Types}
+
+ */
+ property Component style: Qt.createComponent(Settings.style + "/ScrollViewStyle.qml", root)
+
+ /*! \internal */
+ property Style __style: styleLoader.item
+
+ activeFocusOnTab: true
+
+ onContentItemChanged: {
+
+ if (contentItem.hasOwnProperty("contentY") && // Check if flickable
+ contentItem.hasOwnProperty("contentHeight")) {
+ internal.flickableItem = contentItem // "Use content if it is a flickable
+ internal.flickableItem.parent = viewportItem
+ } else {
+ internal.flickableItem = flickableComponent.createObject(viewportItem)
+ contentItem.parent = internal.flickableItem.contentItem
+ }
+ internal.flickableItem.anchors.fill = viewportItem
+ if (!Settings.hasTouchScreen)
+ internal.flickableItem.interactive = false
+ }
+
+
+ children: Item {
+ id: internal
+
+ property Flickable flickableItem
+
+ Loader {
+ id: styleLoader
+ sourceComponent: style
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", root)
+ }
+ property alias __control: root
+ }
+
+ Binding {
+ target: flickableItem
+ property: "contentHeight"
+ when: contentItem !== flickableItem
+ value: contentItem ? contentItem.height : 0
+ }
+
+ Binding {
+ target: flickableItem
+ when: contentItem !== flickableItem
+ property: "contentWidth"
+ value: contentItem ? contentItem.width : 0
+ }
+
+ Connections {
+ target: flickableItem
+
+ onContentYChanged: {
+ scroller.blockUpdates = true
+ scroller.verticalScrollBar.value = flickableItem.contentY
+ scroller.blockUpdates = false
+ }
+
+ onContentXChanged: {
+ scroller.blockUpdates = true
+ scroller.horizontalScrollBar.value = flickableItem.contentX
+ scroller.blockUpdates = false
+ }
+
+ }
+
+ anchors.fill: parent
+
+ Component {
+ id: flickableComponent
+ Flickable {}
+ }
+
+ WheelArea {
+ id: wheelArea
+ parent: flickableItem
+
+ // ### Note this is needed due to broken mousewheel behavior in Flickable.
+
+ anchors.fill: parent
+
+ property int acceleration: 40
+ property int flickThreshold: 20
+ property real speedThreshold: 3
+ property real ignored: 0.001 // ## flick() does not work with 0 yVelocity
+ property int maxFlick: 400
+
+ property bool horizontalRecursionGuard: false
+ property bool verticalRecursionGuard: false
+
+ horizontalMinimumValue: flickableItem ? flickableItem.originX : 0
+ horizontalMaximumValue: flickableItem ? flickableItem.originX + flickableItem.contentWidth - viewport.width : 0
+
+ verticalMinimumValue: flickableItem ? flickableItem.originY : 0
+ verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0
+
+ Connections {
+ target: flickableItem
+
+ onContentYChanged: {
+ wheelArea.verticalRecursionGuard = true
+ wheelArea.verticalValue = flickableItem.contentY
+ wheelArea.verticalRecursionGuard = false
+ }
+ onContentXChanged: {
+ wheelArea.horizontalRecursionGuard = true
+ wheelArea.horizontalValue = flickableItem.contentX
+ wheelArea.horizontalRecursionGuard = false
+ }
+ }
+
+ onVerticalValueChanged: {
+ if (!verticalRecursionGuard) {
+ if (flickableItem.contentY < flickThreshold && verticalDelta > speedThreshold) {
+ flickableItem.flick(ignored, Math.min(maxFlick, acceleration * verticalDelta))
+ } else if (flickableItem.contentY > flickableItem.contentHeight
+ - flickThreshold - viewport.height && verticalDelta < -speedThreshold) {
+ flickableItem.flick(ignored, Math.max(-maxFlick, acceleration * verticalDelta))
+ } else {
+ flickableItem.contentY = verticalValue
+ }
+ }
+ }
+
+ onHorizontalValueChanged: {
+ if (!horizontalRecursionGuard)
+ flickableItem.contentX = horizontalValue
+ }
+ }
+
+ ScrollViewHelper {
+ id: scroller
+ anchors.fill: parent
+ active: wheelArea.active
+ property bool outerFrame: !frameVisible || !(__style ? __style.__externalScrollBars : 0)
+ property int scrollBarSpacing: outerFrame ? 0 : (__style ? __style.__scrollBarSpacing : 0)
+ property int verticalScrollbarOffset: verticalScrollBar.visible && !verticalScrollBar.isTransient ?
+ verticalScrollBar.width + scrollBarSpacing : 0
+ property int horizontalScrollbarOffset: horizontalScrollBar.visible && !horizontalScrollBar.isTransient ?
+ horizontalScrollBar.height + scrollBarSpacing : 0
+ Loader {
+ id: frameLoader
+ sourceComponent: __style ? __style.frame : null
+ anchors.fill: parent
+ anchors.rightMargin: scroller.outerFrame ? 0 : scroller.verticalScrollbarOffset
+ anchors.bottomMargin: scroller.outerFrame ? 0 : scroller.horizontalScrollbarOffset
+ }
+
+ Item {
+ id: viewportItem
+ anchors.fill: frameLoader
+ anchors.topMargin: frameVisible ? __style.padding.top : 0
+ anchors.leftMargin: frameVisible ? __style.padding.left : 0
+ anchors.rightMargin: (frameVisible ? __style.padding.right : 0) + (scroller.outerFrame ? scroller.verticalScrollbarOffset : 0)
+ anchors.bottomMargin: (frameVisible ? __style.padding.bottom : 0) + (scroller.outerFrame ? scroller.horizontalScrollbarOffset : 0)
+ clip: true
+ }
+ }
+ FocusFrame { visible: highlightOnFocus && root.activeFocus }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Slider.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Slider.qml
new file mode 100644
index 0000000000..d87bb526ae
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Slider.qml
@@ -0,0 +1,299 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Slider
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Provides a vertical or horizontal slider control.
+
+ The slider is the classic control for providing a bounded value. It lets
+ the user move a slider handle along a horizontal or vertical groove
+ and translates the handle's position into a value within the legal range.
+
+ \code
+ Slider {
+ onValueChanged: print(value)
+ }
+ \endcode
+
+ The Slider value is by default in the range [0, 1]. If integer values are
+ needed, you can set the \l stepSize.
+
+ You can create a custom appearance for a Slider by
+ assigning a \l {QtQuick.Controls.Styles::SliderStyle}{SliderStyle}.
+*/
+
+Control {
+ id: slider
+
+ /*!
+ \qmlproperty enumeration Slider::orientation
+
+ This property holds the layout orientation of the slider.
+ The default value is \c Qt.Horizontal.
+ */
+ property int orientation: Qt.Horizontal
+
+ /*!
+ \qmlproperty real Slider::minimumValue
+
+ This property holds the minimum value of the Slider.
+ The default value is \c{0.0}.
+ */
+ property alias minimumValue: range.minimumValue
+
+ /*!
+ \qmlproperty real Slider::maximumValue
+
+ This property holds the maximum value of the Slider
+ The default value is \c{1.0}.
+ */
+ property alias maximumValue: range.maximumValue
+
+ /*!
+ \qmlproperty bool Slider::updateValueWhileDragging
+
+ This property indicates whether the current \l value should be updated while
+ the user is moving the slider handle, or only when the button has been released.
+ This property could for instance be modified if changing the slider value would turn
+ out to be too time consuming.
+
+ The default value is \c true.
+ */
+ property bool updateValueWhileDragging: true
+
+ /*!
+ \qmlproperty bool Slider::pressed
+
+ This property indicates whether the slider handle is being pressed.
+ */
+ readonly property alias pressed: mouseArea.pressed
+
+ /*!
+ \qmlproperty bool Slider::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*!
+ \qmlproperty real Slider::stepSize
+
+ This property indicates the slider step size.
+
+ A value of 0 indicates that the value of the slider operates in a
+ continuous range between \l minimumValue and \l maximumValue.
+
+ Any non 0 value indicates a discrete stepSize. The following example
+ will generate a slider with integer values in the range [0-5].
+
+ \qml
+ Slider {
+ maximumValue: 5.0
+ stepSize: 1.0
+ }
+ \endqml
+
+ The default value is \c{0.0}.
+ */
+ property alias stepSize: range.stepSize
+
+ /*!
+ \qmlproperty real Slider::value
+
+ This property holds the current value of the Slider.
+ The default value is \c{0.0}.
+ */
+ property alias value: range.value
+
+ /*!
+ \qmlproperty bool Slider::activeFocusOnPress
+
+ This property indicates whether the Slider should receive active focus when
+ pressed.
+ */
+ property bool activeFocusOnPress: false
+
+ /*!
+ \qmlproperty bool Slider::tickmarksEnabled
+
+ This property indicates whether the Slider should display tickmarks
+ at step intervals. Tick mark spacing is calculated based on the
+ \l stepSize property.
+
+ The default value is \c false.
+ */
+ property bool tickmarksEnabled: false
+
+ /*! \internal */
+ property bool __horizontal: orientation === Qt.Horizontal
+
+ /*! \internal */
+ property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y)
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.Slider
+ Accessible.name: value
+
+ style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider)
+
+ Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0
+ Keys.onLeftPressed: value -= (maximumValue - minimumValue)/10.0
+
+ RangeModel {
+ id: range
+ minimumValue: 0.0
+ maximumValue: 1.0
+ value: 0
+ stepSize: 0.0
+ inverted: __horizontal ? false : true
+
+ positionAtMinimum: 0
+ positionAtMaximum: __horizontal ? slider.width - fakeHandle.width : slider.height - fakeHandle.height
+ }
+
+ Item {
+ id: fakeHandle
+ anchors.verticalCenter: __horizontal ? parent.verticalCenter : undefined
+ anchors.horizontalCenter: !__horizontal ? parent.horizontalCenter : undefined
+ width: __panel.handleWidth
+ height: __panel.handleHeight
+
+ function updatePos() {
+ if (updateValueWhileDragging && !mouseArea.drag.active)
+ range.position = __horizontal ? x : y
+ }
+
+ onXChanged: updatePos();
+ onYChanged: updatePos();
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ hoverEnabled: true
+ anchors.centerIn: parent
+
+ preventStealing: true
+
+ width: parent.width
+ height: parent.height
+
+ property int clickOffset: 0
+
+ function clamp ( val ) {
+ return Math.max(range.positionAtMinimum, Math.min(range.positionAtMaximum, val))
+ }
+
+ onMouseXChanged: {
+ if (pressed && __horizontal) {
+ var pos = clamp (mouse.x + clickOffset - fakeHandle.width/2)
+ fakeHandle.x = pos
+ }
+ }
+
+ onMouseYChanged: {
+ if (pressed && !__horizontal) {
+ var pos = clamp (mouse.y + clickOffset- fakeHandle.height/2)
+ fakeHandle.y = pos
+ }
+ }
+
+ onPressed: {
+ if (slider.activeFocusOnPress)
+ slider.forceActiveFocus();
+
+ var point = mouseArea.mapToItem(fakeHandle, mouse.x, mouse.y)
+ if (fakeHandle.contains(Qt.point(point.x, point.y))) {
+ clickOffset = __horizontal ? fakeHandle.width/2 - point.x : fakeHandle.height/2 - point.y
+ }
+ }
+
+ onReleased: {
+ // If we don't update while dragging, this is the only
+ // moment that the range is updated.
+ if (!slider.updateValueWhileDragging)
+ range.position = __horizontal ? fakeHandle.x : fakeHandle.y;
+ clickOffset = 0
+ }
+ }
+
+
+ // During the drag, we simply ignore the position set from the range, this
+ // means that setting a value while dragging will not "interrupt" the
+ // dragging activity.
+ Binding {
+ when: !mouseArea.drag.active
+ target: fakeHandle
+ property: __horizontal ? "x" : "y"
+ value: range.position
+ }
+
+ WheelArea {
+ id: wheelarea
+ anchors.fill: parent
+ horizontalMinimumValue: slider.minimumValue
+ horizontalMaximumValue: slider.maximumValue
+ verticalMinimumValue: slider.minimumValue
+ verticalMaximumValue: slider.maximumValue
+ property real step: (slider.maximumValue - slider.minimumValue)/(range.positionAtMaximum - range.positionAtMinimum)
+
+ onVerticalWheelMoved: {
+ if (verticalDelta !== 0) {
+ var delta = Math.abs(verticalDelta)*step > stepSize ? verticalDelta*step : verticalDelta/Math.abs(verticalDelta)*stepSize
+ value += delta
+ }
+ }
+
+ onHorizontalWheelMoved: {
+ if (horizontalDelta !== 0) {
+ var delta = Math.abs(horizontalDelta)*step > stepSize ? horizontalDelta*step : horizontalDelta/Math.abs(horizontalDelta)*stepSize
+ value += delta
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SpinBox.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SpinBox.qml
new file mode 100644
index 0000000000..c756566dec
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SpinBox.qml
@@ -0,0 +1,339 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype SpinBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Provides a spin box control.
+
+ SpinBox allows the user to choose a value by clicking the up or down buttons, or by
+ pressing up or down on the keyboard. The user can also type the value in manually.
+
+ By default the SpinBox provides discrete values in the range [0-99] with a \l stepSize of 1 and 0 \l decimals.
+
+ \code
+ SpinBox {
+ id: spinbox
+ }
+ \endcode
+
+ Note that if you require decimal values you will need to set the \l decimals to a non 0 value.
+
+ \code
+ SpinBox {
+ id: spinbox
+ decimals: 2
+ }
+ \endcode
+
+*/
+
+Control {
+ id: spinbox
+
+ /*!
+ \qmlproperty real SpinBox::value
+
+ The value of this SpinBox, clamped to \l minimumValue and \l maximumValue.
+
+ The default value is \c{0.0}.
+ */
+ property alias value: validator.value
+
+ /*!
+ \qmlproperty real SpinBox::minimumValue
+
+ The minimum value of the SpinBox range.
+ The \l value is clamped to this value.
+
+ The default value is \c{0.0}.
+ */
+ property alias minimumValue: validator.minimumValue
+
+ /*!
+ \qmlproperty real SpinBox::maximumValue
+
+ The maximum value of the SpinBox range.
+ The \l value is clamped to this value. If maximumValue is smaller than
+ \l minimumValue, \l minimumValue will be enforced.
+
+ The default value is \c{99}.
+ */
+ property alias maximumValue: validator.maximumValue
+
+ /*! \qmlproperty real SpinBox::stepSize
+ The amount by which the \l value is incremented/decremented when a
+ spin button is pressed.
+
+ The default value is \c{1.0}.
+ */
+ property alias stepSize: validator.stepSize
+
+ /*! \qmlproperty string SpinBox::suffix
+ The suffix for the value. I.e "cm" */
+ property alias suffix: validator.suffix
+
+ /*! \qmlproperty string SpinBox::prefix
+ The prefix for the value. I.e "$" */
+ property alias prefix: validator.prefix
+
+ /*! \qmlproperty int SpinBox::decimals
+ This property indicates the amount of decimals.
+ Note that if you enter more decimals than specified, they will
+ be truncated to the specified amount of decimal places.
+ The default value is \c{0}.
+ */
+ property alias decimals: validator.decimals
+
+ /*! \qmlproperty font SpinBox::font
+
+ This property indicates the current font used by the SpinBox.
+ */
+ property alias font: input.font
+
+ /*! This property indicates whether the Spinbox should get active
+ focus when pressed.
+ The default value is \c true.
+ */
+ property bool activeFocusOnPress: true
+
+ /*! \qmlproperty enumeration horizontalAlignment
+ \since 5.2
+
+ This property indicates how the content is horizontally aligned
+ within the text field.
+
+ The supported values are:
+ \list
+ \li Qt.AlignLeft
+ \li Qt.AlignHCenter
+ \li Qt.AlignRight
+ \endlist
+
+ The default value is style dependent.
+ */
+ property int horizontalAlignment: __panel ? __panel.horizontalAlignment : Qt.AlignLeft
+
+ /*!
+ \qmlproperty bool SpinBox::hovered
+
+ This property indicates whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*!
+ \qmlsignal SpinBox::editingFinished()
+ \since 5.2
+
+ This signal is emitted when the Return or Enter key is pressed or
+ the control loses focus. Note that if there is a validator
+ set on the control and enter/return is pressed, this signal will
+ only be emitted if the validator returns an acceptable state.
+ */
+ signal editingFinished()
+
+ style: Qt.createComponent(Settings.style + "/SpinBoxStyle.qml", spinbox)
+
+ /*! \internal */
+ function __increment() {
+ validator.increment()
+ input.selectValue()
+ }
+
+ /*! \internal */
+ function __decrement() {
+ validator.decrement()
+ input.selectValue()
+ }
+
+ /*! \internal */
+ property alias __text: input.text
+
+ __styleData: QtObject {
+ readonly property bool upEnabled: value != maximumValue;
+ readonly property alias upHovered: mouseUp.containsMouse
+ readonly property alias upPressed: mouseUp.pressed
+
+ readonly property bool downEnabled: value != minimumValue;
+ readonly property alias downPressed: mouseDown.pressed
+ readonly property alias downHovered: mouseDown.containsMouse
+
+ readonly property int contentHeight: Math.max(input.implicitHeight, 16)
+ readonly property int contentWidth: Math.max(maxSizeHint.implicitWidth, minSizeHint.implicitWidth)
+ }
+
+ Text {
+ id: maxSizeHint
+ text: prefix + maximumValue.toFixed(decimals) + suffix
+ font: input.font
+ visible: false
+ }
+
+ Text {
+ id: minSizeHint
+ text: prefix + minimumValue.toFixed(decimals) + suffix
+ font: input.font
+ visible: false
+ }
+
+ activeFocusOnTab: true
+
+ onActiveFocusChanged: if (activeFocus) input.selectValue()
+
+ Accessible.name: input.text
+ Accessible.role: Accessible.SpinBox
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ onPressed: if (activeFocusOnPress) input.forceActiveFocus()
+ onWheel: {
+ if (wheel.angleDelta.y > 0)
+ __increment();
+ else
+ __decrement();
+ }
+ }
+
+ TextInput {
+ id: input
+ clip: contentWidth > width
+ anchors.fill: parent
+ anchors.leftMargin: __style ? __style.padding.left : 0
+ anchors.topMargin: __style ? __style.padding.top : 0
+ anchors.rightMargin: __style ? __style.padding.right: 0
+ anchors.bottomMargin: __style ? __style.padding.bottom: 0
+
+ focus: true
+ activeFocusOnPress: spinbox.activeFocusOnPress
+
+ horizontalAlignment: spinbox.horizontalAlignment
+ verticalAlignment: __panel ? __panel.verticalAlignment : Qt.AlignVCenter
+ selectByMouse: true
+
+ validator: SpinBoxValidator {
+ id: validator
+ property bool ready: false // Delay validation until all properties are ready
+ onTextChanged: if (ready) input.text = validator.text
+ Component.onCompleted: {input.text = validator.text ; ready = true}
+ }
+ onAccepted: {
+ input.text = validator.text
+ selectValue()
+ }
+
+ onEditingFinished: spinbox.editingFinished()
+
+ color: __panel ? __panel.foregroundColor : "black"
+ selectionColor: __panel ? __panel.selectionColor : "black"
+ selectedTextColor: __panel ? __panel.selectedTextColor : "black"
+
+ opacity: parent.enabled ? 1 : 0.5
+ renderType: __style ? __style.renderType : Text.NativeRendering
+
+ function selectValue() {
+ select(prefix.length, text.length - suffix.length)
+ }
+ }
+
+ // Spinbox increment button
+
+ MouseArea {
+ id: mouseUp
+ objectName: "mouseUp"
+ hoverEnabled: true
+
+ property var upRect: __panel ? __panel.upRect : null
+
+ anchors.left: parent.left
+ anchors.top: parent.top
+
+ anchors.leftMargin: upRect ? upRect.x : 0
+ anchors.topMargin: upRect ? upRect.y : 0
+
+ width: upRect ? upRect.width : 0
+ height: upRect ? upRect.height : 0
+
+ onClicked: __increment()
+ onPressed: if (activeFocusOnPress) input.forceActiveFocus()
+
+ property bool autoincrement: false;
+ onReleased: autoincrement = false
+ Timer { running: mouseUp.pressed; interval: 350 ; onTriggered: mouseUp.autoincrement = true }
+ Timer { running: mouseUp.autoincrement; interval: 60 ; repeat: true ; onTriggered: __increment() }
+ }
+
+ // Spinbox decrement button
+
+ MouseArea {
+ id: mouseDown
+ objectName: "mouseDown"
+ hoverEnabled: true
+
+ onClicked: __decrement()
+ onPressed: if (activeFocusOnPress) input.forceActiveFocus()
+
+ property var downRect: __panel ? __panel.downRect : null
+
+ anchors.left: parent.left
+ anchors.top: parent.top
+
+ anchors.leftMargin: downRect ? downRect.x : 0
+ anchors.topMargin: downRect ? downRect.y : 0
+
+ width: downRect ? downRect.width : 0
+ height: downRect ? downRect.height : 0
+
+ property bool autoincrement: false;
+ onReleased: autoincrement = false
+ Timer { running: mouseDown.pressed; interval: 350 ; onTriggered: mouseDown.autoincrement = true }
+ Timer { running: mouseDown.autoincrement; interval: 60 ; repeat: true ; onTriggered: __decrement() }
+ }
+
+ Keys.onUpPressed: __increment()
+ Keys.onDownPressed: __decrement()
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SplitView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SplitView.qml
new file mode 100644
index 0000000000..1f829a3468
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SplitView.qml
@@ -0,0 +1,504 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Layouts 1.0
+import QtQuick.Controls.Private 1.0 as Private
+
+/*!
+ \qmltype SplitView
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup views
+ \brief Lays out items with a draggable splitter between each item.
+
+ SplitView is a control that lays out items horizontally or
+ vertically with a draggable splitter between each item.
+
+ There will always be one (and only one) item in the SplitView that has \l{Layout::fillWidth}{Layout.fillWidth}
+ set to \c true (or \l{Layout::fillHeight}{Layout.fillHeight}, if orientation is Qt.Vertical). This means that the
+ item will get all leftover space when other items have been laid out.
+ By default, the last visible child of the SplitView will have this set, but
+ it can be changed by explicitly setting fillWidth to \c true on another item.
+ As the fillWidth item will automatically be resized to fit the extra space, explicit assignments
+ to width and height will be ignored (but \l{Layout::minimumWidth}{Layout.minimumWidth} and
+ \l{Layout::maximumWidth}{Layout.maximumWidth} will still be respected).
+
+ A handle can belong to the item either on the left or top side, or on the right or bottom side:
+ \list
+ \li If the fillWidth item is to the right: the handle belongs to the left item.
+ \li if the fillWidth item is on the left: the handle belongs to the right item.
+ \endlist
+
+ This will again control which item gets resized when the user drags a handle,
+ and which handle gets hidden when an item is told to hide.
+
+ SplitView supports setting attached Layout properties on child items, which
+ means that you can set the following attached properties for each child:
+ \list
+ \li \l{Layout::minimumWidth}{Layout.minimumWidth}
+ \li \l{Layout::minimumHeight}{Layout.minimumHeight}
+ \li \l{Layout::maximumWidth}{Layout.maximumWidth}
+ \li \l{Layout::maximumHeight}{Layout.maximumHeight}
+ \li \l{Layout::fillWidth}{Layout.fillWidth} (\c true for only one child)
+ \li \l{Layout::fillHeight}{Layout.fillHeight} (\c true for only one child)
+ \endlist
+
+ \note Please import QtQuick.Layout 1.0 in your QML file in order to use the Layout
+ attached properties inside SplitView.
+
+ Example:
+
+ To create a SplitView with three items, and let the center item get superfluous space, one
+ could do the following:
+
+ \qml
+ SplitView {
+ anchors.fill: parent
+ orientation: Qt.Horizontal
+
+ Rectangle {
+ width: 200
+ Layout.maximumWidth: 400
+ color: "gray"
+ }
+ Rectangle {
+ id: centerItem
+ Layout.minimumWidth: 50
+ Layout.fillWidth: true
+ color: "darkgray"
+ }
+ Rectangle {
+ width: 200
+ color: "gray"
+ }
+ }
+ \endqml
+*/
+
+Item {
+ id: root
+
+ /*!
+ \qmlproperty enumeration SplitView::orientation
+
+ This property holds the orientation of the SplitView.
+ The value can be either \c Qt.Horizontal or \c Qt.Vertical.
+ The default value is \c Qt.Horizontal.
+ */
+ property int orientation: Qt.Horizontal
+
+ /*!
+ This property holds the delegate that will be instantiated between each
+ child item. Inside the delegate the following properties are available:
+
+ \table
+ \row \li readonly property bool styleData.index \li Specifies the index of the splitter handle. The handle
+ between the first and the second item will get index 0,
+ the next handle index 1 etc.
+ \row \li readonly property bool styleData.hovered \li The handle is being hovered.
+ \row \li readonly property bool styleData.pressed \li The handle is being pressed.
+ \row \li readonly property bool styleData.resizing \li The handle is being dragged.
+ \endtable
+
+*/
+ property Component handleDelegate: Rectangle {
+ width: 1
+ height: 1
+ color: Qt.darker(pal.window, 1.5)
+ }
+
+ /*!
+ This propery is \c true when the user is resizing any of the items by
+ dragging on the splitter handles.
+ */
+ property bool resizing: false
+
+ /*! \internal */
+ default property alias __contents: contents.data
+ /*! \internal */
+ property alias __items: splitterItems.children
+ /*! \internal */
+ property alias __handles: splitterHandles.children
+
+ clip: true
+ Component.onCompleted: d.init()
+ onWidthChanged: d.updateLayout()
+ onHeightChanged: d.updateLayout()
+ onOrientationChanged: d.changeOrientation()
+
+ SystemPalette { id: pal }
+
+ QtObject {
+ id: d
+ property bool horizontal: orientation == Qt.Horizontal
+ readonly property string minimum: horizontal ? "minimumWidth" : "minimumHeight"
+ readonly property string maximum: horizontal ? "maximumWidth" : "maximumHeight"
+ readonly property string otherMinimum: horizontal ? "minimumHeight" : "minimumWidth"
+ readonly property string otherMaximum: horizontal ? "maximumHeight" : "maximumWidth"
+ readonly property string offset: horizontal ? "x" : "y"
+ readonly property string otherOffset: horizontal ? "y" : "x"
+ readonly property string size: horizontal ? "width" : "height"
+ readonly property string otherSize: horizontal ? "height" : "width"
+ readonly property string implicitSize: horizontal ? "implicitWidth" : "implicitHeight"
+ readonly property string implicitOtherSize: horizontal ? "implicitHeight" : "implicitWidth"
+
+ property int fillIndex: -1
+ property bool updateLayoutGuard: true
+
+ function init()
+ {
+ for (var i=0; i<__contents.length; ++i) {
+ var item = __contents[i];
+ if (!item.hasOwnProperty("x"))
+ continue
+
+ if (splitterItems.children.length > 0)
+ handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1})
+ item.parent = splitterItems
+ i-- // item was removed from list
+
+ // should match disconnections in Component.onDestruction
+ item.widthChanged.connect(d.updateLayout)
+ item.heightChanged.connect(d.updateLayout)
+ item.Layout.maximumWidthChanged.connect(d.updateLayout)
+ item.Layout.minimumWidthChanged.connect(d.updateLayout)
+ item.Layout.maximumHeightChanged.connect(d.updateLayout)
+ item.Layout.minimumHeightChanged.connect(d.updateLayout)
+ item.visibleChanged.connect(d.updateFillIndex)
+ item.Layout.fillWidthChanged.connect(d.updateFillIndex)
+ item.Layout.fillHeightChanged.connect(d.updateFillIndex)
+ }
+
+ d.calculateImplicitSize()
+ d.updateLayoutGuard = false
+ d.updateFillIndex()
+ }
+
+ function updateFillIndex()
+ {
+ if (lastItem.visible !== root.visible)
+ return
+ var policy = (root.orientation === Qt.Horizontal) ? "fillWidth" : "fillHeight"
+ for (var i=0; i<__items.length-1; ++i) {
+ if (__items[i].Layout[policy] === true)
+ break;
+ }
+
+ d.fillIndex = i
+ d.updateLayout()
+ }
+
+ function changeOrientation()
+ {
+ if (__items.length == 0)
+ return;
+ d.updateLayoutGuard = true
+
+ // Swap width/height for items and handles:
+ for (var i=0; i<__items.length; ++i) {
+ var item = __items[i]
+ var tmp = item.x
+ item.x = item.y
+ item.y = tmp
+ tmp = item.width
+ item.width = item.height
+ item.height = tmp
+
+ var handle = __handles[i]
+ if (handle) {
+ tmp = handle.x
+ handle.x = handle.y
+ handle.y = handle.x
+ tmp = handle.width
+ handle.width = handle.height
+ handle.height = tmp
+ }
+ }
+
+ // Change d.horizontal explicit, since the binding will change too late:
+ d.horizontal = orientation == Qt.Horizontal
+ d.updateLayoutGuard = false
+ d.updateFillIndex()
+ }
+
+ function calculateImplicitSize()
+ {
+ var implicitSize = 0
+ var implicitOtherSize = 0
+
+ for (var i=0; i<__items.length; ++i) {
+ var item = __items[i];
+ implicitSize += clampedMinMax(item[d.size], item.Layout[minimum], item.Layout[maximum])
+ var os = clampedMinMax(item[otherSize], item.Layout[otherMinimum], item.Layout[otherMaximum])
+ implicitOtherSize = Math.max(implicitOtherSize, os)
+
+ var handle = __handles[i]
+ if (handle)
+ implicitSize += handle[d.size]
+ }
+
+ root[d.implicitSize] = implicitSize
+ root[d.implicitOtherSize] = implicitOtherSize
+ }
+
+ function clampedMinMax(value, minimum, maximum)
+ {
+ if (value < minimum)
+ value = minimum
+ if (value > maximum)
+ value = maximum
+ return value
+ }
+
+ function accumulatedSize(firstIndex, lastIndex, includeFillItemMinimum)
+ {
+ // Go through items and handles, and
+ // calculate their acummulated width.
+ var w = 0
+ for (var i=firstIndex; i<lastIndex; ++i) {
+
+ var item = __items[i]
+ if (item.visible || i == d.fillIndex) {
+ if (i !== d.fillIndex)
+ w += item[d.size];
+ else if (includeFillItemMinimum && item.Layout[minimum] !== undefined)
+ w += item.Layout[minimum]
+ }
+
+ var handle = __handles[i]
+ if (handle && handle.visible)
+ w += handle[d.size]
+ }
+ return w
+ }
+
+ function updateLayout()
+ {
+ // This function will reposition both handles and
+ // items according to the their width/height:
+ if (__items.length === 0)
+ return;
+ if (!lastItem.visible)
+ return;
+ if (d.updateLayoutGuard === true)
+ return
+ d.updateLayoutGuard = true
+
+ // Ensure all items within their min/max:
+ for (var i=0; i<__items.length; ++i) {
+ if (i !== d.fillIndex) {
+ var item = __items[i];
+ var clampedSize = clampedMinMax(item[d.size], item.Layout[d.minimum], item.Layout[d.maximum])
+ if (clampedSize != item[d.size])
+ item[d.size] = clampedSize
+ }
+ }
+
+ // Set size of fillItem to remaining available space.
+ // Special case: If SplitView size is zero, we leave fillItem with the size
+ // it already got, and assume that SplitView ends up with implicit size as size:
+ if (root[d.size] != 0) {
+ var fillItem = __items[fillIndex]
+ var superfluous = root[d.size] - d.accumulatedSize(0, __items.length, false)
+ var s = Math.max(superfluous, fillItem.Layout[minimum])
+ s = Math.min(s, fillItem.Layout[maximum])
+ fillItem[d.size] = s
+ }
+
+ // Position items and handles according to their width:
+ var lastVisibleItem, lastVisibleHandle, handle
+ for (i=0; i<__items.length; ++i) {
+ // Position item to the right of the previous visible handle:
+ item = __items[i];
+ if (item.visible || i == d.fillIndex) {
+ item[d.offset] = lastVisibleHandle ? lastVisibleHandle[d.offset] + lastVisibleHandle[d.size] : 0
+ item[d.otherOffset] = 0
+ item[d.otherSize] = clampedMinMax(root[otherSize], item.Layout[otherMinimum], item.Layout[otherMaximum])
+ lastVisibleItem = item
+ }
+
+ handle = __handles[i]
+ if (handle && handle.visible) {
+ handle[d.offset] = lastVisibleItem[d.offset] + Math.max(0, lastVisibleItem[d.size])
+ handle[d.otherOffset] = 0
+ handle[d.otherSize] = root[d.otherSize]
+ lastVisibleHandle = handle
+ }
+ }
+
+ d.updateLayoutGuard = false
+ }
+ }
+
+ Component {
+ id: handleLoader
+ Loader {
+ id: itemHandle
+
+ property int __handleIndex: -1
+ property QtObject styleData: QtObject {
+ readonly property int index: __handleIndex
+ readonly property alias hovered: mouseArea.containsMouse
+ readonly property alias pressed: mouseArea.pressed
+ readonly property bool resizing: mouseArea.drag.active
+ onResizingChanged: root.resizing = resizing
+ }
+ property bool resizeLeftItem: (d.fillIndex > __handleIndex)
+ visible: __items[__handleIndex + (resizeLeftItem ? 0 : 1)].visible
+ sourceComponent: handleDelegate
+ onWidthChanged: d.updateLayout()
+ onHeightChanged: d.updateLayout()
+ onXChanged: moveHandle()
+ onYChanged: moveHandle()
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ anchors.leftMargin: (parent.width <= 1) ? -2 : 0
+ anchors.rightMargin: (parent.width <= 1) ? -2 : 0
+ anchors.topMargin: (parent.height <= 1) ? -2 : 0
+ anchors.bottomMargin: (parent.height <= 1) ? -2 : 0
+ hoverEnabled: true
+ drag.threshold: 0
+ drag.target: parent
+ drag.axis: root.orientation === Qt.Horizontal ? Drag.XAxis : Drag.YAxis
+ cursorShape: root.orientation === Qt.Horizontal ? Qt.SplitHCursor : Qt.SplitVCursor
+ }
+
+ function moveHandle() {
+ // Moving the handle means resizing an item. Which one,
+ // left or right, depends on where the fillItem is.
+ // 'updateLayout' will be overridden in case new width violates max/min.
+ // 'updateLayout' will be triggered when an item changes width.
+ if (d.updateLayoutGuard)
+ return
+
+ var leftHandle, leftItem, rightItem, rightHandle
+ var leftEdge, rightEdge, newWidth, leftStopX, rightStopX
+ var i
+
+ if (resizeLeftItem) {
+ // Ensure that the handle is not crossing other handles. So
+ // find the first visible handle to the left to determine the left edge:
+ leftEdge = 0
+ for (i=__handleIndex-1; i>=0; --i) {
+ leftHandle = __handles[i]
+ if (leftHandle.visible) {
+ leftEdge = leftHandle[d.offset] + leftHandle[d.size]
+ break;
+ }
+ }
+
+ // Ensure: leftStopX >= itemHandle[d.offset] >= rightStopX
+ var min = d.accumulatedSize(__handleIndex+1, __items.length, true)
+ rightStopX = root[d.size] - min - itemHandle[d.size]
+ leftStopX = Math.max(leftEdge, itemHandle[d.offset])
+ itemHandle[d.offset] = Math.min(rightStopX, Math.max(leftStopX, itemHandle[d.offset]))
+
+ newWidth = itemHandle[d.offset] - leftEdge
+ leftItem = __items[__handleIndex]
+ // The next line will trigger 'updateLayout':
+ leftItem[d.size] = newWidth
+ } else {
+ // Resize item to the right.
+ // Ensure that the handle is not crossing other handles. So
+ // find the first visible handle to the right to determine the right edge:
+ rightEdge = root[d.size]
+ for (i=__handleIndex+1; i<__handles.length; ++i) {
+ rightHandle = __handles[i]
+ if (rightHandle.visible) {
+ rightEdge = rightHandle[d.offset]
+ break;
+ }
+ }
+
+ // Ensure: leftStopX <= itemHandle[d.offset] <= rightStopX
+ min = d.accumulatedSize(0, __handleIndex+1, true)
+ leftStopX = min - itemHandle[d.size]
+ rightStopX = Math.min((rightEdge - itemHandle[d.size]), itemHandle[d.offset])
+ itemHandle[d.offset] = Math.max(leftStopX, Math.min(itemHandle[d.offset], rightStopX))
+
+ newWidth = rightEdge - (itemHandle[d.offset] + itemHandle[d.size])
+ rightItem = __items[__handleIndex+1]
+ // The next line will trigger 'updateLayout':
+ rightItem[d.size] = newWidth
+ }
+ }
+ }
+ }
+
+ Item {
+ id: contents
+ visible: false
+ anchors.fill: parent
+ }
+ Item {
+ id: splitterItems
+ anchors.fill: parent
+ }
+ Item {
+ id: splitterHandles
+ anchors.fill: parent
+ }
+
+ Item {
+ id: lastItem
+ onVisibleChanged: d.updateFillIndex()
+ }
+
+ Component.onDestruction: {
+ for (var i=0; i<splitterItems.children.length; ++i) {
+ var item = splitterItems.children[i];
+
+ // should match connections in init()
+ item.widthChanged.disconnect(d.updateLayout)
+ item.heightChanged.disconnect(d.updateLayout)
+ item.Layout.maximumWidthChanged.disconnect(d.updateLayout)
+ item.Layout.minimumWidthChanged.disconnect(d.updateLayout)
+ item.Layout.maximumHeightChanged.disconnect(d.updateLayout)
+ item.Layout.minimumHeightChanged.disconnect(d.updateLayout)
+ item.visibleChanged.disconnect(d.updateFillIndex)
+ item.Layout.fillWidthChanged.disconnect(d.updateFillIndex)
+ item.Layout.fillHeightChanged.disconnect(d.updateFillIndex)
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackView.qml
new file mode 100644
index 0000000000..18f77d2ec5
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackView.qml
@@ -0,0 +1,963 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StackView
+ \inherits Item
+ \ingroup views
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+
+ \brief Provides a stack-based navigation model.
+
+ StackView implements a stack-based navigation model, which can be used
+ with a set of interlinked information pages. Items are pushed onto the stack
+ as the user navigates deeper into the material, and popped off again when he
+ chooses to go back.
+
+ \section1 Using StackView in an Application
+ Using the StackView in the application is typically a simple matter of adding
+ the StackView as a child of a Window. The stack is usually anchored to the
+ edges of the window, except at the top or bottom where it might be anchored
+ to a status bar, or some other similar UI component. The stack can then be
+ used by invoking its navigation methods. The first item to show in the StackView
+ is commonly loaded assigning it to \l initialItem.
+
+ \note Items pushed onto the stack view have \l{Supported Attached Properties}{Stack attached properties}.
+
+ \section1 Basic Navigation
+ There are three primary navigation operations in StackView: push(), pop(), and
+ replace (replace by specifying argument \c replace to push()).
+ These correspond to classic stack operations where "push" adds an item to the
+ top of a stack, "pop" removes the top item from the stack, and "replace" is like a
+ pop followed by a push in that it replaces the topmost item on the stack with
+ a new item (but the applied transtition might be different). The topmost item
+ in the stack corresponds to the one that is \l{StackView::currentItem} {currently}
+ visible on the screen. That means that "push" is the logical equivalent of navigating
+ forward or deeper into the application, "pop" is the equivalent of navigating back,
+ and "replace" is the equivalent of replacing the current item.
+
+ Sometimes it is necessary to go back more than a single step in the stack, for
+ example, to return to a "main" item or some kind of section item in the application.
+ For this use case, it is possible to specify an item as a parameter for pop().
+ This is called an "unwind" operation as the stack gets unwound to the specified item.
+ If the item is not found then the stack unwinds until there is only a single item in
+ the stack, which becomes the current item. To explicitly unwind to the bottom
+ of the stack it is recommended to use \l{pop()} {pop(null)}, though technically any
+ non-existent item will do.
+
+ Given the stack [A, B, C]:
+
+ \list
+ \li \l{push()}{push(D)} => [A, B, C, D] - "push" transition animation between C and D
+ \li pop() => [A, B] - "pop" transition animation between C and B
+ \li \l{push()}{push(D, replace)} => [A, B, D] - "replace" transition between C and D
+ \li \l{pop()}{pop(A)} => [A] - "pop" transition between C and A
+ \endlist
+
+ \note Note that when the stack is empty, a push() will not perform a
+ transition animation because there is nothing to transition from (typically during
+ application start-up). A pop() on a stack with depth 1 or 0 is a no-operation.
+ If removing all items from the stack is needed, a separate function clear() is
+ available.
+
+ Calling push() returns the item that was pushed onto the stack.
+ Calling pop() returns the item that was popped off the stack. When pop() is
+ called in an unwind operation the top-most item (the first item that was
+ popped, which will also be the one transitioning out) is returned.
+
+ \section1 Deep Linking
+ \e{Deep linking} means launching an application into a particular state. For example,
+ a newspaper application could be launched into showing a particular article,
+ bypassing the front item (and possibly a section item) that would normally have
+ to be navigated through to get to the article concerned. In terms of StackView, deep
+ linking means the ability to modify the state of the stack, so much so that it is
+ possible to push a set of items to the top of the stack, or to completely reset
+ the stack to a given state.
+
+ The API for deep linking in StackView is the same as for basic navigation. Pushing
+ an array instead of a single item, will involve that all the items in that array will
+ be pushed onto the stack. The transition animation, however, will be conducted as
+ if only the last item in the array was pushed onto the stack. The normal semantics
+ of push() apply for deep linking, meaning that push() adds whatever is pushed onto
+ the stack. Note also that only the last item of the array will be loaded.
+ The rest will be lazy-loaded as needed when entering the screen upon subsequent
+ calls to pop (or when requesting the item by using \a get).
+
+ This gives us the following result, given the stack [A, B, C]:
+
+ \list
+ \li \l{push()}{push([D, E, F])} => [A, B, C, D, E, F] - "push" transition animation between C and F
+ \li \l{push()}{push([D, E, F], replace)} => [A, B, D, E, F] - "replace" transition animation between C and F
+ \li clear(); \l{push()}{push([D, E, F])} => [D, E, F] - no transition animation (since the stack was empty)
+ \endlist
+
+ \section1 Pushing items
+
+ An item pushed onto the StackView can be either an Item, a URL, a string
+ with a URL, or a Component. To push it, assign it to a property "item"
+ inside a property list, and send it as an argument to \l{StackView::push}{push}:
+
+ \code
+ stackView.push({item: yourItem})
+ \endcode
+
+ The list can contain several properties that control how the item should be pushed:
+ \list
+ \li \c item: this property is required, and holds the item to be pushed.
+ \li \c properties: a list of QML properties to be assigned to the item upon push. These
+ properties will be copied into the item at load time, or when the item will become
+ the current item (normally upon push).
+ \li \c immediate: set this property to \c true to skip transition effects. When pushing
+ an array, this property only needs to be set on the first element to make the
+ whole operation immediate.
+ \li \c replace: set this property to replace the current item on the stack. When pushing
+ an array, you only need to set this property on the first element to replace
+ as many elements on the stack as inside the array.
+ \li \c destroyOnPop: set this boolean to true if StackView needs to destroy the item when
+ it is popped off the stack. By default (if \a destroyOnPop is not specified), StackView
+ will destroy items pushed as components or URLs. Items not destroyed will be re-parented
+ back to the original parents they had before being pushed onto the stack and hidden.
+ If you need to set this property, do it with care, so that items are not leaked.
+ \endlist
+
+ If the only argument needed is "item", the following short-hand notation can be applied:
+
+ \code
+ stackView.push(yourItem)
+ \endcode
+
+ You can push several items in one go by using an array of property lists. This is
+ optimizing compared to pushing items one by one, since StackView then can load only the
+ last item in the list. The rest will be loaded as they are about to become
+ the current item (which happens when the stack is popped). The following example shows how
+ to push an array of items:
+
+ \code
+ stackView.push([{item: yourItem1}, {item: yourItem2}])
+ \endcode
+
+ If an inline item is pushed, the item is temporarily re-parented into the StackView. When the item
+ is later popped off, it gets re-parented back to its original owner again.
+ If, however, an item is pushed as a component or a URL, the actual item will be created as an
+ item from that component. This happens automatically when the item is about to become the current
+ item in the stack. Ownership of the item will then normally be taken by the StackView. It will as
+ such automatically destroy the item when it is later popped off. The component that declared the item, by
+ contrast, remains in the ownership of the application and is not destroyed by the stack.
+ This can be overridden by explicitly setting \c{destroyOnPop} in the list of arguments given to push.
+
+ If the \c properties to be pushed are specified, they will be copied into the item at loading time
+ (in case of a component or URL), or when the item will become the current item (in case of an inline
+ item). The following example shows how this can be done:
+
+ \code
+ stackView.push({item: someItem, properties: {fgcolor: "red", bgcolor: "blue"}})
+ \endcode
+
+
+ \note Note that if an item is declared inside another item, and if that parent gets destroyed,
+ (even if a component was used), that child item will also be destroyed.
+ This follows normal Qt parent-child destruction rules, but sometimes comes as a surprise
+ for developers.
+
+ \section1 Lifecycle
+ An item's lifecycle in the StackView can have the following transitions:
+ \list 1
+ \li instantiation
+ \li inactive
+ \li activating
+ \li active
+ \li deactivating
+ \li inactive
+ \li destruction
+ \endlist
+
+ It can move any number of times between inactive and active. When an item is activated,
+ it's visible on the screen and is considered to be the current item. An item
+ in a StackView that is not visible is not activated, even if the item is currently the
+ top-most item in the stack. When the stack becomes visible, the item that is top-most gets
+ activated. Likewise if the stack is then hidden, the topmost item would be deactivated.
+ Popping the item off the top of the stack at this point would not result in further
+ deactivation since the item is not active.
+
+ There is an attached \l{Stack::status}{Stack.status} property that tracks the lifecycle. The
+ status values list is an enumeration with values \c Stack.Inactive, \c Stack.Activating,
+ \c Stack.Active and \c Stack.Deactivating. Combined with the normal \c Component.onComplete and
+ \c Component.onDestruction signals the entire lifecycle is thus:
+
+ \list
+ \li Created: Component.onCompleted()
+ \li Activating: Stack.onStatusChanged (Stack.status is Stack.Activating)
+ \li Acivated: Stack.onStatusChanged (Stack.status is Stack.Active)
+ \li Deactivating: Stack.onStatusChanged (Stack.status is Stack.Deactivating)
+ \li Deactivated: Stack.onStatusChanged (Stack.status is Stack.Inactive)
+ \li Destruction: Component.onDestruction()
+ \endlist
+
+ \section1 Finding items
+ Sometimes it is necessary to search for an item, for example, in order to unwind the stack to
+ an item to which the application does not have a reference. This is facilitated using a
+ function find() in StackView. The find() function takes a callback function as its
+ only argument. The callback gets invoked for each item in the stack (starting at the top).
+ If the callback returns true, then it signals that a match has been found and the find()
+ function returns that item. If the callback fails to return true (no match is found),
+ then find() returns \c null.
+
+ The code below searches for an item in the stack that has a name "order_id" and then unwinds to
+ that item. Note that since find() returns \c {null} if no item is found, and since pop unwinds to
+ the bottom of the stack if null is given as the target item, the code works well even in
+ case no matching item is found.
+
+ \code
+ stackView.pop(stackView.find(function(item) {
+ return item.name == "order_id";
+ }));
+ \endcode
+
+ You can also get to an item in the stack using \l {get()}{get(index)}. You should use
+ this function if your item depends on another item in the stack, as the function will
+ ensure that the item at the given index gets loaded before it is returned.
+
+ \code
+ previousItem = stackView.get(myItem.Stack.index - 1));
+ \endcode
+
+ \section1 Transitions
+
+ A transition is performed whenever a item is pushed or popped, and consists of
+ two items: enterItem and exitItem. The StackView itself will never move items
+ around, but instead delegate the job to an external animation set provided
+ by the style or the application developer. How items should visually enter and leave the stack
+ (and the geometry they should end up with) is therefore completely controlled from the outside.
+
+ When the transition starts, the StackView will search for a transition that
+ matches the operation executed. There are three transitions to choose
+ from: pushTransition, popTransition, and replaceTransition. Each implements how
+ enterItem should animate in, and exitItem out. The transitions are
+ collected inside a StackViewDelegate object assigned to
+ \l {StackView::delegate}{delegate}. By default, popTransition and
+ replaceTransition will be the same as pushTransition, unless you set them
+ to something else.
+
+ A simple fade transition could be implemented as:
+
+ \qml
+ StackView {
+ delegate: StackViewDelegate {
+ function transitionFinished(properties)
+ {
+ properties.exitItem.opacity = 1
+ }
+
+ property Component pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "opacity"
+ from: 0
+ to: 1
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "opacity"
+ from: 1
+ to: 0
+ }
+ }
+ }
+ }
+ \endqml
+
+ PushTransition needs to inherit from StackViewTransition, which is a ParallelAnimation that
+ contains the properties \c enterItem and \c exitItem. You set the target of your
+ inner animations to those items. Since the same items instance can be pushed several
+ times to a StackView, you should always override
+ \l {StackViewDelegate::transitionFinished(properties)}{StackViewDelegate.transitionFinished(properties)}.
+ Implement this function to reset any properties animated on the exitItem so that later
+ transitions can expect the items to be in a default state.
+
+ A more complex example could look like the following. Here, the items are lying on the side before
+ being rotated to an upright position:
+
+ \qml
+ StackView {
+ delegate: StackViewDelegate {
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.rotation = 0
+ }
+
+ property Component pushTransition: StackViewTransition {
+ SequentialAnimation {
+ ScriptAction {
+ script: enterItem.rotation = 90
+ }
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: enterItem.width
+ to: 0
+ }
+ PropertyAnimation {
+ target: enterItem
+ property: "rotation"
+ from: 90
+ to: 0
+ }
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: -exitItem.width
+ }
+ }
+ }
+ }
+ \endqml
+
+ \section2 Advanced usage
+
+ When the StackView needs a new transition, it first calls
+ \l {StackViewDelegate::getTransition(properties)}{StackViewDelegate.getTransition(properties)}.
+ The base implementation of this function just looks for a property named \c properties.name inside
+ itself (root), which is how it finds \c {property Component pushTransition} in the examples above.
+
+ \code
+ function getTransition(properties)
+ {
+ return root[properties.name]
+ }
+ \endcode
+
+ You can override this function for your delegate if you need extra logic to decide which
+ transition to return. You could for example introspect the items, and return different animations
+ depending on the their internal state. StackView will expect you to return a Component that
+ contains a StackViewTransition, or a StackViewTransition directly. The former is easier, as StackView will
+ then create the transition and later destroy it when it's done, while avoiding any sideeffects
+ caused by the transition being alive long after it has run. Returning a StackViewTransition directly
+ can be useful if you need to write some sort of transition caching for performance reasons.
+ As an optimization, you can also return \c null to signal that you just want to show/hide the items
+ immediately without creating or running any transitions. You can also override this function if
+ you need to alter the items in any way before the transition starts.
+
+ \c properties contains the properties that will be assigned to the StackViewTransition before
+ it runs. In fact, you can add more properties to this object during the call
+ if you need to initialize additional properties of your custom StackViewTransition when the returned
+ component is instantiated.
+
+ The following example shows how you can decide which animation to use during runtime :
+
+ \qml
+ StackViewDelegate {
+ function getTransition(properties)
+ {
+ return (properties.enterItem.Stack.index % 2) ? horizontalTransition : verticalTransition
+ }
+
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.y = 0
+ }
+
+ property Component horizontalTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: target.width
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: target.width
+ duration: 300
+ }
+ }
+
+ property Component verticalTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: target.height
+ duration: 300
+ }
+ }
+ }
+ \endqml
+
+ \section1 Supported Attached Properties
+
+ Items in a StackView support these attached properties:
+ \list
+ \li \l{Stack::index}{Stack.index} - Contains the index of the item inside the StackView
+ \li \l{Stack::view}{Stack.view} - Contains the StackView the item is in
+ \li \l{Stack::status}{Stack.status} - Contains the status of the item
+ \endlist
+*/
+
+Item {
+ id: root
+
+ /*! \qmlproperty int StackView::depth
+ \readonly
+ The number of items currently pushed onto the stack.
+ */
+ readonly property alias depth: root.__depth
+
+ /*! \qmlproperty Item StackView::currentItem
+ \readonly
+ The currently top-most item in the stack.
+ */
+ readonly property alias currentItem: root.__currentItem
+
+ /*! The first \l item that should be shown when the StackView is created.
+ \a initialItem can take same value as the first argument to \l{StackView::push()}
+ {StackView.push()}. Note that this is just a convenience for writing
+ \c{Component.onCompleted: stackView.push(myInitialItem)}
+
+ Examples:
+
+ \list
+ \li initialItem: Qt.resolvedUrl("MyItem.qml")
+ \li initialItem: myItem
+ \li initialItem: {"item" : Qt.resolvedUrl("MyRectangle.qml"), "properties" : {"color" : "red"}}
+ \endlist
+ \sa push
+ */
+ property var initialItem: null
+
+ /*! \readonly
+ \a busy is \c true if a transition is running, and \c false otherwise. */
+ readonly property bool busy: __currentTransition !== null
+
+ /*! The transitions to use when pushing or popping items.
+ For better understanding on how to apply custom transitions, read \l{Transitions}.
+ \sa {Stack::transitions}{Stack.transitions} */
+ property StackViewDelegate delegate: StackViewSlideDelegate {}
+
+ /*! Pushes an item onto the stack. The function takes a property list as argument, which
+ should contain one or more of the following properties:
+ \list
+ \li \c item: this property is required, and holds the item you want to push.
+ \li \c properties: a list of QML properties that should be assigned
+ to the item upon push. These properties will be copied into the item when it is
+ loaded (in case of a component or URL), or when it becomes the current item for the
+ first time (normally upon push).
+ \li \c immediate: set this property to \c true to skip transition effects. When pushing
+ an array, you only need to set this property on the first element to make the
+ whole operation immediate.
+ \li \c replace: set this property to replace the current item on the stack. When pushing
+ an array, you only need to set this property on the first element to replace
+ as many elements on the stack as inside the array.
+ \li \c destroyOnPop: set this property to specify if the item needs to be destroyed
+ when its popped off the stack. By default (if \a destroyOnPop is not specified),
+ StackView will destroy items pushed as components or URLs. Items
+ not destroyed will be re-parented to the original parents they had before being
+ pushed onto the stack, and hidden. If you need to set this property, do it with
+ care, so that items are not leaked.
+ \endlist
+
+ You can also push an array of items (property lists) if you need to push several items
+ in one go. A transition will then only occur between the current item and the last
+ item in the list. Loading the other items will be deferred until needed.
+
+ Examples:
+ \list
+ \li stackView.push({item:anItem})
+ \li stackView.push({item:aURL, immediate: true, replace: true})
+ \li stackView.push({item:aRectangle, properties:{color:"red"}})
+ \li stackView.push({item:aComponent, properties:{color:"red"}})
+ \li stackView.push({item:aComponent.createObject(), destroyOnPop:true})
+ \li stackView.push([{item:anitem, immediate:true}, {item:aURL}])
+ \endlist
+
+ \note Note: if the only argument needed is "item", you can apply the following short-
+ hand notation: \c{stackView.push(anItem)}.
+
+ Returns the item that became current.
+
+ \sa initialItem
+ \sa {Pushing items}
+ */
+ function push(item) {
+ // Note: we support two different APIs in this function; The old meego API, and
+ // the new "property list" API. Hence the reason for hiding the fact that you
+ // can pass more arguments than shown in the signature:
+ if (__recursionGuard(true))
+ return
+ var properties = arguments[1]
+ var immediate = arguments[2]
+ var replace = arguments[3]
+ var arrayPushed = (item instanceof Array)
+ var firstItem = arrayPushed ? item[0] : item
+ immediate = (immediate || JSArray.stackView.length === 0)
+
+ if (firstItem && firstItem.item && firstItem.hasOwnProperty("x") === false) {
+ // Property list API used:
+ immediate = immediate || firstItem.immediate
+ replace = replace || firstItem.replace
+ }
+
+ // Create, and push, a new javascript object, called "element", onto the stack.
+ // This element contains all the information necessary to construct the item, and
+ // will, after loaded, also contain the loaded item:
+ if (arrayPushed) {
+ if (item.length === 0)
+ return
+ var outElement = replace ? JSArray.pop() : JSArray.current()
+ for (var i=0; i<item.length; ++i)
+ JSArray.push({itemComponent:item[i], loaded: false, index: __depth, properties: properties});
+ } else {
+ outElement = replace ? JSArray.pop() : JSArray.current()
+ JSArray.push({itemComponent:item, loaded: false, index: __depth, properties: properties})
+ }
+
+ var currentElement = JSArray.current()
+ var transition = {
+ inElement: currentElement,
+ outElement: outElement,
+ immediate: immediate,
+ replace: replace,
+ push: true
+ }
+ __performTransition(transition)
+ __recursionGuard(false)
+ return __currentItem
+ }
+
+ /*! Pops one or more items off the stack. The function takes a property list as argument
+ which can contain one or more of the following properties:
+ \list
+ \li \c item: if specified, all items down to (but not including) \a item will be
+ popped off. If \a item is \c null, all items down to (but not including) the
+ first item will be popped. If not specified, only the current item will be
+ popped.
+ \li \c immediate: set this property to \c true to skip transition effects.
+ \endlist
+
+ Examples:
+ \list
+ \li stackView.pop()
+ \li stackView.pop({item:someItem, immediate: true})
+ \li stackView.pop({immediate: true})
+ \li stackView.pop(null)
+ \endlist
+
+ \note Note: If the only argument needed is "item", you can apply the following short-
+ hand notation: \c{stackView.pop(anItem)}.
+
+ Returns the item that was popped off
+ \sa clear()
+ */
+ function pop(item) {
+ if (__depth <= 1)
+ return null
+ if (item && item.hasOwnProperty("x") === false) {
+ // Property list API used:
+ var immediate = (item.immediate === true)
+ item = item.item
+ } else {
+ immediate = (arguments[1] === true)
+ }
+
+ if (item === __currentItem)
+ return
+
+ if (__recursionGuard(true))
+ return
+
+ var outElement = JSArray.pop()
+ var inElement = JSArray.current()
+
+ if (__depth > 1 && item !== undefined && item !== inElement.item) {
+ // Pop from the top until we find 'item', and return the corresponding
+ // element. Skip all non-loaded items (except the first), since no one
+ // has any references to such items anyway:
+ while (__depth > 1 && !JSArray.current().loaded)
+ JSArray.pop()
+ inElement = JSArray.current()
+ while (__depth > 1 && item !== inElement.item) {
+ JSArray.pop()
+ __cleanup(inElement)
+ while (__depth > 1 && !JSArray.current().loaded)
+ JSArray.pop()
+ inElement = JSArray.current()
+ }
+ }
+
+ var transition = {
+ inElement: inElement,
+ outElement: outElement,
+ immediate: immediate,
+ replace: false,
+ push: false
+ }
+ __performTransition(transition)
+ __recursionGuard(false)
+ return outElement.item;
+ }
+
+ /*! Remove all items from the stack. No animations will be applied. */
+ function clear() {
+ if (__recursionGuard(true))
+ return
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __currentItem = null
+ var count = __depth
+ for (var i=0; i<count; ++i) {
+ var element = JSArray.pop()
+ if (element.item)
+ __cleanup(element);
+ }
+ __recursionGuard(false)
+ }
+
+ /*! Search for a specific item inside the stack. \a func will
+ be called for each item in the stack (with the item as argument)
+ until the function returns true. Return value will be the item found. For
+ example:
+ find(function(item, index) { return item.isTheOne })
+ Set \a onlySearchLoadedItems to \c true to not load items that are
+ not loaded into memory */
+ function find(func, onlySearchLoadedItems) {
+ for (var i=__depth-1; i>=0; --i) {
+ var element = JSArray.stackView[i];
+ if (onlySearchLoadedItems !== true)
+ __loadElement(element)
+ else if (!element.item)
+ continue
+ if (func(element.item))
+ return element.item
+ }
+ return null;
+ }
+
+ /*! Returns the item at position \a index in
+ the stack. If \a dontLoad is true, the
+ item will not be forced to load (and \c null
+ will be returned if not yet loaded) */
+ function get(index, dontLoad)
+ {
+ if (index < 0 || index >= JSArray.stackView.length)
+ return null
+ var element = JSArray.stackView[index]
+ if (dontLoad !== true) {
+ __loadElement(element)
+ return element.item
+ } else if (element.item) {
+ return element.item
+ } else {
+ return null
+ }
+ }
+
+ /*! Immediately completes any ongoing transition.
+ /sa Animation.complete
+ */
+ function completeTransition()
+ {
+ if (__recursionGuard(true))
+ return
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __recursionGuard(false)
+ }
+
+ /********* DEPRECATED API *********/
+
+ /*! \internal
+ \deprecated Use Push() instead */
+ function replace(item, properties, immediate) {
+ push(item, properties, immediate, true)
+ }
+
+ /********* PRIVATE API *********/
+
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+
+ /*! \internal The currently top-most item on the stack. */
+ property Item __currentItem: null
+ /*! \internal The number of items currently pushed onto the stack. */
+ property int __depth: 0
+ /*! \internal Stores the transition info while a transition is ongoing */
+ property var __currentTransition: null
+ /*! \internal Stops the user from pushing items while preparing a transition */
+ property bool __guard: false
+
+ Component.onCompleted: {
+ if (initialItem)
+ push(initialItem)
+ }
+
+ Component.onDestruction: {
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __currentItem = null
+ }
+
+ /*! \internal */
+ function __recursionGuard(use)
+ {
+ if (use && __guard) {
+ console.warn("Warning: StackView: You cannot push/pop recursively!")
+ console.trace()
+ return true
+ }
+ __guard = use
+ }
+
+ /*! \internal */
+ function __loadElement(element)
+ {
+ if (element.loaded) {
+ if (!element.item) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: The item has been deleted outside StackView!"
+ }
+ return
+ }
+ if (!element.itemComponent) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: Invalid item (item was 'null'). "
+ + "This might indicate that the item was deleted outside StackView!"
+ return
+ }
+
+ var comp = __resolveComponent(element.itemComponent, element)
+
+ // Assign properties to item:
+ if (!element.properties)
+ element.properties = {}
+
+ if (comp.hasOwnProperty("createObject")) {
+ if (comp.status === Component.Error) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: Could not load: " + comp.errorString()
+ } else {
+ element.item = comp.createObject(root, element.properties)
+ // Destroy items we create unless the user specified something else:
+ if (!element.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = true
+ }
+ } else {
+ // comp is already an Item, so just re-parent it into the StackView:
+ element.item = comp
+ element.originalParent = parent
+ element.item.parent = root
+ for (var prop in element.properties) {
+ if (element.item.hasOwnProperty(prop))
+ element.item[prop] = element.properties[prop];
+ }
+ // Do not destroy items we didn't create, unless the user specified something else:
+ if (!element.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = false
+ }
+
+ element.item.Stack.__index = element.index
+ element.item.Stack.__view = root
+ // Let item fill all available space by default:
+ element.item.width = Qt.binding(function() { return root.width })
+ element.item.height = Qt.binding(function() { return root.height })
+ element.loaded = true
+ }
+
+ /*! \internal */
+ function __resolveComponent(unknownObjectType, element)
+ {
+ // We need this extra resolve function since we dont really
+ // know what kind of object the user pushed. So we try to
+ // figure it out by inspecting the object:
+ if (unknownObjectType.hasOwnProperty("createObject")) {
+ return unknownObjectType
+ } else if (typeof unknownObjectType == "string") {
+ return Qt.createComponent(unknownObjectType)
+ } else if (unknownObjectType.hasOwnProperty("x")) {
+ return unknownObjectType
+ } else if (unknownObjectType.hasOwnProperty("item")) {
+ // INVARIANT: user pushed a JS-object
+ element.properties = unknownObjectType.properties
+ if (!unknownObjectType.item)
+ unknownObjectType.item = invalidItemReplacement
+ if (unknownObjectType.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = unknownObjectType.destroyOnPop
+ return __resolveComponent(unknownObjectType.item, element)
+ } else {
+ // We cannot determine the type, so assume its a URL:
+ return Qt.createComponent(unknownObjectType)
+ }
+ }
+
+ /*! \internal */
+ function __cleanup(element) {
+ // INVARIANT: element has been removed from JSArray. Destroy its
+ // item, or re-parent it back to the parent it had before it was pushed:
+ var item = element.item
+ if (element.destroyOnPop) {
+ item.destroy()
+ } else {
+ // Mark the item as no longer part of the StackView. It
+ // might reenter on pop if pushed several times:
+ item.visible = false
+ __setStatus(item, Stack.Inactive)
+ item.Stack.__view = null
+ item.Stack.__index = -1
+ if (element.originalParent)
+ item.parent = element.originalParent
+ }
+ }
+
+ /*! \internal */
+ function __setStatus(item, status) {
+ item.Stack.__status = status
+ }
+
+ /*! \internal */
+ function __performTransition(transition)
+ {
+ // Animate item in "outElement" out, and item in "inElement" in. Set a guard to protect
+ // the user from pushing new items on signals that will fire while preparing for the transition
+ // (e.g Stack.onCompleted, Stack.onStatusChanged, Stack.onIndexChanged etc). Otherwise, we will enter
+ // this function several times, which causes the items to be updated half-way.
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __loadElement(transition.inElement)
+
+ transition.name = transition.replace ? "replaceTransition" : (transition.push ? "pushTransition" : "popTransition")
+ var enterItem = transition.inElement.item
+ transition.enterItem = enterItem
+
+ // Since an item can be pushed several times, we need to update its properties:
+ enterItem.parent = root
+ enterItem.Stack.__view = root
+ enterItem.Stack.__index = transition.inElement.index
+ __currentItem = enterItem
+
+ if (!transition.outElement) {
+ // A transition consists of two items, but we got just one. So just show the item:
+ enterItem.visible = true
+ __setStatus(enterItem, Stack.Activating)
+ __setStatus(enterItem, Stack.Active)
+ return
+ }
+
+ var exitItem = transition.outElement.item
+ transition.exitItem = exitItem
+ if (enterItem === exitItem)
+ return
+
+ if (root.delegate) {
+ transition.properties = {
+ "name":transition.name,
+ "enterItem":transition.enterItem,
+ "exitItem":transition.exitItem,
+ "immediate":transition.immediate }
+ var anim = root.delegate.getTransition(transition.properties)
+ if (anim.createObject) {
+ anim = anim.createObject(null, transition.properties)
+ anim.runningChanged.connect(function(){ if (anim.running === false) anim.destroy() })
+ }
+ transition.animation = anim
+ }
+
+ if (!transition.animation) {
+ console.warn("Warning: StackView: no", transition.name, "found!")
+ return
+ }
+ if (enterItem.anchors.fill || exitItem.anchors.fill)
+ console.warn("Warning: StackView: cannot transition an item that is anchored!")
+
+ __currentTransition = transition
+ __setStatus(exitItem, Stack.Deactivating)
+ enterItem.visible = true
+ __setStatus(enterItem, Stack.Activating)
+ transition.animation.runningChanged.connect(animationFinished)
+ transition.animation.start()
+ // NB! For empty animations, "animationFinished" is already
+ // executed at this point, leaving __animation === null:
+ if (transition.immediate === true && transition.animation)
+ transition.animation.complete()
+ }
+
+ /*! \internal */
+ function animationFinished()
+ {
+ if (!__currentTransition || __currentTransition.animation.running)
+ return
+
+ __currentTransition.animation.runningChanged.disconnect(animationFinished)
+ __currentTransition.exitItem.visible = false
+ __setStatus(__currentTransition.exitItem, Stack.Inactive);
+ __setStatus(__currentTransition.enterItem, Stack.Active);
+ __currentTransition.properties.animation = __currentTransition.animation
+ root.delegate.transitionFinished(__currentTransition.properties)
+
+ if (!__currentTransition.push || __currentTransition.replace)
+ __cleanup(__currentTransition.outElement)
+
+ __currentTransition = null
+ }
+
+ /*! \internal */
+ property Component invalidItemReplacement: Component {
+ Text {
+ width: parent.width
+ height: parent.height
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewDelegate.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewDelegate.qml
new file mode 100644
index 0000000000..e77b823527
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewDelegate.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+/*!
+ \qmltype StackViewDelegate
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+
+ \brief A delegate used by StackView for loading transitions.
+
+ See the documentation for the \l {QtQuick.Controls1::StackView} {StackView}
+ component.
+
+*/
+QtObject {
+ id: root
+
+ function getTransition(properties)
+ {
+ return root[properties.name]
+ }
+
+ function transitionFinished(properties)
+ {
+ }
+
+ property Component pushTransition: StackViewTransition {}
+ property Component popTransition: root["pushTransition"]
+ property Component replaceTransition: root["pushTransition"]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewTransition.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewTransition.qml
new file mode 100644
index 0000000000..e58ad3f34e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewTransition.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+ParallelAnimation {
+ id: root
+ /*! The name of the animation that is running. Can be one of the following:
+ \list
+ \li 'PushTransition'
+ \li 'PopTransition'
+ \li 'ReplaceTransition'
+ \endlist
+ */
+ property string name
+ /*! The page that is transitioning in. */
+ property Item enterItem
+ /*! The page that is transitioning out */
+ property Item exitItem
+ /*! Set to \c true if the transition is told to
+ fast-forward directly to its end-state */
+ property bool immediate
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StatusBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StatusBar.qml
new file mode 100644
index 0000000000..cf41a2dc76
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StatusBar.qml
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StatusBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup applicationwindow
+ \brief Contains status information in your app.
+
+ The common way of using StatusBar is in relation to \l ApplicationWindow.
+
+ Note that the StatusBar does not provide a layout of its own, but requires
+ you to position its contents, for instance by creating a \l RowLayout.
+
+ If only a single item is used within the StatusBar, it will resize to fit the implicitHeight
+ of its contained item. This makes it particularly suitable for use together with layouts.
+ Otherwise the height is platform dependent.
+
+ \code
+ import QtQuick.Controls 1.1
+ import QtQuick.Layouts 1.0
+
+ ApplicationWindow {
+ statusBar: StatusBar {
+ RowLayout {
+ Label { text: "Read Only" }
+ }
+ }
+ }
+ \endcode
+*/
+
+Item {
+ id: statusbar
+
+ activeFocusOnTab: false
+ Accessible.role: Accessible.StatusBar
+
+ width: parent ? parent.width : implicitWidth
+ implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
+ implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(),
+ loader.item ? loader.item.implicitHeight : 19)
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/StatusBarStyle.qml", statusbar)
+
+ /*! \internal */
+ property alias __style: styleLoader.item
+
+ /*! \internal */
+ default property alias __content: container.data
+
+ /*!
+ \qmlproperty Item StatusBar::contentItem
+
+ This property holds the content Item of the status bar.
+
+ Items declared as children of a StatusBar are automatically parented to the StatusBar's contentItem.
+ Items created dynamically need to be explicitly parented to the contentItem:
+
+ \note The implicit size of the StatusBar is calculated based on the size of its content. If you want to anchor
+ items inside the status bar, you must specify an explicit width and height on the StatusBar itself.
+ */
+ readonly property alias contentItem: container
+
+ data: [
+ Loader {
+ id: loader
+ anchors.fill: parent
+ sourceComponent: styleLoader.item ? styleLoader.item.panel : null
+ onLoaded: item.z = -1
+ Loader {
+ id: styleLoader
+ property alias __control: statusbar
+ sourceComponent: style
+ }
+ },
+ Item {
+ id: container
+ z: 1
+ focus: true
+ anchors.fill: parent
+
+ anchors.topMargin: topMargin
+ anchors.leftMargin: leftMargin
+ anchors.rightMargin: rightMargin
+ anchors.bottomMargin: bottomMargin
+
+ property int topMargin: __style ? __style.padding.top : 0
+ property int bottomMargin: __style ? __style.padding.bottom : 0
+ property int leftMargin: __style ? __style.padding.left : 0
+ property int rightMargin: __style ? __style.padding.right : 0
+
+ property Item layoutItem: container.children.length === 1 ? container.children[0] : null
+ function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) :
+ loader.item ? loader.item.implicitWidth: 0) }
+ function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) : loader.item ? loader.item.implicitHeight : 0) }
+ }]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml
new file mode 100644
index 0000000000..d53ccb2925
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype BusyIndicatorStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.2
+ \ingroup controlsstyling
+ \brief Provides custom styling for BusyIndicatorStyle
+
+ You can create a busy indicator by replacing the "indicator" delegate
+ of the BusyIndicatorStyle with a custom design.
+
+ Example:
+ \qml
+ BusyIndicator {
+ style: BusyIndicatorStyle
+ indicator: Image {
+ visible: control.running
+ source: "spinner.png"
+ NumberAnimation on rotation {
+ running: control.running
+ loops: Animation.Infinite
+ duration: 2000
+ from: 0 ; to: 360
+ }
+ }
+ }
+ }
+ \endqml
+*/
+Style {
+ id: indicatorstyle
+
+ /*! The \l BusyIndicator attached to this style. */
+ readonly property BusyIndicator control: __control
+
+ /*! This defines the appearance of the busy indicator. */
+ property Component indicator: Item {
+ implicitWidth: 48
+ implicitHeight: 48
+
+ opacity: control.running ? 1 : 0
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
+
+ Image {
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ width: Math.min(parent.width, parent.height)
+ height: width
+ source: width <= 32 ? "images/spinner_small.png" :
+ width >= 48 ? "images/spinner_large.png" :
+ "images/spinner_medium.png"
+ RotationAnimator on rotation {
+ duration: 800
+ loops: Animation.Infinite
+ from: 0
+ to: 360
+ }
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ anchors.fill: parent
+ implicitWidth: indicatorLoader.implicitWidth
+ implicitHeight: indicatorLoader.implicitHeight
+
+ Loader {
+ id: indicatorLoader
+ sourceComponent: indicator
+ anchors.centerIn: parent
+ width: Math.min(parent.width, parent.height)
+ height: width
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ButtonStyle.qml
new file mode 100644
index 0000000000..ad14095c59
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ButtonStyle.qml
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ButtonStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for Button
+
+ You can create a custom button by replacing the "background" delegate
+ of the ButtonStyle with a custom design.
+
+ Example:
+ \qml
+ Button {
+ text: "A button"
+ style: ButtonStyle {
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 25
+ border.width: control.activeFocus ? 2 : 1
+ border.color: "#888"
+ radius: 4
+ gradient: Gradient {
+ GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
+ GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
+ }
+ }
+ }
+ }
+ \endqml
+ If you need a custom label, you can replace the label item.
+*/
+
+Style {
+ id: buttonstyle
+
+ /*! The \l Button attached to this style. */
+ readonly property Button control: __control
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ /*! The padding between the background and the label components. */
+ padding {
+ top: 4
+ left: 4
+ right: control.menu !== null ? Math.round(TextSingleton.implicitHeight * 0.5) : 4
+ bottom: 4
+ }
+
+ /*! This defines the background of the button. */
+ property Component background: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: control.pressed ? 0 : -1
+ color: "#10000000"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: control.pressed ? "#aaa" : "#fefefe" ; position: 0}
+ GradientStop {color: control.pressed ? "#ccc" : "#e3e3e3" ; position: control.pressed ? 0.1: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ Rectangle {
+ anchors.fill: parent
+ radius: parent.radius
+ color: control.activeFocus ? "#47b" : "white"
+ opacity: control.hovered || control.activeFocus ? 0.1 : 0
+ Behavior on opacity {NumberAnimation{ duration: 100 }}
+ }
+ }
+ Image {
+ id: imageItem
+ visible: control.menu !== null
+ source: "images/arrow-down.png"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: padding.right
+ opacity: control.enabled ? 0.6 : 0.5
+ }
+ }
+
+ /*! This defines the label of the button. */
+ property Component label: Item {
+ implicitWidth: row.implicitWidth
+ implicitHeight: row.implicitHeight
+ Row {
+ id: row
+ anchors.centerIn: parent
+ spacing: 2
+ Image {
+ source: control.iconSource
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Text {
+ renderType: Text.NativeRendering
+ anchors.verticalCenter: parent.verticalCenter
+ text: control.text
+ color: __syspal.text
+ }
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ anchors.fill: parent
+ implicitWidth: Math.max(labelLoader.implicitWidth + padding.left + padding.right, backgroundLoader.implicitWidth)
+ implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight)
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ }
+
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ anchors.fill: parent
+ anchors.leftMargin: padding.left
+ anchors.topMargin: padding.top
+ anchors.rightMargin: padding.right
+ anchors.bottomMargin: padding.bottom
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml
new file mode 100644
index 0000000000..8fb58207cb
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml
@@ -0,0 +1,196 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Window 2.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype CheckBoxStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for CheckBox
+
+ Example:
+ \qml
+ CheckBox {
+ text: "Check Box"
+ style: CheckBoxStyle {
+ indicator: Rectangle {
+ implicitWidth: 16
+ implicitHeight: 16
+ radius: 3
+ border.color: control.activeFocus ? "darkblue" : "gray"
+ border.width: 1
+ Rectangle {
+ visible: control.checked
+ color: "#555"
+ border.color: "#333"
+ radius: 1
+ anchors.margins: 4
+ anchors.fill: parent
+ }
+ }
+ }
+ }
+ \endqml
+*/
+Style {
+ id: checkboxStyle
+
+ /*! The \l CheckBox attached to this style. */
+ readonly property CheckBox control: __control
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ /*! This defines the text label. */
+ property Component label: Item {
+ implicitWidth: text.implicitWidth + 2
+ implicitHeight: text.implicitHeight
+ Rectangle {
+ anchors.fill: text
+ anchors.margins: -1
+ anchors.leftMargin: -3
+ anchors.rightMargin: -3
+ visible: control.activeFocus
+ height: 6
+ radius: 3
+ color: "#224f9fef"
+ border.color: "#47b"
+ opacity: 0.6
+ }
+ Text {
+ id: text
+ text: control.text
+ anchors.centerIn: parent
+ color: __syspal.text
+ renderType: Text.NativeRendering
+ }
+ }
+ /*! The background under indicator and label. */
+ property Component background
+
+ /*! The spacing between indicator and label. */
+ property int spacing: Math.round(TextSingleton.implicitHeight/4)
+
+ /*! This defines the indicator button. */
+ property Component indicator: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight)
+ height: width
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: "#eee" ; position: 0}
+ GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ }
+
+ Image {
+ source: "images/check.png"
+ opacity: control.checkedState === Qt.Checked ? control.enabled ? 1 : 0.5 : 0
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 1
+ Behavior on opacity {NumberAnimation {duration: 80}}
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: Math.round(baserect.radius)
+ antialiasing: true
+ gradient: Gradient {
+ GradientStop {color: control.pressed ? "#555" : "#999" ; position: 0}
+ GradientStop {color: "#555" ; position: 1}
+ }
+ radius: baserect.radius - 1
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ border.color: "#222"
+ Behavior on opacity {NumberAnimation {duration: 80}}
+ opacity: control.checkedState === Qt.PartiallyChecked ? control.enabled ? 1 : 0.5 : 0
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ implicitWidth: Math.max(backgroundLoader.implicitWidth, row.implicitWidth + padding.left + padding.right)
+ implicitHeight: Math.max(backgroundLoader.implicitHeight, labelLoader.implicitHeight + padding.top + padding.bottom,indicatorLoader.implicitHeight + padding.top + padding.bottom)
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: background
+ anchors.fill: parent
+ }
+ Row {
+ id: row
+ anchors.fill: parent
+
+ anchors.leftMargin: padding.left
+ anchors.rightMargin: padding.right
+ anchors.topMargin: padding.top
+ anchors.bottomMargin: padding.bottom
+
+ spacing: checkboxStyle.spacing
+ Loader {
+ id: indicatorLoader
+ sourceComponent: indicator
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml
new file mode 100644
index 0000000000..2b4b237d20
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ComboBoxStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for ComboBox
+*/
+
+Style {
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l ComboBox attached to this style. */
+ readonly property ComboBox control: __control
+
+ /*! The padding between the background and the label components. */
+ padding { top: 4 ; left: 6 ; right: 6 ; bottom:4 }
+
+ /*! The size of the drop down button when the combobox is editable. */
+ property int drowDownButtonWidth: Math.round(TextSingleton.implicitHeight)
+
+ /*! This defines the background of the button. */
+ property Component background: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: control.pressed ? 0 : -1
+ color: "#10000000"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: control.pressed ? "#bababa" : "#fefefe" ; position: 0}
+ GradientStop {color: control.pressed ? "#ccc" : "#e3e3e3" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ Rectangle {
+ anchors.fill: parent
+ radius: parent.radius
+ color: control.activeFocus ? "#47b" : "white"
+ opacity: control.hovered || control.activeFocus ? 0.1 : 0
+ Behavior on opacity {NumberAnimation{ duration: 100 }}
+ }
+ }
+ Image {
+ id: imageItem
+ visible: control.menu !== null
+ source: "images/arrow-down.png"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: drowDownButtonWidth / 2
+ opacity: control.enabled ? 0.6 : 0.3
+ }
+ }
+
+ /*! \internal */
+ property Component __editor: Item {
+ implicitWidth: 100
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ clip: true
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: 0
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ anchors.rightMargin: -radius
+ anchors.bottomMargin: 1
+ gradient: Gradient {
+ GradientStop {color: "#e0e0e0" ; position: 0}
+ GradientStop {color: "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ }
+ Rectangle {
+ color: "#aaa"
+ anchors.bottomMargin: 2
+ anchors.topMargin: 1
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ width: 1
+ }
+ }
+
+ /*! This defines the label of the button. */
+ property Component label: Item {
+ implicitWidth: textitem.implicitWidth + 20
+ Text {
+ id: textitem
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: 4
+ anchors.rightMargin: 10
+ anchors.verticalCenter: parent.verticalCenter
+ text: control.currentText
+ renderType: Text.NativeRendering
+ color: __syspal.text
+ elide: Text.ElideRight
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ property bool popup: false
+ anchors.centerIn: parent
+ anchors.fill: parent
+ implicitWidth: backgroundLoader.implicitWidth
+ implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight)
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+
+ }
+
+ Loader {
+ id: editorLoader
+ anchors.fill: parent
+ anchors.rightMargin: drowDownButtonWidth + padding.right
+ anchors.bottomMargin: -1
+ sourceComponent: control.editable ? __editor : null
+ }
+
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ visible: !control.editable
+ anchors.fill: parent
+ anchors.leftMargin: padding.left
+ anchors.topMargin: padding.top
+ anchors.rightMargin: padding.right
+ anchors.bottomMargin: padding.bottom
+ }
+ }
+
+ /*! \internal */
+ property Component __dropDownStyle: MenuStyle {
+ maxPopupHeight: 600
+ __menuItemType: "comboboxitem"
+ scrollerStyle: ScrollViewStyle {
+ property bool useScrollers: false
+ }
+ }
+
+ /*! \internal */
+ property Component __popupStyle: Style {
+
+ property Component frame: Rectangle {
+ width: (parent ? parent.contentWidth : 0)
+ height: (parent ? parent.contentHeight : 0) + 2
+ border.color: "white"
+ property real maxHeight: 500
+ property int margin: 1
+ }
+
+ property Component menuItem: Text {
+ text: "NOT IMPLEMENTED"
+ color: "red"
+ font {
+ pixelSize: 14
+ bold: true
+ }
+ }
+
+ property Component scrollerStyle: Style {
+ padding { left: 0; right: 0; top: 0; bottom: 0 }
+ property bool scrollToClickedPosition: false
+ property Component frame: Item { visible: false }
+ property Component corner: Item { visible: false }
+ property Component __scrollbar: Item { visible: false }
+ property bool useScrollers: true
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml
new file mode 100644
index 0000000000..27edf11c5c
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype FocusFrameStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+Item {
+ property int margin: -3
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml
new file mode 100644
index 0000000000..c0c08d5623
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype GroupBoxStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+ \ingroup controlsstyling
+ \since 5.1
+*/
+Style {
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l GroupBox attached to this style. */
+ readonly property GroupBox control: __control
+
+ /*! The margin from the content item to the groupbox. */
+ padding {
+ top: (control.title.length > 0 || control.checkable ? TextSingleton.implicitHeight : 0) + 10
+ left: 8
+ right: 8
+ bottom: 6
+ }
+
+ /*! The title text color. */
+ property color textColor: __syspal.text
+
+ /*! The check box. */
+ property Component checkbox: Item {
+ implicitWidth: 18
+ implicitHeight: 18
+ BorderImage {
+ anchors.fill: parent
+ source: "images/editbox.png"
+ border.top: 6
+ border.bottom: 6
+ border.left: 6
+ border.right: 6
+ }
+ Rectangle {
+ height: 16
+ width: 16
+ antialiasing: true
+ visible: control.checked
+ color: "#666"
+ radius: 1
+ anchors.margins: 4
+ anchors.fill: parent
+ anchors.topMargin: 3
+ anchors.bottomMargin: 5
+ border.color: "#222"
+ opacity: control.enabled ? 1 : 0.5
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ border.color: "#33ffffff"
+ }
+ }
+ BorderImage {
+ anchors.fill: parent
+ anchors.margins: -1
+ source: "images/focusframe.png"
+ visible: control.activeFocus
+ border.left: 4
+ border.right: 4
+ border.top: 4
+ border.bottom: 4
+ }
+ }
+
+ /*! The groupbox frame. */
+ property Component panel: Item {
+ anchors.fill: parent
+ Loader {
+ id: checkboxloader
+ anchors.left: parent.left
+ sourceComponent: control.checkable ? checkbox : null
+ anchors.verticalCenter: label.verticalCenter
+ width: item ? item.implicitWidth : 0
+ }
+
+ Text {
+ id: label
+ anchors.top: parent.top
+ anchors.left: checkboxloader.right
+ anchors.margins: 4
+ text: control.title
+ color: textColor
+ renderType: Text.NativeRendering
+ }
+
+ BorderImage {
+ anchors.fill: parent
+ anchors.topMargin: padding.top - 7
+ source: "images/groupbox.png"
+ border.left: 4
+ border.right: 4
+ border.top: 4
+ border.bottom: 4
+ visible: !control.flat
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml
new file mode 100644
index 0000000000..3a3b552dd6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype MenuBarStyle
+ \internal
+ \ingroup applicationwindowstyling
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+
+Style {
+ readonly property color __backgroundColor: "#dcdcdc"
+
+ property Component frame: Rectangle {
+ width: control.__contentItem.width
+ height: contentHeight
+ color: __backgroundColor
+ }
+
+ property Component menuItem: Rectangle {
+ width: text.width + 12
+ height: text.height + 4
+ color: sunken ? "#49d" :__backgroundColor
+
+ SystemPalette { id: syspal }
+
+ Text {
+ id: text
+ text: StyleHelpers.stylizeMnemonics(menuItem.title)
+ anchors.centerIn: parent
+ renderType: Text.NativeRendering
+ color: sunken ? "white" : syspal.windowText
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuStyle.qml
new file mode 100644
index 0000000000..c05c6a6d10
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuStyle.qml
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype MenuStyle
+ \internal
+ \ingroup menusstyling
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+
+Style {
+ id: styleRoot
+
+ property string __menuItemType: "menuitem"
+ property real maxPopupHeight: 600 // ### FIXME Screen.desktopAvailableHeight * 0.99
+
+ property Component frame: Rectangle {
+ width: (parent ? parent.contentWidth : 0) + 2
+ height: (parent ? parent.contentHeight : 0) + 2
+
+ color: "lightgray"
+ border { width: 1; color: "darkgray" }
+
+ property int subMenuOverlap: -1
+ property real maxHeight: maxPopupHeight
+ property int margin: 1
+ }
+
+ property Component menuItem: Rectangle {
+ x: 1
+ y: 1
+ implicitWidth: Math.max((parent ? parent.width : 0),
+ 18 + text.paintedWidth + (rightDecoration.visible ? rightDecoration.width + 40 : 12))
+ implicitHeight: isSeparator ? text.font.pixelSize / 2 : !!scrollerDirection ? text.font.pixelSize * 0.75 : text.paintedHeight + 4
+ color: selected && enabled ? "" : backgroundColor
+ gradient: selected && enabled ? selectedGradient : undefined
+ border.width: 1
+ border.color: selected && enabled ? Qt.darker(selectedColor, 1) : color
+ readonly property int leftMargin: __menuItemType === "menuitem" ? 18 : 0
+
+ readonly property color backgroundColor: "#dcdcdc"
+ readonly property color selectedColor: "#49d"
+ Gradient {
+ id: selectedGradient
+ GradientStop {color: Qt.lighter(selectedColor, 1.3) ; position: -0.2}
+ GradientStop {color: selectedColor; position: 1.4}
+ }
+ antialiasing: true
+
+ SystemPalette {
+ id: syspal
+ colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ readonly property string itemText: parent ? parent.text : ""
+ readonly property bool mirrored: Qt.application.layoutDirection === Qt.RightToLeft
+
+ Loader {
+ id: checkMark
+ x: mirrored ? parent.width - width - 4 : 4
+ y: 6
+ active: __menuItemType === "menuitem" && !!menuItem && !!menuItem["checkable"]
+ sourceComponent: exclusive ? exclusiveCheckMark : nonExclusiveCheckMark
+
+ readonly property bool checked: !!menuItem && !!menuItem.checked
+ readonly property bool exclusive: !!menuItem && !!menuItem["exclusiveGroup"]
+
+ Component {
+ id: nonExclusiveCheckMark
+ BorderImage {
+ width: 12
+ height: 12
+ source: "images/editbox.png"
+ border.top: 6
+ border.bottom: 6
+ border.left: 6
+ border.right: 6
+
+ Rectangle {
+ antialiasing: true
+ visible: checkMark.checked
+ color: "#666"
+ radius: 1
+ anchors.margins: 4
+ anchors.fill: parent
+ anchors.topMargin: 3
+ anchors.bottomMargin: 5
+ border.color: "#222"
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ border.color: "#33ffffff"
+ }
+ }
+ }
+ }
+
+ Component {
+ id: exclusiveCheckMark
+ Rectangle {
+ x: 1
+ width: 10
+ height: 10
+ color: "white"
+ border.color: "gray"
+ antialiasing: true
+ radius: height/2
+
+ Rectangle {
+ anchors.centerIn: parent
+ visible: checkMark.checked
+ width: 4
+ height: 4
+ color: "#666"
+ border.color: "#222"
+ antialiasing: true
+ radius: height/2
+ }
+ }
+ }
+ }
+
+ Text {
+ id: text
+ visible: !isSeparator
+ text: StyleHelpers.stylizeMnemonics(itemText)
+ readonly property real offset: __menuItemType === "menuitem" ? 24 : 6
+ x: mirrored ? parent.width - width - offset : offset
+ anchors.verticalCenter: parent.verticalCenter
+ renderType: Text.NativeRendering
+ color: selected && enabled ? "white" : syspal.text
+ }
+
+ Text {
+ id: rightDecoration
+ readonly property string shortcut: !!menuItem && menuItem["shortcut"] || ""
+ visible: isSubmenu || shortcut !== ""
+ text: isSubmenu ? mirrored ? "\u25c2" : "\u25b8" // BLACK LEFT/RIGHT-POINTING SMALL TRIANGLE
+ : shortcut
+ LayoutMirroring.enabled: mirrored
+ anchors {
+ right: parent.right
+ rightMargin: 6
+ baseline: isSubmenu ? undefined : text.baseline
+ }
+ font.pixelSize: isSubmenu ? text.font.pixelSize : text.font.pixelSize * 0.9
+ color: text.color
+ renderType: Text.NativeRendering
+ style: selected || !isSubmenu ? Text.Normal : Text.Raised; styleColor: Qt.lighter(color, 4)
+ }
+
+ Image {
+ id: scrollerDecoration
+ visible: !!scrollerDirection
+ anchors.centerIn: parent
+ source: scrollerDirection === "up" ? "images/arrow-up.png" : "images/arrow-down.png"
+ }
+
+ Rectangle {
+ visible: isSeparator
+ width: parent.width - 2
+ height: 1
+ x: 1
+ anchors.verticalCenter: parent.verticalCenter
+ color: "darkgray"
+ }
+ }
+
+ property Component scrollerStyle: Style {
+ padding { left: 0; right: 0; top: 0; bottom: 0 }
+ property bool scrollToClickedPosition: false
+ property Component frame: Item { visible: false }
+ property Component corner: Item { visible: false }
+ property Component __scrollbar: Item { visible: false }
+ property bool useScrollers: true
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml
new file mode 100644
index 0000000000..d8ff8140eb
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ProgressBarStyle
+
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for ProgressBar
+
+ Example:
+ \qml
+ ProgressBar {
+ value: slider.value
+ style: ProgressBarStyle {
+ background: Rectangle {
+ radius: 2
+ color: "lightgray"
+ border.color: "gray"
+ border.width: 1
+ implicitWidth: 200
+ implicitHeight: 24
+ }
+ progress: Rectangle {
+ color: "lightsteelblue"
+ border.color: "steelblue"
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+ id: progressBarStyle
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l ProgressBar attached to this style. */
+ readonly property ProgressBar control: __control
+
+ /*! A value in the range [0-1] indicating the current progress. */
+ readonly property real currentProgress: control.indeterminate ? 1.0 :
+ control.value / control.maximumValue
+
+ /*! This property holds the visible contents of the progress bar
+ You can access the Slider through the \c control property.
+
+ For convenience, you can also access the readonly property \c styleData.progress
+ which provides the current progress as a \c real in the range [0-1]
+ */
+ padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 }
+
+ /*! \qmlproperty Component ProgressBarStyle::progress
+ The progress component for this style.
+ */
+ property Component progress: Item {
+ property color progressColor: "#49d"
+ anchors.fill: parent
+ clip: true
+ Rectangle {
+ id: base
+ width: control.width
+ height: control.height
+ radius: TextSingleton.implicitHeight * 0.16
+ antialiasing: true
+ gradient: Gradient {
+ GradientStop {color: Qt.lighter(progressColor, 1.3) ; position: 0}
+ GradientStop {color: progressColor ; position: 1.4}
+ }
+ border.width: 1
+ border.color: Qt.darker(progressColor, 1.2)
+ Rectangle {
+ color: "transparent"
+ radius: 1.5
+ clip: true
+ antialiasing: true
+ anchors.fill: parent
+ anchors.margins: 1
+ border.color: Qt.rgba(1,1,1,0.1)
+ Image {
+ visible: control.indeterminate
+ height: parent.height
+ NumberAnimation on x {
+ from: -39
+ to: 0
+ running: control.indeterminate
+ duration: 800
+ loops: Animation.Infinite
+ }
+ fillMode: Image.Tile
+ width: parent.width + 25
+ source: "images/progress-indeterminate.png"
+ }
+ }
+ }
+ Rectangle {
+ height: parent.height - 2
+ width: 1
+ y: 1
+ anchors.right: parent.right
+ anchors.rightMargin: 1
+ color: Qt.rgba(1,1,1,0.1)
+ visible: splitter.visible
+ }
+ Rectangle {
+ id: splitter
+ height: parent.height - 2
+ width: 1
+ y: 1
+ anchors.right: parent.right
+ color: Qt.darker(progressColor, 1.2)
+ property int offset: currentProgress * control.width
+ visible: offset > base.radius && offset < control.width - base.radius + 1
+ }
+ }
+
+ /*! \qmlproperty Component ProgressBarStyle::background
+ The background component for this style.
+
+ \note The implicitWidth and implicitHeight of the background component
+ must be set.
+ */
+ property Component background: Item {
+ implicitWidth: 200
+ implicitHeight: Math.max(17, Math.round(TextSingleton.implicitHeight * 0.7))
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: control.pressed ? 0 : -1
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: "#eee" ; position: 0}
+ GradientStop {color: "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ Rectangle {
+ anchors.fill: parent
+ radius: parent.radius
+ color: control.activeFocus ? "#47b" : "white"
+ opacity: control.hovered || control.activeFocus ? 0.1 : 0
+ Behavior on opacity {NumberAnimation{ duration: 100 }}
+ }
+ }
+ }
+
+ /*! \qmlproperty Component ProgressBarStyle::panel
+ The panel component for this style.
+ */
+ property Component panel: Item{
+ property bool horizontal: control.orientation == Qt.Horizontal
+ implicitWidth: horizontal ? backgroundLoader.implicitWidth : backgroundLoader.implicitHeight
+ implicitHeight: horizontal ? backgroundLoader.implicitHeight : backgroundLoader.implicitWidth
+
+ Item {
+ width: horizontal ? parent.width : parent.height
+ height: !horizontal ? parent.width : parent.height
+ y: horizontal ? 0 : width
+ rotation: horizontal ? 0 : -90
+ transformOrigin: Item.TopLeft
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ }
+
+ Loader {
+ sourceComponent: progressBarStyle.progress
+ anchors.topMargin: padding.top
+ anchors.leftMargin: padding.left
+ anchors.rightMargin: padding.right
+ anchors.bottomMargin: padding.bottom
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ width: currentProgress * (parent.width - padding.left - padding.right)
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml
new file mode 100644
index 0000000000..78f423ace4
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype RadioButtonStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for RadioButton
+
+ Example:
+ \qml
+ RadioButton {
+ text: "Radio Button"
+ style: RadioButtonStyle {
+ indicator: Rectangle {
+ implicitWidth: 16
+ implicitHeight: 16
+ radius: 9
+ border.color: control.activeFocus ? "darkblue" : "gray"
+ border.width: 1
+ Rectangle {
+ anchors.fill: parent
+ visible: control.checked
+ color: "#555"
+ radius: 9
+ anchors.margins: 4
+ }
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+ id: radiobuttonStyle
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l RadioButton attached to this style. */
+ readonly property RadioButton control: __control
+
+ /*! This defines the text label. */
+ property Component label: Item {
+ implicitWidth: text.implicitWidth + 2
+ implicitHeight: text.implicitHeight
+ Rectangle {
+ anchors.fill: text
+ anchors.margins: -1
+ anchors.leftMargin: -3
+ anchors.rightMargin: -3
+ visible: control.activeFocus
+ height: 6
+ radius: 3
+ color: "#224f9fef"
+ border.color: "#47b"
+ opacity: 0.6
+ }
+ Text {
+ id: text
+ text: control.text
+ anchors.centerIn: parent
+ color: __syspal.text
+ renderType: Text.NativeRendering
+ }
+ }
+
+ /*! The background under indicator and label. */
+ property Component background
+
+ /*! The spacing between indicator and label. */
+ property int spacing: Math.round(TextSingleton.implicitHeight/4)
+
+ /*! This defines the indicator button. */
+ property Component indicator: Rectangle {
+ width: Math.round(TextSingleton.implicitHeight)
+ height: width
+ gradient: Gradient {
+ GradientStop {color: "#eee" ; position: 0}
+ GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.4}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ border.color: control.activeFocus ? "#16c" : "gray"
+ antialiasing: true
+ radius: height/2
+ Rectangle {
+ anchors.centerIn: parent
+ width: Math.round(parent.width * 0.5)
+ height: width
+ gradient: Gradient {
+ GradientStop {color: "#999" ; position: 0}
+ GradientStop {color: "#555" ; position: 1}
+ }
+ border.color: "#222"
+ antialiasing: true
+ radius: height/2
+ Behavior on opacity {NumberAnimation {duration: 80}}
+ opacity: control.checked ? control.enabled ? 1 : 0.5 : 0
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ implicitWidth: Math.max(backgroundLoader.implicitWidth, row.implicitWidth + padding.left + padding.right)
+ implicitHeight: Math.max(backgroundLoader.implicitHeight, labelLoader.implicitHeight + padding.top + padding.bottom,indicatorLoader.implicitHeight + padding.top + padding.bottom)
+
+ Loader {
+ id:backgroundLoader
+ sourceComponent: background
+ anchors.fill: parent
+ }
+ Row {
+ id: row
+ anchors.fill: parent
+
+ anchors.leftMargin: padding.left
+ anchors.rightMargin: padding.right
+ anchors.topMargin: padding.top
+ anchors.bottomMargin: padding.bottom
+
+ spacing: radiobuttonStyle.spacing
+ Loader {
+ id: indicatorLoader
+ sourceComponent: indicator
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml
new file mode 100644
index 0000000000..a7dbcc520e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml
@@ -0,0 +1,398 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ScrollViewStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup viewsstyling
+ \brief Provides custom styling for ScrollView
+*/
+Style {
+ id: root
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l ScrollView attached to this style. */
+ readonly property ScrollView control: __control
+
+ /*! This property controls the frame border padding of the scrollView. */
+ padding {left: 1; top: 1; right: 1; bottom: 1}
+
+ /*! This Component paints the corner area between scroll bars */
+ property Component corner: Rectangle { color: "#ccc" }
+
+ /*! This component determines if the flickable should reposition itself at the
+ mouse location when clicked. */
+ property bool scrollToClickedPosition: true
+
+ /*! This property holds whether the scroll bars are transient. Transient scroll bars
+ appear when the content is scrolled and disappear when they are no longer needed.
+
+ The default value is platform dependent. */
+ property bool transientScrollBars: Settings.hasTouchScreen
+
+ /*! This Component paints the frame around scroll bars. */
+ property Component frame: Rectangle {
+ color: control["backgroundVisible"] ? "white": "transparent"
+ border.color: "#999"
+ border.width: 1
+ radius: 1
+ visible: control.frameVisible
+ }
+
+ /*! This is the minimum extent of the scroll bar handle.
+
+ The default value is \c 30.
+ */
+
+ property int minimumHandleLength: 30
+
+ /*! This property controls the edge overlap
+ between the handle and the increment/decrement buttons.
+
+ The default value is \c 30.
+ */
+
+ property int handleOverlap: 1
+
+ /*! This component controls the appearance of the
+ scroll bar background.
+
+ You can access the following state properties:
+
+ \table
+ \row \li property bool \b styleData.hovered
+ \row \li property bool \b styleData.horizontal
+ \endtable
+ */
+
+ property Component scrollBarBackground: Item {
+ property bool sticky: false
+ property bool hovered: styleData.hovered
+ implicitWidth: Math.round(TextSingleton.implicitHeight)
+ implicitHeight: Math.round(TextSingleton.implicitHeight)
+ clip: true
+ opacity: transientScrollBars ? 0.5 : 1.0
+ visible: !transientScrollBars || sticky
+ Rectangle {
+ anchors.fill: parent
+ color: "#ddd"
+ border.color: "#aaa"
+ anchors.rightMargin: styleData.horizontal ? -2 : -1
+ anchors.leftMargin: styleData.horizontal ? -2 : 0
+ anchors.topMargin: styleData.horizontal ? 0 : -2
+ anchors.bottomMargin: styleData.horizontal ? -1 : -2
+ }
+ onHoveredChanged: if (hovered) sticky = true
+ onVisibleChanged: if (!visible) sticky = false
+ }
+
+ /*! This component controls the appearance of the
+ scroll bar handle.
+
+ You can access the following state properties:
+
+ \table
+ \row \li property bool \b styleData.hovered
+ \row \li property bool \b styleData.pressed
+ \row \li property bool \b styleData.horizontal
+ \endtable
+ */
+
+ property Component handle: Item {
+ property bool sticky: false
+ property bool hovered: __activeControl !== "none"
+ implicitWidth: Math.round(TextSingleton.implicitHeight) + 1
+ implicitHeight: Math.round(TextSingleton.implicitHeight) + 1
+ BorderImage {
+ id: img
+ opacity: styleData.pressed && !transientScrollBars ? 0.5 : styleData.hovered ? 1 : 0.8
+ source: "images/scrollbar-handle-" + (transientScrollBars ? "transient" : styleData.horizontal ? "horizontal" : "vertical") + ".png"
+ border.left: transientScrollBars ? 5 : 2
+ border.top: transientScrollBars ? 5 : 2
+ border.right: transientScrollBars ? 5 : 2
+ border.bottom: transientScrollBars ? 5 : 2
+ anchors.top: !styleData.horizontal ? parent.top : undefined
+ anchors.margins: transientScrollBars ? 2 : 0
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.left: styleData.horizontal ? parent.left : undefined
+ width: !styleData.horizontal && transientScrollBars ? sticky ? 13 : 10 : parent.width
+ height: styleData.horizontal && transientScrollBars ? sticky ? 13 : 10 : parent.height
+ Behavior on width { enabled: !styleData.horizontal && transientScrollBars; NumberAnimation { duration: 100 } }
+ Behavior on height { enabled: styleData.horizontal && transientScrollBars; NumberAnimation { duration: 100 } }
+ }
+ onHoveredChanged: if (hovered) sticky = true
+ onVisibleChanged: if (!visible) sticky = false
+ }
+
+ /*! This component controls the appearance of the
+ scroll bar increment button.
+
+ You can access the following state properties:
+
+ \table
+ \row \li property bool \b styleData.hovered
+ \row \li property bool \b styleData.pressed
+ \row \li property bool \b styleData.horizontal
+ \endtable
+ */
+ property Component incrementControl: Rectangle {
+ visible: !transientScrollBars
+ implicitWidth: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight)
+ implicitHeight: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight)
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ anchors.rightMargin: -1
+ border.color: "#aaa"
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ border.color: "#44ffffff"
+ }
+ Image {
+ source: styleData.horizontal ? "images/arrow-right.png" : "images/arrow-down.png"
+ anchors.centerIn: parent
+ opacity: control.enabled ? 0.6 : 0.5
+ }
+ gradient: Gradient {
+ GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0}
+ GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1}
+ }
+ }
+ }
+
+ /*! This component controls the appearance of the
+ scroll bar decrement button.
+
+ You can access the following state properties:
+
+ \table
+ \row \li property bool \b styleData.hovered
+ \row \li property bool \b styleData.pressed
+ \row \li property bool \b styleData.horizontal
+ \endtable
+ */
+ property Component decrementControl: Rectangle {
+ visible: !transientScrollBars
+ implicitWidth: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight)
+ implicitHeight: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight)
+ Rectangle {
+ anchors.fill: parent
+ anchors.topMargin: styleData.horizontal ? 0 : -1
+ anchors.leftMargin: styleData.horizontal ? -1 : 0
+ anchors.bottomMargin: styleData.horizontal ? -1 : 0
+ anchors.rightMargin: styleData.horizontal ? 0 : -1
+ color: "lightgray"
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ border.color: "#44ffffff"
+ }
+ Image {
+ source: styleData.horizontal ? "images/arrow-left.png" : "images/arrow-up.png"
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: styleData.horizontal ? 0 : -1
+ anchors.horizontalCenterOffset: styleData.horizontal ? -1 : 0
+ opacity: control.enabled ? 0.6 : 0.5
+ }
+ gradient: Gradient {
+ GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0}
+ GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1}
+ }
+ border.color: "#aaa"
+ }
+ }
+
+ /*! \internal */
+ property Component __scrollbar: Item {
+ id: panel
+ property string activeControl: "none"
+ property bool scrollToClickPosition: true
+ property bool isTransient: transientScrollBars
+
+ property bool on: false
+ property bool raised: false
+ property bool sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed
+
+ states: State {
+ name: "out"
+ when: isTransient && panel.activeControl === "none" && !panel.on && !panel.raised
+ PropertyChanges { target: panel; opacity: 0 }
+ }
+
+ transitions: Transition {
+ to: "out"
+ SequentialAnimation {
+ PauseAnimation { duration: 450 }
+ NumberAnimation { properties: "opacity"; duration: 200 }
+ PropertyAction { target: panel; property: "visible"; value: false }
+ }
+ }
+
+ implicitWidth: __styleData.horizontal ? 200 : bg.implicitWidth
+ implicitHeight: __styleData.horizontal ? bg.implicitHeight : 200
+
+ function pixelMetric(arg) {
+ if (arg === "scrollbarExtent")
+ return (__styleData.horizontal ? bg.height : bg.width);
+ return 0;
+ }
+
+ function styleHint(arg) {
+ return false;
+ }
+
+ function hitTest(argX, argY) {
+ if (itemIsHit(handleControl, argX, argY))
+ return "handle"
+ else if (itemIsHit(incrementLoader, argX, argY))
+ return "up";
+ else if (itemIsHit(decrementLoader, argX, argY))
+ return "down";
+ else if (itemIsHit(bg, argX, argY)) {
+ if (__styleData.horizontal && argX < handleControl.x || !__styleData.horizontal && argY < handleControl.y)
+ return "upPage"
+ else
+ return "downPage"
+ }
+
+ return "none";
+ }
+
+ function subControlRect(arg) {
+ if (arg === "handle") {
+ return Qt.rect(handleControl.x, handleControl.y, handleControl.width, handleControl.height);
+ } else if (arg === "groove") {
+ if (__styleData.horizontal) {
+ return Qt.rect(incrementLoader.width - handleOverlap,
+ 0,
+ __control.width - (incrementLoader.width + decrementLoader.width - handleOverlap * 2),
+ __control.height);
+ } else {
+ return Qt.rect(0,
+ incrementLoader.height - handleOverlap,
+ __control.width,
+ __control.height - (incrementLoader.height + decrementLoader.height - handleOverlap * 2));
+ }
+ }
+ return Qt.rect(0,0,0,0);
+ }
+
+ function itemIsHit(argItem, argX, argY) {
+ var pos = argItem.mapFromItem(__control, argX, argY);
+ return (pos.x >= 0 && pos.x <= argItem.width && pos.y >= 0 && pos.y <= argItem.height);
+ }
+
+ Loader {
+ id: incrementLoader
+ anchors.top: parent.top
+ anchors.left: parent.left
+ sourceComponent: decrementControl
+ property QtObject styleData: QtObject {
+ readonly property bool hovered: activeControl === "up"
+ readonly property bool pressed: __styleData.upPressed
+ readonly property bool horizontal: __styleData.horizontal
+ }
+ }
+
+ Loader {
+ id: bg
+ anchors.top: __styleData.horizontal ? undefined : incrementLoader.bottom
+ anchors.bottom: __styleData.horizontal ? undefined : decrementLoader.top
+ anchors.left: __styleData.horizontal ? incrementLoader.right : undefined
+ anchors.right: __styleData.horizontal ? decrementLoader.left : undefined
+ sourceComponent: scrollBarBackground
+ property QtObject styleData: QtObject {
+ readonly property bool horizontal: __styleData.horizontal
+ readonly property bool hovered: activeControl !== "none"
+ }
+ }
+
+ Loader {
+ id: decrementLoader
+ anchors.bottom: __styleData.horizontal ? undefined : parent.bottom
+ anchors.right: __styleData.horizontal ? parent.right : undefined
+ sourceComponent: incrementControl
+ property QtObject styleData: QtObject {
+ readonly property bool hovered: activeControl === "down"
+ readonly property bool pressed: __styleData.downPressed
+ readonly property bool horizontal: __styleData.horizontal
+ }
+ }
+
+ property var flickableItem: control.flickableItem
+ property int extent: Math.max(minimumHandleLength, __styleData.horizontal ?
+ (flickableItem ? flickableItem.width/flickableItem.contentWidth : 0 ) * bg.width :
+ (flickableItem ? flickableItem.height/flickableItem.contentHeight : 0) * bg.height)
+
+ Loader {
+ id: handleControl
+ height: __styleData.horizontal ? implicitHeight : extent
+ width: __styleData.horizontal ? extent : implicitWidth
+ anchors.top: bg.top
+ anchors.left: bg.left
+ anchors.topMargin: __styleData.horizontal ? 0 : -handleOverlap + (__control.value / __control.maximumValue) * (bg.height + 2 * handleOverlap- height)
+ anchors.leftMargin: __styleData.horizontal ? -handleOverlap + (__control.value / __control.maximumValue) * (bg.width + 2 * handleOverlap - width) : 0
+ sourceComponent: handle
+ property QtObject styleData: QtObject {
+ readonly property bool hovered: activeControl === "handle"
+ readonly property bool pressed: __styleData.handlePressed
+ readonly property bool horizontal: __styleData.horizontal
+ }
+ readonly property alias __activeControl: panel.activeControl
+ }
+ }
+
+ /*! \internal */
+ property bool __externalScrollBars: false
+ /*! \internal */
+ property int __scrollBarSpacing: 4
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SliderStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SliderStyle.qml
new file mode 100644
index 0000000000..a62230bcf5
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SliderStyle.qml
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype SliderStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for Slider
+
+ The slider style allows you to create a custom appearance for
+ a \l Slider control.
+
+ The implicit size of the slider is calculated based on the
+ maximum implicit size of the \c background and \c handle
+ delegates combined.
+
+ Example:
+ \qml
+ Slider {
+ anchors.centerIn: parent
+ style: SliderStyle {
+ groove: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 8
+ color: "gray"
+ radius: 8
+ }
+ handle: Rectangle {
+ anchors.centerIn: parent
+ color: control.pressed ? "white" : "lightgray"
+ border.color: "gray"
+ border.width: 2
+ width: 34
+ height: 34
+ radius: 12
+ }
+ }
+ }
+ \endqml
+*/
+Style {
+ id: styleitem
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l Slider attached to this style. */
+ readonly property Slider control: __control
+
+ padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 }
+
+ /*! This property holds the item for the slider handle.
+ You can access the slider through the \c control property
+ */
+ property Component handle: Item{
+ implicitWidth: implicitHeight
+ implicitHeight: TextSingleton.implicitHeight * 1.2
+
+ FastGlow {
+ source: handle
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ anchors.topMargin: 1
+ smooth: true
+ color: "#11000000"
+ spread: 0.8
+ transparentBorder: true
+ blur: 0.1
+
+ }
+ Rectangle {
+ id: handle
+ anchors.fill: parent
+
+ radius: width/2
+ gradient: Gradient {
+ GradientStop { color: control.pressed ? "#e0e0e0" : "#fff" ; position: 1 }
+ GradientStop { color: "#eee" ; position: 0 }
+ }
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ radius: width/2
+ border.color: "#99ffffff"
+ color: control.activeFocus ? "#224f7fbf" : "transparent"
+ }
+ border.color: control.activeFocus ? "#47b" : "#777"
+ }
+
+ }
+ /*! This property holds the background groove of the slider.
+
+ You can access the handle position through the \c styleData.handlePosition property.
+ */
+ property Component groove: Item {
+ property color fillColor: "#49d"
+ anchors.verticalCenter: parent.verticalCenter
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
+ implicitHeight: Math.max(6, Math.round(TextSingleton.implicitHeight * 0.3))
+ Rectangle {
+ radius: height/2
+ anchors.fill: parent
+ border.width: 1
+ border.color: "#888"
+ gradient: Gradient {
+ GradientStop { color: "#bbb" ; position: 0 }
+ GradientStop { color: "#ccc" ; position: 0.6 }
+ GradientStop { color: "#ccc" ; position: 1 }
+ }
+ }
+ Item {
+ clip: true
+ width: styleData.handlePosition
+ height: parent.height
+ Rectangle {
+ anchors.fill: parent
+ border.color: Qt.darker(fillColor, 1.2)
+ radius: height/2
+ gradient: Gradient {
+ GradientStop {color: Qt.lighter(fillColor, 1.3) ; position: 0}
+ GradientStop {color: fillColor ; position: 1.4}
+ }
+ }
+ }
+ }
+
+ /*! This property holds the tick mark labels
+ \since QtQuick.Controls.Styles 1.1
+
+ You can access the handle width through the \c styleData.handleWidth property.
+ */
+ property Component tickmarks: Repeater {
+ id: repeater
+ model: control.stepSize > 0 ? 1 + (control.maximumValue - control.minimumValue) / control.stepSize : 0
+ Rectangle {
+ color: "#777"
+ width: 1 ; height: 3
+ y: repeater.height
+ x: styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1))
+ }
+ }
+
+ /*! This property holds the slider style panel.
+
+ Note that it is generally not recommended to override this.
+ */
+ property Component panel: Item {
+ id: root
+ property int handleWidth: handleLoader.width
+ property int handleHeight: handleLoader.height
+
+ property bool horizontal : control.orientation === Qt.Horizontal
+ property int horizontalSize: grooveLoader.implicitWidth + padding.left + padding.right
+ property int verticalSize: Math.max(handleLoader.implicitHeight, grooveLoader.implicitHeight) + padding.top + padding.bottom
+
+ implicitWidth: horizontal ? horizontalSize : verticalSize
+ implicitHeight: horizontal ? verticalSize : horizontalSize
+
+ y: horizontal ? 0 : height
+ rotation: horizontal ? 0 : -90
+ transformOrigin: Item.TopLeft
+
+ Item {
+
+ anchors.fill: parent
+
+ Loader {
+ id: grooveLoader
+ property QtObject styleData: QtObject {
+ readonly property int handlePosition: handleLoader.x + handleLoader.width/2
+ }
+ x: padding.left
+ sourceComponent: groove
+ width: (horizontal ? parent.width : parent.height) - padding.left - padding.right
+ y: Math.round(padding.top + (Math.round(horizontal ? parent.height : parent.width - padding.top - padding.bottom) - grooveLoader.item.height)/2)
+ }
+ Loader {
+ id: tickMarkLoader
+ anchors.fill: parent
+ sourceComponent: control.tickmarksEnabled ? tickmarks : null
+ property QtObject styleData: QtObject { readonly property int handleWidth: control.__panel.handleWidth }
+ }
+ Loader {
+ id: handleLoader
+ sourceComponent: handle
+ anchors.verticalCenter: grooveLoader.verticalCenter
+ x: Math.round((control.__handlePos - control.minimumValue) / (control.maximumValue - control.minimumValue) * ((horizontal ? root.width : root.height) - item.width))
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml
new file mode 100644
index 0000000000..9f1b565d32
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype SpinBoxStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.2
+ \ingroup controlsstyling
+ \brief Provides custom styling for SpinBox
+
+ Example:
+ \qml
+ SpinBox {
+ style: SpinBoxStyle{
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 20
+ border.color: "gray"
+ radius: 2
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+ id: spinboxStyle
+
+ /*! The \l SpinBox attached to this style. */
+ readonly property SpinBox control: __control
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ /*! The content margins of the text field. */
+ padding { top: 1 ; left: Math.round(TextSingleton.implicitHeight/2) ; right: Math.round(TextSingleton.implicitHeight) ; bottom: 0 }
+
+ /*! \qmlproperty enumeration horizontalAlignment
+
+ This property defines the default text aligment.
+
+ The supported values are:
+ \list
+ \li Qt.AlignLeft
+ \li Qt.AlignHCenter
+ \li Qt.AlignRight
+ \endlist
+
+ The default value is Qt.AlignRight
+ */
+ property int horizontalAlignment: Qt.AlignRight
+
+ /*! The text color. */
+ property color textColor: __syspal.text
+
+ /*! The text highlight color, used behind selections. */
+ property color selectionColor: __syspal.highlight
+
+ /*! The highlighted text color, used in selections. */
+ property color selectedTextColor: __syspal.highlightedText
+
+ /*!
+ \qmlproperty enumeration renderType
+
+ Override the default rendering type for the control.
+
+ Supported render types are:
+ \list
+ \li Text.QtRendering
+ \li Text.NativeRendering - the default
+ \endlist
+
+ \sa Text::renderType
+ */
+ property int renderType: Text.NativeRendering
+
+ /*! The button used to increment the value. */
+ property Component incrementControl: Item {
+ implicitWidth: padding.right
+ Image {
+ source: "images/arrow-up.png"
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: 1
+ opacity: control.enabled ? (styleData.upPressed ? 1 : 0.6) : 0.5
+ }
+ }
+
+ /*! The button used to decrement the value. */
+ property Component decrementControl: Item {
+ implicitWidth: padding.right
+ Image {
+ source: "images/arrow-down.png"
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -2
+ opacity: control.enabled ? (styleData.downPressed ? 1 : 0.6) : 0.5
+ }
+ }
+
+ /*! The background of the SpinBox. */
+ property Component background: Item {
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ implicitWidth: styleData.contentWidth + 26
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: "#eee" ; position: 0}
+ GradientStop {color: "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ id: styleitem
+ implicitWidth: backgroundLoader.implicitWidth
+ implicitHeight: backgroundLoader.implicitHeight
+
+ property color foregroundColor: spinboxStyle.textColor
+ property color selectionColor: spinboxStyle.selectionColor
+ property color selectedTextColor: spinboxStyle.selectedTextColor
+
+ property var margins: spinboxStyle.padding
+
+ property rect upRect: Qt.rect(width - incrementControlLoader.implicitWidth, 0, incrementControlLoader.implicitWidth, height / 2 + 1)
+ property rect downRect: Qt.rect(width - decrementControlLoader.implicitWidth, height / 2, decrementControlLoader.implicitWidth, height / 2)
+
+ property int horizontalAlignment: spinboxStyle.horizontalAlignment
+ property int verticalAlignment: Qt.AlignVCenter
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ }
+
+ Loader {
+ id: incrementControlLoader
+ x: upRect.x
+ y: upRect.y
+ width: upRect.width
+ height: upRect.height
+ sourceComponent: incrementControl
+ }
+
+ Loader {
+ id: decrementControlLoader
+ x: downRect.x
+ y: downRect.y
+ width: downRect.width
+ height: downRect.height
+ sourceComponent: decrementControl
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml
new file mode 100644
index 0000000000..aa8f6d6e9f
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StatusBarStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \ingroup controlsstyling
+ \since 5.2
+ \brief Provides custom styling for StatusBar
+
+ The status bar can be defined by overriding the background component and
+ setting the content padding.
+
+ Example:
+ \qml
+ StatusBar {
+ style: StatusBarStyle {
+ padding {
+ left: 8
+ right: 8
+ top: 3
+ bottom: 3
+ }
+ background: Rectangle {
+ implicitHeight: 16
+ implicitWidth: 200
+ gradient: Gradient{
+ GradientStop{color: "#eee" ; position: 0}
+ GradientStop{color: "#ccc" ; position: 1}
+ }
+ Rectangle {
+ anchors.top: parent.top
+ width: parent.width
+ height: 1
+ color: "#999"
+ }
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+
+ /*! The content padding inside the status bar. */
+ padding {
+ left: 3
+ right: 3
+ top: 3
+ bottom: 2
+ }
+
+ /*! This defines the background of the tool bar. */
+ property Component background: Rectangle {
+ implicitHeight: 16
+ implicitWidth: 200
+
+ gradient: Gradient{
+ GradientStop{color: "#eee" ; position: 0}
+ GradientStop{color: "#ccc" ; position: 1}
+ }
+
+ Rectangle {
+ anchors.top: parent.top
+ width: parent.width
+ height: 1
+ color: "#999"
+ }
+ }
+
+ property Component panel: Loader {
+ sourceComponent: background
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SwitchStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SwitchStyle.qml
new file mode 100644
index 0000000000..687966453e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SwitchStyle.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype SwitchStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.2
+ \ingroup controlsstyling
+ \brief Provides custom styling for Switch
+
+ Example:
+ \qml
+ Switch {
+ style: SwitchStyle {
+ groove: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 20
+ radius: 9
+ border.color: control.activeFocus ? "darkblue" : "gray"
+ border.width: 1
+ }
+ }
+ }
+ \endqml
+*/
+Style {
+ id: switchstyle
+
+ /*! The content padding. */
+ padding {
+ top: 0
+ left: 0
+ right: 0
+ bottom: 0
+ }
+
+ /*! This defines the switch handle. */
+ property Component handle: Rectangle {
+ opacity: control.enabled ? 1.0 : 0.5
+ implicitWidth: Math.round((parent.parent.width - padding.left - padding.right)/2)
+ implicitHeight: control.height - padding.top - padding.bottom
+
+ border.color: control.activeFocus ? Qt.darker(__syspal.highlight, 2) : Qt.darker(__syspal.button, 2)
+ property color bg: control.activeFocus ? Qt.darker(__syspal.highlight, 1.2) : __syspal.button
+ gradient: Gradient {
+ GradientStop {color: Qt.lighter(bg, 1.4) ; position: 0}
+ GradientStop {color: bg ; position: 1}
+ }
+
+ radius: 2
+ }
+
+ /*! This property holds the background groove of the switch. */
+ property Component groove: Rectangle {
+ property color shadow: control.checked ? Qt.darker(__syspal.highlight, 1.2): "#999"
+ property color bg: control.checked ? __syspal.highlight:"#bbb"
+
+ implicitWidth: Math.round(implicitHeight * 3)
+ implicitHeight: Math.max(16, Math.round(TextSingleton.implicitHeight))
+
+ border.color: "gray"
+ color: "red"
+
+ radius: 2
+ Behavior on shadow {ColorAnimation{ duration: 80 }}
+ Behavior on bg {ColorAnimation{ duration: 80 }}
+ gradient: Gradient {
+ GradientStop {color: shadow; position: 0}
+ GradientStop {color: bg ; position: 0.2}
+ GradientStop {color: bg ; position: 1}
+ }
+ Rectangle {
+ color: "#44ffffff"
+ height: 1
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: -1
+ width: parent.width - 2
+ x: 1
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+
+ implicitWidth: Math.round(grooveLoader.width + padding.left + padding.right)
+ implicitHeight: grooveLoader.implicitHeight + padding.top + padding.bottom
+
+ property var __groove: grooveLoader
+ property var __handle: handleLoader
+ property bool enableAnimation: false
+
+ Loader {
+ id: grooveLoader
+ y: padding.top
+ x: padding.left
+
+ sourceComponent: groove
+ anchors.verticalCenter: parent.verticalCenter
+
+
+ Loader {
+ id: handleLoader
+
+ z:1
+ anchors.top: grooveLoader.top
+ anchors.bottom: grooveLoader.bottom
+ anchors.topMargin: padding.top
+ anchors.bottomMargin: padding.bottom
+
+ Behavior on x {
+ id: behavior
+ enabled: enableAnimation
+ NumberAnimation {
+ duration: 150
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ sourceComponent: handle
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TabViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TabViewStyle.qml
new file mode 100644
index 0000000000..430dd02fa4
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TabViewStyle.qml
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TabViewStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup viewsstyling
+ \brief Provides custom styling for TabView
+
+\qml
+ TabView {
+ id: frame
+ anchors.fill: parent
+ anchors.margins: 4
+ Tab { title: "Tab 1" }
+ Tab { title: "Tab 2" }
+ Tab { title: "Tab 3" }
+
+ style: TabViewStyle {
+ frameOverlap: 1
+ tab: Rectangle {
+ color: styleData.selected ? "steelblue" :"lightsteelblue"
+ border.color: "steelblue"
+ implicitWidth: Math.max(text.width + 4, 80)
+ implicitHeight: 20
+ radius: 2
+ Text {
+ id: text
+ anchors.centerIn: parent
+ text: styleData.title
+ color: styleData.selected ? "white" : "black"
+ }
+ }
+ frame: Rectangle { color: "steelblue" }
+ }
+ }
+\endqml
+
+*/
+
+Style {
+
+ /*! The \l ScrollView attached to this style. */
+ readonly property TabView control: __control
+
+ /*! This property holds whether the user can move the tabs.
+ Tabs are not movable by default. */
+ property bool tabsMovable: false
+
+ /*! This property holds the horizontal alignment of
+ the tab buttons. Supported values are:
+ \list
+ \li Qt.AlignLeft (default)
+ \li Qt.AlignHCenter
+ \li Qt.AlignRight
+ \endlist
+ */
+ property int tabsAlignment: Qt.AlignLeft
+
+ /*! This property holds the amount of overlap there are between
+ individual tab buttons. */
+ property int tabOverlap: 1
+
+ /*! This property holds the amount of overlap there are between
+ individual tab buttons and the frame. */
+ property int frameOverlap: 2
+
+ /*! This defines the tab frame. */
+ property Component frame: Rectangle {
+ color: "#dcdcdc"
+ border.color: "#aaa"
+
+ Rectangle {
+ anchors.fill: parent
+ color: "transparent"
+ border.color: "#66ffffff"
+ anchors.margins: 1
+ }
+ }
+
+ /*! This defines the tab. You can access the tab state through the
+ \c styleData property, with the following properties:
+
+ \table
+ \row \li readonly property int \b styleData.index \li This is the current tab index.
+ \row \li readonly property bool \b styleData.selected \li This is the active tab.
+ \row \li readonly property string \b styleData.title \li Tab title text.
+ \row \li readonly property bool \b styleData.nextSelected \li The next tab is selected.
+ \row \li readonly property bool \b styleData.previousSelected \li The previous tab is selected.
+ \row \li readonly property bool \b styleData.hovered \li The tab is being hovered.
+ \row \li readonly property bool \b styleData.activeFocus \li The tab button has keyboard focus.
+ \row \li readonly property bool \b styleData.availableWidth \li The available width for the tabs.
+ \endtable
+ */
+ property Component tab: Item {
+ scale: control.tabPosition === Qt.TopEdge ? 1 : -1
+
+ property int totalOverlap: tabOverlap * (control.count - 1)
+ property real maxTabWidth: (styleData.availableWidth + totalOverlap) / control.count
+
+ implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20))
+ implicitHeight: Math.round(textitem.implicitHeight + 10)
+
+ clip: true
+ Item {
+ anchors.fill: parent
+ anchors.bottomMargin: styleData.selected ? 0 : 2
+ clip: true
+ BorderImage {
+ anchors.fill: parent
+ source: styleData.selected ? "images/tab_selected.png" : "images/tab.png"
+ border.top: 6
+ border.bottom: 6
+ border.left: 6
+ border.right: 6
+ anchors.topMargin: styleData.selected ? 0 : 1
+ }
+ }
+ Rectangle {
+ anchors.fill: textitem
+ anchors.margins: -1
+ anchors.leftMargin: -3
+ anchors.rightMargin: -3
+ visible: (styleData.activeFocus && styleData.selected)
+ height: 6
+ radius: 3
+ color: "#224f9fef"
+ border.color: "#47b"
+ }
+ Text {
+ id: textitem
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ text: styleData.title
+ renderType: Text.NativeRendering
+ scale: control.tabPosition === Qt.TopEdge ? 1 : -1
+ color: __syspal.text
+ }
+ }
+
+ /*! This defines the left corner. */
+ property Component leftCorner: null
+
+ /*! This defines the right corner. */
+ property Component rightCorner: null
+
+ /*! This defines the tab bar background. */
+ property Component tabBar: null
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TableViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TableViewStyle.qml
new file mode 100644
index 0000000000..512b0cfef7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TableViewStyle.qml
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TableViewStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup viewsstyling
+ \brief Provides custom styling for TableView
+
+ Note that this class derives from \l ScrollViewStyle
+ and supports all of the properties defined there.
+*/
+ScrollViewStyle {
+ id: root
+
+ /*! The \l TableView attached to this style. */
+ readonly property TableView control: __control
+
+ /*! The text color. */
+ property color textColor: __syspal.text
+
+ /*! The background color. */
+ property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
+
+ /*! The alternate background color. */
+ property color alternateBackgroundColor: "#f5f5f5"
+
+ /*! The text highlight color, used within selections. */
+ property color highlightedTextColor: "white"
+
+ /*! Activates items on single click. */
+ property bool activateItemOnSingleClick: false
+
+ padding.top: control.headerVisible ? 0 : 1
+
+ /*! \qmlproperty Component TableViewStyle::headerDelegate
+ Delegate for header. This delegate is described in \l {TableView::headerDelegate}
+ */
+ property Component headerDelegate: BorderImage {
+ height: textItem.implicitHeight * 1.2
+ source: "images/header.png"
+ border.left: 4
+ border.bottom: 2
+ border.top: 2
+ Text {
+ id: textItem
+ anchors.fill: parent
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignLeft
+ anchors.leftMargin: 12
+ text: styleData.value
+ elide: Text.ElideRight
+ color: textColor
+ renderType: Text.NativeRendering
+ }
+ Rectangle {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 1
+ anchors.topMargin: 1
+ width: 1
+ color: "#ccc"
+ }
+ }
+
+ /*! \qmlproperty Component TableViewStyle::rowDelegate
+ Delegate for header. This delegate is described in \l {TableView::rowDelegate}
+ */
+ property Component rowDelegate: Rectangle {
+ height: Math.round(TextSingleton.implicitHeight * 1.2)
+ property color selectedColor: styleData.hasActiveFocus ? "#07c" : "#999"
+ color: styleData.selected ? selectedColor :
+ !styleData.alternate ? alternateBackgroundColor : backgroundColor
+ }
+
+ /*! \qmlproperty Component TableViewStyle::itemDelegate
+ Delegate for item. This delegate is described in \l {TableView::itemDelegate}
+ */
+ property Component itemDelegate: Item {
+ height: Math.max(16, label.implicitHeight)
+ property int implicitWidth: label.implicitWidth + 20
+
+ Text {
+ id: label
+ objectName: "label"
+ width: parent.width
+ anchors.leftMargin: 12
+ anchors.left: parent.left
+ anchors.right: parent.right
+ horizontalAlignment: styleData.textAlignment
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: 1
+ elide: styleData.elideMode
+ text: styleData.value !== undefined ? styleData.value : ""
+ color: styleData.textColor
+ renderType: Text.NativeRendering
+ }
+ }
+}
+
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml
new file mode 100644
index 0000000000..c974c01dac
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TextAreaStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.2
+ \ingroup controlsstyling
+ \brief Provides custom styling for TextArea.
+
+ Example:
+ \qml
+ TextArea {
+ style: TextAreaStyle {
+ textColor: "#333"
+ selectionColor: "steelblue"
+ selectedTextColor: "#eee"
+ backgroundColor: "#eee"
+ }
+ }
+ \endqml
+*/
+
+ScrollViewStyle {
+ id: style
+
+ /*! The \l TextArea attached to this style. */
+ readonly property TextArea control: __control
+
+ /*! The current font. */
+ property font font
+
+ /*! The text color. */
+ property color textColor: __syspal.text
+
+ /*! The text highlight color, used behind selections. */
+ property color selectionColor: __syspal.highlight
+
+ /*! The highlighted text color, used in selections. */
+ property color selectedTextColor: __syspal.highlightedText
+
+ /*! The background color. */
+ property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
+
+ /*!
+ \qmlproperty enumeration renderType
+
+ Override the default rendering type for the control.
+
+ Supported render types are:
+ \list
+ \li Text.QtRendering
+ \li Text.NativeRendering - the default
+ \endlist
+
+ \sa Text::renderType
+ */
+ property int renderType: Text.NativeRendering
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml
new file mode 100644
index 0000000000..8b4494d186
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TextFieldStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \since 5.1
+ \ingroup controlsstyling
+ \brief Provides custom styling for TextField.
+
+ Example:
+ \qml
+ TextField {
+ style: TextFieldStyle {
+ textColor: "black"
+ background: Rectangle {
+ radius: 2
+ implicitWidth: 100
+ implicitHeight: 24
+ border.color: "#333"
+ border.width: 1
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+ id: style
+
+ /*! \internal */
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ /*! The \l TextField attached to this style. */
+ readonly property TextField control: __control
+
+ /*! The content margins of the text field. */
+ padding { top: 4 ; left: TextSingleton.implicitHeight/3 ; right: TextSingleton.implicitHeight/3 ; bottom:4 }
+
+ /*! The current font. */
+ property font font
+
+ /*! The text color. */
+ property color textColor: __syspal.text
+
+ /*! The text highlight color, used behind selections. */
+ property color selectionColor: __syspal.highlight
+
+ /*! The highlighted text color, used in selections. */
+ property color selectedTextColor: __syspal.highlightedText
+
+ /*!
+ \qmlproperty enumeration renderType
+
+ Override the default rendering type for the control.
+
+ Supported render types are:
+ \list
+ \li Text.QtRendering
+ \li Text.NativeRendering - the default
+ \endlist
+
+ \sa Text::renderType
+ */
+ property int renderType: Text.NativeRendering
+
+ /*! The placeholder text color, used when the text field is empty.
+ \since 5.2
+ */
+ property color placeholderTextColor: Qt.rgba(0, 0, 0, 0.5)
+
+ /*! The background of the text field. */
+ property Component background: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 8)
+ implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ Rectangle {
+ anchors.fill: parent
+ anchors.bottomMargin: -1
+ color: "#44ffffff"
+ radius: baserect.radius
+ }
+ Rectangle {
+ id: baserect
+ gradient: Gradient {
+ GradientStop {color: "#e0e0e0" ; position: 0}
+ GradientStop {color: "#fff" ; position: 0.1}
+ GradientStop {color: "#fff" ; position: 1}
+ }
+ radius: TextSingleton.implicitHeight * 0.16
+ anchors.fill: parent
+ border.color: control.activeFocus ? "#47b" : "#999"
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ anchors.fill: parent
+
+ property int topMargin: padding.top
+ property int leftMargin: padding.left
+ property int rightMargin: padding.right
+ property int bottomMargin: padding.bottom
+
+ property color textColor: style.textColor
+ property color selectionColor: style.selectionColor
+ property color selectedTextColor: style.selectedTextColor
+
+ implicitWidth: backgroundLoader.implicitWidth ? backgroundLoader.implicitWidth : 100
+ implicitHeight: backgroundLoader.implicitHeight ? backgroundLoader.implicitHeight : 20
+
+ property color placeholderTextColor: style.placeholderTextColor
+ property font font: style.font
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: background
+ anchors.fill: parent
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml
new file mode 100644
index 0000000000..ca5d93fbae
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ToolBarStyle
+ \inqmlmodule QtQuick.Controls.Styles
+ \ingroup controlsstyling
+ \since 5.2
+ \brief Provides custom styling for ToolBar
+
+ The tool bar can be defined by overriding the background component and
+ setting the content padding.
+
+ Example:
+ \qml
+ ToolBar {
+ style: ToolBarStyle {
+ padding {
+ left: 8
+ right: 8
+ top: 3
+ bottom: 3
+ }
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ border.color: "#999"
+ gradient: Gradient {
+ GradientStop { position: 0 ; color: "#fff" }
+ GradientStop { position: 1 ; color: "#eee" }
+ }
+ }
+ }
+ }
+ \endqml
+*/
+
+Style {
+
+ /*! The content padding inside the tool bar. */
+ padding {
+ left: 6
+ right: 6
+ top: 3
+ bottom: 3
+ }
+
+ /*! This defines the background of the tool bar. */
+ property Component background: Item {
+ implicitHeight: 40
+ implicitWidth: 200
+ Rectangle {
+ anchors.fill: parent
+ gradient: Gradient{
+ GradientStop{color: "#eee" ; position: 0}
+ GradientStop{color: "#ccc" ; position: 1}
+ }
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: parent.width
+ height: 1
+ color: "#999"
+ }
+ }
+ }
+
+ property Component panel: Loader {
+ sourceComponent: background
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml
new file mode 100644
index 0000000000..dcdfe4dee8
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ToolButtonStyle
+ \internal
+ \ingroup controlsstyling
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+Style {
+ readonly property ToolButton control: __control
+ property Component panel: Item {
+ id: styleitem
+ implicitWidth: (hasIcon ? 36 : Math.max(label.implicitWidth + frame.border.left + frame.border.right, 36))
+ + (arrow.visible ? 10 : 0)
+ implicitHeight: hasIcon ? 36 : Math.max(label.implicitHeight, 36)
+
+ readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
+
+ Rectangle {
+ anchors.fill: parent
+ visible: control.pressed || (control.checkable && control.checked)
+ color: "lightgray"
+ radius:4
+ border.color: "#aaa"
+ }
+ Item {
+ anchors.left: parent.left
+ anchors.right: arrow.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ clip: true
+ Text {
+ id: label
+ visible: !hasIcon
+ anchors.centerIn: parent
+ text: control.text
+ }
+ Image {
+ id: icon
+ anchors.centerIn: parent
+ source: control.iconSource
+ }
+ }
+
+ BorderImage {
+ id: frame
+ anchors.fill: parent
+ anchors.margins: -1
+ anchors.topMargin: -2
+ anchors.rightMargin: 0
+ source: "images/focusframe.png"
+ visible: control.activeFocus
+ border.left: 4
+ border.right: 4
+ border.top: 4
+ border.bottom: 4
+ }
+
+ Image {
+ id: arrow
+ visible: control.menu !== null
+ source: visible ? "images/arrow-down.png" : ""
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: visible ? 3 : 0
+ opacity: control.enabled ? 0.7 : 0.5
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml
new file mode 100644
index 0000000000..99f37919f9
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Controls.Styles 1.1
+
+BusyIndicatorStyle { }
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml
new file mode 100644
index 0000000000..33e8f0eeda
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property Component panel: StyleItem {
+ id: styleitem
+ elementType: "button"
+ sunken: control.pressed || (control.checkable && control.checked)
+ raised: !(control.pressed || (control.checkable && control.checked))
+ hover: control.hovered
+ text: control.iconSource === "" ? "" : control.text
+ hasFocus: control.activeFocus
+ hints: control.styleHints
+ // If no icon, let the style do the drawing
+ activeControl: control.isDefault ? "default" : "f"
+
+ properties: {
+ "icon": control.__iconAction.__icon,
+ "menu": control.menu
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml
new file mode 100644
index 0000000000..819c6a8198
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property Component panel: Item {
+ anchors.fill: parent
+
+ implicitWidth: styleitem.implicitWidth
+ implicitHeight: styleitem.implicitHeight
+ baselineOffset: styleitem.baselineOffset
+ StyleItem {
+ id: styleitem
+ elementType: "checkbox"
+ sunken: control.pressed
+ on: control.checked || control.pressed
+ hover: control.hovered
+ enabled: control.enabled
+ hasFocus: control.activeFocus && styleitem.style == "mac"
+ hints: control.styleHints
+ properties: {"partiallyChecked": (control.checkedState === Qt.PartiallyChecked) }
+ contentHeight: textitem.implicitHeight
+ contentWidth: textitem.implicitWidth + indicatorWidth
+ property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4)
+ property bool macStyle: (style === "mac")
+
+ Text {
+ id: textitem
+ text: control.text
+ anchors.left: parent.left
+ anchors.leftMargin: parent.indicatorWidth
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: parent.macStyle ? 1 : 0
+ anchors.right: parent.right
+ renderType: Text.NativeRendering
+ elide: Text.ElideRight
+ enabled: control.enabled
+ color: __syspal.windowText
+ StyleItem {
+ elementType: "focusrect"
+ anchors.margins: -1
+ anchors.leftMargin: -2
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ width: textitem.implicitWidth + 3
+ visible: control.activeFocus
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml
new file mode 100644
index 0000000000..b36b4c1ddc
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+import "." as Desktop
+
+Style {
+ readonly property ComboBox control: __control
+ property int drowDownButtonWidth: 24
+ property Component panel: Item {
+ property bool popup: !!styleItem.styleHint("comboboxpopup")
+
+ implicitWidth: 125
+ implicitHeight: styleItem.implicitHeight
+ baselineOffset: styleItem.baselineOffset
+ anchors.fill: parent
+ StyleItem {
+ id: styleItem
+
+ height: parent.height
+ width: parent.width
+ elementType: "combobox"
+ sunken: control.pressed
+ raised: !sunken
+ hover: control.hovered
+ enabled: control.enabled
+ // The style makes sure the text rendering won't overlap the decoration.
+ // In that case, 35 pixels margin in this case looks good enough. Worst
+ // case, the ellipsis will be truncated (2nd worst, not visible at all).
+ text: elidedText(control.currentText, Text.ElideRight, parent.width - 35)
+ hasFocus: control.activeFocus
+ // contentHeight as in QComboBox
+ contentHeight: Math.max(Math.ceil(textHeight("")), 14) + 2
+
+ hints: control.styleHints
+ properties: {
+ "popup": control.__popup,
+ "editable" : control.editable
+ }
+ }
+ }
+
+ property Component __popupStyle: MenuStyle {
+ __menuItemType: "comboboxitem"
+ }
+
+ property Component __dropDownStyle: Style {
+ property Component frame: StyleItem {
+ elementType: "frame"
+
+ width: (parent ? parent.contentWidth : 0)
+ height: (parent ? parent.contentHeight : 0) + 2 * pixelMetric("defaultframewidth")
+ property real maxHeight: 600
+ property int margin: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth")
+ }
+
+ property Component menuItem: StyleItem {
+ elementType: "itemrow"
+ selected: parent ? parent.selected : false
+
+ x: pixelMetric("defaultframewidth")
+ y: pixelMetric("defaultframewidth")
+
+ implicitWidth: textItem.contentWidth
+ implicitHeight: textItem.contentHeight
+
+ StyleItem {
+ id: textItem
+ elementType: "item"
+ contentWidth: textWidth(text)
+ contentHeight: textHeight(text)
+ text: parent && parent.parent ? parent.parent.text : ""
+ selected: parent ? parent.selected : false
+ }
+ }
+
+ property Component scrollerStyle: Desktop.ScrollViewStyle {
+ property bool useScrollers: false
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml
new file mode 100644
index 0000000000..0bea860eee
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype FocusFrameStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+StyleItem {
+ property int margin: -3
+ anchors.fill: parent
+ elementType: "focusframe"
+}
+
+
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml
new file mode 100644
index 0000000000..cfe02d3f17
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+
+Style {
+ readonly property GroupBox control: __control
+
+ property var __style: StyleItem { id: style }
+ property int titleHeight: 18
+
+ Component.onCompleted: {
+ var stylename = __style.style
+ if (stylename.indexOf("windows") > -1)
+ titleHeight = 9
+ }
+
+ padding {
+ top: Math.round(Settings.dpiScaleFactor * (control.title.length > 0 || control.checkable ? titleHeight : 0) + (style.style == "mac" ? 9 : 6))
+ left: Math.round(Settings.dpiScaleFactor * 8)
+ right: Math.round(Settings.dpiScaleFactor * 8)
+ bottom: Math.round(Settings.dpiScaleFactor * 7 + (style.style.indexOf("windows") > -1 ? 2 : 0))
+ }
+
+ property Component panel: StyleItem {
+ anchors.fill: parent
+ id: styleitem
+ elementType: "groupbox"
+ text: control.title
+ on: control.checked
+ hasFocus: control.__checkbox.activeFocus
+ activeControl: control.checkable ? "checkbox" : ""
+ properties: { "checkable" : control.checkable , "sunken" : !control.flat}
+ textureHeight: 128
+ border {top: 32 ; bottom: 8}
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml
new file mode 100644
index 0000000000..a8b389c1a7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+
+Style {
+ property Component frame: StyleItem {
+ elementType: "menubar"
+ contentWidth: control.__contentItem.width
+ contentHeight: parent ? parent.contentHeight : 0
+ width: implicitWidth + 2 * (pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth"))
+ height: implicitHeight + 2 * (pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth"))
+ + pixelMetric("spacebelowmenubar")
+
+ Accessible.role: Accessible.MenuBar
+ }
+
+ property Component menuItem: StyleItem {
+ elementType: "menubaritem"
+ x: pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth")
+ y: pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth")
+
+ text: menuItem.title
+ contentWidth: textWidth(text)
+ contentHeight: textHeight(text)
+ width: implicitWidth + pixelMetric("menubaritemspacing")
+
+ enabled: menuItem.enabled
+ selected: (parent && parent.selected) || sunken
+ sunken: parent && parent.sunken
+
+ hints: { "showUnderlined": showUnderlined }
+
+ Accessible.role: Accessible.MenuItem
+ Accessible.name: StyleHelpers.removeMnemonics(text)
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuStyle.qml
new file mode 100644
index 0000000000..ad04281de8
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuStyle.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ id: styleRoot
+
+ property string __menuItemType: "menuitem"
+
+ property Component frame: StyleItem {
+ elementType: "menu"
+
+ contentWidth: parent ? parent.contentWidth : 0
+ contentHeight: parent ? parent.contentHeight : 0
+ width: implicitWidth
+ height: implicitHeight
+
+ property int subMenuOverlap: -2 * pixelMetric("menupanelwidth")
+ property real maxHeight: Screen.desktopAvailableHeight * 0.99
+ property int margin: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth")
+
+ Rectangle {
+ visible: anchors.margins > 0
+ anchors {
+ fill: parent
+ margins: pixelMetric("menupanelwidth")
+ }
+ color: __syspal.window
+ }
+
+ Accessible.role: Accessible.PopupMenu
+ }
+
+ property Component menuItem: StyleItem {
+ elementType: __menuItemType
+ x: pixelMetric("menuhmargin") + pixelMetric("menupanelwidth")
+ y: pixelMetric("menuvmargin")
+
+ text: !!parent && parent.text
+ property string textAndShorcut: text + (properties.shortcut ? "\t" + properties.shortcut : "")
+ contentWidth: textWidth(textAndShorcut)
+ contentHeight: textHeight(textAndShorcut)
+
+ enabled: !!parent && parent.enabled
+ selected: !!parent && parent.selected
+ on: !!menuItem && !!menuItem["checkable"] && menuItem.checked
+
+ hints: { "showUnderlined": showUnderlined }
+
+ properties: {
+ "checkable": !!menuItem && !!menuItem["checkable"],
+ "exclusive": !!menuItem && !!menuItem["exclusiveGroup"],
+ "shortcut": !!menuItem && menuItem["shortcut"] || "",
+ "isSubmenu": isSubmenu,
+ "scrollerDirection": scrollerDirection,
+ "icon": !!menuItem && menuItem.__icon
+ }
+
+ Accessible.role: Accessible.MenuItem
+ Accessible.name: StyleHelpers.removeMnemonics(text)
+ }
+
+ property Component scrollerStyle: Style {
+ padding { left: 0; right: 0; top: 0; bottom: 0 }
+ property bool scrollToClickedPosition: false
+ property Component frame: Item { visible: false }
+ property Component corner: Item { visible: false }
+ property Component __scrollbar: Item { visible: false }
+ property bool useScrollers: true
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml
new file mode 100644
index 0000000000..70fa040247
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property Component panel: StyleItem {
+ anchors.fill: parent
+ elementType: "progressbar"
+ // XXX: since desktop uses int instead of real, the progressbar
+ // range [0..1] must be stretched to a good precision
+ property int factor : 1000
+ property int decimals: 3
+ value: indeterminate ? 0 : control.value.toFixed(decimals) * factor // does indeterminate value need to be 1 on windows?
+ minimum: indeterminate ? 0 : control.minimumValue.toFixed(decimals) * factor
+ maximum: indeterminate ? 0 : control.maximumValue.toFixed(decimals) * factor
+ enabled: control.enabled
+ horizontal: control.orientation === Qt.Horizontal
+ hints: control.styleHints
+ contentWidth: horizontal ? 200 : 23
+ contentHeight: horizontal ? 23 : 200
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml
new file mode 100644
index 0000000000..4a00ee22a6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ readonly property RadioButton control: __control
+ property Component panel: Item {
+ anchors.fill: parent
+
+ implicitWidth: styleitem.implicitWidth
+ implicitHeight: styleitem.implicitHeight
+ baselineOffset: styleitem.baselineOffset
+
+ StyleItem {
+ id: styleitem
+ elementType: "radiobutton"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: macStyle ? -1 : 0
+ sunken: control.pressed
+ on: control.checked || control.pressed
+ hover: control.hovered
+ enabled: control.enabled
+ hasFocus: control.activeFocus && styleitem.style == "mac"
+ hints: control.styleHints
+ contentHeight: textitem.implicitHeight
+ contentWidth: textitem.implicitWidth + indicatorWidth
+ property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4)
+ property bool macStyle: (style === "mac")
+
+ Text {
+ id: textitem
+ text: control.text
+ anchors.left: parent.left
+ anchors.leftMargin: parent.indicatorWidth
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: parent.macStyle ? 2 : 0
+ anchors.right: parent.right
+ renderType: Text.NativeRendering
+ elide: Text.ElideRight
+ enabled: control.enabled
+ color: __syspal.windowText
+ StyleItem {
+ elementType: "focusrect"
+ anchors.margins: -1
+ anchors.leftMargin: -2
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ width: textitem.implicitWidth + 3
+ visible: control.activeFocus
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml
new file mode 100644
index 0000000000..b78fc04335
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick.Controls.Private 1.0
+StyleItem {
+ elementType: "itemrow"
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml
new file mode 100644
index 0000000000..22c2844164
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ id: root
+
+ padding {
+ property int frameWidth: __styleitem.pixelMetric("defaultframewidth")
+ left: frameWidth
+ top: frameWidth
+ bottom: frameWidth
+ right: frameWidth
+ }
+
+ property StyleItem __styleitem: StyleItem { elementType: "frame" }
+
+ property Component frame: StyleItem {
+ id: styleitem
+ elementType: "frame"
+ sunken: true
+ visible: control.frameVisible
+ textureHeight: 64
+ textureWidth: 64
+ border {
+ top: 16
+ left: 16
+ right: 16
+ bottom: 16
+ }
+ }
+
+ property Component corner: StyleItem { elementType: "scrollareacorner" }
+
+ readonly property bool __externalScrollBars: __styleitem.styleHint("externalScrollBars")
+ readonly property int __scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing")
+ readonly property bool scrollToClickedPosition: __styleitem.styleHint("scrollToClickPosition") !== 0
+
+ property Component __scrollbar: StyleItem {
+ anchors.fill:parent
+ elementType: "scrollbar"
+ hover: activeControl != "none"
+ activeControl: "none"
+ sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed
+ minimum: __control.minimumValue
+ maximum: __control.maximumValue
+ value: __control.value
+ horizontal: __styleData.horizontal
+ enabled: __control.enabled
+
+ implicitWidth: horizontal ? 200 : pixelMetric("scrollbarExtent")
+ implicitHeight: horizontal ? pixelMetric("scrollbarExtent") : 200
+ }
+
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SliderStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SliderStyle.qml
new file mode 100644
index 0000000000..fd426e35b7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SliderStyle.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ readonly property Item control: __control
+ property Component panel: StyleItem {
+ elementType: "slider"
+ sunken: control.pressed
+ implicitWidth: 200
+ contentHeight: horizontal ? 22 : 200
+ contentWidth: horizontal ? 200 : 22
+
+ maximum: control.maximumValue*100
+ minimum: control.minimumValue*100
+ step: control.stepSize*100
+ value: control.__handlePos*100
+ horizontal: control.orientation === Qt.Horizontal
+ enabled: control.enabled
+ hasFocus: control.activeFocus
+ hints: control.styleHints
+ activeControl: control.tickmarksEnabled ? "ticks" : ""
+ property int handleWidth: 15
+ property int handleHeight: 15
+ }
+ padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml
new file mode 100644
index 0000000000..5cf13ea8fa
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ readonly property SpinBox control: __control
+
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ padding {
+ top: control.__panel ? control.__panel.topPadding + (styleitem.style === "mac" ? 2 : 0) : 0
+ left: control.__panel ? control.__panel.leftPadding : 0
+ right: control.__panel ? control.__panel.rightPadding : 0
+ bottom: control.__panel ? control.__panel.bottomPadding : 0
+ }
+ StyleItem {id: styleitem ; visible: false}
+
+ property int renderType: Text.NativeRendering
+
+ property Component panel: Item {
+ id: style
+
+ property rect upRect
+ property rect downRect
+
+ property int horizontalAlignment: Qt.platform.os === "osx" ? Qt.AlignRight : Qt.AlignLeft
+ property int verticalAlignment: Qt.AlignVCenter
+
+ property color foregroundColor: __syspal.text
+ property color backgroundColor: __syspal.base
+ property color selectionColor: __syspal.highlight
+ property color selectedTextColor: __syspal.highlightedText
+
+ property int topPadding: edit.anchors.topMargin
+ property int leftPadding: 3 + edit.anchors.leftMargin
+ property int rightPadding: 3 + edit.anchors.rightMargin
+ property int bottomPadding: edit.anchors.bottomMargin
+
+ width: 100
+ height: styleitem.implicitHeight
+
+ implicitWidth: 2 + styleitem.implicitWidth
+ implicitHeight: styleitem.implicitHeight
+ baselineOffset: styleitem.baselineOffset
+
+ Item {
+ id: edit
+ anchors.fill: parent
+ Rectangle {
+ color: "white"
+ anchors.fill: parent
+ anchors.margins: -1
+ }
+ FocusFrame {
+ anchors.fill: parent
+ focusMargin:-6
+ visible: spinbox.activeFocus && styleitem.styleHint("focuswidget")
+ }
+ }
+
+ function updateRect() {
+ style.upRect = styleitem.subControlRect("up");
+ style.downRect = styleitem.subControlRect("down");
+ var inputRect = styleitem.subControlRect("edit");
+ edit.anchors.topMargin = inputRect.y
+ edit.anchors.leftMargin = inputRect.x
+ edit.anchors.rightMargin = style.width - inputRect.width - edit.anchors.leftMargin
+ edit.anchors.bottomMargin = style.height - inputRect.height - edit.anchors.topMargin
+ }
+
+ Component.onCompleted: updateRect()
+ onWidthChanged: updateRect()
+ onHeightChanged: updateRect()
+
+ StyleItem {
+ id: styleitem
+ elementType: "spinbox"
+ anchors.fill: parent
+ sunken: (styleData.downEnabled && styleData.downPressed) || (styleData.upEnabled && styleData.upPressed)
+ hover: control.hovered
+ hints: control.styleHints
+ hasFocus: control.activeFocus
+ enabled: control.enabled
+ value: (styleData.upPressed ? 1 : 0) |
+ (styleData.downPressed ? 1<<1 : 0) |
+ (styleData.upEnabled ? (1<<2) : 0) |
+ (styleData.downEnabled ? (1<<3) : 0)
+ contentWidth: styleData.contentWidth
+ contentHeight: styleData.contentHeight
+ textureHeight: implicitHeight
+ border {top: 6 ; bottom: 6}
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml
new file mode 100644
index 0000000000..1a1c687ea4
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StatusBarStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+Style {
+
+ padding.left: 4
+ padding.right: 4
+ padding.top: 3
+ padding.bottom: 2
+
+ property Component panel: StyleItem {
+ implicitHeight: 16
+ implicitWidth: 200
+ anchors.fill: parent
+ elementType: "statusbar"
+ textureWidth: 64
+ border {left: 16 ; right: 16}
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml
new file mode 100644
index 0000000000..df9dd5bf96
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+
+SwitchStyle {
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml
new file mode 100644
index 0000000000..cf61a4d16e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+Style {
+ id: root
+
+ property bool tabsMovable: false
+ property int tabsAlignment: __barstyle.styleHint("tabbaralignment") === "center" ? Qt.AlignHCenter : Qt.AlignLeft;
+ property int tabOverlap: __barstyle.pixelMetric("taboverlap");
+ property int frameOverlap: __barstyle.pixelMetric("tabbaseoverlap");
+
+ property StyleItem __barstyle: StyleItem {
+ elementType: "tab"
+ properties: { "tabposition" : (control.tabPosition === Qt.TopEdge ? "Top" : "Bottom") }
+ visible: false
+ }
+
+ property Component frame: StyleItem {
+ id: styleitem
+ anchors.fill: parent
+ anchors.topMargin: 1//stack.baseOverlap
+ z: style == "oxygen" ? 1 : 0
+ elementType: "tabframe"
+ value: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).x : 0
+ minimum: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).width : 0
+ maximum: tabbarItem && tabsVisible ? tabbarItem.width : width
+ properties: { "selectedTabRect" : tabbarItem.__selectedTabRect, "orientation" : control.tabPosition }
+ hints: control.styleHints
+ Component.onCompleted: {
+ stack.frameWidth = styleitem.pixelMetric("defaultframewidth");
+ stack.style = style;
+ }
+ border{
+ top: 16
+ bottom: 16
+ }
+ textureHeight: 64
+ }
+
+ property Component tab: Item {
+ id: item
+ property string tabpos: control.count === 1 ? "only" : index === 0 ? "beginning" : index === control.count - 1 ? "end" : "middle"
+ property string selectedpos: styleData.nextSelected ? "next" : styleData.previousSelected ? "previous" : ""
+ property string orientation: control.tabPosition === Qt.TopEdge ? "Top" : "Bottom"
+ property int tabHSpace: __barstyle.pixelMetric("tabhspace");
+ property int tabVSpace: __barstyle.pixelMetric("tabvspace");
+ property int totalOverlap: tabOverlap * (control.count - 1)
+ property real maxTabWidth: (control.width + totalOverlap) / control.count
+ implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(styleData.title)) + tabHSpace + 2)
+ implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0)
+
+ StyleItem {
+ id: styleitem
+
+ elementType: "tab"
+ paintMargins: style === "mac" ? 0 : 2
+
+ anchors.fill: parent
+ anchors.topMargin: style === "mac" ? 2 : 0
+ anchors.rightMargin: -paintMargins
+ anchors.bottomMargin: -1
+ anchors.leftMargin: -paintMargins + (style === "mac" && selected ? -1 : 0)
+ properties: { "hasFrame" : true, "orientation": orientation, "tabpos": tabpos, "selectedpos": selectedpos }
+ hints: control.styleHints
+
+ selected: styleData.selected
+ text: elidedText(styleData.title, tabbarItem.elide, item.width - item.tabHSpace)
+ hover: styleData.hovered
+ hasFocus: tabbarItem.activeFocus && selected
+ }
+ }
+
+ property Component leftCorner: null
+ property Component rightCorner: null
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml
new file mode 100644
index 0000000000..88611ab5c7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import "."
+
+ScrollViewStyle {
+ id: root
+
+ property var __syspal: SystemPalette {
+ colorGroup: control.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
+ readonly property TableView control: __control
+ property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick")
+ property color textColor: __styleitem.textColor
+ property color backgroundColor: __syspal.base
+ property color highlightedTextColor: __styleitem.highlightedTextColor
+
+ property StyleItem __styleitem: StyleItem{
+ property color textColor: styleHint("textColor")
+ property color highlightedTextColor: styleHint("highlightedTextColor")
+ elementType: "item"
+ visible: false
+ active: control.activeFocus
+ onActiveChanged: {
+ highlightedTextColor = styleHint("highlightedTextColor")
+ textColor = styleHint("textColor")
+ }
+ }
+
+ property Component headerDelegate: StyleItem {
+ elementType: "header"
+ activeControl: itemSort
+ raised: true
+ sunken: styleData.pressed
+ text: styleData.value
+ hover: styleData.containsMouse
+ hints: control.styleHints
+ properties: {"headerpos": headerPosition}
+ property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : "";
+ property string headerPosition: control.columnCount === 1 ? "only" :
+ styleData.column === control.columnCount-1 ? "end" :
+ styleData.column === 0 ? "beginning" : ""
+ }
+
+ property Component rowDelegate: BorderImage {
+ visible: styleData.selected || styleData.alternate
+ source: "image://__tablerow/" + (styleData.alternate ? "alternate_" : "")
+ + (styleData.selected ? "selected_" : "")
+ + (styleData.hasActiveFocus ? "active" : "")
+ height: Math.max(16, RowItemSingleton.implicitHeight)
+ border.left: 4 ; border.right: 4
+ }
+
+ property Component itemDelegate: Item {
+ height: Math.max(16, label.implicitHeight)
+ property int implicitWidth: label.implicitWidth + 16
+
+ Text {
+ id: label
+ objectName: "label"
+ width: parent.width
+ anchors.leftMargin: 8
+ font: __styleitem.font
+ anchors.left: parent.left
+ anchors.right: parent.right
+ horizontalAlignment: styleData.textAlignment
+ anchors.verticalCenter: parent.verticalCenter
+ elide: styleData.elideMode
+ text: styleData.value !== undefined ? styleData.value : ""
+ color: styleData.textColor
+ renderType: Text.NativeRendering
+ }
+ }
+}
+
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml
new file mode 100644
index 0000000000..3f2904a350
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+ScrollViewStyle {
+ property font font: __styleitem.font
+ property color textColor: __styleitem.textColor
+ property color selectionColor: __syspal.highlight
+ property color selectedTextColor: __syspal.highlightedText
+ property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
+
+ property StyleItem __styleitem: StyleItem{
+ property color textColor: styleHint("textColor")
+ elementType: "edit"
+ visible: false
+ active: control.activeFocus
+ onActiveChanged: textColor = styleHint("textColor")
+ }
+
+ property int renderType: Text.NativeRendering
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml
new file mode 100644
index 0000000000..0ca0d743d6
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property int renderType: Text.NativeRendering
+
+ property Component panel: StyleItem {
+ id: textfieldstyle
+ elementType: "edit"
+ anchors.fill: parent
+
+ sunken: true
+ hasFocus: control.activeFocus
+ hover: hovered
+ hints: control.styleHints
+
+ SystemPalette {
+ id: syspal
+ colorGroup: control.enabled ?
+ SystemPalette.Active :
+ SystemPalette.Disabled
+ }
+
+ property color textColor: syspal.text
+ property color placeholderTextColor: "darkGray"
+ property color selectionColor: syspal.highlight
+ property color selectedTextColor: syspal.highlightedText
+
+
+ property bool rounded: !!hints["rounded"]
+ property int topMargin: style === "mac" ? 3 : 2
+ property int leftMargin: rounded ? 12 : 4
+ property int rightMargin: leftMargin
+ property int bottomMargin: 2
+
+ contentWidth: 100
+ // Form QLineEdit::sizeHint
+ contentHeight: Math.max(control.__contentHeight, 16)
+
+ FocusFrame {
+ anchors.fill: parent
+ visible: textfield.activeFocus && textfieldstyle.styleHint("focuswidget") && !rounded
+ }
+ textureHeight: implicitHeight
+ textureWidth: 32
+ border {top: 8 ; bottom: 8 ; left: 8 ; right: 8}
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml
new file mode 100644
index 0000000000..4f4b451e10
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype StatusBarStyle
+ \internal
+ \inqmlmodule QtQuick.Controls.Styles
+*/
+Style {
+
+ padding.left: 6
+ padding.right: 6
+ padding.top: 1
+ padding.bottom: style.style === "mac" ? 1 : style.style === "fusion" ? 3 : 2
+
+ StyleItem { id: style ; visible: false}
+
+ property Component panel: StyleItem {
+ id: toolbar
+ anchors.fill: parent
+ elementType: "toolbar"
+ textureWidth: 64
+ border {left: 16 ; right: 16}
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml
new file mode 100644
index 0000000000..d690a5775e
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+Style {
+ property Component panel: StyleItem {
+ id: styleitem
+
+ anchors.fill: parent
+ elementType: "toolbutton"
+ on: control.checkable && control.checked
+ sunken: control.pressed
+ raised: !(control.checkable && control.checked) && control.hovered
+ hover: control.hovered
+ hasFocus: control.activeFocus
+ hints: control.styleHints
+ text: control.text
+
+ properties: {
+ "icon": control.__iconAction.__icon,
+ "position": control.__position,
+ "menu" : control.menu !== null
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/qmldir b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/qmldir
new file mode 100644
index 0000000000..ac80635cc2
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/qmldir
@@ -0,0 +1,2 @@
+singleton RowItemSingleton 1.0 RowItemSingleton.qml
+
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/qmldir b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/qmldir
new file mode 100644
index 0000000000..5cd368ac88
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/qmldir
@@ -0,0 +1,17 @@
+module QtQuick.Controls.Styles
+ButtonStyle 1.0 Base/ButtonStyle.qml
+BusyIndicatorStyle 1.1 Base/BusyIndicatorStyle.qml
+CheckBoxStyle 1.0 Base/CheckBoxStyle.qml
+ComboBoxStyle 1.0 Base/ComboBoxStyle.qml
+ProgressBarStyle 1.0 Base/ProgressBarStyle.qml
+RadioButtonStyle 1.0 Base/RadioButtonStyle.qml
+ScrollViewStyle 1.0 Base/ScrollViewStyle.qml
+SliderStyle 1.0 Base/SliderStyle.qml
+SpinBoxStyle 1.1 Base/SpinBoxStyle.qml
+SwitchStyle 1.1 Base/SwitchStyle.qml
+TabViewStyle 1.0 Base/TabViewStyle.qml
+TableViewStyle 1.0 Base/TableViewStyle.qml
+TextAreaStyle 1.1 Base/TextAreaStyle.qml
+TextFieldStyle 1.0 Base/TextFieldStyle.qml
+ToolBarStyle 1.0 Base/ToolBarStyle.qml
+StatusBarStyle 1.0 Base/StatusBarStyle.qml
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Switch.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Switch.qml
new file mode 100644
index 0000000000..bed46a8449
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Switch.qml
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype Switch
+ \inqmlmodule QtQuick.Controls
+ \since 5.2
+ \ingroup controls
+ \brief A switch.
+
+ A Switch is an option button that can be switched on (checked) or off
+ (unchecked). Switches are typically used to represent features in an
+ application that can be enabled or disabled without affecting others.
+
+ On mobile platforms, switches are commonly used to enable or disable
+ features.
+
+ \qml
+ Column {
+ Switch { checked: true }
+ Switch { checked: false }
+ }
+ \endqml
+
+ You can create a custom appearance for a Switch by
+ assigning a \l {QtQuick.Controls.Styles::SwitchStyle}{SwitchStyle}.
+*/
+
+Control {
+ id: root
+
+ /*!
+ This property is \c true if the control is checked.
+ The default value is \c false.
+ */
+ property bool checked: false
+
+ /*!
+ This property is \c true if the control takes the focus when it is
+ pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be
+ called on the control.
+ */
+ property bool activeFocusOnPress: false
+
+ /*!
+ This property stores the ExclusiveGroup that the control belongs to.
+ */
+ property ExclusiveGroup exclusiveGroup: null
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat)
+ checked = !checked;
+ }
+
+ /*! \internal */
+ onExclusiveGroupChanged: {
+ if (exclusiveGroup)
+ exclusiveGroup.bindCheckable(root)
+ }
+
+ MouseArea {
+ id: internal
+
+ property Item handle: __panel ? __panel.__handle : null
+ property int min: __style ? __style.padding.left : 0
+ property int max: handle.parent.width - (handle ? handle.width : 0) -
+ ( __style ? __style.padding.right : 0)
+ focus: true
+ anchors.fill: parent
+ drag.threshold: 0
+ drag.target: handle
+ drag.axis: Drag.XAxis
+ drag.minimumX: min
+ drag.maximumX: max
+
+ onPressed: {
+ if (activeFocusOnPress)
+ root.forceActiveFocus()
+ }
+
+ onReleased: {
+ if (drag.active) {
+ checked = (handle.x < max/2) ? false : true;
+ internal.handle.x = checked ? internal.max : internal.min
+ } else {
+ checked = (handle.x === max) ? false : true
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ internal.handle.x = checked ? internal.max : internal.min
+ __panel.enableAnimation = true
+ }
+
+ onCheckedChanged: {
+ if (internal.handle)
+ internal.handle.x = checked ? internal.max : internal.min
+ }
+
+ activeFocusOnTab: true
+ Accessible.role: Accessible.CheckBox
+ Accessible.name: "switch"
+
+ /*!
+ The style that should be applied to the switch. Custom style
+ components can be created with:
+
+ \codeline Qt.createComponent("path/to/style.qml", switchId);
+ */
+ style: Qt.createComponent(Settings.style + "/SwitchStyle.qml", root)
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Tab.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Tab.qml
new file mode 100644
index 0000000000..cfd757c972
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Tab.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+/*!
+ \qmltype Tab
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup viewaddons
+ \brief Tab represents the content of a tab in a TabView.
+
+ A Tab item inherits from Loader and provides a similar
+ api.
+*/
+
+Loader {
+ id: tab
+ anchors.fill: parent
+
+ /*! This property holds the title of the tab. */
+ property string title
+
+ /*! \internal */
+ property bool __inserted: false
+
+ Accessible.role: Accessible.LayeredPane
+ active: false
+ visible: false
+
+ activeFocusOnTab: false
+
+ onVisibleChanged: if (visible) active = true
+
+ /*! \internal */
+ default property alias component: tab.sourceComponent
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TabView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TabView.qml
new file mode 100644
index 0000000000..e20bcf224f
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TabView.qml
@@ -0,0 +1,270 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TabView
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup views
+ \brief A control that allows the user to select one of multiple stacked items.
+
+ You can create a custom appearance for a TabView by
+ assigning a \l {QtQuick.Controls.Styles::TabViewStyle}{TabViewStyle}.
+*/
+
+FocusScope {
+ id: root
+
+ implicitWidth: 240
+ implicitHeight: 150
+
+ /*! The current tab index */
+ property int currentIndex: 0
+
+ /*! The current tab count */
+ property int count: 0
+
+ /*! The visibility of the tab frame around contents */
+ property bool frameVisible: true
+
+ /*! The visibility of the tab bar */
+ property bool tabsVisible: true
+
+ /*!
+ \qmlproperty enumeration TabView::tabPosition
+
+ \list
+ \li Qt.TopEdge (default)
+ \li Qt.BottomEdge
+ \endlist
+ */
+ property int tabPosition: Qt.TopEdge
+
+ /*! \internal */
+ default property alias data: stack.data
+
+ /*! Adds a new tab page with title with and optional Component.
+ Returns the newly added tab.
+ */
+ function addTab(title, component) {
+ return insertTab(__tabs.count, title, component)
+ }
+
+ /*! Inserts a new tab with title at index, with an optional Component.
+ Returns the newly added tab.
+ */
+ function insertTab(index, title, component) {
+ // 'loader' parent is a pending workaround while waiting for:
+ // https://codereview.qt-project.org/#change,65788
+ var tab = tabcomp.createObject(loader)
+ tab.sourceComponent = component
+ tab.title = title
+ // insert at appropriate index first, then set the parent to
+ // avoid onChildrenChanged appending it to the end of the list
+ __tabs.insert(index, {tab: tab})
+ tab.__inserted = true
+ tab.parent = stack
+ __setOpacities()
+ return tab
+ }
+
+ /*! Removes and destroys a tab at the given \a index. */
+ function removeTab(index) {
+ var tab = __tabs.get(index).tab
+ __tabs.remove(index, 1)
+ tab.destroy()
+ if (currentIndex > 0)
+ currentIndex--
+ __setOpacities()
+ }
+
+ /*! Moves a tab \a from index \a to another. */
+ function moveTab(from, to) {
+ __tabs.move(from, to, 1)
+
+ if (currentIndex == from) {
+ currentIndex = to
+ } else {
+ var start = Math.min(from, to)
+ var end = Math.max(from, to)
+ if (currentIndex >= start && currentIndex <= end) {
+ if (from < to)
+ --currentIndex
+ else
+ ++currentIndex
+ }
+ }
+ }
+
+ /*! Returns the \l Tab item at \a index. */
+ function getTab(index) {
+ return __tabs.get(index).tab
+ }
+
+ /*! \internal */
+ property ListModel __tabs: ListModel { }
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/TabViewStyle.qml", root)
+
+ /*! \internal */
+ property var __styleItem: loader.item
+
+ onCurrentIndexChanged: __setOpacities()
+
+ /*! \internal */
+ function __setOpacities() {
+ for (var i = 0; i < __tabs.count; ++i) {
+ var child = __tabs.get(i).tab
+ child.visible = (i == currentIndex ? true : false)
+ }
+ count = __tabs.count
+ }
+
+ activeFocusOnTab: false
+
+ Component {
+ id: tabcomp
+ Tab {}
+ }
+
+ TabBar {
+ id: tabbarItem
+ objectName: "tabbar"
+ tabView: root
+ style: loader.item
+ anchors.top: parent.top
+ anchors.left: root.left
+ anchors.right: root.right
+ }
+
+ Loader {
+ id: loader
+ z: tabbarItem.z - 1
+ sourceComponent: style
+ property var __control: root
+ }
+
+ Loader {
+ id: frameLoader
+ z: tabbarItem.z - 1
+
+ anchors.fill: parent
+ anchors.topMargin: tabPosition === Qt.TopEdge && tabbarItem && tabsVisible ? Math.max(0, tabbarItem.height - baseOverlap) : 0
+ anchors.bottomMargin: tabPosition === Qt.BottomEdge && tabbarItem && tabsVisible ? Math.max(0, tabbarItem.height -baseOverlap) : 0
+ sourceComponent: frameVisible && loader.item ? loader.item.frame : null
+
+ property int baseOverlap: __styleItem ? __styleItem.frameOverlap : 0
+
+ Item {
+ id: stack
+
+ anchors.fill: parent
+ anchors.margins: (frameVisible ? frameWidth : 0)
+ anchors.topMargin: anchors.margins + (style =="mac" ? 6 : 0)
+ anchors.bottomMargin: anchors.margins
+
+ property int frameWidth
+ property string style
+ property bool completed: false
+
+ Component.onCompleted: {
+ addTabs(stack.children)
+ completed = true
+ }
+
+ onChildrenChanged: {
+ if (completed)
+ stack.addTabs(stack.children)
+ }
+
+ function addTabs(tabs) {
+ var tabAdded = false
+ for (var i = 0 ; i < tabs.length ; ++i) {
+ var tab = tabs[i]
+ if (!tab.__inserted && tab.Accessible.role === Accessible.LayeredPane) {
+ tab.__inserted = true
+ // reparent tabs created dynamically by createObject(tabView)
+ tab.parent = stack
+ // a dynamically added tab should also get automatically removed when destructed
+ if (completed)
+ tab.Component.onDestruction.connect(stack.onDynamicTabDestroyed.bind(tab))
+ __tabs.append({tab: tab})
+ tabAdded = true
+ }
+ }
+ if (tabAdded)
+ __setOpacities()
+ }
+
+ function onDynamicTabDestroyed() {
+ for (var i = 0; i < __tabs.count; ++i) {
+ if (__tabs.get(i).tab === this) {
+ __tabs.remove(i, 1)
+ __setOpacities()
+ break
+ }
+ }
+ }
+ }
+ onLoaded: { item.z = -1 }
+ }
+
+ onChildrenChanged: stack.addTabs(root.children)
+
+ states: [
+ State {
+ name: "Bottom"
+ when: tabPosition === Qt.BottomEdge && tabbarItem != undefined
+ PropertyChanges {
+ target: tabbarItem
+ anchors.topMargin: -frameLoader.baseOverlap
+ }
+ AnchorChanges {
+ target: tabbarItem
+ anchors.top: frameLoader.bottom
+ }
+ }
+ ]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableView.qml
new file mode 100644
index 0000000000..586f1211df
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableView.qml
@@ -0,0 +1,1016 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+
+/*!
+ \qmltype TableView
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup views
+ \brief Provides a list view with scroll bars, styling and header sections.
+
+ \image tableview.png
+
+ A TableView is similar to \l ListView, and adds scroll bars, selection, and
+ resizable header sections. As with \l ListView, data for each row is provided through a \l model:
+
+ \code
+ ListModel {
+ id: libraryModel
+ ListElement{ title: "A Masterpiece" ; author: "Gabriel" }
+ ListElement{ title: "Brilliance" ; author: "Jens" }
+ ListElement{ title: "Outstanding" ; author: "Frederik" }
+ }
+ \endcode
+
+ You provide title and size of a column header
+ by adding a \l TableViewColumn as demonstrated below.
+ \code
+
+ TableView {
+ TableViewColumn{ role: "title" ; title: "Title" ; width: 100 }
+ TableViewColumn{ role: "author" ; title: "Author" ; width: 200 }
+ model: libraryModel
+ }
+ \endcode
+
+ The header sections are attached to values in the \l model by defining
+ the model role they attach to. Each property in the model will
+ then be shown in their corresponding column.
+
+ You can customize the look by overriding the \l itemDelegate,
+ \l rowDelegate, or \l headerDelegate properties.
+
+ The view itself does not provide sorting. This has to
+ be done on the model itself. However you can provide sorting
+ on the model, and enable sort indicators on headers.
+
+\list
+ \li int sortIndicatorColumn - The index of the current sort column
+ \li bool sortIndicatorVisible - Whether the sort indicator should be enabled
+ \li enum sortIndicatorOrder - Qt.AscendingOrder or Qt.DescendingOrder depending on state
+\endlist
+
+ You can create a custom appearance for a TableView by
+ assigning a \l {QtQuick.Controls.Styles::TableViewStyle}{TableViewStyle}.
+*/
+
+ScrollView {
+ id: root
+
+ /*! \qmlproperty model TableView::model
+ This property holds the model providing data for the table view.
+
+ The model provides the set of data that is used to create the items in the view.
+ Models can be created directly in QML using ListModel, XmlListModel or VisualItemModel,
+ or provided by C++ model classes. \sa ListView::model
+
+ Example model:
+
+ \code
+ model: ListModel {
+ ListElement{ column1: "value 1" ; column2: "value 2" }
+ ListElement{ column1: "value 3" ; column2: "value 4" }
+ }
+ \endcode
+ \sa {qml-data-models}{Data Models}
+ */
+ property var model
+
+ /*! This property is set to \c true if the view alternates the row color.
+ The default value is \c true. */
+ property bool alternatingRowColors: true
+
+ /*! This property determines if the header is visible.
+ The default value is \c true. */
+ property bool headerVisible: true
+
+ /*! \qmlproperty bool TableView::backgroundVisible
+
+ This property determines if the background should be filled or not.
+
+ The default value is \c true.
+
+ \note The rowDelegate is not affected by this property
+ */
+ property alias backgroundVisible: colorRect.visible
+
+ /*! This property defines a delegate to draw a specific cell.
+
+ In the item delegate you have access to the following special properties:
+ \list
+ \li styleData.selected - if the item is currently selected
+ \li styleData.value - the value or text for this item
+ \li styleData.textColor - the default text color for an item
+ \li styleData.row - the index of the row
+ \li styleData.column - the index of the column
+ \li styleData.elideMode - the elide mode of the column
+ \li styleData.textAlignment - the horizontal text alignment of the column
+ \endlist
+
+ Example:
+ \code
+ itemDelegate: Item {
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ color: styleData.textColor
+ elide: styleData.elideMode
+ text: styleData.value
+ }
+ }
+ \endcode */
+ property Component itemDelegate: __style ? __style.itemDelegate : null
+
+ /*! This property defines a delegate to draw a row.
+
+ In the row delegate you have access to the following special properties:
+ \list
+ \li styleData.alternate - true when the row uses the alternate background color
+ \li styleData.selected - true when the row is currently selected
+ \li styleData.row - the index of the row
+ \endlist
+ */
+ property Component rowDelegate: __style ? __style.rowDelegate : null
+
+ /*! This property defines a delegate to draw a header.
+
+ In the header delegate you have access to the following special properties:
+ \list
+ \li styleData.value - the value or text for this item
+ \li styleData.column - the index of the column
+ \li styleData.pressed - true when the column is being pressed
+ \li styleData.containsMouse - true when the column is under the mouse
+ \li styleData.textAlignment - the horizontal text alignment of the column (since QtQuickControls 1.1)
+ \endlist
+ */
+ property Component headerDelegate: __style ? __style.headerDelegate : null
+
+ /*! Index of the current sort column.
+ The default value is \c {0}. */
+ property int sortIndicatorColumn
+
+ /*! This property shows or hides the sort indicator
+ The default value is \c false.
+ \note The view itself does not sort the data. */
+ property bool sortIndicatorVisible: false
+
+ /*!
+ \qmlproperty enumeration TableView::sortIndicatorOrder
+
+ This sets the sorting order of the sort indicator
+ The allowed values are:
+ \list
+ \li Qt.AscendingOrder - the default
+ \li Qt.DescendingOrder
+ \endlist
+ */
+ property int sortIndicatorOrder: Qt.AscendingOrder
+
+ /*! \internal */
+ default property alias __columns: root.data
+
+ /*! \qmlproperty Component TableView::contentHeader
+ This is the content header of the TableView */
+ property alias contentHeader: listView.header
+
+ /*! \qmlproperty Component TableView::contentFooter
+ This is the content footer of the TableView */
+ property alias contentFooter: listView.footer
+
+ /*! \qmlproperty int TableView::rowCount
+ The current number of rows */
+ readonly property alias rowCount: listView.count
+
+ /*! \qmlproperty int TableView::columnCount
+ The current number of columns */
+ readonly property alias columnCount: columnModel.count
+
+ /*! \qmlproperty string TableView::section.property
+ \qmlproperty enumeration TableView::section.criteria
+ \qmlproperty Component TableView::section.delegate
+ \qmlproperty enumeration TableView::section.labelPositioning
+ These properties determine the section labels.
+ \sa ListView::section */
+ property alias section: listView.section
+
+ /*! \qmlproperty int TableView::currentRow
+ The current row index of the view.
+ The default value is \c -1 to indicate that no row is selected.
+ */
+ property alias currentRow: listView.currentIndex
+
+ /*! \internal */
+ property alias __currentRowItem: listView.currentItem
+
+ /*! \qmlsignal TableView::activated(int row)
+
+ Emitted when the user activates an item by mouse or keyboard interaction.
+ Mouse activation is triggered by single- or double-clicking, depending on the platform.
+
+ \a row int provides access to the activated row index.
+
+ \note This signal is only emitted for mouse interaction that is not blocked in the row or item delegate.
+ */
+ signal activated(int row)
+
+ /*! \qmlsignal TableView::clicked(int row)
+
+ Emitted when the user clicks a valid row by single clicking
+
+ \a row int provides access to the clicked row index.
+
+ \note This signal is only emitted if the row or item delegate does not accept mouse events.
+ */
+ signal clicked(int row)
+
+ /*! \qmlsignal TableView::doubleClicked(int row)
+
+ Emitted when the user double clicks a valid row.
+
+ \a row int provides access to the clicked row index.
+
+ \note This signal is only emitted if the row or item delegate does not accept mouse events.
+ */
+ signal doubleClicked(int row)
+
+ /*!
+ \qmlmethod TableView::positionViewAtRow( int row, PositionMode mode )
+
+ Positions the view such that the specified \a row is at the position defined by \a mode:
+ \list
+ \li ListView.Beginning - position item at the top of the view.
+ \li ListView.Center - position item in the center of the view.
+ \li ListView.End - position item at bottom of the view.
+ \li ListView.Visible - if any part of the item is visible then take no action, otherwise bring the item into view.
+ \li ListView.Contain - ensure the entire item is visible. If the item is larger than the view the item is positioned
+ at the top of the view.
+ \endlist
+
+ If positioning the \a row creates an empty space at the beginning
+ or end of the view, then the view is positioned at the boundary.
+
+ For example, to position the view at the end at startup:
+
+ \code
+ Component.onCompleted: table.positionViewAtRow(rowCount -1, ListView.Contain)
+ \endcode
+
+ Depending on how the model is populated, the model may not be ready when
+ TableView Component.onCompleted is called. In that case you may need to
+ delay the call to positionViewAtRow by using a \l {QtQml::Timer}{Timer}.
+
+ \note This method should only be called after the component has completed.
+ */
+
+ function positionViewAtRow(row, mode) {
+ listView.positionViewAtIndex(row, mode)
+ }
+
+ /*!
+ \qmlmethod int TableView::rowAt( int x, int y )
+
+ Returns the index of the visible row at the point \a x, \a y in content
+ coordinates. If there is no visible row at the point specified, \c -1 is returned.
+
+ \note This method should only be called after the component has completed.
+ */
+
+ function rowAt(x, y) {
+ var obj = root.mapToItem(listView.contentItem, x, y)
+ return listView.indexAt(obj.x, obj.y)
+ }
+
+ /*! Adds a \a column and returns the added column.
+
+ The \a column argument can be an instance of TableViewColumn,
+ or a Component. The component has to contain a TableViewColumn.
+ Otherwise \c null is returned.
+ */
+ function addColumn(column) {
+ return insertColumn(columnCount, column)
+ }
+
+ /*! Inserts a \a column at the given \a index and returns the inserted column.
+
+ The \a column argument can be an instance of TableViewColumn,
+ or a Component. The component has to contain a TableViewColumn.
+ Otherwise \c null is returned.
+ */
+ function insertColumn(index, column) {
+ var object = column
+ if (typeof column['createObject'] === 'function')
+ object = column.createObject(root)
+
+ else if (object.__view) {
+ console.warn("TableView::insertColumn(): you cannot add a column to multiple views")
+ return null
+ }
+ if (index >= 0 && index <= columnCount && object.Accessible.role === Accessible.ColumnHeader) {
+ object.__view = root
+ columnModel.insert(index, {columnItem: object})
+ return object
+ }
+
+ if (object !== column)
+ object.destroy()
+ console.warn("TableView::insertColumn(): invalid argument")
+ return null
+ }
+
+ /*! Removes and destroys a column at the given \a index. */
+ function removeColumn(index) {
+ if (index < 0 || index >= columnCount) {
+ console.warn("TableView::removeColumn(): invalid argument")
+ return
+ }
+ var column = columnModel.get(index).columnItem
+ columnModel.remove(index, 1)
+ column.destroy()
+ }
+
+ /*! Moves a column \a from index \a to another. */
+ function moveColumn(from, to) {
+ if (from < 0 || from >= columnCount || to < 0 || to >= columnCount) {
+ console.warn("TableView::moveColumn(): invalid argument")
+ return
+ }
+ columnModel.move(from, to, 1)
+ }
+
+ /*! Returns the column at the given \a index
+ or \c null if the \a index is invalid. */
+ function getColumn(index) {
+ if (index < 0 || index >= columnCount)
+ return null
+ return columnModel.get(index).columnItem
+ }
+
+ /*! \qmlproperty Selection TableView::selection
+ \since QtQuick.Controls 1.1
+
+ This property contains the current row-selection of the \l TableView.
+ The selection allows you to select, deselect or iterate over selected rows.
+
+ \list
+ \li function \b clear() - deselects all rows
+ \li function \b selectAll() - selects all rows
+ \li function \b select(from, to) - select a range
+ \li functton \b deselect(from, to) - de-selects a range
+ \li function \b forEach(callback) - Allows you to iterate over selected rows
+ \li function \b contains(index) - Allows you to iterate over selected rows
+ \li signal \b selectionChanged() - The current row selection changed
+ \li readonly property int \b count - The number of selected rows
+ \endlist
+
+ \b Example:
+ \code
+ tableview.selection.select(0) // select row index 0
+
+ tableview.selection.select(1, 3) // select row indexes 1, 2 and 3
+
+ tableview.selection.deselect(0, 1) // deselects row index 0 and 1
+
+ tableview.selection.deselect(2) // deselects row index 2
+ \endcode
+
+ \b Example: To iterate over selected indexes, you can pass a callback function.
+ \a rowIndex is passed as as an argument to the callback function.
+ \code
+ tableview.selection.forEach( function(rowIndex) {console.log(rowIndex)} )
+ \endcode
+
+ */
+
+ readonly property alias selection: selectionObject
+
+ /*!
+ \qmlproperty enumeration TableView::selectionMode
+ \since QtQuick.Controls 1.1
+
+ This enum indicates how the view responds to user selections:
+
+ The possible modes are:
+
+ \list
+
+ \li SelectionMode.NoSelection - Items cannot be selected.
+
+ \li SelectionMode.SingleSelection - When the user selects an item,
+ any already-selected item becomes unselected, and the user cannot
+ unselect the selected item. (Default)
+
+ \li SelectionMode.MultiSelection - When the user selects an item in the usual way,
+ the selection status of that item is toggled and the other items are left alone.
+
+ \li SelectionMode.ExtendedSelection - When the user selects an item in the usual way,
+ the selection is cleared and the new item selected. However, if the user presses the
+ Ctrl key when clicking on an item, the clicked item gets toggled and all other items
+ are left untouched. If the user presses the Shift key while clicking
+ on an item, all items between the current item and the clicked item are selected or unselected,
+ depending on the state of the clicked item. Multiple items can be selected by dragging the
+ mouse over them.
+
+ \li SelectionMode.ContiguousSelection - When the user selects an item in the usual way,
+ the selection is cleared and the new item selected. However, if the user presses the Shift key while
+ clicking on an item, all items between the current item and the clicked item are selected.
+
+ \endlist
+ */
+ property int selectionMode: SelectionMode.SingleSelection
+
+ Component.onCompleted: {
+ for (var i = 0; i < __columns.length; ++i) {
+ var column = __columns[i]
+ if (column.Accessible.role === Accessible.ColumnHeader)
+ addColumn(column)
+ }
+ }
+
+ style: Qt.createComponent(Settings.style + "/TableViewStyle.qml", root)
+
+
+ Accessible.role: Accessible.Table
+
+ implicitWidth: 200
+ implicitHeight: 150
+
+ frameVisible: true
+ __scrollBarTopMargin: (__style && __style.transientScrollBars || Qt.platform.os === "osx") ? headerrow.height : 0
+ __viewTopMargin: headerrow.height
+
+ /*! \internal */
+ property bool __activateItemOnSingleClick: __style ? __style.activateItemOnSingleClick : false
+
+ /*! \internal */
+ function __decrementCurrentIndex() {
+ __scroller.blockUpdates = true;
+ listView.decrementCurrentIndex();
+ __scroller.blockUpdates = false;
+
+ var newIndex = listView.indexAt(0, listView.contentY)
+ if (newIndex !== -1) {
+ if (selectionMode > SelectionMode.SingleSelection)
+ mousearea.dragRow = newIndex
+ else if (selectionMode === SelectionMode.SingleSelection)
+ selection.__selectOne(newIndex)
+ }
+ }
+
+ /*! \internal */
+ function __incrementCurrentIndex() {
+ __scroller.blockUpdates = true;
+ listView.incrementCurrentIndex();
+ __scroller.blockUpdates = false;
+
+ var newIndex = Math.max(0, listView.indexAt(0, listView.height + listView.contentY))
+ if (newIndex !== -1) {
+ if (selectionMode > SelectionMode.SingleSelection)
+ mousearea.dragRow = newIndex
+ else if (selectionMode === SelectionMode.SingleSelection)
+ selection.__selectOne(newIndex)
+ }
+ }
+
+ onModelChanged: selection.clear()
+
+ ListView {
+ id: listView
+ focus: true
+ activeFocusOnTab: true
+ anchors.topMargin: tableHeader.height
+ anchors.fill: parent
+ currentIndex: -1
+ visible: columnCount > 0
+ interactive: Settings.hasTouchScreen
+
+ SystemPalette {
+ id: palette
+ colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled
+ }
+
+ Rectangle {
+ id: colorRect
+ parent: viewport
+ anchors.fill: parent
+ color: __style ? __style.backgroundColor : palette.base
+ z: -2
+ }
+
+ MouseArea {
+ id: mousearea
+
+ z: -1
+ anchors.fill: listView
+ propagateComposedEvents: true
+
+ property bool autoincrement: false
+ property bool autodecrement: false
+ property int mouseModifiers: 0
+ property int previousRow: 0
+ property int clickedRow: -1
+ property int dragRow: -1
+ property int firstKeyRow: -1
+
+ onReleased: {
+ autoincrement = false
+ autodecrement = false
+ var clickIndex = listView.indexAt(0, mouseY + listView.contentY)
+ if (clickIndex > -1) {
+ if (Settings.hasTouchScreen) {
+ listView.currentIndex = clickIndex
+ mouseSelect(clickIndex, mouse.modifiers)
+ }
+ previousRow = clickIndex
+ }
+
+ if (mousearea.dragRow >= 0) {
+ selection.__select(selection.contains(mousearea.clickedRow), mousearea.clickedRow, mousearea.dragRow)
+ mousearea.dragRow = -1
+ }
+ }
+
+ // Handle vertical scrolling whem dragging mouse outside boundraries
+ Timer { running: mousearea.autoincrement && __verticalScrollBar.visible; repeat: true; interval: 20 ; onTriggered: __incrementCurrentIndex()}
+ Timer { running: mousearea.autodecrement && __verticalScrollBar.visible; repeat: true; interval: 20 ; onTriggered: __decrementCurrentIndex()}
+
+ onPositionChanged: {
+ if (mouseY > listView.height && pressed) {
+ if (autoincrement) return;
+ autodecrement = false;
+ autoincrement = true;
+ } else if (mouseY < 0 && pressed) {
+ if (autodecrement) return;
+ autoincrement = false;
+ autodecrement = true;
+ } else {
+ autoincrement = false;
+ autodecrement = false;
+ }
+
+ if (pressed && !Settings.hasTouchScreen) {
+ var newIndex = Math.max(0, listView.indexAt(0, mouseY + listView.contentY))
+ if (newIndex >= 0 && newIndex != currentRow) {
+ listView.currentIndex = newIndex;
+ if (selectionMode === SelectionMode.SingleSelection) {
+ selection.__selectOne(newIndex)
+ } else if (selectionMode > 1) {
+ dragRow = newIndex
+ }
+ }
+ }
+ mouseModifiers = mouse.modifiers
+ }
+
+ onClicked: {
+ var clickIndex = listView.indexAt(0, mouseY + listView.contentY)
+ if (clickIndex > -1) {
+ if (root.__activateItemOnSingleClick)
+ root.activated(clickIndex)
+ root.clicked(clickIndex)
+ }
+ }
+
+ onPressed: {
+ var newIndex = listView.indexAt(0, mouseY + listView.contentY)
+ listView.forceActiveFocus()
+ if (newIndex > -1 && !Settings.hasTouchScreen) {
+ listView.currentIndex = newIndex
+ mouseSelect(newIndex, mouse.modifiers)
+ mousearea.clickedRow = newIndex
+ }
+ mouseModifiers = mouse.modifiers
+ }
+
+ function mouseSelect(index, modifiers) {
+ if (selectionMode) {
+ if (modifiers & Qt.ShiftModifier && (selectionMode === SelectionMode.ExtendedSelection)) {
+ selection.select(previousRow, index)
+ } else if (selectionMode === SelectionMode.MultiSelection ||
+ (selectionMode === SelectionMode.ExtendedSelection && modifiers & Qt.ControlModifier)) {
+ selection.__select(!selection.contains(index) , index)
+ } else {
+ selection.__selectOne(index)
+ }
+ }
+ }
+
+ onDoubleClicked: {
+ var clickIndex = listView.indexAt(0, mouseY + listView.contentY)
+ if (clickIndex > -1) {
+ if (!root.__activateItemOnSingleClick)
+ root.activated(clickIndex)
+ root.doubleClicked(clickIndex)
+ }
+ }
+
+ // Note: with boolean preventStealing we are keeping the flickable from
+ // eating our mouse press events
+ preventStealing: !Settings.hasTouchScreen
+
+ TableViewSelection { id: selectionObject }
+ }
+
+ // Fills extra rows with alternate color
+ Column {
+ id: rowfiller
+ Loader {
+ id: rowSizeItem
+ sourceComponent: root.rowDelegate
+ visible: false
+ property QtObject styleData: QtObject {
+ property bool alternate: false
+ property bool selected: false
+ property bool hasActiveFocus: false
+ }
+ }
+ property int rowHeight: rowSizeItem.implicitHeight
+ property int paddedRowCount: height/rowHeight
+ property int count: listView.count
+ y: listView.contentHeight
+ width: parent.width
+ visible: alternatingRowColors
+ height: viewport.height - listView.contentHeight
+ Repeater {
+ model: visible ? parent.paddedRowCount : 0
+ Loader {
+ width: rowfiller.width
+ height: rowfiller.rowHeight
+ sourceComponent: root.rowDelegate
+ property QtObject styleData: QtObject {
+ readonly property bool alternate: (index + rowCount) % 2 === 1
+ readonly property bool selected: false
+ readonly property bool hasActiveFocus: root.activeFocus
+ }
+ readonly property var model: listView.model
+ readonly property var modelData: null
+ }
+ }
+ }
+
+ ListModel {
+ id: columnModel
+ }
+
+ highlightFollowsCurrentItem: true
+ model: root.model
+
+ function keySelect(shiftPressed, row) {
+ if (row < 0 || row === rowCount - 1)
+ return
+ if (shiftPressed && (selectionMode >= SelectionMode.ExtendedSelection)) {
+ selection.__ranges = new Array()
+ selection.select(mousearea.firstKeyRow, row)
+ } else {
+ selection.__selectOne(row)
+ }
+ }
+
+ Keys.onUpPressed: {
+ event.accepted = false
+ __scroller.blockUpdates = true;
+ listView.decrementCurrentIndex();
+ __scroller.blockUpdates = false;
+ if (selectionMode)
+ keySelect(event.modifiers & Qt.ShiftModifier, currentRow)
+ }
+
+ Keys.onDownPressed: {
+ event.accepted = false
+ __scroller.blockUpdates = true;
+ listView.incrementCurrentIndex();
+ __scroller.blockUpdates = false;
+ if (selectionMode)
+ keySelect(event.modifiers & Qt.ShiftModifier, currentRow)
+ }
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_PageUp) {
+ __verticalScrollBar.value = __verticalScrollBar.value - listView.height
+ } else if (event.key === Qt.Key_PageDown)
+ __verticalScrollBar.value = __verticalScrollBar.value + listView.height
+
+ if (event.key === Qt.Key_Shift) {
+ mousearea.firstKeyRow = currentRow
+ }
+
+ if (event.key === Qt.Key_A && event.modifiers & Qt.ControlModifier) {
+ if (selectionMode > 1)
+ selection.selectAll()
+ }
+ }
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Shift)
+ mousearea.firstKeyRow = -1
+ }
+
+ Keys.onReturnPressed: {
+ event.accepted = false
+ if (currentRow > -1)
+ root.activated(currentRow);
+ }
+
+ delegate: FocusScope {
+ id: rowitem
+ width: itemrow.width
+ height: rowstyle.height
+
+ function selected() {
+ if (mousearea.dragRow > -1 && (rowIndex >= mousearea.clickedRow && rowIndex <= mousearea.dragRow
+ || rowIndex <= mousearea.clickedRow && rowIndex >=mousearea.dragRow))
+ return selection.contains(mousearea.clickedRow)
+
+ return selection.count && selection.contains(rowIndex)
+ }
+ readonly property int rowIndex: model.index
+ readonly property bool alternate: alternatingRowColors && rowIndex % 2 == 1
+ readonly property var itemModelData: typeof modelData == "undefined" ? null : modelData
+ readonly property var itemModel: model
+ readonly property bool itemSelected: selected()
+ readonly property color itemTextColor: itemSelected ? __style.highlightedTextColor : __style.textColor
+
+ onActiveFocusChanged: {
+ if (activeFocus)
+ listView.currentIndex = rowIndex
+ }
+
+ Loader {
+ id: rowstyle
+ // row delegate
+ sourceComponent: root.rowDelegate
+ // Row fills the view width regardless of item size
+ // But scrollbar should not adjust to it
+ height: item ? item.height : 16
+ width: parent.width + __horizontalScrollBar.width
+ x: listView.contentX
+
+ // these properties are exposed to the row delegate
+ // Note: these properties should be mirrored in the row filler as well
+ property QtObject styleData: QtObject {
+ readonly property int row: rowitem.rowIndex
+ readonly property bool alternate: rowitem.alternate
+ readonly property bool selected: rowitem.itemSelected
+ readonly property bool hasActiveFocus: root.activeFocus
+ }
+ readonly property var model: listView.model
+ readonly property var modelData: rowitem.itemModelData
+ }
+ Row {
+ id: itemrow
+ height: parent.height
+ Repeater {
+ id: repeater
+ model: columnModel
+
+ Loader {
+ id: itemDelegateLoader
+ width: columnItem.width
+ height: parent ? parent.height : 0
+ visible: columnItem.visible
+ sourceComponent: columnItem.delegate ? columnItem.delegate : itemDelegate
+
+ // these properties are exposed to the item delegate
+ readonly property var model: listView.model
+ readonly property var modelData: itemModelData
+
+ property QtObject styleData: QtObject {
+ readonly property int row: rowitem.rowIndex
+ readonly property int column: index
+ readonly property int elideMode: columnItem.elideMode
+ readonly property int textAlignment: columnItem.horizontalAlignment
+ readonly property bool selected: rowitem.itemSelected
+ readonly property color textColor: rowitem.itemTextColor
+ readonly property string role: columnItem.role
+ readonly property var value: itemModel.hasOwnProperty(role)
+ ? itemModel[role] // Qml ListModel and QAbstractItemModel
+ : modelData && modelData.hasOwnProperty(role)
+ ? modelData[role] // QObjectList / QObject
+ : modelData != undefined ? modelData : "" // Models without role
+ }
+ }
+ }
+ onWidthChanged: listView.contentWidth = width
+ }
+ }
+
+ Text{ id:text }
+
+ Item {
+ id: tableHeader
+ clip: true
+ parent: __scroller
+ visible: headerVisible
+ anchors.top: parent.top
+ anchors.topMargin: viewport.anchors.topMargin
+ anchors.leftMargin: viewport.anchors.leftMargin
+ anchors.margins: viewport.anchors.margins
+ anchors.rightMargin: (frameVisible ? __scroller.rightMargin : 0) +
+ (__scroller.outerFrame && __scrollBarTopMargin ? 0 : __verticalScrollBar.width
+ + __scroller.scrollBarSpacing + root.__style.padding.right)
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ height: headerrow.height
+
+ Row {
+ id: headerrow
+ x: -listView.contentX
+
+ Repeater {
+ id: repeater
+
+ property int targetIndex: -1
+ property int dragIndex: -1
+
+ model: columnModel
+
+ delegate: Item {
+ z:-index
+ width: columnCount == 1 ? viewport.width + __verticalScrollBar.width : modelData.width
+ visible: modelData.visible
+ height: headerVisible ? headerStyle.height : 0
+
+ Loader {
+ id: headerStyle
+ sourceComponent: root.headerDelegate
+ anchors.left: parent.left
+ anchors.right: parent.right
+ property QtObject styleData: QtObject {
+ readonly property string value: modelData.title
+ readonly property bool pressed: headerClickArea.pressed
+ readonly property bool containsMouse: headerClickArea.containsMouse
+ readonly property int column: index
+ readonly property int textAlignment: modelData.horizontalAlignment
+ }
+ }
+ Rectangle{
+ id: targetmark
+ width: parent.width
+ height:parent.height
+ opacity: (index == repeater.targetIndex && repeater.targetIndex != repeater.dragIndex) ? 0.5 : 0
+ Behavior on opacity { NumberAnimation{duration:160}}
+ color: palette.highlight
+ visible: modelData.movable
+ }
+
+ MouseArea{
+ id: headerClickArea
+ drag.axis: Qt.YAxis
+ hoverEnabled: true
+ anchors.fill: parent
+ onClicked: {
+ if (sortIndicatorColumn == index)
+ sortIndicatorOrder = sortIndicatorOrder == Qt.AscendingOrder ? Qt.DescendingOrder : Qt.AscendingOrder
+ sortIndicatorColumn = index
+ }
+ // Here we handle moving header sections
+ // NOTE: the direction is different from the master branch
+ // so this indicates that I am using an invalid assumption on item ordering
+ onPositionChanged: {
+ if (modelData.movable && pressed && columnCount > 1) { // only do this while dragging
+ for (var h = columnCount-1 ; h >= 0 ; --h) {
+ if (drag.target.x > headerrow.children[h].x) {
+ repeater.targetIndex = h
+ break
+ }
+ }
+ }
+ }
+
+ onPressed: {
+ repeater.dragIndex = index
+ draghandle.x = parent.x
+ }
+
+ onReleased: {
+ if (repeater.targetIndex >= 0 && repeater.targetIndex != index ) {
+ var targetColumn = columnModel.get(repeater.targetIndex).columnItem
+ if (targetColumn.movable) {
+ columnModel.move(index, repeater.targetIndex, 1)
+ if (sortIndicatorColumn == index)
+ sortIndicatorColumn = repeater.targetIndex
+ }
+ }
+ repeater.targetIndex = -1
+ }
+ drag.maximumX: 1000
+ drag.minimumX: -1000
+ drag.target: modelData.movable && columnCount > 1 ? draghandle : null
+ }
+
+ Loader {
+ id: draghandle
+ property QtObject styleData: QtObject{
+ readonly property string value: modelData.title
+ readonly property bool pressed: headerClickArea.pressed
+ readonly property bool containsMouse: headerClickArea.containsMouse
+ readonly property int column: index
+ readonly property int textAlignment: modelData.horizontalAlignment
+ }
+
+ parent: tableHeader
+ width: modelData.width
+ height: parent.height
+ sourceComponent: root.headerDelegate
+ visible: headerClickArea.pressed
+ opacity: 0.5
+ }
+
+
+ MouseArea {
+ id: headerResizeHandle
+ property int offset: 0
+ property int minimumSize: 20
+ anchors.rightMargin: -width/2
+ width: 16 ; height: parent.height
+ anchors.right: parent.right
+ enabled: modelData.resizable && columnCount > 1
+ onPositionChanged: {
+ var newHeaderWidth = modelData.width + (mouseX - offset)
+ modelData.width = Math.max(minimumSize, newHeaderWidth)
+ }
+ property bool found:false
+
+ onDoubleClicked: {
+ var row
+ var minWidth = 0
+ var listdata = listView.children[0]
+ for (row = 0 ; row < listdata.children.length ; ++row){
+ var item = listdata.children[row+1]
+ if (item && item.children[1] && item.children[1].children[index] &&
+ item.children[1].children[index].children[0].hasOwnProperty("implicitWidth"))
+ minWidth = Math.max(minWidth, item.children[1].children[index].children[0].implicitWidth)
+ }
+ if (minWidth)
+ modelData.width = minWidth
+ }
+ onPressedChanged: if (pressed) offset=mouseX
+ cursorShape: enabled ? Qt.SplitHCursor : Qt.ArrowCursor
+ }
+ }
+ }
+ }
+ Loader {
+ id: loader
+ property QtObject styleData: QtObject{
+ readonly property string value: ""
+ readonly property bool pressed: false
+ readonly property bool containsMouse: false
+ readonly property int column: -1
+ readonly property int textAlignment: Text.AlignLeft
+ }
+
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: headerrow.bottom
+ anchors.rightMargin: -2
+ sourceComponent: root.headerDelegate
+ width: root.width - headerrow.width + 2
+ visible: root.columnCount
+ z:-1
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableViewColumn.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableViewColumn.qml
new file mode 100644
index 0000000000..cbf2094563
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableViewColumn.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+/*!
+ \qmltype TableViewColumn
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup viewitems
+ \brief Used to define columns in a \l TableView.
+*/
+
+QtObject {
+
+ /*! \internal */
+ property Item __view: null
+
+ /*! The title text of the column. */
+ property string title
+
+ /*! The model \c role of the column. */
+ property string role
+
+ /*! The current width of the column
+ The default value depends on platform. If only one
+ column is defined, the width expands to the viewport.
+ */
+ property int width: (__view && __view.columnCount === 1) ? __view.viewport.width : 160
+
+ /*! The visible status of the column. */
+ property bool visible: true
+
+ /*! Determines if the column should be resizable.
+ \since QtQuick.Controls 1.1 */
+ property bool resizable: true
+
+ /*! Determines if the column should be movable.
+ The default value is \c true.
+ \note A non-movable column may get indirectly moved if adjacent columns are movable.
+ \since QtQuick.Controls 1.1 */
+ property bool movable: true
+
+ /*! \qmlproperty enumeration TableViewColumn::elideMode
+ The text elide mode of the column.
+ Allowed values are:
+ \list
+ \li Text.ElideNone
+ \li Text.ElideLeft
+ \li Text.ElideMiddle
+ \li Text.ElideRight - the default
+ \endlist
+ \sa {QtQuick2::}{Text::elide} */
+ property int elideMode: Text.ElideRight
+
+ /*! \qmlproperty enumeration TableViewColumn::horizontalAlignment
+ The horizontal text alignment of the column.
+ Allowed values are:
+ \list
+ \li Text.AlignLeft - the default
+ \li Text.AlignRight
+ \li Text.AlignHCenter
+ \li Text.AlignJustify
+ \endlist
+ \sa {QtQuick2::}{Text::horizontalAlignment} */
+ property int horizontalAlignment: Text.AlignLeft
+
+ /*! The delegate of the column. This can be used to set the
+ \l TableView::itemDelegate for a specific column.
+
+ In the delegate you have access to the following special properties:
+ \list
+ \li styleData.selected - if the item is currently selected
+ \li styleData.value - the value or text for this item
+ \li styleData.textColor - the default text color for an item
+ \li styleData.row - the index of the row
+ \li styleData.column - the index of the column
+ \li styleData.elideMode - the elide mode of the column
+ \li styleData.textAlignment - the horizontal text alignment of the column
+ \endlist
+ */
+ property Component delegate
+
+ Accessible.role: Accessible.ColumnHeader
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextArea.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextArea.qml
new file mode 100644
index 0000000000..7269791962
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextArea.qml
@@ -0,0 +1,764 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+/*!
+ \qmltype TextArea
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Displays multiple lines of editable formatted text.
+
+ It can display both plain and rich text. For example:
+
+ \qml
+ TextArea {
+ width: 240
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ \endqml
+
+ Clipboard support is provided by the cut(), copy(), and paste() functions, and the selection can
+ be handled in a traditional "mouse" mechanism by setting selectByMouse, or handled completely
+ from QML by manipulating selectionStart and selectionEnd, or using selectAll() or selectWord().
+
+ You can translate between cursor positions (characters from the start of the document) and pixel
+ points using positionAt() and positionToRectangle().
+
+ You can create a custom appearance for a TextArea by
+ assigning a \l{QtQuick.Controls.Styles::TextAreaStyle}{TextAreaStyle}.
+
+ \sa TextField, TextEdit
+*/
+
+ScrollView {
+ id: area
+
+ /*!
+ \qmlproperty bool TextArea::activeFocusOnPress
+
+ Whether the TextEdit should gain active focus on a mouse press. By default this is
+ set to true.
+ */
+ property alias activeFocusOnPress: edit.activeFocusOnPress
+
+ /*!
+ \qmlproperty url TextArea::baseUrl
+
+ This property specifies a base URL which is used to resolve relative URLs
+ within the text.
+
+ The default value is the url of the QML file instantiating the TextArea item.
+ */
+ property alias baseUrl: edit.baseUrl
+
+ /*!
+ \qmlproperty bool TextArea::canPaste
+
+ Returns true if the TextArea is writable and the content of the clipboard is
+ suitable for pasting into the TextArea.
+ */
+ readonly property alias canPaste: edit.canPaste
+
+ /*!
+ \qmlproperty bool TextArea::canRedo
+
+ Returns true if the TextArea is writable and there are \l {undo}{undone}
+ operations that can be redone.
+ */
+ readonly property alias canRedo: edit.canRedo
+
+ /*!
+ \qmlproperty bool TextArea::canUndo
+
+ Returns true if the TextArea is writable and there are previous operations
+ that can be undone.
+ */
+ readonly property alias canUndo: edit.canUndo
+
+ /*!
+ \qmlproperty color TextArea::textColor
+
+ The text color.
+
+ \qml
+ TextArea { textColor: "orange" }
+ \endqml
+ */
+ property alias textColor: edit.color
+
+ /*!
+ \qmlproperty int TextArea::cursorPosition
+ The position of the cursor in the TextArea.
+ */
+ property alias cursorPosition: edit.cursorPosition
+
+ /*! \qmlproperty font TextArea::font
+
+ The font of the TextArea.
+ */
+ property alias font: edit.font
+
+ /*!
+ \qmlproperty enumeration TextArea::horizontalAlignment
+
+ Sets the alignment of the text within the TextArea item's width.
+
+ By default, the horizontal text alignment follows the natural alignment of the text,
+ for example, text that is read from left to right will be aligned to the left.
+
+ The valid values for \c horizontalAlignment are:
+ \list
+ \li TextEdit.AlignLeft (Default)
+ \li TextEdit.AlignRight
+ \li TextEdit.AlignHCenter
+ \endlist
+
+ When using the attached property LayoutMirroring::enabled to mirror application
+ layouts, the horizontal alignment of text will also be mirrored. However, the property
+ \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment
+ of TextArea, use the read-only property \c effectiveHorizontalAlignment.
+ */
+ property alias horizontalAlignment: edit.horizontalAlignment
+
+ /*!
+ \qmlproperty enumeration TextArea::effectiveHorizontalAlignment
+
+ Gets the effective horizontal alignment of the text within the TextArea item's width.
+
+ To set/get the default horizontal alignment of TextArea, use the property \c horizontalAlignment.
+
+ */
+ readonly property alias effectiveHorizontalAlignment: edit.effectiveHorizontalAlignment
+
+ /*!
+ \qmlproperty enumeration TextArea::verticalAlignment
+
+ Sets the alignment of the text within the TextArea item's height.
+
+ The valid values for \c verticalAlignment are:
+ \list
+ \li TextEdit.AlignTop
+ \li TextEdit.AlignBottom
+ \li TextEdit.AlignVCenter (Default)
+ \endlist
+ */
+ property alias verticalAlignment: edit.verticalAlignment
+
+ /*!
+ \qmlproperty enumeration TextArea::inputMethodHints
+
+ Provides hints to the input method about the expected content of the text edit, and how it
+ should operate.
+
+ The value is a bit-wise combination of flags or Qt.ImhNone if no hints are set.
+
+ The default value is \c Qt.ImhNone.
+
+ Flags that alter behavior are:
+
+ \list
+ \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.
+ \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method
+ in any persistent storage like predictive user dictionary.
+ \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case
+ when a sentence ends.
+ \li Qt.ImhPreferNumbers - Numbers are preferred (but not required).
+ \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required).
+ \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required).
+ \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing.
+
+ \li Qt.ImhDate - The text editor functions as a date field.
+ \li Qt.ImhTime - The text editor functions as a time field.
+ \endlist
+
+ Flags that restrict input (exclusive flags) are:
+
+ \list
+ \li Qt.ImhDigitsOnly - Only digits are allowed.
+ \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.
+ \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed.
+ \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed.
+ \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.
+ \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.
+ \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.
+ \endlist
+
+ Masks:
+
+ \list
+ \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
+ \endlist
+ */
+ property alias inputMethodHints: edit.inputMethodHints
+
+ /*!
+ \qmlproperty int TextArea::length
+
+ Returns the total number of plain text characters in the TextArea item.
+
+ As this number doesn't include any formatting markup, it may not be the same as the
+ length of the string returned by the \l text property.
+
+ This property can be faster than querying the length the \l text property as it doesn't
+ require any copying or conversion of the TextArea's internal string data.
+ */
+ readonly property alias length: edit.length
+
+ /*!
+ \qmlproperty int TextArea::lineCount
+
+ Returns the total number of lines in the TextArea item.
+ */
+ readonly property alias lineCount: edit.lineCount
+
+ /*!
+ \qmlproperty bool TextArea::readOnly
+
+ Whether the user can interact with the TextArea item.
+
+ The difference from a disabled text field is that it will appear
+ to be active, and text can be selected and copied.
+
+ If this property is set to \c true, the text cannot be edited by user interaction.
+
+ By default this property is \c false.
+ */
+ property alias readOnly: edit.readOnly
+
+ /*!
+ \qmlproperty string TextArea::selectedText
+
+ This read-only property provides the text currently selected in the
+ text edit.
+ */
+ readonly property alias selectedText: edit.selectedText
+
+ /*!
+ \qmlproperty int TextArea::selectionEnd
+
+ The cursor position after the last character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionStart, cursorPosition, selectedText
+ */
+ readonly property alias selectionEnd: edit.selectionEnd
+
+ /*!
+ \qmlproperty int TextArea::selectionStart
+
+ The cursor position before the first character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionEnd, cursorPosition, selectedText
+ */
+ readonly property alias selectionStart: edit.selectionStart
+
+ /*!
+ \qmlproperty bool TextArea::tabChangesFocus
+
+ This property holds whether Tab changes focus, or is accepted as input.
+
+ Defaults to \c false.
+ */
+ property bool tabChangesFocus: false
+
+ /*!
+ \qmlproperty string TextArea::text
+
+ The text to display. If the text format is AutoText the text edit will
+ automatically determine whether the text should be treated as
+ rich text. This determination is made using Qt::mightBeRichText().
+ */
+ property alias text: edit.text
+
+ /*!
+ \qmlproperty enumeration TextArea::textFormat
+
+ The way the text property should be displayed.
+
+ \list
+ \li TextEdit.AutoText
+ \li TextEdit.PlainText
+ \li TextEdit.RichText
+ \endlist
+
+ The default is TextEdit.PlainText. If the text format is TextEdit.AutoText the text edit
+ will automatically determine whether the text should be treated as
+ rich text. This determination is made using Qt::mightBeRichText().
+ */
+ property alias textFormat: edit.textFormat
+
+ /*!
+ \qmlproperty enumeration TextArea::wrapMode
+
+ Set this property to wrap the text to the TextArea item's width.
+ The text will only wrap if an explicit width has been set.
+
+ \list
+ \li TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.
+ \li TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.
+ \li TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
+ \li TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
+ \endlist
+
+ The default is \c TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap.
+ */
+ property alias wrapMode: edit.wrapMode
+
+ /*!
+ \qmlproperty bool TextArea::selectByMouse
+
+ This property determines if the user can select the text with the
+ mouse.
+
+ The default value is \c true.
+ */
+ property alias selectByMouse: edit.selectByMouse
+
+ /*!
+ \qmlproperty bool TextArea::selectByKeyboard
+
+ This property determines if the user can select the text with the
+ keyboard.
+
+ If set to \c true, the user can use the keyboard to select the text
+ even if the editor is read-only. If set to \c false, the user cannot
+ use the keyboard to select the text even if the editor is editable.
+
+ The default value is \c true when the editor is editable,
+ and \c false when read-only.
+
+ \sa readOnly
+ */
+ property alias selectByKeyboard: edit.selectByKeyboard
+
+ /*!
+ \qmlsignal TextArea::linkActivated(string link)
+
+ This signal is emitted when the user clicks on a link embedded in the text.
+ The link must be in rich text or HTML format and the
+ \a link string provides access to the particular link.
+ */
+ signal linkActivated(string link)
+
+ /*!
+ \qmlsignal TextArea::linkHovered(string link)
+ \since 5.2
+
+ This signal is emitted when the user hovers a link embedded in the text.
+ The link must be in rich text or HTML format and the
+ \a link string provides access to the particular link.
+
+ \sa hoveredLink
+ */
+ signal linkHovered(string link)
+
+ /*!
+ \qmlproperty string TextArea::hoveredLink
+ \since QtQuick.Controls 1.1
+
+ This property contains the link string when user hovers a link
+ embedded in the text. The link must be in rich text or HTML format
+ and the link string provides access to the particular link.
+
+ \sa onLinkHovered
+ */
+ readonly property alias hoveredLink: edit.hoveredLink
+
+ /*!
+ \qmlmethod TextArea::append(string)
+
+ Appends \a string as a new line to the end of the text area.
+ */
+ function append (string) {
+ edit.append(string)
+ __verticalScrollBar.value = __verticalScrollBar.maximumValue
+ }
+
+ /*!
+ \qmlmethod TextArea::copy()
+
+ Copies the currently selected text to the system clipboard.
+ */
+ function copy() {
+ edit.copy();
+ }
+
+ /*!
+ \qmlmethod TextArea::cut()
+
+ Moves the currently selected text to the system clipboard.
+ */
+ function cut() {
+ edit.cut();
+ }
+
+ /*!
+ \qmlmethod TextArea::deselect()
+
+ Removes active text selection.
+ */
+ function deselect() {
+ edit.deselect();
+ }
+
+ /*!
+ \qmlmethod string TextArea::getFormattedText(int start, int end)
+
+ Returns the section of text that is between the \a start and \a end positions.
+
+ The returned text will be formatted according to the \l textFormat property.
+ */
+ function getFormattedText(start, end) {
+ return edit.getFormattedText(start, end);
+ }
+
+ /*!
+ \qmlmethod string TextArea::getText(int start, int end)
+
+ Returns the section of text that is between the \a start and \a end positions.
+
+ The returned text does not include any rich text formatting.
+ */
+ function getText(start, end) {
+ return edit.getText(start, end);
+ }
+
+ /*!
+ \qmlmethod TextArea::insert(int position, string text)
+
+ Inserts \a text into the TextArea at position.
+ */
+ function insert(position, text) {
+ edit.insert(position, text);
+ }
+
+ /*!
+ \qmlmethod TextArea::isRightToLeft(int start, int end)
+
+ Returns true if the natural reading direction of the editor text
+ found between positions \a start and \a end is right to left.
+ */
+ function isRightToLeft(start, end) {
+ return edit.isRightToLeft(start, end);
+ }
+
+ /*!
+ \qmlmethod TextArea::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters)
+
+ Moves the cursor to \a position and updates the selection according to the optional \a mode
+ parameter. (To only move the cursor, set the \l cursorPosition property.)
+
+ When this method is called it additionally sets either the
+ selectionStart or the selectionEnd (whichever was at the previous cursor position)
+ to the specified position. This allows you to easily extend and contract the selected
+ text range.
+
+ The selection mode specifies whether the selection is updated on a per character or a per word
+ basis. If not specified the selection mode will default to TextEdit.SelectCharacters.
+
+ \list
+ \li TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at
+ the previous cursor position) to the specified position.
+ \li TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all
+ words between the specified position and the previous cursor position. Words partially in the
+ range are included.
+ \endlist
+
+ For example, take this sequence of calls:
+
+ \code
+ cursorPosition = 5
+ moveCursorSelection(9, TextEdit.SelectCharacters)
+ moveCursorSelection(7, TextEdit.SelectCharacters)
+ \endcode
+
+ This moves the cursor to the 5th position, extends the selection end from 5 to 9,
+ and then retracts the selection end from 9 to 7, leaving the text from the 5th
+ position to the 7th position selected (the 6th and 7th characters).
+
+ The same sequence with TextEdit.SelectWords will extend the selection start to a word boundary
+ before or on the 5th position, and extend the selection end to a word boundary on or past the 9th position.
+ */
+ function moveCursorSelection(position, mode) {
+ edit.moveCursorSelection(position, mode);
+ }
+
+ /*!
+ \qmlmethod TextArea::paste()
+
+ Replaces the currently selected text by the contents of the system clipboard.
+ */
+ function paste() {
+ edit.paste();
+ }
+
+ /*!
+ \qmlmethod int TextArea::positionAt(int x, int y)
+
+ Returns the text position closest to pixel position (\a x, \a y).
+
+ Position 0 is before the first character, position 1 is after the first character
+ but before the second, and so on until position \l {text}.length, which is after all characters.
+ */
+ function positionAt(x, y) {
+ return edit.positionAt(x, y);
+ }
+
+ /*!
+ \qmlmethod rectangle TextArea::positionToRectangle(position)
+
+ Returns the rectangle at the given \a position in the text. The x, y,
+ and height properties correspond to the cursor that would describe
+ that position.
+ */
+ function positionToRectangle(position) {
+ return edit.positionToRectangle(position);
+ }
+
+ /*!
+ \qmlmethod TextArea::redo()
+
+ Redoes the last operation if redo is \l {canRedo}{available}.
+ */
+ function redo() {
+ edit.redo();
+ }
+
+ /*!
+ \qmlmethod string TextArea::remove(int start, int end)
+
+ Removes the section of text that is between the \a start and \a end positions from the TextArea.
+ */
+ function remove(start, end) {
+ return edit.remove(start, end);
+ }
+
+ /*!
+ \qmlmethod TextArea::select(int start, int end)
+
+ Causes the text from \a start to \a end to be selected.
+
+ If either start or end is out of range, the selection is not changed.
+
+ After calling this, selectionStart will become the lesser
+ and selectionEnd will become the greater (regardless of the order passed
+ to this method).
+
+ \sa selectionStart, selectionEnd
+ */
+ function select(start, end) {
+ edit.select(start, end);
+ }
+
+ /*!
+ \qmlmethod TextArea::selectAll()
+
+ Causes all text to be selected.
+ */
+ function selectAll() {
+ edit.selectAll();
+ }
+
+ /*!
+ \qmlmethod TextArea::selectWord()
+
+ Causes the word closest to the current cursor position to be selected.
+ */
+ function selectWord() {
+ edit.selectWord();
+ }
+
+ /*!
+ \qmlmethod TextArea::undo()
+
+ Undoes the last operation if undo is \l {canUndo}{available}. Deselects any
+ current selection, and updates the selection start to the current cursor
+ position.
+ */
+ function undo() {
+ edit.undo();
+ }
+
+ /*! \qmlproperty bool TextArea::backgroundVisible
+
+ This property determines if the background should be filled or not.
+
+ The default value is \c true.
+ */
+ property alias backgroundVisible: colorRect.visible
+
+ /*! \internal */
+ default property alias data: area.data
+
+ /*! \qmlproperty real TextArea::textMargin
+ \since QtQuick.Controls 1.1
+
+ The margin, in pixels, around the text in the TextArea.
+ */
+ property alias textMargin: edit.textMargin
+
+ frameVisible: true
+
+ activeFocusOnTab: true
+
+ Accessible.role: Accessible.EditableText
+
+ style: Qt.createComponent(Settings.style + "/TextAreaStyle.qml", area)
+
+ /*!
+ \qmlproperty TextDocument TextArea::textDocument
+
+ This property exposes the \l QQuickTextDocument of this TextArea.
+ \sa TextEdit::textDocument
+ */
+ property alias textDocument: edit.textDocument
+
+ Flickable {
+ id: flickable
+
+ interactive: false
+ anchors.fill: parent
+
+ TextEdit {
+ id: edit
+ focus: true
+
+ Rectangle {
+ id: colorRect
+ parent: viewport
+ anchors.fill: parent
+ color: __style ? __style.backgroundColor : "white"
+ z: -1
+ }
+
+ property int layoutRecursionDepth: 0
+
+ function doLayout() {
+ // scrollbars affect the document/viewport size and vice versa, so we
+ // must allow the layout loop to recurse twice until the sizes stabilize
+ if (layoutRecursionDepth <= 2) {
+ layoutRecursionDepth++
+
+ if (wrapMode == TextEdit.NoWrap) {
+ __horizontalScrollBar.visible = edit.contentWidth > viewport.width
+ edit.width = Math.max(viewport.width, edit.contentWidth)
+ } else {
+ __horizontalScrollBar.visible = false
+ edit.width = viewport.width
+ }
+ edit.height = Math.max(viewport.height, edit.contentHeight)
+
+ flickable.contentWidth = edit.contentWidth
+ flickable.contentHeight = edit.contentHeight
+
+ layoutRecursionDepth--
+ }
+ }
+
+ Connections {
+ target: area.viewport
+ onWidthChanged: edit.doLayout()
+ onHeightChanged: edit.doLayout()
+ }
+ onContentWidthChanged: edit.doLayout()
+ onContentHeightChanged: edit.doLayout()
+ onWrapModeChanged: edit.doLayout()
+
+ renderType: __style ? __style.renderType : Text.NativeRendering
+ font: __style ? __style.font : font
+ color: __style ? __style.textColor : "darkgray"
+ selectionColor: __style ? __style.selectionColor : "darkred"
+ selectedTextColor: __style ? __style.selectedTextColor : "white"
+ wrapMode: TextEdit.WordWrap
+ textMargin: 4
+
+ selectByMouse: true
+ readOnly: false
+
+ KeyNavigation.priority: KeyNavigation.BeforeItem
+ KeyNavigation.tab: area.tabChangesFocus ? area.KeyNavigation.tab : null
+ KeyNavigation.backtab: area.tabChangesFocus ? area.KeyNavigation.backtab : null
+
+ // keep textcursor within scroll view
+ onCursorPositionChanged: {
+ if (cursorRectangle.y >= flickableItem.contentY + viewport.height - cursorRectangle.height - textMargin) {
+ // moving down
+ flickableItem.contentY = cursorRectangle.y - viewport.height + cursorRectangle.height + textMargin
+ } else if (cursorRectangle.y < flickableItem.contentY) {
+ // moving up
+ flickableItem.contentY = cursorRectangle.y - textMargin
+ }
+
+ if (cursorRectangle.x >= flickableItem.contentX + viewport.width - textMargin) {
+ // moving right
+ flickableItem.contentX = cursorRectangle.x - viewport.width + textMargin
+ } else if (cursorRectangle.x < flickableItem.contentX) {
+ // moving left
+ flickableItem.contentX = cursorRectangle.x - textMargin
+ }
+ }
+ onLinkActivated: area.linkActivated(link)
+ onLinkHovered: area.linkHovered(link)
+
+ MouseArea {
+ parent: area.viewport
+ anchors.fill: parent
+ cursorShape: edit.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
+ acceptedButtons: Qt.NoButton
+ }
+ }
+ }
+
+ Keys.onPressed: {
+ if (event.key == Qt.Key_PageUp) {
+ __verticalScrollBar.value -= area.height
+ } else if (event.key == Qt.Key_PageDown)
+ __verticalScrollBar.value += area.height
+ }
+
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextField.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextField.qml
new file mode 100644
index 0000000000..0961430d52
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextField.qml
@@ -0,0 +1,609 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TextField
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Displays a single line of editable plain text.
+
+ TextField is used to accept a line of text input. Input constraints can be
+ placed on a TextField item (for example, through a \l validator or \l
+ inputMask). Setting \l echoMode to an appropriate value enables
+ TextField to be used for a password input field.
+
+ You can create a custom appearance for a TextField by
+ assigning a \l {QtQuick.Controls.Styles::TextFieldStyle}{TextFieldStyle}.
+
+ \sa TextArea, TextInput
+*/
+
+Control {
+ id: textfield
+
+ /*!
+ \qmlproperty bool TextField::acceptableInput
+
+ Returns \c true if the text field contains acceptable
+ text.
+
+ If a validator or input mask was set, this property will return \c
+ true if the current text satisfies the validator or mask as
+ a final string (not as an intermediate string).
+
+ The default value is \c true.
+
+ \sa validator, inputMask, accepted
+
+ */
+ readonly property alias acceptableInput: textInput.acceptableInput // read only
+
+ /*!
+ \qmlproperty bool TextField::activeFocusOnPress
+
+ This property is set to \c true if the TextField should gain active
+ focus on a mouse press.
+
+ The default value is \c true.
+ */
+ property alias activeFocusOnPress: textInput.activeFocusOnPress
+
+ /*!
+ \qmlproperty bool TextField::canPaste
+
+ Returns \c true if the TextField is writable and the content of the
+ clipboard is suitable for pasting into the TextField.
+ */
+ readonly property alias canPaste: textInput.canPaste
+
+ /*!
+ \qmlproperty bool TextField::canRedo
+
+ Returns \c true if the TextField is writable and there are \l
+ {undo}{undone} operations that can be redone.
+ */
+ readonly property alias canRedo: textInput.canRedo
+
+ /*!
+ \qmlproperty bool TextField::canUndo
+
+ Returns \c true if the TextField is writable and there are previous
+ operations that can be undone.
+ */
+ readonly property alias canUndo: textInput.canUndo
+
+ /*!
+ \qmlproperty color TextField::textColor
+
+ This property holds the text color.
+ */
+ property alias textColor: textInput.color
+
+ /*!
+ \qmlproperty int TextField::cursorPosition
+
+ This property holds the position of the cursor in the TextField.
+ */
+ property alias cursorPosition: textInput.cursorPosition
+
+ /*!
+ \qmlproperty string TextField::displayText
+
+ This property holds the text displayed in the TextField.
+
+ If \l echoMode is set to TextInput::Normal, this holds the
+ same value as the TextField::text property. Otherwise,
+ this property holds the text visible to the user, while
+ the \l text property holds the actual entered text.
+ */
+ readonly property alias displayText: textInput.displayText
+
+ /*!
+ \qmlproperty enumeration TextField::echoMode
+
+ Specifies how the text should be displayed in the
+ TextField.
+
+ The possible modes are:
+ \list
+ \li TextInput.Normal - Displays the text as it is. (Default)
+ \li TextInput.Password - Displays asterisks instead of characters.
+ \li TextInput.NoEcho - Displays nothing.
+ \li TextInput.PasswordEchoOnEdit - Displays characters as they are
+ entered while editing, otherwise displays asterisks.
+ \endlist
+ */
+ property alias echoMode: textInput.echoMode
+
+ /*!
+ \qmlproperty font TextField::font
+
+ Sets the font of the TextField.
+ */
+ property alias font: textInput.font
+
+ /*!
+ \qmlproperty enumeration TextField::horizontalAlignment
+
+ Sets the alignment of the text within the TextField item's width.
+
+ By default, the horizontal text alignment follows the natural alignment
+ of the text, for example text that is read from left to right will be
+ aligned to the left.
+
+ The possible alignment values are:
+ \list
+ \li TextInput.AlignLeft
+ \li TextInput.AlignRight
+ \li TextInput.AlignHCenter
+ \endlist
+
+ When using the attached property, LayoutMirroring::enabled, to mirror
+ application layouts, the horizontal alignment of text will also be
+ mirrored. However, the property \c horizontalAlignment will remain
+ unchanged. To query the effective horizontal alignment of TextField, use
+ the read-only property \c effectiveHorizontalAlignment.
+ */
+ property alias horizontalAlignment: textInput.horizontalAlignment
+
+ /*!
+ \qmlproperty enumeration TextField::effectiveHorizontalAlignment
+
+ Gets the effective horizontal alignment of the text within the TextField
+ item's width.
+
+ \l horizontalAlignment contains the default horizontal alignment.
+
+ \sa horizontalAlignment
+
+ */
+ readonly property alias effectiveHorizontalAlignment: textInput.effectiveHorizontalAlignment
+
+ /*!
+ \qmlproperty enumeration TextField::verticalAlignment
+
+ Sets the alignment of the text within the TextField item's height.
+
+ The possible alignment values are:
+ \list
+ \li TextInput.AlignTop
+ \li TextInput.AlignBottom
+ \li TextInput.AlignVCenter (default).
+ \endlist
+ */
+ property alias verticalAlignment: textInput.verticalAlignment
+
+ /*!
+ \qmlproperty string TextField::inputMask
+
+ Sets an input mask on the TextField, restricting the allowable text
+ inputs. See QLineEdit::inputMask for further details, as the exact same
+ mask strings are used by TextField.
+
+ \sa acceptableInput, validator
+ */
+ property alias inputMask: textInput.inputMask
+
+ /*!
+ \qmlproperty enumeration TextField::inputMethodHints
+
+ Provides hints to the input method about the expected content of the
+ text field and how it should operate.
+
+ The value is a bit-wise combination of flags, or \c Qt.ImhNone if no
+ hints are set.
+
+ The default value is \c Qt.ImhNone.
+
+ Flags that alter behavior are:
+
+ \list
+ \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.
+ This is automatically set when setting echoMode to \c TextInput.Password.
+ \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method
+ in any persistent storage like predictive user dictionary.
+ \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case
+ when a sentence ends.
+ \li Qt.ImhPreferNumbers - Numbers are preferred (but not required).
+ \li Qt.ImhPreferUppercase - Uppercase letters are preferred (but not required).
+ \li Qt.ImhPreferLowercase - Lowercase letters are preferred (but not required).
+ \li Qt.ImhNoPredictiveText - Do not use predictive text (for example, dictionary lookup) while typing.
+
+ \li Qt.ImhDate - The text editor functions as a date field.
+ \li Qt.ImhTime - The text editor functions as a time field.
+ \endlist
+
+ Flags that restrict input (exclusive flags) are:
+
+ \list
+ \li Qt.ImhDigitsOnly - Only digits are allowed.
+ \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.
+ \li Qt.ImhUppercaseOnly - Only uppercase letter input is allowed.
+ \li Qt.ImhLowercaseOnly - Only lowercase letter input is allowed.
+ \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.
+ \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.
+ \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.
+ \endlist
+
+ Masks:
+ \list
+ \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
+ \endlist
+ */
+ property alias inputMethodHints: textInput.inputMethodHints
+
+ /*!
+ \qmlproperty int TextField::length
+
+ Returns the total number of characters in the TextField item.
+
+ If the TextField has an input mask, the length will include mask
+ characters and may differ from the length of the string returned by the
+ \l text property.
+
+ This property can be faster than querying the length of the \l text
+ property as it doesn't require any copying or conversion of the
+ TextField's internal string data.
+ */
+ readonly property alias length: textInput.length
+
+ /*!
+ \qmlproperty int TextField::maximumLength
+
+ This property holds the maximum permitted length of the text in the
+ TextField.
+
+ If the text is too long, it is truncated at the limit.
+ */
+ property alias maximumLength: textInput.maximumLength
+
+ /*!
+ \qmlproperty string TextField::placeholderText
+
+ This property contains the text that is shown in the text field when the
+ text field is empty and has no focus.
+ */
+ property alias placeholderText: placeholderTextComponent.text
+
+ /*!
+ \qmlproperty bool TextField::readOnly
+
+ Sets whether user input can modify the contents of the TextField. Read-
+ only is different from a disabled text field in that the text field will
+ appear to be active and text can still be selected and copied.
+
+ If readOnly is set to \c true, then user input will not affect the text.
+ Any bindings or attempts to set the text property will still
+ work, however.
+ */
+ property alias readOnly: textInput.readOnly
+
+ /*!
+ \qmlproperty string TextField::selectedText
+
+ Provides the text currently selected in the text input.
+
+ It is equivalent to the following snippet, but is faster and easier
+ to use.
+
+ \code
+ myTextField.text.toString().substring(myTextField.selectionStart, myTextField.selectionEnd);
+ \endcode
+ */
+ readonly property alias selectedText: textInput.selectedText
+
+ /*!
+ \qmlproperty int TextField::selectionEnd
+
+ The cursor position after the last character in the current selection.
+
+ This property is read-only. To change the selection, use
+ select(start,end), selectAll(), or selectWord().
+
+ \sa selectionStart, cursorPosition, selectedText
+ */
+ readonly property alias selectionEnd: textInput.selectionEnd
+
+ /*!
+ \qmlproperty int TextField::selectionStart
+
+ The cursor position before the first character in the current selection.
+
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
+
+ \sa selectionEnd, cursorPosition, selectedText
+ */
+ readonly property alias selectionStart: textInput.selectionStart
+
+ /*!
+ \qmlproperty string TextField::text
+
+ This property contains the text in the TextField.
+ */
+ property alias text: textInput.text
+
+ /*!
+ \qmlproperty Validator TextField::validator
+
+ Allows you to set a validator on the TextField. When a validator is set,
+ the TextField will only accept input which leaves the text property in
+ an intermediate state. The accepted signal will only be sent
+ if the text is in an acceptable state when enter is pressed.
+
+ Currently supported validators are \l{QtQuick2::IntValidator},
+ \l{QtQuick2::DoubleValidator}, and \l{QtQuick2::RegExpValidator}. An
+ example of using validators is shown below, which allows input of
+ integers between 11 and 31 into the text input:
+
+ \code
+ import QtQuick 2.1
+ import QtQuick.Controls 1.1
+
+ TextField {
+ validator: IntValidator {bottom: 11; top: 31;}
+ focus: true
+ }
+ \endcode
+
+ \sa acceptableInput, inputMask, accepted
+ */
+ property alias validator: textInput.validator
+
+ /*!
+ \qmlsignal TextField::accepted()
+
+ This signal is emitted when the Return or Enter key is pressed.
+ Note that if there is a \l validator or \l inputMask set on the text
+ field, the signal will only be emitted if the input is in an acceptable
+ state.
+ */
+ signal accepted()
+
+ /*!
+ \qmlsignal TextField::editingFinished()
+ \since 5.2
+
+ This signal is emitted when the Return or Enter key is pressed or
+ the text field loses focus. Note that if there is a validator or
+ inputMask set on the text field and enter/return is pressed, this
+ signal will only be emitted if the input follows
+ the inputMask and the validator returns an acceptable state.
+ */
+ signal editingFinished()
+
+ /*!
+ \qmlmethod TextField::copy()
+
+ Copies the currently selected text to the system clipboard.
+ */
+ function copy() {
+ textInput.copy()
+ }
+
+ /*!
+ \qmlmethod TextField::cut()
+
+ Moves the currently selected text to the system clipboard.
+ */
+ function cut() {
+ textInput.cut()
+ }
+
+ /*!
+ \qmlmethod TextField::deselect()
+
+ Removes active text selection.
+ */
+ function deselect() {
+ textInput.deselect();
+ }
+
+ /*!
+ \qmlmethod string TextField::getText(int start, int end)
+
+ Removes the section of text that is between the \a start and \a end
+ positions from the TextField.
+ */
+ function getText(start, end) {
+ return textInput.getText(start, end);
+ }
+
+ /*!
+ \qmlmethod TextField::insert(int position, string text)
+
+ Inserts \a text into the TextField at \a position.
+ */
+ function insert(position, text) {
+ textInput.insert(position, text);
+ }
+
+ /*!
+ \qmlmethod bool TextField::isRightToLeft(int start, int end)
+
+ Returns \c true if the natural reading direction of the editor text
+ found between positions \a start and \a end is right to left.
+ */
+ function isRightToLeft(start, end) {
+ return textInput.isRightToLeft(start, end);
+ }
+
+ /*!
+ \qmlmethod TextField::paste()
+
+ Replaces the currently selected text by the contents of the system
+ clipboard.
+ */
+ function paste() {
+ textInput.paste()
+ }
+
+ /*!
+ \qmlmethod TextField::redo()
+
+ Performs the last operation if redo is \l {canRedo}{available}.
+ */
+ function redo() {
+ textInput.redo();
+ }
+
+ /*!
+ \qmlmethod TextField::select(int start, int end)
+
+ Causes the text from \a start to \a end to be selected.
+
+ If either start or end is out of range, the selection is not changed.
+
+ After calling select, selectionStart will become the lesser
+ and selectionEnd will become the greater (regardless of the order passed
+ to this method).
+
+ \sa selectionStart, selectionEnd
+ */
+ function select(start, end) {
+ textInput.select(start, end)
+ }
+
+ /*!
+ \qmlmethod TextField::selectAll()
+
+ Causes all text to be selected.
+ */
+ function selectAll() {
+ textInput.selectAll()
+ }
+
+ /*!
+ \qmlmethod TextField::selectWord()
+
+ Causes the word closest to the current cursor position to be selected.
+ */
+ function selectWord() {
+ textInput.selectWord()
+ }
+
+ /*!
+ \qmlmethod TextField::undo()
+
+ Reverts the last operation if undo is \l {canUndo}{available}. undo()
+ deselects any current selection and updates the selection start to the
+ current cursor position.
+ */
+ function undo() {
+ textInput.undo();
+ }
+
+ /*! \qmlproperty bool TextField::hovered
+
+ This property holds whether the control is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*! \internal */
+ property alias __contentHeight: textInput.contentHeight
+
+ /*! \internal */
+ property alias __contentWidth: textInput.contentWidth
+
+ style: Qt.createComponent(Settings.style + "/TextFieldStyle.qml", textInput)
+
+ activeFocusOnTab: true
+
+ Accessible.name: text
+ Accessible.role: Accessible.EditableText
+ Accessible.description: placeholderText
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.IBeamCursor
+ onClicked: textfield.forceActiveFocus()
+ }
+
+ Text {
+ id: placeholderTextComponent
+ anchors.fill: textInput
+ font: textInput.font
+ horizontalAlignment: textInput.horizontalAlignment
+ verticalAlignment: textInput.verticalAlignment
+ opacity: !textInput.text.length && !textInput.inputMethodComposing ? 1 : 0
+ color: __panel ? __panel.placeholderTextColor : "darkgray"
+ clip: contentWidth > width;
+ elide: Text.ElideRight
+ renderType: __style ? __style.renderType : Text.NativeRendering
+ Behavior on opacity { NumberAnimation { duration: 90 } }
+ }
+
+ TextInput {
+ id: textInput
+ focus: true
+ selectByMouse: true
+ selectionColor: __panel ? __panel.selectionColor : "darkred"
+ selectedTextColor: __panel ? __panel.selectedTextColor : "white"
+
+ font: __panel ? __panel.font : font
+ anchors.leftMargin: __panel ? __panel.leftMargin : 0
+ anchors.topMargin: __panel ? __panel.topMargin : 0
+ anchors.rightMargin: __panel ? __panel.rightMargin : 0
+ anchors.bottomMargin: __panel ? __panel.bottomMargin : 0
+
+ anchors.fill: parent
+ verticalAlignment: Text.AlignVCenter
+
+ color: __panel ? __panel.textColor : "darkgray"
+ clip: contentWidth > width
+
+ renderType: __style ? __style.renderType : Text.NativeRendering
+
+ onAccepted: {
+ Qt.inputMethod.commit()
+ Qt.inputMethod.hide()
+ textfield.accepted()
+ }
+
+ onEditingFinished: textfield.editingFinished()
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolBar.qml
new file mode 100644
index 0000000000..1a4c7cb65f
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolBar.qml
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ToolBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup applicationwindow
+ \brief Contains ToolButton and related controls.
+
+ The common way of using ToolBar is in relation to \l ApplicationWindow. It
+ provides styling and is generally designed to work well with ToolButton as
+ well as other controls.
+
+ Note that the ToolBar does not provide a layout of its own, but requires
+ you to position its contents, for instance by creating a \l RowLayout.
+
+ If only a single item is used within the ToolBar, it will resize to fit the implicitHeight
+ of its contained item. This makes it particularly suitable for use together with layouts.
+ Otherwise the height is platform dependent.
+
+ \code
+ import QtQuick.Controls 1.1
+ import QtQuick.Layouts 1.0
+
+ ApplicationWindow {
+ toolBar: ToolBar {
+ RowLayout {
+ ToolButton { ... }
+ ToolButton { ... }
+ ToolButton { ... }
+ }
+ }
+ }
+ \endcode
+*/
+
+Item {
+ id: toolbar
+
+ activeFocusOnTab: false
+ Accessible.role: Accessible.ToolBar
+ LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
+ LayoutMirroring.childrenInherit: true
+
+ width: parent ? parent.width : implicitWidth
+ implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
+ implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight()
+
+ /*! \internal */
+ property Component style: Qt.createComponent(Settings.style + "/ToolBarStyle.qml", toolbar)
+
+ /*! \internal */
+ property alias __style: styleLoader.item
+
+ /*! \internal */
+ default property alias __content: container.data
+
+ /*!
+ \qmlproperty Item ToolBar::contentItem
+
+ This property holds the content Item of the tool bar.
+
+ Items declared as children of a ToolBar are automatically parented to the ToolBar's contentItem.
+ Items created dynamically need to be explicitly parented to the contentItem:
+
+ \note The implicit size of the ToolBar is calculated based on the size of its content. If you want to anchor
+ items inside the tool bar, you must specify an explicit width and height on the ToolBar itself.
+ */
+ readonly property alias contentItem: container
+
+ data: [
+ Loader {
+ id: loader
+ anchors.fill: parent
+ sourceComponent: styleLoader.item ? styleLoader.item.panel : null
+ onLoaded: item.z = -1
+ Loader {
+ id: styleLoader
+ property alias __control: toolbar
+ sourceComponent: style
+ }
+ },
+ Item {
+ id: container
+ z: 1
+ focus: true
+ anchors.fill: parent
+
+ anchors.topMargin: topMargin
+ anchors.leftMargin: leftMargin
+ anchors.rightMargin: rightMargin
+ anchors.bottomMargin: bottomMargin
+
+ property int topMargin: __style ? __style.padding.top : 0
+ property int bottomMargin: __style ? __style.padding.bottom : 0
+ property int leftMargin: __style ? __style.padding.left : 0
+ property int rightMargin: __style ? __style.padding.right : 0
+
+ property Item layoutItem: container.children.length === 1 ? container.children[0] : null
+ function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) :
+ loader.item ? loader.item.implicitWidth : 0) }
+ function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) :
+ loader.item ? loader.item.implicitHeight : 0) }
+ }]
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolButton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolButton.qml
new file mode 100644
index 0000000000..0ff62ec45a
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolButton.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype ToolButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+ \ingroup controls
+ \brief Provides a button type that is typically used within a ToolBar.
+
+ ToolButton is functionally similar to \l Button, but can provide a look that is more
+ suitable within a \l ToolBar.
+
+ \code
+ ToolButton {
+ iconSource: "edit-cut.png"
+ }
+ \endcode
+
+ You can create a custom appearance for a ToolButton by
+ assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}.
+*/
+
+Button {
+ id: button
+ style: Qt.createComponent(Settings.style + "/ToolButtonStyle.qml", button)
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/plugins.qmltypes
new file mode 100644
index 0000000000..eadb72efb7
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/plugins.qmltypes
@@ -0,0 +1,1889 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated with the command 'qmlplugindump -nonrelocatable QtQuick.Controls 1.1'.
+
+Module {
+ Component {
+ name: "QQuickAbstractStyle"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/AbstractStyle 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "padding"; type: "QQuickPadding"; isReadonly: true; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickAction"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/Action 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "shortcut"; type: "QVariant" }
+ Signal { name: "triggered" }
+ Signal {
+ name: "toggled"
+ Parameter { name: "checked"; type: "bool" }
+ }
+ Signal {
+ name: "shortcutChanged"
+ Parameter { name: "shortcut"; type: "QVariant" }
+ }
+ Signal { name: "iconChanged" }
+ Signal {
+ name: "tooltipChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method { name: "trigger" }
+ }
+ Component {
+ name: "QQuickControlSettings"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/Settings 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "style"; type: "QUrl"; isReadonly: true }
+ Property { name: "styleName"; type: "string" }
+ Property { name: "stylePath"; type: "string" }
+ Property { name: "dpiScaleFactor"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickExclusiveGroup"
+ defaultProperty: "__actions"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/ExclusiveGroup 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "current"; type: "QObject"; isPointer: true }
+ Property { name: "__actions"; type: "QQuickAction"; isList: true; isReadonly: true }
+ Method {
+ name: "bindCheckable"
+ Parameter { name: "o"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "unbindCheckable"
+ Parameter { name: "o"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickMenu"
+ defaultProperty: "items"
+ prototype: "QQuickMenuText"
+ exports: ["QtQuick.Controls/MenuPrivate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "title"; type: "string" }
+ Property { name: "items"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__selectedIndex"; type: "int" }
+ Property { name: "__popupVisible"; type: "bool"; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__minimumWidth"; type: "int" }
+ Property { name: "__font"; type: "QFont" }
+ Property { name: "__xOffset"; type: "double" }
+ Property { name: "__yOffset"; type: "double" }
+ Signal { name: "__menuClosed" }
+ Signal { name: "popupVisibleChanged" }
+ Method { name: "__closeMenu" }
+ Method { name: "__dismissMenu" }
+ Method { name: "popup" }
+ Method {
+ name: "addItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "insertItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "int" }
+ Parameter { type: "string" }
+ }
+ Method { name: "addSeparator" }
+ Method {
+ name: "insertSeparator"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { type: "int" }
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ Parameter { name: "atActionIndex"; type: "int" }
+ }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickMenuBar"
+ defaultProperty: "menus"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/MenuBarPrivate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Signal { name: "contentItemChanged" }
+ }
+ Component {
+ name: "QQuickMenuBase"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/MenuBase 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "visible"; type: "bool" }
+ Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true }
+ Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickMenuItem"
+ prototype: "QQuickMenuText"
+ exports: ["QtQuick.Controls/MenuItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "shortcut"; type: "QVariant" }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Signal { name: "triggered" }
+ Signal {
+ name: "toggled"
+ Parameter { name: "checked"; type: "bool" }
+ }
+ Method { name: "trigger" }
+ }
+ Component {
+ name: "QQuickMenuItemType"
+ exports: ["QtQuick.Controls/MenuItemType 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "MenuItemType"
+ values: {
+ "Separator": 0,
+ "Item": 1,
+ "Menu": 2
+ }
+ }
+ }
+ Component {
+ name: "QQuickMenuSeparator"
+ prototype: "QQuickMenuBase"
+ exports: ["QtQuick.Controls/MenuSeparator 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickMenuText"
+ prototype: "QQuickMenuBase"
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Signal { name: "__textChanged" }
+ }
+ Component {
+ name: "QQuickPadding"
+ prototype: "QObject"
+ Property { name: "left"; type: "int" }
+ Property { name: "top"; type: "int" }
+ Property { name: "right"; type: "int" }
+ Property { name: "bottom"; type: "int" }
+ Method {
+ name: "setLeft"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setTop"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setRight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setBottom"
+ Parameter { name: "arg"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickRangeModel"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/RangeModel 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "position"; type: "double" }
+ Property { name: "positionAtMinimum"; type: "double" }
+ Property { name: "positionAtMaximum"; type: "double" }
+ Property { name: "inverted"; type: "bool" }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "value"; type: "double" }
+ }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "position"; type: "double" }
+ }
+ Signal {
+ name: "stepSizeChanged"
+ Parameter { name: "stepSize"; type: "double" }
+ }
+ Signal {
+ name: "invertedChanged"
+ Parameter { name: "inverted"; type: "bool" }
+ }
+ Signal {
+ name: "minimumChanged"
+ Parameter { name: "min"; type: "double" }
+ }
+ Signal {
+ name: "maximumChanged"
+ Parameter { name: "max"; type: "double" }
+ }
+ Signal {
+ name: "positionAtMinimumChanged"
+ Parameter { name: "min"; type: "double" }
+ }
+ Signal {
+ name: "positionAtMaximumChanged"
+ Parameter { name: "max"; type: "double" }
+ }
+ Method { name: "toMinimum" }
+ Method { name: "toMaximum" }
+ Method {
+ name: "setValue"
+ Parameter { name: "value"; type: "double" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "double" }
+ }
+ Method {
+ name: "valueForPosition"
+ type: "double"
+ Parameter { name: "position"; type: "double" }
+ }
+ Method {
+ name: "positionForValue"
+ type: "double"
+ Parameter { name: "value"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickSpinBoxValidator"
+ prototype: "QValidator"
+ exports: ["QtQuick.Controls.Private/SpinBoxValidator 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string"; isReadonly: true }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "decimals"; type: "int" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "prefix"; type: "string" }
+ Property { name: "suffix"; type: "string" }
+ Method { name: "increment" }
+ Method { name: "decrement" }
+ }
+ Component {
+ name: "QQuickStack"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/Stack 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "Inactive": 0,
+ "Deactivating": 1,
+ "Activating": 2,
+ "Active": 3
+ }
+ }
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "__index"; type: "int" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "__status"; type: "Status" }
+ Property { name: "view"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "__view"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickStyleItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.Private/StyleItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "sunken"; type: "bool" }
+ Property { name: "raised"; type: "bool" }
+ Property { name: "active"; type: "bool" }
+ Property { name: "selected"; type: "bool" }
+ Property { name: "hasFocus"; type: "bool" }
+ Property { name: "on"; type: "bool" }
+ Property { name: "hover"; type: "bool" }
+ Property { name: "horizontal"; type: "bool" }
+ Property { name: "transient"; type: "bool" }
+ Property { name: "elementType"; type: "string" }
+ Property { name: "text"; type: "string" }
+ Property { name: "activeControl"; type: "string" }
+ Property { name: "style"; type: "string"; isReadonly: true }
+ Property { name: "hints"; type: "QVariantMap" }
+ Property { name: "properties"; type: "QVariantMap" }
+ Property { name: "font"; type: "QFont"; isReadonly: true }
+ Property { name: "minimum"; type: "int" }
+ Property { name: "maximum"; type: "int" }
+ Property { name: "value"; type: "int" }
+ Property { name: "step"; type: "int" }
+ Property { name: "paintMargins"; type: "int" }
+ Property { name: "contentWidth"; type: "int" }
+ Property { name: "contentHeight"; type: "int" }
+ Signal { name: "infoChanged" }
+ Signal { name: "hintChanged" }
+ Signal {
+ name: "contentWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "contentHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "pixelMetric"
+ type: "int"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "styleHint"
+ type: "QVariant"
+ Parameter { type: "string" }
+ }
+ Method { name: "updateSizeHint" }
+ Method { name: "updateRect" }
+ Method { name: "updateItem" }
+ Method {
+ name: "hitTest"
+ type: "string"
+ Parameter { name: "x"; type: "int" }
+ Parameter { name: "y"; type: "int" }
+ }
+ Method {
+ name: "subControlRect"
+ type: "QRectF"
+ Parameter { name: "subcontrolString"; type: "string" }
+ }
+ Method {
+ name: "elidedText"
+ type: "string"
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "elideMode"; type: "int" }
+ Parameter { name: "width"; type: "int" }
+ }
+ Method {
+ name: "hasThemeIcon"
+ type: "bool"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "textWidth"
+ type: "double"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "textHeight"
+ type: "double"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickTooltip"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls.Private/Tooltip 1.0"]
+ exportMetaObjectRevisions: [0]
+ Method {
+ name: "showText"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ Parameter { name: "pos"; type: "QPointF" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method { name: "hideText" }
+ }
+ Component {
+ name: "QQuickWheelArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.Private/WheelArea 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "verticalDelta"; type: "double" }
+ Property { name: "horizontalDelta"; type: "double" }
+ Property { name: "horizontalMinimumValue"; type: "double" }
+ Property { name: "horizontalMaximumValue"; type: "double" }
+ Property { name: "verticalMinimumValue"; type: "double" }
+ Property { name: "verticalMaximumValue"; type: "double" }
+ Property { name: "horizontalValue"; type: "double" }
+ Property { name: "verticalValue"; type: "double" }
+ Property { name: "scrollSpeed"; type: "double" }
+ Property { name: "active"; type: "bool" }
+ Signal { name: "verticalWheelMoved" }
+ Signal { name: "horizontalWheelMoved" }
+ }
+ Component {
+ name: "QQuickWindow"
+ defaultProperty: "data"
+ prototype: "QWindow"
+ exports: ["QtQuick.Window/Window 2.0", "QtQuick.Window/Window 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property {
+ name: "activeFocusItem"
+ revision: 1
+ type: "QQuickItem"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal { name: "frameSwapped" }
+ Signal { name: "sceneGraphInitialized" }
+ Signal { name: "sceneGraphInvalidated" }
+ Signal { name: "beforeSynchronizing" }
+ Signal { name: "beforeRendering" }
+ Signal { name: "afterRendering" }
+ Signal {
+ name: "closing"
+ revision: 1
+ Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { type: "QColor" }
+ }
+ Signal { name: "activeFocusItemChanged"; revision: 1 }
+ Method { name: "update" }
+ Method { name: "releaseResources" }
+ }
+ Component {
+ name: "QWindow"
+ prototype: "QObject"
+ Enum {
+ name: "Visibility"
+ values: {
+ "Hidden": 0,
+ "AutomaticVisibility": 1,
+ "Windowed": 2,
+ "Minimized": 3,
+ "Maximized": 4,
+ "FullScreen": 5
+ }
+ }
+ Property { name: "title"; type: "string" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "minimumWidth"; revision: 1; type: "int" }
+ Property { name: "minimumHeight"; revision: 1; type: "int" }
+ Property { name: "maximumWidth"; revision: 1; type: "int" }
+ Property { name: "maximumHeight"; revision: 1; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
+ Signal {
+ name: "screenChanged"
+ Parameter { name: "screen"; type: "QScreen"; isPointer: true }
+ }
+ Signal {
+ name: "modalityChanged"
+ Parameter { name: "modality"; type: "Qt::WindowModality" }
+ }
+ Signal {
+ name: "windowStateChanged"
+ Parameter { name: "windowState"; type: "Qt::WindowState" }
+ }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumWidthChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumHeightChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumWidthChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumHeightChanged"
+ revision: 1
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
+ name: "contentOrientationChanged"
+ revision: 1
+ Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
+ }
+ Signal {
+ name: "focusObjectChanged"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
+ Method {
+ name: "setVisible"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method { name: "showMinimized" }
+ Method { name: "showMaximized" }
+ Method { name: "showFullScreen" }
+ Method { name: "showNormal" }
+ Method { name: "close"; type: "bool" }
+ Method { name: "raise" }
+ Method { name: "lower" }
+ Method {
+ name: "setTitle"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setMinimumWidth"
+ revision: 1
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMinimumHeight"
+ revision: 1
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setMaximumWidth"
+ revision: 1
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMaximumHeight"
+ revision: 1
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "alert"
+ Parameter { name: "msec"; type: "int" }
+ }
+ }
+ Component {
+ prototype: "QQuickWindow"
+ name: "QtQuick.Controls/ApplicationWindow"
+ exports: ["QtQuick.Controls/ApplicationWindow 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "menuBar"; type: "MenuBar_QMLTYPE_1"; isPointer: true }
+ Property { name: "toolBar"; type: "QQuickItem"; isPointer: true }
+ Property { name: "statusBar"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property {
+ name: "activeFocusItem"
+ revision: 1
+ type: "QQuickItem"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal { name: "frameSwapped" }
+ Signal { name: "sceneGraphInitialized" }
+ Signal { name: "sceneGraphInvalidated" }
+ Signal { name: "beforeSynchronizing" }
+ Signal { name: "beforeRendering" }
+ Signal { name: "afterRendering" }
+ Signal {
+ name: "closing"
+ revision: 1
+ Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { type: "QColor" }
+ }
+ Signal { name: "activeFocusItemChanged"; revision: 1 }
+ Method { name: "update" }
+ Method { name: "forcePolish" }
+ Method { name: "releaseResources" }
+ Property { name: "title"; type: "string" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "minimumWidth"; type: "int" }
+ Property { name: "minimumHeight"; type: "int" }
+ Property { name: "maximumWidth"; type: "int" }
+ Property { name: "maximumHeight"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
+ Signal {
+ name: "screenChanged"
+ Parameter { name: "screen"; type: "QScreen"; isPointer: true }
+ }
+ Signal {
+ name: "modalityChanged"
+ Parameter { name: "modality"; type: "Qt::WindowModality" }
+ }
+ Signal {
+ name: "windowStateChanged"
+ Parameter { name: "windowState"; type: "Qt::WindowState" }
+ }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
+ name: "contentOrientationChanged"
+ Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
+ }
+ Signal {
+ name: "focusObjectChanged"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
+ Method {
+ name: "setVisible"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method { name: "showMinimized" }
+ Method { name: "showMaximized" }
+ Method { name: "showFullScreen" }
+ Method { name: "showNormal" }
+ Method { name: "close"; type: "bool" }
+ Method { name: "raise" }
+ Method { name: "lower" }
+ Method {
+ name: "setTitle"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setMinimumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMinimumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setMaximumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMaximumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "alert"
+ revision: 1
+ Parameter { name: "msec"; type: "int" }
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/BusyIndicator"
+ exports: ["QtQuick.Controls/BusyIndicator 1.1"]
+ exportMetaObjectRevisions: [1]
+ defaultProperty: "data"
+ Property { name: "running"; type: "bool" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/Button"
+ exports: ["QtQuick.Controls/Button 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__textColor"; type: "QColor" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "isDefault"; type: "bool" }
+ Property { name: "menu"; type: "Menu_QMLTYPE_16"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/CheckBox"
+ exports: ["QtQuick.Controls/CheckBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checked"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "__cycleStatesHandler"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Property { name: "checkedState"; type: "int" }
+ Property { name: "partiallyCheckedEnabled"; type: "bool" }
+ Property { name: "__ignoreChecked"; type: "bool" }
+ Method { name: "__cycleCheckBoxStates"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ComboBox"
+ exports: ["QtQuick.Controls/ComboBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "textRole"; type: "string" }
+ Property { name: "editable"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "__popup"; type: "QVariant" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentText"; type: "string"; isReadonly: true }
+ Property { name: "editText"; type: "string" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Signal { name: "accepted" }
+ Signal {
+ name: "activated"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "textAt"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "find"
+ type: "QVariant"
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/GroupBox"
+ exports: ["QtQuick.Controls/GroupBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "title"; type: "string" }
+ Property { name: "flat"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "__checkbox"; type: "CheckBox_QMLTYPE_25"; isReadonly: true; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickText"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Text 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextStyle"
+ values: {
+ "Normal": 0,
+ "Outline": 1,
+ "Raised": 2,
+ "Sunken": 3
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2,
+ "StyledText": 4
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Enum {
+ name: "LineHeightMode"
+ values: {
+ "ProportionalHeight": 0,
+ "FixedHeight": 1
+ }
+ }
+ Enum {
+ name: "FontSizeMode"
+ values: {
+ "FixedSize": 0,
+ "HorizontalFit": 1,
+ "VerticalFit": 2,
+ "Fit": 3
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "linkColor"; type: "QColor" }
+ Property { name: "style"; type: "TextStyle" }
+ Property { name: "styleColor"; type: "QColor" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "truncated"; type: "bool"; isReadonly: true }
+ Property { name: "maximumLineCount"; type: "int" }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "elide"; type: "TextElideMode" }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "lineHeight"; type: "double" }
+ Property { name: "lineHeightMode"; type: "LineHeightMode" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "minimumPixelSize"; type: "int" }
+ Property { name: "minimumPointSize"; type: "int" }
+ Property { name: "fontSizeMode"; type: "FontSizeMode" }
+ Property { name: "renderType"; type: "RenderType" }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "styleChanged"
+ Parameter { name: "style"; type: "TextStyle" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "elideModeChanged"
+ Parameter { name: "mode"; type: "TextElideMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "lineHeightChanged"
+ Parameter { name: "lineHeight"; type: "double" }
+ }
+ Signal {
+ name: "lineHeightModeChanged"
+ Parameter { name: "mode"; type: "LineHeightMode" }
+ }
+ Signal {
+ name: "lineLaidOut"
+ Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
+ }
+ Method { name: "doLayout" }
+ }
+
+ Component {
+ prototype: "QQuickText"
+ name: "QtQuick.Controls/Label"
+ exports: ["QtQuick.Controls/Label 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickMenu"
+ name: "QtQuick.Controls/Menu"
+ exports: ["QtQuick.Controls/Menu 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "items"
+ Property { name: "__selfComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__currentIndex"; type: "int" }
+ Property { name: "__menuComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__menuBar"; type: "QVariant" }
+ Method {
+ name: "addMenu"
+ type: "QVariant"
+ Parameter { name: "title"; type: "QVariant" }
+ }
+ Method {
+ name: "insertMenu"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "title"; type: "QVariant" }
+ }
+ Property { name: "title"; type: "string" }
+ Property { name: "items"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__selectedIndex"; type: "int" }
+ Property { name: "__popupVisible"; type: "bool"; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__minimumWidth"; type: "int" }
+ Property { name: "__font"; type: "QFont" }
+ Property { name: "__xOffset"; type: "double" }
+ Property { name: "__yOffset"; type: "double" }
+ Signal { name: "__menuClosed" }
+ Signal { name: "popupVisibleChanged" }
+ Method { name: "__closeMenu" }
+ Method { name: "__dismissMenu" }
+ Method { name: "popup" }
+ Method {
+ name: "addItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "insertItem"
+ type: "QQuickMenuItem*"
+ Parameter { type: "int" }
+ Parameter { type: "string" }
+ }
+ Method { name: "addSeparator" }
+ Method {
+ name: "insertSeparator"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { type: "int" }
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { type: "QQuickMenuBase"; isPointer: true }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ Parameter { name: "atActionIndex"; type: "int" }
+ }
+ Method {
+ name: "__popup"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true }
+ Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__icon"; type: "QVariant"; isReadonly: true }
+ Signal { name: "__textChanged" }
+ }
+ Component {
+ prototype: "QQuickMenuBar"
+ name: "QtQuick.Controls/MenuBar"
+ exports: ["QtQuick.Controls/MenuBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "menus"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__menuBarComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true }
+ Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true }
+ Property { name: "__isNative"; type: "bool"; isReadonly: true }
+ Signal { name: "contentItemChanged" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ProgressBar"
+ exports: ["QtQuick.Controls/ProgressBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "indeterminate"; type: "bool" }
+ Property { name: "orientation"; type: "int" }
+ Property { name: "__initialized"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Method {
+ name: "setValue"
+ type: "QVariant"
+ Parameter { name: "v"; type: "QVariant" }
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/RadioButton"
+ exports: ["QtQuick.Controls/RadioButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checked"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "__cycleStatesHandler"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ScrollView"
+ exports: ["QtQuick.Controls/ScrollView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "contentItem"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/Slider"
+ exports: ["QtQuick.Controls/Slider 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "orientation"; type: "int" }
+ Property { name: "updateValueWhileDragging"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "tickmarksEnabled"; type: "bool" }
+ Property { name: "__horizontal"; type: "bool" }
+ Property { name: "__handlePos"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "value"; type: "double" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/SpinBox"
+ exports: ["QtQuick.Controls/SpinBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "suffix"; type: "string" }
+ Property { name: "prefix"; type: "string" }
+ Property { name: "decimals"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "__text"; type: "string" }
+ Method { name: "__increment"; type: "QVariant" }
+ Method { name: "__decrement"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/SplitView"
+ exports: ["QtQuick.Controls/SplitView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__contents"
+ Property { name: "orientation"; type: "int" }
+ Property { name: "handleDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "resizing"; type: "bool" }
+ Property { name: "__contents"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "__items"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "__handles"; type: "QQuickItem"; isList: true; isReadonly: true }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/StackView"
+ exports: ["QtQuick.Controls/StackView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "busy"; type: "bool"; isReadonly: true }
+ Property { name: "delegate"; type: "StackViewDelegate_QMLTYPE_97"; isPointer: true }
+ Property { name: "__currentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__depth"; type: "int" }
+ Property { name: "__guard"; type: "bool" }
+ Property { name: "invalidItemReplacement"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "initialItem"; type: "QVariant" }
+ Property { name: "__currentTransition"; type: "QVariant" }
+ Property { name: "depth"; type: "int"; isReadonly: true }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Method {
+ name: "push"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ }
+ Method {
+ name: "pop"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ }
+ Method { name: "clear"; type: "QVariant" }
+ Method {
+ name: "find"
+ type: "QVariant"
+ Parameter { name: "func"; type: "QVariant" }
+ Parameter { name: "onlySearchLoadedItems"; type: "QVariant" }
+ }
+ Method {
+ name: "get"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "dontLoad"; type: "QVariant" }
+ }
+ Method { name: "completeTransition"; type: "QVariant" }
+ Method {
+ name: "replace"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ Parameter { name: "properties"; type: "QVariant" }
+ Parameter { name: "immediate"; type: "QVariant" }
+ }
+ Method {
+ name: "__recursionGuard"
+ type: "QVariant"
+ Parameter { name: "use"; type: "QVariant" }
+ }
+ Method {
+ name: "__loadElement"
+ type: "QVariant"
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__resolveComponent"
+ type: "QVariant"
+ Parameter { name: "unknownObjectType"; type: "QVariant" }
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__cleanup"
+ type: "QVariant"
+ Parameter { name: "element"; type: "QVariant" }
+ }
+ Method {
+ name: "__setStatus"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ Parameter { name: "status"; type: "QVariant" }
+ }
+ Method {
+ name: "__performTransition"
+ type: "QVariant"
+ Parameter { name: "transition"; type: "QVariant" }
+ }
+ Method { name: "animationFinished"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Controls/StackViewDelegate"
+ exports: ["QtQuick.Controls/StackViewDelegate 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "pushTransition"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "popTransition"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "replaceTransition"; type: "QQmlComponent"; isPointer: true }
+ Method {
+ name: "getTransition"
+ type: "QVariant"
+ Parameter { name: "properties"; type: "QVariant" }
+ }
+ Method {
+ name: "transitionFinished"
+ type: "QVariant"
+ Parameter { name: "properties"; type: "QVariant" }
+ }
+ }
+ Component {
+ prototype: "QQuickParallelAnimation"
+ name: "QtQuick.Controls/StackViewTransition"
+ exports: ["QtQuick.Controls/StackViewTransition 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "animations"
+ Property { name: "name"; type: "string" }
+ Property { name: "enterItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "exitItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "immediate"; type: "bool" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/StatusBar"
+ exports: ["QtQuick.Controls/StatusBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickLoader"
+ name: "QtQuick.Controls/Tab"
+ exports: ["QtQuick.Controls/Tab 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "component"
+ Property { name: "title"; type: "string" }
+ Property { name: "__inserted"; type: "bool" }
+ Property { name: "component"; type: "QQmlComponent"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TabView"
+ exports: ["QtQuick.Controls/TabView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "count"; type: "int" }
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "tabsVisible"; type: "bool" }
+ Property { name: "tabPosition"; type: "int" }
+ Property { name: "__tabs"; type: "QQmlListModel"; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__styleItem"; type: "QVariant" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Method {
+ name: "addTab"
+ type: "QVariant"
+ Parameter { name: "title"; type: "QVariant" }
+ Parameter { name: "component"; type: "QVariant" }
+ }
+ Method {
+ name: "insertTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "title"; type: "QVariant" }
+ Parameter { name: "component"; type: "QVariant" }
+ }
+ Method {
+ name: "removeTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "moveTab"
+ type: "QVariant"
+ Parameter { name: "from"; type: "QVariant" }
+ Parameter { name: "to"; type: "QVariant" }
+ }
+ Method {
+ name: "getTab"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method { name: "__setOpacities"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TableView"
+ exports: ["QtQuick.Controls/TableView 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__columns"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "alternatingRowColors"; type: "bool" }
+ Property { name: "headerVisible"; type: "bool" }
+ Property { name: "itemDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "rowDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "headerDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "sortIndicatorColumn"; type: "int" }
+ Property { name: "sortIndicatorVisible"; type: "bool" }
+ Property { name: "sortIndicatorOrder"; type: "int" }
+ Property { name: "__activateItemOnSingleClick"; type: "bool" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "backgroundVisible"; type: "bool" }
+ Property { name: "__columns"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentHeader"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "contentFooter"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "rowCount"; type: "int"; isReadonly: true }
+ Property { name: "columnCount"; type: "int"; isReadonly: true }
+ Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true }
+ Property { name: "currentRow"; type: "int" }
+ Property { name: "__currentRowItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "activated"
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "doubleClicked"
+ Parameter { name: "row"; type: "int" }
+ }
+ Method {
+ name: "positionViewAtRow"
+ type: "QVariant"
+ Parameter { name: "row"; type: "QVariant" }
+ Parameter { name: "mode"; type: "QVariant" }
+ }
+ Method {
+ name: "rowAt"
+ type: "QVariant"
+ Parameter { name: "x"; type: "QVariant" }
+ Parameter { name: "y"; type: "QVariant" }
+ }
+ Method {
+ name: "addColumn"
+ type: "QVariant"
+ Parameter { name: "column"; type: "QVariant" }
+ }
+ Method {
+ name: "insertColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "column"; type: "QVariant" }
+ }
+ Method {
+ name: "removeColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "moveColumn"
+ type: "QVariant"
+ Parameter { name: "from"; type: "QVariant" }
+ Parameter { name: "to"; type: "QVariant" }
+ }
+ Method {
+ name: "getColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method { name: "__decrementCurrentIndex"; type: "QVariant" }
+ Method { name: "__incrementCurrentIndex"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Controls/TableViewColumn"
+ exports: ["QtQuick.Controls/TableViewColumn 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "__view"; type: "QQuickItem"; isPointer: true }
+ Property { name: "title"; type: "string" }
+ Property { name: "role"; type: "string" }
+ Property { name: "width"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "resizable"; type: "bool" }
+ Property { name: "movable"; type: "bool" }
+ Property { name: "elideMode"; type: "int" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TextArea"
+ exports: ["QtQuick.Controls/TextArea 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "frameVisible"; type: "bool" }
+ Property { name: "highlightOnFocus"; type: "bool" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scroller"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__scrollBarTopMargin"; type: "int" }
+ Property { name: "__viewTopMargin"; type: "int" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true }
+ Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true }
+ Property {
+ name: "__horizontalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "__verticalScrollBar"
+ type: "ScrollBar_QMLTYPE_51"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "tabChangesFocus"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "textColor"; type: "QColor" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "int" }
+ Property { name: "inputMethodHints"; type: "int" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "textFormat"; type: "int" }
+ Property { name: "wrapMode"; type: "int" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "selectByKeyboard"; type: "bool" }
+ Property { name: "hoveredLink"; type: "string"; isReadonly: true }
+ Property { name: "backgroundVisible"; type: "bool" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "textMargin"; type: "double" }
+ Property { name: "textDocument"; type: "QQuickTextDocument"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ Parameter { name: "link"; type: "string" }
+ }
+ Method {
+ name: "append"
+ type: "QVariant"
+ Parameter { name: "string"; type: "QVariant" }
+ }
+ Method { name: "copy"; type: "QVariant" }
+ Method { name: "cut"; type: "QVariant" }
+ Method { name: "deselect"; type: "QVariant" }
+ Method {
+ name: "getFormattedText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "getText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "insert"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method {
+ name: "isRightToLeft"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "mode"; type: "QVariant" }
+ }
+ Method { name: "paste"; type: "QVariant" }
+ Method {
+ name: "positionAt"
+ type: "QVariant"
+ Parameter { name: "x"; type: "QVariant" }
+ Parameter { name: "y"; type: "QVariant" }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ }
+ Method { name: "redo"; type: "QVariant" }
+ Method {
+ name: "remove"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "select"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Method { name: "selectWord"; type: "QVariant" }
+ Method { name: "undo"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/TextField"
+ exports: ["QtQuick.Controls/TextField 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "textColor"; type: "QColor" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "displayText"; type: "string"; isReadonly: true }
+ Property { name: "echoMode"; type: "int" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "int" }
+ Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "int" }
+ Property { name: "inputMask"; type: "string" }
+ Property { name: "inputMethodHints"; type: "int" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "maximumLength"; type: "int" }
+ Property { name: "placeholderText"; type: "string" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "text"; type: "string" }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "__contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "__contentWidth"; type: "double"; isReadonly: true }
+ Signal { name: "accepted" }
+ Method { name: "copy"; type: "QVariant" }
+ Method { name: "cut"; type: "QVariant" }
+ Method { name: "deselect"; type: "QVariant" }
+ Method {
+ name: "getText"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method {
+ name: "insert"
+ type: "QVariant"
+ Parameter { name: "position"; type: "QVariant" }
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method {
+ name: "isRightToLeft"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "paste"; type: "QVariant" }
+ Method { name: "redo"; type: "QVariant" }
+ Method {
+ name: "select"
+ type: "QVariant"
+ Parameter { name: "start"; type: "QVariant" }
+ Parameter { name: "end"; type: "QVariant" }
+ }
+ Method { name: "selectAll"; type: "QVariant" }
+ Method { name: "selectWord"; type: "QVariant" }
+ Method { name: "undo"; type: "QVariant" }
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls/ToolBar"
+ exports: ["QtQuick.Controls/ToolBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "__content"
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Controls/ToolButton"
+ exports: ["QtQuick.Controls/ToolButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "data"
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__textColor"; type: "QColor" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/qmldir b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/qmldir
new file mode 100644
index 0000000000..f51b055323
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.Controls
+plugin qtquickcontrolsplugin
+classname QtQuickControlsPlugin
+typeinfo plugins.qmltypes
diff --git a/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/plugins.qmltypes
new file mode 100644
index 0000000000..cadef10370
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/plugins.qmltypes
@@ -0,0 +1,5623 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable -builtins'
+
+Module {
+ Component {
+ name: "QAbstractItemModel"
+ prototype: "QObject"
+ Enum {
+ name: "LayoutChangeHint"
+ values: {
+ "NoLayoutChangeHint": 0,
+ "VerticalSortHint": 1,
+ "HorizontalSortHint": 2
+ }
+ }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "topLeft"; type: "QModelIndex" }
+ Parameter { name: "bottomRight"; type: "QModelIndex" }
+ Parameter { name: "roles"; type: "QVector<int>" }
+ }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "topLeft"; type: "QModelIndex" }
+ Parameter { name: "bottomRight"; type: "QModelIndex" }
+ }
+ Signal {
+ name: "headerDataChanged"
+ Parameter { name: "orientation"; type: "Qt::Orientation" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "layoutChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
+ }
+ Signal {
+ name: "layoutChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ }
+ Signal { name: "layoutChanged" }
+ Signal {
+ name: "layoutAboutToBeChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
+ }
+ Signal {
+ name: "layoutAboutToBeChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ }
+ Signal { name: "layoutAboutToBeChanged" }
+ Signal {
+ name: "rowsAboutToBeInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsAboutToBeRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal { name: "modelAboutToBeReset" }
+ Signal { name: "modelReset" }
+ Signal {
+ name: "rowsAboutToBeMoved"
+ Parameter { name: "sourceParent"; type: "QModelIndex" }
+ Parameter { name: "sourceStart"; type: "int" }
+ Parameter { name: "sourceEnd"; type: "int" }
+ Parameter { name: "destinationParent"; type: "QModelIndex" }
+ Parameter { name: "destinationRow"; type: "int" }
+ }
+ Signal {
+ name: "rowsMoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ Parameter { name: "destination"; type: "QModelIndex" }
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeMoved"
+ Parameter { name: "sourceParent"; type: "QModelIndex" }
+ Parameter { name: "sourceStart"; type: "int" }
+ Parameter { name: "sourceEnd"; type: "int" }
+ Parameter { name: "destinationParent"; type: "QModelIndex" }
+ Parameter { name: "destinationColumn"; type: "int" }
+ }
+ Signal {
+ name: "columnsMoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ Parameter { name: "destination"; type: "QModelIndex" }
+ Parameter { name: "column"; type: "int" }
+ }
+ Method { name: "submit"; type: "bool" }
+ Method { name: "revert" }
+ }
+ Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" }
+ Component {
+ name: "QDoubleValidator"
+ prototype: "QValidator"
+ Enum {
+ name: "Notation"
+ values: {
+ "StandardNotation": 0,
+ "ScientificNotation": 1
+ }
+ }
+ Property { name: "bottom"; type: "double" }
+ Property { name: "top"; type: "double" }
+ Property { name: "decimals"; type: "int" }
+ Property { name: "notation"; type: "Notation" }
+ Signal {
+ name: "bottomChanged"
+ Parameter { name: "bottom"; type: "double" }
+ }
+ Signal {
+ name: "topChanged"
+ Parameter { name: "top"; type: "double" }
+ }
+ Signal {
+ name: "decimalsChanged"
+ Parameter { name: "decimals"; type: "int" }
+ }
+ Signal {
+ name: "notationChanged"
+ Parameter { name: "notation"; type: "QDoubleValidator::Notation" }
+ }
+ }
+ Component {
+ name: "QInputMethod"
+ prototype: "QObject"
+ exports: ["QtQuick/InputMethod 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Action"
+ values: {
+ "Click": 0,
+ "ContextMenu": 1
+ }
+ }
+ Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "keyboardRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "visible"; type: "bool"; isReadonly: true }
+ Property { name: "animating"; type: "bool"; isReadonly: true }
+ Property { name: "locale"; type: "QLocale"; isReadonly: true }
+ Property { name: "inputDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Signal {
+ name: "inputDirectionChanged"
+ Parameter { name: "newDirection"; type: "Qt::LayoutDirection" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method {
+ name: "update"
+ Parameter { name: "queries"; type: "Qt::InputMethodQueries" }
+ }
+ Method { name: "reset" }
+ Method { name: "commit" }
+ Method {
+ name: "invokeAction"
+ Parameter { name: "a"; type: "Action" }
+ Parameter { name: "cursorPosition"; type: "int" }
+ }
+ }
+ Component {
+ name: "QIntValidator"
+ prototype: "QValidator"
+ Property { name: "bottom"; type: "int" }
+ Property { name: "top"; type: "int" }
+ Signal {
+ name: "bottomChanged"
+ Parameter { name: "bottom"; type: "int" }
+ }
+ Signal {
+ name: "topChanged"
+ Parameter { name: "top"; type: "int" }
+ }
+ }
+ Component {
+ name: "QKeySequence"
+ exports: ["QtQuick/StandardKey 2.2"]
+ exportMetaObjectRevisions: [2]
+ Enum {
+ name: "StandardKey"
+ values: {
+ "UnknownKey": 0,
+ "HelpContents": 1,
+ "WhatsThis": 2,
+ "Open": 3,
+ "Close": 4,
+ "Save": 5,
+ "New": 6,
+ "Delete": 7,
+ "Cut": 8,
+ "Copy": 9,
+ "Paste": 10,
+ "Undo": 11,
+ "Redo": 12,
+ "Back": 13,
+ "Forward": 14,
+ "Refresh": 15,
+ "ZoomIn": 16,
+ "ZoomOut": 17,
+ "Print": 18,
+ "AddTab": 19,
+ "NextChild": 20,
+ "PreviousChild": 21,
+ "Find": 22,
+ "FindNext": 23,
+ "FindPrevious": 24,
+ "Replace": 25,
+ "SelectAll": 26,
+ "Bold": 27,
+ "Italic": 28,
+ "Underline": 29,
+ "MoveToNextChar": 30,
+ "MoveToPreviousChar": 31,
+ "MoveToNextWord": 32,
+ "MoveToPreviousWord": 33,
+ "MoveToNextLine": 34,
+ "MoveToPreviousLine": 35,
+ "MoveToNextPage": 36,
+ "MoveToPreviousPage": 37,
+ "MoveToStartOfLine": 38,
+ "MoveToEndOfLine": 39,
+ "MoveToStartOfBlock": 40,
+ "MoveToEndOfBlock": 41,
+ "MoveToStartOfDocument": 42,
+ "MoveToEndOfDocument": 43,
+ "SelectNextChar": 44,
+ "SelectPreviousChar": 45,
+ "SelectNextWord": 46,
+ "SelectPreviousWord": 47,
+ "SelectNextLine": 48,
+ "SelectPreviousLine": 49,
+ "SelectNextPage": 50,
+ "SelectPreviousPage": 51,
+ "SelectStartOfLine": 52,
+ "SelectEndOfLine": 53,
+ "SelectStartOfBlock": 54,
+ "SelectEndOfBlock": 55,
+ "SelectStartOfDocument": 56,
+ "SelectEndOfDocument": 57,
+ "DeleteStartOfWord": 58,
+ "DeleteEndOfWord": 59,
+ "DeleteEndOfLine": 60,
+ "InsertParagraphSeparator": 61,
+ "InsertLineSeparator": 62,
+ "SaveAs": 63,
+ "Preferences": 64,
+ "Quit": 65,
+ "FullScreen": 66,
+ "Deselect": 67,
+ "DeleteCompleteLine": 68
+ }
+ }
+ }
+ Component {
+ name: "QObject"
+ exports: ["QtQml/QtObject 2.0", "QtQuick/QtObject 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "objectName"; type: "string" }
+ Signal {
+ name: "objectNameChanged"
+ Parameter { name: "objectName"; type: "string" }
+ }
+ Method { name: "toString" }
+ Method { name: "destroy" }
+ Method {
+ name: "destroy"
+ Parameter { name: "delay"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQmlApplication"
+ prototype: "QObject"
+ Property { name: "arguments"; type: "QStringList"; isReadonly: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "version"; type: "string" }
+ Property { name: "organization"; type: "string" }
+ Property { name: "domain"; type: "string" }
+ Signal { name: "aboutToQuit" }
+ Method {
+ name: "setName"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setVersion"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setOrganization"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setDomain"
+ Parameter { name: "arg"; type: "string" }
+ }
+ }
+ Component {
+ name: "QQmlBind"
+ prototype: "QObject"
+ exports: ["QtQml/Binding 2.0", "QtQuick/Binding 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "property"; type: "string" }
+ Property { name: "value"; type: "QVariant" }
+ Property { name: "when"; type: "bool" }
+ }
+ Component {
+ name: "QQmlComponent"
+ prototype: "QObject"
+ exports: [
+ "QML/Component 1.0",
+ "QtQml/Component 2.0",
+ "QtQuick/Component 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0, 0]
+ attachedType: "QQmlComponentAttached"
+ Enum {
+ name: "CompilationMode"
+ values: {
+ "PreferSynchronous": 0,
+ "Asynchronous": 1
+ }
+ }
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "progress"; type: "double"; isReadonly: true }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "url"; type: "QUrl"; isReadonly: true }
+ Signal {
+ name: "statusChanged"
+ Parameter { type: "QQmlComponent::Status" }
+ }
+ Signal {
+ name: "progressChanged"
+ Parameter { type: "double" }
+ }
+ Method {
+ name: "loadUrl"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "loadUrl"
+ Parameter { name: "url"; type: "QUrl" }
+ Parameter { name: "mode"; type: "CompilationMode" }
+ }
+ Method {
+ name: "setData"
+ Parameter { type: "QByteArray" }
+ Parameter { name: "baseUrl"; type: "QUrl" }
+ }
+ Method { name: "errorString"; type: "string" }
+ }
+ Component {
+ name: "QQmlComponentAttached"
+ prototype: "QObject"
+ Signal { name: "completed" }
+ Signal { name: "destruction" }
+ }
+ Component {
+ name: "QQmlConnections"
+ prototype: "QObject"
+ exports: ["QtQml/Connections 2.0", "QtQuick/Connections 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "ignoreUnknownSignals"; type: "bool" }
+ }
+ Component {
+ name: "QQmlDelegateModel"
+ defaultProperty: "delegate"
+ prototype: "QQmlInstanceModel"
+ exports: ["QtQuick/VisualDataModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlDelegateModelAttached"
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "filterOnGroup"; type: "string" }
+ Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true }
+ Property {
+ name: "persistedItems"
+ type: "QQmlDelegateModelGroup"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true }
+ Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "rootIndex"; type: "QVariant" }
+ Signal { name: "filterGroupChanged" }
+ Signal { name: "defaultGroupsChanged" }
+ Method {
+ name: "modelIndex"
+ type: "QVariant"
+ Parameter { name: "idx"; type: "int" }
+ }
+ Method { name: "parentModelIndex"; type: "QVariant" }
+ }
+ Component {
+ name: "QQmlDelegateModelAttached"
+ prototype: "QObject"
+ Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true }
+ Property { name: "groups"; type: "QStringList" }
+ Property { name: "isUnresolved"; type: "bool"; isReadonly: true }
+ Signal { name: "unresolvedChanged" }
+ }
+ Component {
+ name: "QQmlDelegateModelGroup"
+ prototype: "QObject"
+ exports: ["QtQuick/VisualDataGroup 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "includeByDefault"; type: "bool" }
+ Signal { name: "defaultIncludeChanged" }
+ Signal {
+ name: "changed"
+ Parameter { name: "removed"; type: "QQmlV4Handle" }
+ Parameter { name: "inserted"; type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "insert"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "create"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "resolve"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "remove"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "addGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "removeGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "setGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "move"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "get"
+ type: "QQmlV4Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component { name: "QQmlDelegateModelParts"; prototype: "QObject" }
+ Component {
+ name: "QQmlEasingValueType"
+ prototype: "QQmlValueType"
+ exports: ["QtQuick/Easing 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Type"
+ values: {
+ "Linear": 0,
+ "InQuad": 1,
+ "OutQuad": 2,
+ "InOutQuad": 3,
+ "OutInQuad": 4,
+ "InCubic": 5,
+ "OutCubic": 6,
+ "InOutCubic": 7,
+ "OutInCubic": 8,
+ "InQuart": 9,
+ "OutQuart": 10,
+ "InOutQuart": 11,
+ "OutInQuart": 12,
+ "InQuint": 13,
+ "OutQuint": 14,
+ "InOutQuint": 15,
+ "OutInQuint": 16,
+ "InSine": 17,
+ "OutSine": 18,
+ "InOutSine": 19,
+ "OutInSine": 20,
+ "InExpo": 21,
+ "OutExpo": 22,
+ "InOutExpo": 23,
+ "OutInExpo": 24,
+ "InCirc": 25,
+ "OutCirc": 26,
+ "InOutCirc": 27,
+ "OutInCirc": 28,
+ "InElastic": 29,
+ "OutElastic": 30,
+ "InOutElastic": 31,
+ "OutInElastic": 32,
+ "InBack": 33,
+ "OutBack": 34,
+ "InOutBack": 35,
+ "OutInBack": 36,
+ "InBounce": 37,
+ "OutBounce": 38,
+ "InOutBounce": 39,
+ "OutInBounce": 40,
+ "InCurve": 41,
+ "OutCurve": 42,
+ "SineCurve": 43,
+ "CosineCurve": 44,
+ "Bezier": 45
+ }
+ }
+ Property { name: "type"; type: "Type" }
+ Property { name: "amplitude"; type: "double" }
+ Property { name: "overshoot"; type: "double" }
+ Property { name: "period"; type: "double" }
+ Property { name: "bezierCurve"; type: "QVariantList" }
+ }
+ Component {
+ name: "QQmlInstanceModel"
+ prototype: "QObject"
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Signal {
+ name: "modelUpdated"
+ Parameter { name: "changeSet"; type: "QQmlChangeSet" }
+ Parameter { name: "reset"; type: "bool" }
+ }
+ Signal {
+ name: "createdItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "initItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "destroyingItem"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQmlInstantiator"
+ defaultProperty: "delegate"
+ prototype: "QObject"
+ exports: ["QtQml/Instantiator 2.1", "QtQuick/Instantiator 2.1"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "active"; type: "bool" }
+ Property { name: "asynchronous"; type: "bool" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "object"; type: "QObject"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "objectAdded"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "objectRemoved"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "objectAt"
+ type: "QObject*"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQmlListElement"
+ prototype: "QObject"
+ exports: ["QtQuick/ListElement 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQmlListModel"
+ prototype: "QAbstractListModel"
+ exports: ["QtQuick/ListModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "dynamicRoles"; type: "bool" }
+ Method { name: "clear" }
+ Method {
+ name: "remove"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "insert"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "get"
+ type: "QQmlV4Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "set"
+ Parameter { name: "index"; type: "int" }
+ Parameter { type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "setProperty"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "property"; type: "string" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "move"
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ Parameter { name: "count"; type: "int" }
+ }
+ Method { name: "sync" }
+ }
+ Component {
+ name: "QQmlLocale"
+ exports: ["QtQml/Locale 2.2", "QtQuick/Locale 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Enum {
+ name: "MeasurementSystem"
+ values: {
+ "MetricSystem": 0,
+ "ImperialSystem": 1,
+ "ImperialUSSystem": 1,
+ "ImperialUKSystem": 2
+ }
+ }
+ Enum {
+ name: "FormatType"
+ values: {
+ "LongFormat": 0,
+ "ShortFormat": 1,
+ "NarrowFormat": 2
+ }
+ }
+ Enum {
+ name: "CurrencySymbolFormat"
+ values: {
+ "CurrencyIsoCode": 0,
+ "CurrencySymbol": 1,
+ "CurrencyDisplayName": 2
+ }
+ }
+ Enum {
+ name: "DayOfWeek"
+ values: {
+ "Sunday": 0,
+ "Monday": 1,
+ "Tuesday": 2,
+ "Wednesday": 3,
+ "Thursday": 4,
+ "Friday": 5,
+ "Saturday": 6
+ }
+ }
+ }
+ Component {
+ name: "QQmlObjectModel"
+ defaultProperty: "children"
+ prototype: "QQmlInstanceModel"
+ exports: ["QtQuick/VisualItemModel 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlObjectModelAttached"
+ Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQmlObjectModelAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ }
+ Component {
+ name: "QQmlTimer"
+ prototype: "QObject"
+ exports: ["QtQml/Timer 2.0", "QtQuick/Timer 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "interval"; type: "int" }
+ Property { name: "running"; type: "bool" }
+ Property { name: "repeat"; type: "bool" }
+ Property { name: "triggeredOnStart"; type: "bool" }
+ Property { name: "parent"; type: "QObject"; isReadonly: true; isPointer: true }
+ Signal { name: "triggered" }
+ Method { name: "start" }
+ Method { name: "stop" }
+ Method { name: "restart" }
+ }
+ Component { name: "QQmlValueType"; prototype: "QObject" }
+ Component {
+ name: "QQuickAbstractAnimation"
+ prototype: "QObject"
+ exports: ["QtQuick/Animation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Loops"
+ values: {
+ "Infinite": -2
+ }
+ }
+ Property { name: "running"; type: "bool" }
+ Property { name: "paused"; type: "bool" }
+ Property { name: "alwaysRunToEnd"; type: "bool" }
+ Property { name: "loops"; type: "int" }
+ Signal { name: "started" }
+ Signal { name: "stopped" }
+ Signal {
+ name: "runningChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "pausedChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "alwaysRunToEndChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "loopCountChanged"
+ Parameter { type: "int" }
+ }
+ Method { name: "restart" }
+ Method { name: "start" }
+ Method { name: "pause" }
+ Method { name: "resume" }
+ Method { name: "stop" }
+ Method { name: "complete" }
+ }
+ Component {
+ name: "QQuickAccessibleAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/Accessible 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "role"; type: "QAccessible::Role" }
+ Property { name: "name"; type: "string" }
+ Property { name: "description"; type: "string" }
+ Method { name: "valueChanged" }
+ Method { name: "cursorPositionChanged" }
+ }
+ Component {
+ name: "QQuickAnchorAnimation"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/AnchorAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "duration"; type: "int" }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Signal {
+ name: "durationChanged"
+ Parameter { type: "int" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { type: "QEasingCurve" }
+ }
+ }
+ Component {
+ name: "QQuickAnchorChanges"
+ prototype: "QQuickStateOperation"
+ exports: ["QtQuick/AnchorChanges 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickAnchorSet"
+ prototype: "QObject"
+ Property { name: "left"; type: "QQmlScriptString" }
+ Property { name: "right"; type: "QQmlScriptString" }
+ Property { name: "horizontalCenter"; type: "QQmlScriptString" }
+ Property { name: "top"; type: "QQmlScriptString" }
+ Property { name: "bottom"; type: "QQmlScriptString" }
+ Property { name: "verticalCenter"; type: "QQmlScriptString" }
+ Property { name: "baseline"; type: "QQmlScriptString" }
+ }
+ Component {
+ name: "QQuickAnchors"
+ prototype: "QObject"
+ Property { name: "left"; type: "QQuickAnchorLine" }
+ Property { name: "right"; type: "QQuickAnchorLine" }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine" }
+ Property { name: "top"; type: "QQuickAnchorLine" }
+ Property { name: "bottom"; type: "QQuickAnchorLine" }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine" }
+ Property { name: "baseline"; type: "QQuickAnchorLine" }
+ Property { name: "margins"; type: "double" }
+ Property { name: "leftMargin"; type: "double" }
+ Property { name: "rightMargin"; type: "double" }
+ Property { name: "horizontalCenterOffset"; type: "double" }
+ Property { name: "topMargin"; type: "double" }
+ Property { name: "bottomMargin"; type: "double" }
+ Property { name: "verticalCenterOffset"; type: "double" }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "fill"; type: "QQuickItem"; isPointer: true }
+ Property { name: "centerIn"; type: "QQuickItem"; isPointer: true }
+ Property { name: "alignWhenCentered"; type: "bool" }
+ Signal { name: "centerAlignedChanged" }
+ }
+ Component {
+ name: "QQuickAnimatedImage"
+ defaultProperty: "data"
+ prototype: "QQuickImage"
+ exports: ["QtQuick/AnimatedImage 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "playing"; type: "bool" }
+ Property { name: "paused"; type: "bool" }
+ Property { name: "currentFrame"; type: "int" }
+ Property { name: "frameCount"; type: "int"; isReadonly: true }
+ Property { name: "sourceSize"; type: "QSize"; isReadonly: true }
+ Signal { name: "frameChanged" }
+ }
+ Component {
+ name: "QQuickAnimatedSprite"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/AnimatedSprite 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "LoopParameters"
+ values: {
+ "Infinite": -1
+ }
+ }
+ Property { name: "running"; type: "bool" }
+ Property { name: "interpolate"; type: "bool" }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "reverse"; type: "bool" }
+ Property { name: "frameSync"; type: "bool" }
+ Property { name: "frameCount"; type: "int" }
+ Property { name: "frameHeight"; type: "int" }
+ Property { name: "frameWidth"; type: "int" }
+ Property { name: "frameX"; type: "int" }
+ Property { name: "frameY"; type: "int" }
+ Property { name: "frameRate"; type: "double" }
+ Property { name: "frameDuration"; type: "int" }
+ Property { name: "loops"; type: "int" }
+ Property { name: "paused"; type: "bool" }
+ Property { name: "currentFrame"; type: "int" }
+ Signal {
+ name: "pausedChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "runningChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "interpolateChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Signal {
+ name: "reverseChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "frameSyncChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "frameCountChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameXChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameYChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameRateChanged"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Signal {
+ name: "frameDurationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "loopsChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "currentFrameChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method { name: "start" }
+ Method { name: "stop" }
+ Method { name: "restart" }
+ Method {
+ name: "advance"
+ Parameter { name: "frames"; type: "int" }
+ }
+ Method { name: "advance" }
+ Method { name: "pause" }
+ Method { name: "resume" }
+ Method {
+ name: "setRunning"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setPaused"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setInterpolate"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Method {
+ name: "setReverse"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setFrameSync"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setFrameCount"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameRate"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Method {
+ name: "setFrameDuration"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method { name: "resetFrameRate" }
+ Method { name: "resetFrameDuration" }
+ Method {
+ name: "setLoops"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setCurrentFrame"
+ Parameter { name: "arg"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickAnimationController"
+ defaultProperty: "animation"
+ prototype: "QObject"
+ exports: ["QtQuick/AnimationController 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "progress"; type: "double" }
+ Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
+ Method { name: "reload" }
+ Method { name: "completeToBeginning" }
+ Method { name: "completeToEnd" }
+ }
+ Component {
+ name: "QQuickAnimationGroup"
+ defaultProperty: "animations"
+ prototype: "QQuickAbstractAnimation"
+ Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickAnimator"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/Animator 2.2"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Property { name: "duration"; type: "int" }
+ Property { name: "to"; type: "double" }
+ Property { name: "from"; type: "double" }
+ Signal {
+ name: "targetItemChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "durationChanged"
+ Parameter { name: "duration"; type: "int" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { name: "curve"; type: "QEasingCurve" }
+ }
+ Signal {
+ name: "toChanged"
+ Parameter { name: "to"; type: "double" }
+ }
+ Signal {
+ name: "fromChanged"
+ Parameter { name: "from"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickApplication"
+ prototype: "QQmlApplication"
+ exports: ["QtQuick/Application 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "active"; type: "bool"; isReadonly: true }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true }
+ Property { name: "state"; type: "Qt::ApplicationState"; isReadonly: true }
+ Signal {
+ name: "stateChanged"
+ Parameter { name: "state"; type: "Qt::ApplicationState" }
+ }
+ }
+ Component {
+ name: "QQuickBasePositioner"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Positioner 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickPositionerAttached"
+ Property { name: "spacing"; type: "double" }
+ Property { name: "populate"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "move"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "add"; type: "QQuickTransition"; isPointer: true }
+ }
+ Component {
+ name: "QQuickBehavior"
+ defaultProperty: "animation"
+ prototype: "QObject"
+ exports: ["QtQuick/Behavior 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ }
+ Component {
+ name: "QQuickBorderImage"
+ defaultProperty: "data"
+ prototype: "QQuickImageBase"
+ exports: ["QtQuick/BorderImage 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "TileMode"
+ values: {
+ "Stretch": 0,
+ "Repeat": 1,
+ "Round": 2
+ }
+ }
+ Property { name: "border"; type: "QQuickScaleGrid"; isReadonly: true; isPointer: true }
+ Property { name: "horizontalTileMode"; type: "TileMode" }
+ Property { name: "verticalTileMode"; type: "TileMode" }
+ Property { name: "sourceSize"; type: "QSize"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickCanvasItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Canvas 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RenderTarget"
+ values: {
+ "Image": 0,
+ "FramebufferObject": 1
+ }
+ }
+ Enum {
+ name: "RenderStrategy"
+ values: {
+ "Immediate": 0,
+ "Threaded": 1,
+ "Cooperative": 2
+ }
+ }
+ Property { name: "available"; type: "bool"; isReadonly: true }
+ Property { name: "contextType"; type: "string" }
+ Property { name: "context"; type: "QQmlV4Handle"; isReadonly: true }
+ Property { name: "canvasSize"; type: "QSizeF" }
+ Property { name: "tileSize"; type: "QSize" }
+ Property { name: "canvasWindow"; type: "QRectF" }
+ Property { name: "renderTarget"; type: "RenderTarget" }
+ Property { name: "renderStrategy"; type: "RenderStrategy" }
+ Signal {
+ name: "paint"
+ Parameter { name: "region"; type: "QRect" }
+ }
+ Signal { name: "painted" }
+ Signal { name: "imageLoaded" }
+ Method {
+ name: "loadImage"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "unloadImage"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageLoaded"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageLoading"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "isImageError"
+ type: "bool"
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ Method {
+ name: "getContext"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "requestAnimationFrame"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "cancelRequestAnimationFrame"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "requestPaint" }
+ Method {
+ name: "markDirty"
+ Parameter { name: "dirtyRect"; type: "QRectF" }
+ }
+ Method { name: "markDirty" }
+ Method {
+ name: "save"
+ type: "bool"
+ Parameter { name: "filename"; type: "string" }
+ }
+ Method {
+ name: "toDataURL"
+ type: "string"
+ Parameter { name: "type"; type: "string" }
+ }
+ Method { name: "toDataURL"; type: "string" }
+ }
+ Component {
+ name: "QQuickColorAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["QtQuick/ColorAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "QColor" }
+ Property { name: "to"; type: "QColor" }
+ }
+ Component {
+ name: "QQuickColumn"
+ defaultProperty: "data"
+ prototype: "QQuickBasePositioner"
+ exports: ["QtQuick/Column 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickCurve"
+ prototype: "QQuickPathElement"
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "relativeX"; type: "double" }
+ Property { name: "relativeY"; type: "double" }
+ }
+ Component {
+ name: "QQuickDoubleValidator"
+ prototype: "QDoubleValidator"
+ exports: ["QtQuick/DoubleValidator 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "locale"; type: "string" }
+ Signal { name: "localeNameChanged" }
+ }
+ Component {
+ name: "QQuickDrag"
+ prototype: "QObject"
+ exports: ["QtQuick/Drag 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickDragAttached"
+ Enum {
+ name: "DragType"
+ values: {
+ "None": 0,
+ "Automatic": 1,
+ "Internal": 2
+ }
+ }
+ Enum {
+ name: "Axis"
+ values: {
+ "XAxis": 1,
+ "YAxis": 2,
+ "XAndYAxis": 3,
+ "XandYAxis": 3
+ }
+ }
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "axis"; type: "Axis" }
+ Property { name: "minimumX"; type: "double" }
+ Property { name: "maximumX"; type: "double" }
+ Property { name: "minimumY"; type: "double" }
+ Property { name: "maximumY"; type: "double" }
+ Property { name: "active"; type: "bool"; isReadonly: true }
+ Property { name: "filterChildren"; type: "bool" }
+ Property { name: "threshold"; type: "double" }
+ }
+ Component {
+ name: "QQuickDragAttached"
+ prototype: "QObject"
+ Property { name: "active"; type: "bool" }
+ Property { name: "source"; type: "QObject"; isPointer: true }
+ Property { name: "target"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "hotSpot"; type: "QPointF" }
+ Property { name: "keys"; type: "QStringList" }
+ Property { name: "mimeData"; type: "QVariantMap" }
+ Property { name: "supportedActions"; type: "Qt::DropActions" }
+ Property { name: "proposedAction"; type: "Qt::DropAction" }
+ Property { name: "dragType"; type: "QQuickDrag::DragType" }
+ Signal { name: "dragStarted" }
+ Signal {
+ name: "dragFinished"
+ Parameter { name: "dropAction"; type: "Qt::DropAction" }
+ }
+ Method {
+ name: "start"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "startDrag"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "cancel" }
+ Method { name: "drop"; type: "int" }
+ }
+ Component {
+ name: "QQuickDropArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/DropArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "containsDrag"; type: "bool"; isReadonly: true }
+ Property { name: "keys"; type: "QStringList" }
+ Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true }
+ Signal { name: "sourceChanged" }
+ Signal {
+ name: "entered"
+ Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true }
+ }
+ Signal { name: "exited" }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true }
+ }
+ Signal {
+ name: "dropped"
+ Parameter { name: "drop"; type: "QQuickDropEvent"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickDropAreaDrag"
+ prototype: "QObject"
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "source"; type: "QObject"; isReadonly: true; isPointer: true }
+ Signal { name: "positionChanged" }
+ }
+ Component {
+ name: "QQuickFlickable"
+ defaultProperty: "flickableData"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Flickable 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "BoundsBehavior"
+ values: {
+ "StopAtBounds": 0,
+ "DragOverBounds": 1,
+ "DragAndOvershootBounds": 2
+ }
+ }
+ Enum {
+ name: "FlickableDirection"
+ values: {
+ "AutoFlickDirection": 0,
+ "HorizontalFlick": 1,
+ "VerticalFlick": 2,
+ "HorizontalAndVerticalFlick": 3
+ }
+ }
+ Property { name: "contentWidth"; type: "double" }
+ Property { name: "contentHeight"; type: "double" }
+ Property { name: "contentX"; type: "double" }
+ Property { name: "contentY"; type: "double" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "topMargin"; type: "double" }
+ Property { name: "bottomMargin"; type: "double" }
+ Property { name: "originY"; type: "double"; isReadonly: true }
+ Property { name: "leftMargin"; type: "double" }
+ Property { name: "rightMargin"; type: "double" }
+ Property { name: "originX"; type: "double"; isReadonly: true }
+ Property { name: "horizontalVelocity"; type: "double"; isReadonly: true }
+ Property { name: "verticalVelocity"; type: "double"; isReadonly: true }
+ Property { name: "boundsBehavior"; type: "BoundsBehavior" }
+ Property { name: "rebound"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "maximumFlickVelocity"; type: "double" }
+ Property { name: "flickDeceleration"; type: "double" }
+ Property { name: "moving"; type: "bool"; isReadonly: true }
+ Property { name: "movingHorizontally"; type: "bool"; isReadonly: true }
+ Property { name: "movingVertically"; type: "bool"; isReadonly: true }
+ Property { name: "flicking"; type: "bool"; isReadonly: true }
+ Property { name: "flickingHorizontally"; type: "bool"; isReadonly: true }
+ Property { name: "flickingVertically"; type: "bool"; isReadonly: true }
+ Property { name: "dragging"; type: "bool"; isReadonly: true }
+ Property { name: "draggingHorizontally"; type: "bool"; isReadonly: true }
+ Property { name: "draggingVertically"; type: "bool"; isReadonly: true }
+ Property { name: "flickableDirection"; type: "FlickableDirection" }
+ Property { name: "interactive"; type: "bool" }
+ Property { name: "pressDelay"; type: "int" }
+ Property { name: "atXEnd"; type: "bool"; isReadonly: true }
+ Property { name: "atYEnd"; type: "bool"; isReadonly: true }
+ Property { name: "atXBeginning"; type: "bool"; isReadonly: true }
+ Property { name: "atYBeginning"; type: "bool"; isReadonly: true }
+ Property {
+ name: "visibleArea"
+ type: "QQuickFlickableVisibleArea"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "pixelAligned"; type: "bool" }
+ Property { name: "flickableData"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "flickableChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Signal { name: "isAtBoundaryChanged" }
+ Signal { name: "movementStarted" }
+ Signal { name: "movementEnded" }
+ Signal { name: "flickStarted" }
+ Signal { name: "flickEnded" }
+ Signal { name: "dragStarted" }
+ Signal { name: "dragEnded" }
+ Method {
+ name: "resizeContent"
+ Parameter { name: "w"; type: "double" }
+ Parameter { name: "h"; type: "double" }
+ Parameter { name: "center"; type: "QPointF" }
+ }
+ Method { name: "returnToBounds" }
+ Method {
+ name: "flick"
+ Parameter { name: "xVelocity"; type: "double" }
+ Parameter { name: "yVelocity"; type: "double" }
+ }
+ Method { name: "cancelFlick" }
+ }
+ Component {
+ name: "QQuickFlickableVisibleArea"
+ prototype: "QObject"
+ Property { name: "xPosition"; type: "double"; isReadonly: true }
+ Property { name: "yPosition"; type: "double"; isReadonly: true }
+ Property { name: "widthRatio"; type: "double"; isReadonly: true }
+ Property { name: "heightRatio"; type: "double"; isReadonly: true }
+ Signal {
+ name: "xPositionChanged"
+ Parameter { name: "xPosition"; type: "double" }
+ }
+ Signal {
+ name: "yPositionChanged"
+ Parameter { name: "yPosition"; type: "double" }
+ }
+ Signal {
+ name: "widthRatioChanged"
+ Parameter { name: "widthRatio"; type: "double" }
+ }
+ Signal {
+ name: "heightRatioChanged"
+ Parameter { name: "heightRatio"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickFlipable"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Flipable 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Side"
+ values: {
+ "Front": 0,
+ "Back": 1
+ }
+ }
+ Property { name: "front"; type: "QQuickItem"; isPointer: true }
+ Property { name: "back"; type: "QQuickItem"; isPointer: true }
+ Property { name: "side"; type: "Side"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickFlow"
+ defaultProperty: "data"
+ prototype: "QQuickBasePositioner"
+ exports: ["QtQuick/Flow 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Flow"
+ values: {
+ "LeftToRight": 0,
+ "TopToBottom": 1
+ }
+ }
+ Property { name: "flow"; type: "Flow" }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickFocusScope"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/FocusScope 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickFontLoader"
+ prototype: "QObject"
+ exports: ["QtQuick/FontLoader 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "name"; type: "string" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickFontValueType"
+ prototype: "QQmlValueType"
+ exports: ["QtQuick/Font 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "FontWeight"
+ values: {
+ "Light": 25,
+ "Normal": 50,
+ "DemiBold": 63,
+ "Bold": 75,
+ "Black": 87
+ }
+ }
+ Enum {
+ name: "Capitalization"
+ values: {
+ "MixedCase": 0,
+ "AllUppercase": 1,
+ "AllLowercase": 2,
+ "SmallCaps": 3,
+ "Capitalize": 4
+ }
+ }
+ Property { name: "family"; type: "string" }
+ Property { name: "bold"; type: "bool" }
+ Property { name: "weight"; type: "FontWeight" }
+ Property { name: "italic"; type: "bool" }
+ Property { name: "underline"; type: "bool" }
+ Property { name: "overline"; type: "bool" }
+ Property { name: "strikeout"; type: "bool" }
+ Property { name: "pointSize"; type: "double" }
+ Property { name: "pixelSize"; type: "int" }
+ Property { name: "capitalization"; type: "Capitalization" }
+ Property { name: "letterSpacing"; type: "double" }
+ Property { name: "wordSpacing"; type: "double" }
+ }
+ Component {
+ name: "QQuickGradient"
+ defaultProperty: "stops"
+ prototype: "QObject"
+ exports: ["QtQuick/Gradient 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true }
+ Signal { name: "updated" }
+ }
+ Component {
+ name: "QQuickGradientStop"
+ prototype: "QObject"
+ exports: ["QtQuick/GradientStop 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "position"; type: "double" }
+ Property { name: "color"; type: "QColor" }
+ }
+ Component {
+ name: "QQuickGrid"
+ defaultProperty: "data"
+ prototype: "QQuickBasePositioner"
+ exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Enum {
+ name: "Flow"
+ values: {
+ "LeftToRight": 0,
+ "TopToBottom": 1
+ }
+ }
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Property { name: "rows"; type: "int" }
+ Property { name: "columns"; type: "int" }
+ Property { name: "rowSpacing"; type: "double" }
+ Property { name: "columnSpacing"; type: "double" }
+ Property { name: "flow"; type: "Flow" }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" }
+ Property {
+ name: "effectiveHorizontalItemAlignment"
+ revision: 1
+ type: "HAlignment"
+ isReadonly: true
+ }
+ Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "effectiveHorizontalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ revision: 1
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ }
+ Component {
+ name: "QQuickGridMesh"
+ prototype: "QQuickShaderEffectMesh"
+ exports: ["QtQuick/GridMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "resolution"; type: "QSize" }
+ }
+ Component {
+ name: "QQuickGridView"
+ defaultProperty: "data"
+ prototype: "QQuickItemView"
+ exports: ["QtQuick/GridView 2.0", "QtQuick/GridView 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickGridViewAttached"
+ Enum {
+ name: "Flow"
+ values: {
+ "FlowLeftToRight": 0,
+ "FlowTopToBottom": 2
+ }
+ }
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapToRow": 1,
+ "SnapOneRow": 2
+ }
+ }
+ Property { name: "flow"; type: "Flow" }
+ Property { name: "cellWidth"; type: "double" }
+ Property { name: "cellHeight"; type: "double" }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Signal { name: "highlightMoveDurationChanged" }
+ Method { name: "moveCurrentIndexUp" }
+ Method { name: "moveCurrentIndexDown" }
+ Method { name: "moveCurrentIndexLeft" }
+ Method { name: "moveCurrentIndexRight" }
+ }
+ Component {
+ name: "QQuickGridViewAttached"
+ prototype: "QQuickItemViewAttached"
+ Property { name: "view"; type: "QQuickGridView"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickImage"
+ defaultProperty: "data"
+ prototype: "QQuickImageBase"
+ exports: ["QtQuick/Image 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "FillMode"
+ values: {
+ "Stretch": 0,
+ "PreserveAspectFit": 1,
+ "PreserveAspectCrop": 2,
+ "Tile": 3,
+ "TileVertically": 4,
+ "TileHorizontally": 5,
+ "Pad": 6
+ }
+ }
+ Property { name: "fillMode"; type: "FillMode" }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Signal { name: "paintedGeometryChanged" }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ }
+ Component {
+ name: "QQuickImageBase"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "progress"; type: "double"; isReadonly: true }
+ Property { name: "asynchronous"; type: "bool" }
+ Property { name: "cache"; type: "bool" }
+ Property { name: "sourceSize"; type: "QSize" }
+ Property { name: "mirror"; type: "bool" }
+ Signal {
+ name: "sourceChanged"
+ Parameter { type: "QUrl" }
+ }
+ Signal {
+ name: "statusChanged"
+ Parameter { type: "QQuickImageBase::Status" }
+ }
+ Signal {
+ name: "progressChanged"
+ Parameter { name: "progress"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickImplicitSizeItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ Property { name: "implicitWidth"; type: "double"; isReadonly: true }
+ Property { name: "implicitHeight"; type: "double"; isReadonly: true }
+ Signal { name: "implicitWidthChanged2"; revision: 1 }
+ Signal { name: "implicitHeightChanged2"; revision: 1 }
+ }
+ Component {
+ name: "QQuickIntValidator"
+ prototype: "QIntValidator"
+ exports: ["QtQuick/IntValidator 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "locale"; type: "string" }
+ Signal { name: "localeNameChanged" }
+ }
+ Component {
+ name: "QQuickItem"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["QtQuick/Item 2.0", "QtQuick/Item 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ Enum {
+ name: "TransformOrigin"
+ values: {
+ "TopLeft": 0,
+ "Top": 1,
+ "TopRight": 2,
+ "Left": 3,
+ "Center": 4,
+ "Right": 5,
+ "BottomLeft": 6,
+ "Bottom": 7,
+ "BottomRight": 8
+ }
+ }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickItemLayer"
+ prototype: "QObject"
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "textureSize"; type: "QSize" }
+ Property { name: "sourceRect"; type: "QRectF" }
+ Property { name: "mipmap"; type: "bool" }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "wrapMode"; type: "QQuickShaderEffectSource::WrapMode" }
+ Property { name: "format"; type: "QQuickShaderEffectSource::Format" }
+ Property { name: "samplerName"; type: "QByteArray" }
+ Property { name: "effect"; type: "QQmlComponent"; isPointer: true }
+ Signal {
+ name: "enabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Signal {
+ name: "sizeChanged"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ Signal {
+ name: "mipmapChanged"
+ Parameter { name: "mipmap"; type: "bool" }
+ }
+ Signal {
+ name: "wrapModeChanged"
+ Parameter { name: "mode"; type: "QQuickShaderEffectSource::WrapMode" }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "name"; type: "QByteArray" }
+ }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "component"; type: "QQmlComponent"; isPointer: true }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { name: "smooth"; type: "bool" }
+ }
+ Signal {
+ name: "formatChanged"
+ Parameter { name: "format"; type: "QQuickShaderEffectSource::Format" }
+ }
+ Signal {
+ name: "sourceRectChanged"
+ Parameter { name: "sourceRect"; type: "QRectF" }
+ }
+ }
+ Component {
+ name: "QQuickItemView"
+ defaultProperty: "flickableData"
+ prototype: "QQuickFlickable"
+ exports: ["QtQuick/ItemView 2.1"]
+ exportMetaObjectRevisions: [1]
+ Enum {
+ name: "LayoutDirection"
+ values: {
+ "LeftToRight": 0,
+ "RightToLeft": 1,
+ "VerticalTopToBottom": 2,
+ "VerticalBottomToTop": 3
+ }
+ }
+ Enum {
+ name: "VerticalLayoutDirection"
+ values: {
+ "TopToBottom": 2,
+ "BottomToTop": 3
+ }
+ }
+ Enum {
+ name: "HighlightRangeMode"
+ values: {
+ "NoHighlightRange": 0,
+ "ApplyRange": 1,
+ "StrictlyEnforceRange": 2
+ }
+ }
+ Enum {
+ name: "PositionMode"
+ values: {
+ "Beginning": 0,
+ "Center": 1,
+ "End": 2,
+ "Visible": 3,
+ "Contain": 4,
+ "SnapPosition": 5
+ }
+ }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "keyNavigationWraps"; type: "bool" }
+ Property { name: "cacheBuffer"; type: "int" }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "verticalLayoutDirection"; type: "VerticalLayoutDirection" }
+ Property { name: "header"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "headerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "footer"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "footerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "populate"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "add"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "addDisplaced"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "move"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "moveDisplaced"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "remove"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "removeDisplaced"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "displaced"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "highlight"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "highlightFollowsCurrentItem"; type: "bool" }
+ Property { name: "highlightRangeMode"; type: "HighlightRangeMode" }
+ Property { name: "preferredHighlightBegin"; type: "double" }
+ Property { name: "preferredHighlightEnd"; type: "double" }
+ Property { name: "highlightMoveDuration"; type: "int" }
+ Signal { name: "populateTransitionChanged" }
+ Signal { name: "addTransitionChanged" }
+ Signal { name: "addDisplacedTransitionChanged" }
+ Signal { name: "moveTransitionChanged" }
+ Signal { name: "moveDisplacedTransitionChanged" }
+ Signal { name: "removeTransitionChanged" }
+ Signal { name: "removeDisplacedTransitionChanged" }
+ Signal { name: "displacedTransitionChanged" }
+ Method {
+ name: "positionViewAtIndex"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "mode"; type: "int" }
+ }
+ Method {
+ name: "indexAt"
+ type: "int"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method { name: "positionViewAtBeginning" }
+ Method { name: "positionViewAtEnd" }
+ Method { name: "forceLayout"; revision: 1 }
+ }
+ Component {
+ name: "QQuickItemViewAttached"
+ prototype: "QObject"
+ Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
+ Property { name: "delayRemove"; type: "bool" }
+ Property { name: "section"; type: "string"; isReadonly: true }
+ Property { name: "previousSection"; type: "string"; isReadonly: true }
+ Property { name: "nextSection"; type: "string"; isReadonly: true }
+ Signal { name: "currentItemChanged" }
+ Signal { name: "add" }
+ Signal { name: "remove" }
+ Signal { name: "prevSectionChanged" }
+ }
+ Component {
+ name: "QQuickKeyNavigationAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/KeyNavigation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Priority"
+ values: {
+ "BeforeItem": 0,
+ "AfterItem": 1
+ }
+ }
+ Property { name: "left"; type: "QQuickItem"; isPointer: true }
+ Property { name: "right"; type: "QQuickItem"; isPointer: true }
+ Property { name: "up"; type: "QQuickItem"; isPointer: true }
+ Property { name: "down"; type: "QQuickItem"; isPointer: true }
+ Property { name: "tab"; type: "QQuickItem"; isPointer: true }
+ Property { name: "backtab"; type: "QQuickItem"; isPointer: true }
+ Property { name: "priority"; type: "Priority" }
+ }
+ Component {
+ name: "QQuickKeysAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/Keys 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Priority"
+ values: {
+ "BeforeItem": 0,
+ "AfterItem": 1
+ }
+ }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "forwardTo"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "priority"; type: "Priority" }
+ Signal {
+ name: "pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit0Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit1Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit2Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit3Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit4Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit5Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit6Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit7Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit8Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit9Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "leftPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "rightPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "upPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "downPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "tabPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "backtabPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "asteriskPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "numberSignPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "escapePressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "returnPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "enterPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "deletePressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "spacePressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "backPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "cancelPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "selectPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "yesPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "noPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context1Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context2Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context3Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context4Pressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "callPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "hangupPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "flipPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "menuPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "volumeUpPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "volumeDownPressed"
+ Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickLayoutMirroringAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/LayoutMirroring 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "childrenInherit"; type: "bool" }
+ }
+ Component {
+ name: "QQuickListView"
+ defaultProperty: "data"
+ prototype: "QQuickItemView"
+ exports: ["QtQuick/ListView 2.0", "QtQuick/ListView 2.1"]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickListViewAttached"
+ Enum {
+ name: "Orientation"
+ values: {
+ "Horizontal": 1,
+ "Vertical": 2
+ }
+ }
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapToItem": 1,
+ "SnapOneItem": 2
+ }
+ }
+ Property { name: "highlightMoveVelocity"; type: "double" }
+ Property { name: "highlightResizeVelocity"; type: "double" }
+ Property { name: "highlightResizeDuration"; type: "int" }
+ Property { name: "spacing"; type: "double" }
+ Property { name: "orientation"; type: "Orientation" }
+ Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true }
+ Property { name: "currentSection"; type: "string"; isReadonly: true }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Method { name: "incrementCurrentIndex" }
+ Method { name: "decrementCurrentIndex" }
+ }
+ Component {
+ name: "QQuickListViewAttached"
+ prototype: "QQuickItemViewAttached"
+ Property { name: "view"; type: "QQuickListView"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickLoader"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Loader 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "active"; type: "bool" }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "sourceComponent"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "item"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "progress"; type: "double"; isReadonly: true }
+ Property { name: "asynchronous"; type: "bool" }
+ Signal { name: "loaded" }
+ Method {
+ name: "setSource"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickMouseArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/MouseArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "mouseX"; type: "double"; isReadonly: true }
+ Property { name: "mouseY"; type: "double"; isReadonly: true }
+ Property { name: "containsMouse"; type: "bool"; isReadonly: true }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "pressedButtons"; type: "Qt::MouseButtons"; isReadonly: true }
+ Property { name: "acceptedButtons"; type: "Qt::MouseButtons" }
+ Property { name: "hoverEnabled"; type: "bool" }
+ Property { name: "drag"; type: "QQuickDrag"; isReadonly: true; isPointer: true }
+ Property { name: "preventStealing"; type: "bool" }
+ Property { name: "propagateComposedEvents"; type: "bool" }
+ Property { name: "cursorShape"; type: "Qt::CursorShape" }
+ Signal { name: "hoveredChanged" }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "mouseXChanged"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "mouseYChanged"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pressed"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pressAndHold"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "doubleClicked"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "wheel"
+ Parameter { name: "wheel"; type: "QQuickWheelEvent"; isPointer: true }
+ }
+ Signal { name: "entered" }
+ Signal { name: "exited" }
+ Signal { name: "canceled" }
+ }
+ Component {
+ name: "QQuickMouseEvent"
+ prototype: "QObject"
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "button"; type: "int"; isReadonly: true }
+ Property { name: "buttons"; type: "int"; isReadonly: true }
+ Property { name: "modifiers"; type: "int"; isReadonly: true }
+ Property { name: "wasHeld"; type: "bool"; isReadonly: true }
+ Property { name: "isClick"; type: "bool"; isReadonly: true }
+ Property { name: "accepted"; type: "bool" }
+ }
+ Component {
+ name: "QQuickMultiPointTouchArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/MultiPointTouchArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true }
+ Property { name: "minimumTouchPoints"; type: "int" }
+ Property { name: "maximumTouchPoints"; type: "int" }
+ Signal {
+ name: "pressed"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ Signal {
+ name: "updated"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ Signal {
+ name: "canceled"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ Signal {
+ name: "gestureStarted"
+ Parameter { name: "gesture"; type: "QQuickGrabGestureEvent"; isPointer: true }
+ }
+ Signal {
+ name: "touchUpdated"
+ Parameter { name: "touchPoints"; type: "QList<QObject*>" }
+ }
+ }
+ Component {
+ name: "QQuickNumberAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["QtQuick/NumberAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "double" }
+ Property { name: "to"; type: "double" }
+ }
+ Component {
+ name: "QQuickOpacityAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/OpacityAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickPackage"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["QtQuick/Package 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickPackageAttached"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPackageAttached"
+ prototype: "QObject"
+ Property { name: "name"; type: "string" }
+ }
+ Component {
+ name: "QQuickPaintedItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/PaintedItem 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RenderTarget"
+ values: {
+ "Image": 0,
+ "FramebufferObject": 1,
+ "InvertedYFramebufferObject": 2
+ }
+ }
+ Property { name: "contentsSize"; type: "QSize" }
+ Property { name: "fillColor"; type: "QColor" }
+ Property { name: "contentsScale"; type: "double" }
+ Property { name: "renderTarget"; type: "RenderTarget" }
+ }
+ Component {
+ name: "QQuickParallelAnimation"
+ defaultProperty: "animations"
+ prototype: "QQuickAnimationGroup"
+ exports: ["QtQuick/ParallelAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickParentAnimation"
+ defaultProperty: "animations"
+ prototype: "QQuickAnimationGroup"
+ exports: ["QtQuick/ParentAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "newParent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "via"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickParentChange"
+ prototype: "QQuickStateOperation"
+ exports: ["QtQuick/ParentChange 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "x"; type: "QQmlScriptString" }
+ Property { name: "y"; type: "QQmlScriptString" }
+ Property { name: "width"; type: "QQmlScriptString" }
+ Property { name: "height"; type: "QQmlScriptString" }
+ Property { name: "scale"; type: "QQmlScriptString" }
+ Property { name: "rotation"; type: "QQmlScriptString" }
+ }
+ Component {
+ name: "QQuickPath"
+ defaultProperty: "pathElements"
+ prototype: "QObject"
+ exports: ["QtQuick/Path 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true }
+ Property { name: "startX"; type: "double" }
+ Property { name: "startY"; type: "double" }
+ Property { name: "closed"; type: "bool"; isReadonly: true }
+ Signal { name: "changed" }
+ }
+ Component {
+ name: "QQuickPathAnimation"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/PathAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Orientation"
+ values: {
+ "Fixed": 0,
+ "RightFirst": 1,
+ "LeftFirst": 2,
+ "BottomFirst": 3,
+ "TopFirst": 4
+ }
+ }
+ Property { name: "duration"; type: "int" }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Property { name: "path"; type: "QQuickPath"; isPointer: true }
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "orientation"; type: "Orientation" }
+ Property { name: "anchorPoint"; type: "QPointF" }
+ Property { name: "orientationEntryDuration"; type: "int" }
+ Property { name: "orientationExitDuration"; type: "int" }
+ Property { name: "endRotation"; type: "double" }
+ Signal {
+ name: "durationChanged"
+ Parameter { type: "int" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { type: "QEasingCurve" }
+ }
+ Signal {
+ name: "orientationChanged"
+ Parameter { type: "Orientation" }
+ }
+ Signal {
+ name: "anchorPointChanged"
+ Parameter { type: "QPointF" }
+ }
+ Signal {
+ name: "orientationEntryDurationChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "orientationExitDurationChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "endRotationChanged"
+ Parameter { type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickPathArc"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathArc 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "ArcDirection"
+ values: {
+ "Clockwise": 0,
+ "Counterclockwise": 1
+ }
+ }
+ Property { name: "radiusX"; type: "double" }
+ Property { name: "radiusY"; type: "double" }
+ Property { name: "useLargeArc"; type: "bool" }
+ Property { name: "direction"; type: "ArcDirection" }
+ }
+ Component {
+ name: "QQuickPathAttribute"
+ prototype: "QQuickPathElement"
+ exports: ["QtQuick/PathAttribute 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "name"; type: "string" }
+ Property { name: "value"; type: "double" }
+ }
+ Component {
+ name: "QQuickPathCatmullRomCurve"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathCurve 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickPathCubic"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathCubic 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "control1X"; type: "double" }
+ Property { name: "control1Y"; type: "double" }
+ Property { name: "control2X"; type: "double" }
+ Property { name: "control2Y"; type: "double" }
+ Property { name: "relativeControl1X"; type: "double" }
+ Property { name: "relativeControl1Y"; type: "double" }
+ Property { name: "relativeControl2X"; type: "double" }
+ Property { name: "relativeControl2Y"; type: "double" }
+ }
+ Component {
+ name: "QQuickPathElement"
+ prototype: "QObject"
+ Signal { name: "changed" }
+ }
+ Component {
+ name: "QQuickPathInterpolator"
+ prototype: "QObject"
+ exports: ["QtQuick/PathInterpolator 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "path"; type: "QQuickPath"; isPointer: true }
+ Property { name: "progress"; type: "double" }
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "angle"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPathLine"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathLine 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickPathPercent"
+ prototype: "QQuickPathElement"
+ exports: ["QtQuick/PathPercent 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "value"; type: "double" }
+ }
+ Component {
+ name: "QQuickPathQuad"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathQuad 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "controlX"; type: "double" }
+ Property { name: "controlY"; type: "double" }
+ Property { name: "relativeControlX"; type: "double" }
+ Property { name: "relativeControlY"; type: "double" }
+ }
+ Component {
+ name: "QQuickPathSvg"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathSvg 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "path"; type: "string" }
+ }
+ Component {
+ name: "QQuickPathView"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/PathView 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickPathViewAttached"
+ Enum {
+ name: "HighlightRangeMode"
+ values: {
+ "NoHighlightRange": 0,
+ "ApplyRange": 1,
+ "StrictlyEnforceRange": 2
+ }
+ }
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapToItem": 1,
+ "SnapOneItem": 2
+ }
+ }
+ Enum {
+ name: "PositionMode"
+ values: {
+ "Beginning": 0,
+ "Center": 1,
+ "End": 2,
+ "Contain": 4,
+ "SnapPosition": 5
+ }
+ }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "path"; type: "QQuickPath"; isPointer: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "offset"; type: "double" }
+ Property { name: "highlight"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "preferredHighlightBegin"; type: "double" }
+ Property { name: "preferredHighlightEnd"; type: "double" }
+ Property { name: "highlightRangeMode"; type: "HighlightRangeMode" }
+ Property { name: "highlightMoveDuration"; type: "int" }
+ Property { name: "dragMargin"; type: "double" }
+ Property { name: "maximumFlickVelocity"; type: "double" }
+ Property { name: "flickDeceleration"; type: "double" }
+ Property { name: "interactive"; type: "bool" }
+ Property { name: "moving"; type: "bool"; isReadonly: true }
+ Property { name: "flicking"; type: "bool"; isReadonly: true }
+ Property { name: "dragging"; type: "bool"; isReadonly: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "pathItemCount"; type: "int" }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Property { name: "cacheItemCount"; type: "int" }
+ Signal { name: "snapPositionChanged" }
+ Signal { name: "movementStarted" }
+ Signal { name: "movementEnded" }
+ Signal { name: "flickStarted" }
+ Signal { name: "flickEnded" }
+ Signal { name: "dragStarted" }
+ Signal { name: "dragEnded" }
+ Method { name: "incrementCurrentIndex" }
+ Method { name: "decrementCurrentIndex" }
+ Method {
+ name: "positionViewAtIndex"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "mode"; type: "int" }
+ }
+ Method {
+ name: "indexAt"
+ type: "int"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickPathViewAttached"
+ prototype: "QObject"
+ Property { name: "view"; type: "QQuickPathView"; isReadonly: true; isPointer: true }
+ Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
+ Property { name: "onPath"; type: "bool"; isReadonly: true }
+ Signal { name: "currentItemChanged" }
+ Signal { name: "pathChanged" }
+ }
+ Component {
+ name: "QQuickPauseAnimation"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/PauseAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "duration"; type: "int" }
+ Signal {
+ name: "durationChanged"
+ Parameter { type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickPen"
+ prototype: "QObject"
+ Property { name: "width"; type: "double" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "pixelAligned"; type: "bool" }
+ Signal { name: "penChanged" }
+ }
+ Component {
+ name: "QQuickPinch"
+ prototype: "QObject"
+ exports: ["QtQuick/Pinch 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Axis"
+ values: {
+ "NoDrag": 0,
+ "XAxis": 1,
+ "YAxis": 2,
+ "XAndYAxis": 3,
+ "XandYAxis": 3
+ }
+ }
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "minimumScale"; type: "double" }
+ Property { name: "maximumScale"; type: "double" }
+ Property { name: "minimumRotation"; type: "double" }
+ Property { name: "maximumRotation"; type: "double" }
+ Property { name: "dragAxis"; type: "Axis" }
+ Property { name: "minimumX"; type: "double" }
+ Property { name: "maximumX"; type: "double" }
+ Property { name: "minimumY"; type: "double" }
+ Property { name: "maximumY"; type: "double" }
+ Property { name: "active"; type: "bool"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPinchArea"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/PinchArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "pinchStarted"
+ Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pinchUpdated"
+ Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pinchFinished"
+ Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickPositionerAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "isFirstItem"; type: "bool"; isReadonly: true }
+ Property { name: "isLastItem"; type: "bool"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPropertyAction"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/PropertyAction 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "property"; type: "string" }
+ Property { name: "properties"; type: "string" }
+ Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "value"; type: "QVariant" }
+ Signal {
+ name: "valueChanged"
+ Parameter { type: "QVariant" }
+ }
+ Signal {
+ name: "propertiesChanged"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickPropertyAnimation"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/PropertyAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "duration"; type: "int" }
+ Property { name: "from"; type: "QVariant" }
+ Property { name: "to"; type: "QVariant" }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "property"; type: "string" }
+ Property { name: "properties"; type: "string" }
+ Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "durationChanged"
+ Parameter { type: "int" }
+ }
+ Signal {
+ name: "fromChanged"
+ Parameter { type: "QVariant" }
+ }
+ Signal {
+ name: "toChanged"
+ Parameter { type: "QVariant" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { type: "QEasingCurve" }
+ }
+ Signal {
+ name: "propertiesChanged"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickPropertyChanges"
+ prototype: "QQuickStateOperation"
+ exports: ["QtQuick/PropertyChanges 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "target"; type: "QObject"; isPointer: true }
+ Property { name: "restoreEntryValues"; type: "bool" }
+ Property { name: "explicit"; type: "bool" }
+ }
+ Component {
+ name: "QQuickRectangle"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Rectangle 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "color"; type: "QColor" }
+ Property { name: "gradient"; type: "QQuickGradient"; isPointer: true }
+ Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
+ Property { name: "radius"; type: "double" }
+ }
+ Component {
+ name: "QQuickRepeater"
+ defaultProperty: "delegate"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/Repeater 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Signal {
+ name: "itemAdded"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "itemRemoved"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickRotation"
+ prototype: "QQuickTransform"
+ exports: ["QtQuick/Rotation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "origin"; type: "QVector3D" }
+ Property { name: "angle"; type: "double" }
+ Property { name: "axis"; type: "QVector3D" }
+ }
+ Component {
+ name: "QQuickRotationAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["QtQuick/RotationAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RotationDirection"
+ values: {
+ "Numerical": 0,
+ "Shortest": 1,
+ "Clockwise": 2,
+ "Counterclockwise": 3
+ }
+ }
+ Property { name: "from"; type: "double" }
+ Property { name: "to"; type: "double" }
+ Property { name: "direction"; type: "RotationDirection" }
+ }
+ Component {
+ name: "QQuickRotationAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/RotationAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RotationDirection"
+ values: {
+ "Numerical": 0,
+ "Shortest": 1,
+ "Clockwise": 2,
+ "Counterclockwise": 3
+ }
+ }
+ Property { name: "direction"; type: "RotationDirection" }
+ Signal {
+ name: "directionChanged"
+ Parameter { name: "dir"; type: "RotationDirection" }
+ }
+ }
+ Component {
+ name: "QQuickRow"
+ defaultProperty: "data"
+ prototype: "QQuickBasePositioner"
+ exports: ["QtQuick/Row 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickScale"
+ prototype: "QQuickTransform"
+ exports: ["QtQuick/Scale 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "origin"; type: "QVector3D" }
+ Property { name: "xScale"; type: "double" }
+ Property { name: "yScale"; type: "double" }
+ Property { name: "zScale"; type: "double" }
+ Signal { name: "scaleChanged" }
+ }
+ Component {
+ name: "QQuickScaleAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/ScaleAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickScaleGrid"
+ prototype: "QObject"
+ Property { name: "left"; type: "int" }
+ Property { name: "top"; type: "int" }
+ Property { name: "right"; type: "int" }
+ Property { name: "bottom"; type: "int" }
+ Signal { name: "borderChanged" }
+ }
+ Component {
+ name: "QQuickScriptAction"
+ prototype: "QQuickAbstractAnimation"
+ exports: ["QtQuick/ScriptAction 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "script"; type: "QQmlScriptString" }
+ Property { name: "scriptName"; type: "string" }
+ }
+ Component {
+ name: "QQuickSequentialAnimation"
+ defaultProperty: "animations"
+ prototype: "QQuickAnimationGroup"
+ exports: ["QtQuick/SequentialAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickShaderEffect"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/ShaderEffect 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "CullMode"
+ values: {
+ "NoCulling": 0,
+ "BackFaceCulling": 1,
+ "FrontFaceCulling": 2
+ }
+ }
+ Enum {
+ name: "Status"
+ values: {
+ "Compiled": 0,
+ "Uncompiled": 1,
+ "Error": 2
+ }
+ }
+ Property { name: "fragmentShader"; type: "QByteArray" }
+ Property { name: "vertexShader"; type: "QByteArray" }
+ Property { name: "blending"; type: "bool" }
+ Property { name: "mesh"; type: "QVariant" }
+ Property { name: "cullMode"; type: "CullMode" }
+ Property { name: "log"; type: "string"; isReadonly: true }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickShaderEffectMesh"
+ prototype: "QObject"
+ exports: ["QtQuick/ShaderEffectMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Signal { name: "geometryChanged" }
+ }
+ Component {
+ name: "QQuickShaderEffectSource"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/ShaderEffectSource 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "WrapMode"
+ values: {
+ "ClampToEdge": 0,
+ "RepeatHorizontally": 1,
+ "RepeatVertically": 2,
+ "Repeat": 3
+ }
+ }
+ Enum {
+ name: "Format"
+ values: {
+ "Alpha": 6406,
+ "RGB": 6407,
+ "RGBA": 6408
+ }
+ }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "sourceItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "sourceRect"; type: "QRectF" }
+ Property { name: "textureSize"; type: "QSize" }
+ Property { name: "format"; type: "Format" }
+ Property { name: "live"; type: "bool" }
+ Property { name: "hideSource"; type: "bool" }
+ Property { name: "mipmap"; type: "bool" }
+ Property { name: "recursive"; type: "bool" }
+ Signal { name: "scheduledUpdateCompleted" }
+ Method { name: "scheduleUpdate" }
+ }
+ Component {
+ name: "QQuickSmoothedAnimation"
+ prototype: "QQuickNumberAnimation"
+ exports: ["QtQuick/SmoothedAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "ReversingMode"
+ values: {
+ "Eased": 0,
+ "Immediate": 1,
+ "Sync": 2
+ }
+ }
+ Property { name: "velocity"; type: "double" }
+ Property { name: "reversingMode"; type: "ReversingMode" }
+ Property { name: "maximumEasingTime"; type: "double" }
+ }
+ Component {
+ name: "QQuickSpringAnimation"
+ prototype: "QQuickNumberAnimation"
+ exports: ["QtQuick/SpringAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "velocity"; type: "double" }
+ Property { name: "spring"; type: "double" }
+ Property { name: "damping"; type: "double" }
+ Property { name: "epsilon"; type: "double" }
+ Property { name: "modulus"; type: "double" }
+ Property { name: "mass"; type: "double" }
+ Signal { name: "syncChanged" }
+ }
+ Component {
+ name: "QQuickSprite"
+ prototype: "QQuickStochasticState"
+ exports: ["QtQuick/Sprite 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "reverse"; type: "bool" }
+ Property { name: "frameSync"; type: "bool" }
+ Property { name: "frames"; type: "int" }
+ Property { name: "frameCount"; type: "int" }
+ Property { name: "frameHeight"; type: "int" }
+ Property { name: "frameWidth"; type: "int" }
+ Property { name: "frameX"; type: "int" }
+ Property { name: "frameY"; type: "int" }
+ Property { name: "frameRate"; type: "double" }
+ Property { name: "frameRateVariation"; type: "double" }
+ Property { name: "frameDuration"; type: "int" }
+ Property { name: "frameDurationVariation"; type: "int" }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Signal {
+ name: "frameHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "reverseChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "frameCountChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameXChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameYChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameRateChanged"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Signal {
+ name: "frameRateVariationChanged"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Signal {
+ name: "frameDurationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameDurationVariationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "frameSyncChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Method {
+ name: "setFrameHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setReverse"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setFrames"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameCount"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameRate"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Method {
+ name: "setFrameRateVariation"
+ Parameter { name: "arg"; type: "double" }
+ }
+ Method {
+ name: "setFrameDuration"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameDurationVariation"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setFrameSync"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickSpriteSequence"
+ defaultProperty: "sprites"
+ prototype: "QQuickItem"
+ exports: ["QtQuick/SpriteSequence 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "running"; type: "bool" }
+ Property { name: "interpolate"; type: "bool" }
+ Property { name: "goalSprite"; type: "string" }
+ Property { name: "currentSprite"; type: "string"; isReadonly: true }
+ Property { name: "sprites"; type: "QQuickSprite"; isList: true; isReadonly: true }
+ Signal {
+ name: "runningChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "interpolateChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "goalSpriteChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Signal {
+ name: "currentSpriteChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "jumpTo"
+ Parameter { name: "sprite"; type: "string" }
+ }
+ Method {
+ name: "setGoalSprite"
+ Parameter { name: "sprite"; type: "string" }
+ }
+ Method {
+ name: "setRunning"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setInterpolate"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickState"
+ defaultProperty: "changes"
+ prototype: "QObject"
+ exports: ["QtQuick/State 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "name"; type: "string" }
+ Property { name: "when"; type: "QQmlBinding"; isPointer: true }
+ Property { name: "extend"; type: "string" }
+ Property { name: "changes"; type: "QQuickStateOperation"; isList: true; isReadonly: true }
+ Signal { name: "completed" }
+ }
+ Component {
+ name: "QQuickStateChangeScript"
+ prototype: "QQuickStateOperation"
+ exports: ["QtQuick/StateChangeScript 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "script"; type: "QQmlScriptString" }
+ Property { name: "name"; type: "string" }
+ }
+ Component {
+ name: "QQuickStateGroup"
+ prototype: "QObject"
+ exports: ["QtQuick/StateGroup 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "state"; type: "string" }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ }
+ Component { name: "QQuickStateOperation"; prototype: "QObject" }
+ Component {
+ name: "QQuickStochasticState"
+ prototype: "QObject"
+ Property { name: "duration"; type: "int" }
+ Property { name: "durationVariation"; type: "int" }
+ Property { name: "randomStart"; type: "bool" }
+ Property { name: "to"; type: "QVariantMap" }
+ Property { name: "name"; type: "string" }
+ Signal {
+ name: "durationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Signal {
+ name: "toChanged"
+ Parameter { name: "arg"; type: "QVariantMap" }
+ }
+ Signal {
+ name: "durationVariationChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal { name: "entered" }
+ Signal {
+ name: "randomStartChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setDuration"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setName"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setTo"
+ Parameter { name: "arg"; type: "QVariantMap" }
+ }
+ Method {
+ name: "setDurationVariation"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setRandomStart"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickSystemPalette"
+ prototype: "QObject"
+ exports: ["QtQuick/SystemPalette 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "ColorGroup"
+ values: {
+ "Active": 0,
+ "Inactive": 2,
+ "Disabled": 1
+ }
+ }
+ Property { name: "colorGroup"; type: "QQuickSystemPalette::ColorGroup" }
+ Property { name: "window"; type: "QColor"; isReadonly: true }
+ Property { name: "windowText"; type: "QColor"; isReadonly: true }
+ Property { name: "base"; type: "QColor"; isReadonly: true }
+ Property { name: "text"; type: "QColor"; isReadonly: true }
+ Property { name: "alternateBase"; type: "QColor"; isReadonly: true }
+ Property { name: "button"; type: "QColor"; isReadonly: true }
+ Property { name: "buttonText"; type: "QColor"; isReadonly: true }
+ Property { name: "light"; type: "QColor"; isReadonly: true }
+ Property { name: "midlight"; type: "QColor"; isReadonly: true }
+ Property { name: "dark"; type: "QColor"; isReadonly: true }
+ Property { name: "mid"; type: "QColor"; isReadonly: true }
+ Property { name: "shadow"; type: "QColor"; isReadonly: true }
+ Property { name: "highlight"; type: "QColor"; isReadonly: true }
+ Property { name: "highlightedText"; type: "QColor"; isReadonly: true }
+ Signal { name: "paletteChanged" }
+ }
+ Component {
+ name: "QQuickText"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Text 2.0", "QtQuick/Text 2.2"]
+ exportMetaObjectRevisions: [0, 2]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextStyle"
+ values: {
+ "Normal": 0,
+ "Outline": 1,
+ "Raised": 2,
+ "Sunken": 3
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2,
+ "StyledText": 4
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Enum {
+ name: "LineHeightMode"
+ values: {
+ "ProportionalHeight": 0,
+ "FixedHeight": 1
+ }
+ }
+ Enum {
+ name: "FontSizeMode"
+ values: {
+ "FixedSize": 0,
+ "HorizontalFit": 1,
+ "VerticalFit": 2,
+ "Fit": 3
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "linkColor"; type: "QColor" }
+ Property { name: "style"; type: "TextStyle" }
+ Property { name: "styleColor"; type: "QColor" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "truncated"; type: "bool"; isReadonly: true }
+ Property { name: "maximumLineCount"; type: "int" }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "elide"; type: "TextElideMode" }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "lineHeight"; type: "double" }
+ Property { name: "lineHeightMode"; type: "LineHeightMode" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "minimumPixelSize"; type: "int" }
+ Property { name: "minimumPointSize"; type: "int" }
+ Property { name: "fontSizeMode"; type: "FontSizeMode" }
+ Property { name: "renderType"; type: "RenderType" }
+ Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ revision: 2
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "styleChanged"
+ Parameter { name: "style"; type: "TextStyle" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "elideModeChanged"
+ Parameter { name: "mode"; type: "TextElideMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "lineHeightChanged"
+ Parameter { name: "lineHeight"; type: "double" }
+ }
+ Signal {
+ name: "lineHeightModeChanged"
+ Parameter { name: "mode"; type: "LineHeightMode" }
+ }
+ Signal {
+ name: "lineLaidOut"
+ Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
+ }
+ Method { name: "doLayout" }
+ }
+ Component { name: "QQuickTextDocument"; prototype: "QObject" }
+ Component {
+ name: "QQuickTextEdit"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: [
+ "QtQuick/TextEdit 2.0",
+ "QtQuick/TextEdit 2.1",
+ "QtQuick/TextEdit 2.2"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "SelectionMode"
+ values: {
+ "SelectCharacters": 0,
+ "SelectWords": 1
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "selectionColor"; type: "QColor" }
+ Property { name: "selectedTextColor"; type: "QColor" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "cursorVisible"; type: "bool" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "persistentSelection"; type: "bool" }
+ Property { name: "textMargin"; type: "double" }
+ Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
+ Property { name: "selectByKeyboard"; revision: 1; type: "bool" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "mouseSelectionMode"; type: "SelectionMode" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "renderType"; type: "RenderType" }
+ Property {
+ name: "textDocument"
+ revision: 1
+ type: "QQuickTextDocument"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "selectionColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "selectedTextColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "readOnlyChanged"
+ Parameter { name: "isReadOnly"; type: "bool" }
+ }
+ Signal {
+ name: "cursorVisibleChanged"
+ Parameter { name: "isCursorVisible"; type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnPressChanged"
+ Parameter { name: "activeFocusOnPressed"; type: "bool" }
+ }
+ Signal {
+ name: "persistentSelectionChanged"
+ Parameter { name: "isPersistentSelection"; type: "bool" }
+ }
+ Signal {
+ name: "textMarginChanged"
+ Parameter { name: "textMargin"; type: "double" }
+ }
+ Signal {
+ name: "selectByKeyboardChanged"
+ revision: 1
+ Parameter { name: "selectByKeyboard"; type: "bool" }
+ }
+ Signal {
+ name: "selectByMouseChanged"
+ Parameter { name: "selectByMouse"; type: "bool" }
+ }
+ Signal {
+ name: "mouseSelectionModeChanged"
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ revision: 2
+ Parameter { name: "link"; type: "string" }
+ }
+ Method { name: "selectAll" }
+ Method { name: "selectWord" }
+ Method {
+ name: "select"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "deselect" }
+ Method {
+ name: "isRightToLeft"
+ type: "bool"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "cut" }
+ Method { name: "copy" }
+ Method { name: "paste" }
+ Method { name: "undo" }
+ Method { name: "redo" }
+ Method {
+ name: "insert"
+ Parameter { name: "position"; type: "int" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "append"
+ revision: 2
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QRectF"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "positionAt"
+ type: "int"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Method {
+ name: "getText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "getFormattedText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickTextInput"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/TextInput 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "EchoMode"
+ values: {
+ "Normal": 0,
+ "NoEcho": 1,
+ "Password": 2,
+ "PasswordEchoOnEdit": 3
+ }
+ }
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "SelectionMode"
+ values: {
+ "SelectCharacters": 0,
+ "SelectWords": 1
+ }
+ }
+ Enum {
+ name: "CursorPosition"
+ values: {
+ "CursorBetweenCharacters": 0,
+ "CursorOnCharacter": 1
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "selectionColor"; type: "QColor" }
+ Property { name: "selectedTextColor"; type: "QColor" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "cursorVisible"; type: "bool" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "maximumLength"; type: "int" }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "inputMask"; type: "string" }
+ Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Property { name: "echoMode"; type: "EchoMode" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "passwordCharacter"; type: "string" }
+ Property { name: "displayText"; type: "string"; isReadonly: true }
+ Property { name: "autoScroll"; type: "bool" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "mouseSelectionMode"; type: "SelectionMode" }
+ Property { name: "persistentSelection"; type: "bool" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "renderType"; type: "RenderType" }
+ Signal { name: "accepted" }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "readOnlyChanged"
+ Parameter { name: "isReadOnly"; type: "bool" }
+ }
+ Signal {
+ name: "cursorVisibleChanged"
+ Parameter { name: "isCursorVisible"; type: "bool" }
+ }
+ Signal {
+ name: "maximumLengthChanged"
+ Parameter { name: "maximumLength"; type: "int" }
+ }
+ Signal {
+ name: "inputMaskChanged"
+ Parameter { name: "inputMask"; type: "string" }
+ }
+ Signal {
+ name: "echoModeChanged"
+ Parameter { name: "echoMode"; type: "EchoMode" }
+ }
+ Signal {
+ name: "activeFocusOnPressChanged"
+ Parameter { name: "activeFocusOnPress"; type: "bool" }
+ }
+ Signal {
+ name: "autoScrollChanged"
+ Parameter { name: "autoScroll"; type: "bool" }
+ }
+ Signal {
+ name: "selectByMouseChanged"
+ Parameter { name: "selectByMouse"; type: "bool" }
+ }
+ Signal {
+ name: "mouseSelectionModeChanged"
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Method { name: "selectAll" }
+ Method { name: "selectWord" }
+ Method {
+ name: "select"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "deselect" }
+ Method {
+ name: "isRightToLeft"
+ type: "bool"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "cut" }
+ Method { name: "copy" }
+ Method { name: "paste" }
+ Method { name: "undo" }
+ Method { name: "redo" }
+ Method {
+ name: "insert"
+ Parameter { name: "position"; type: "int" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "positionAt"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QRectF"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Method {
+ name: "getText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickTouchPoint"
+ prototype: "QObject"
+ exports: ["QtQuick/TouchPoint 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "pointId"; type: "int"; isReadonly: true }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "x"; type: "double"; isReadonly: true }
+ Property { name: "y"; type: "double"; isReadonly: true }
+ Property { name: "pressure"; type: "double"; isReadonly: true }
+ Property { name: "velocity"; type: "QVector2D"; isReadonly: true }
+ Property { name: "area"; type: "QRectF"; isReadonly: true }
+ Property { name: "startX"; type: "double"; isReadonly: true }
+ Property { name: "startY"; type: "double"; isReadonly: true }
+ Property { name: "previousX"; type: "double"; isReadonly: true }
+ Property { name: "previousY"; type: "double"; isReadonly: true }
+ Property { name: "sceneX"; type: "double"; isReadonly: true }
+ Property { name: "sceneY"; type: "double"; isReadonly: true }
+ }
+ Component { name: "QQuickTransform"; prototype: "QObject" }
+ Component {
+ name: "QQuickTransition"
+ defaultProperty: "animations"
+ prototype: "QObject"
+ exports: ["QtQuick/Transition 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "string" }
+ Property { name: "to"; type: "string" }
+ Property { name: "reversible"; type: "bool" }
+ Property { name: "running"; type: "bool"; isReadonly: true }
+ Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true }
+ Property { name: "enabled"; type: "bool" }
+ }
+ Component {
+ name: "QQuickTranslate"
+ prototype: "QQuickTransform"
+ exports: ["QtQuick/Translate 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ }
+ Component {
+ name: "QQuickUniformAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/UniformAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "uniform"; type: "string" }
+ Signal {
+ name: "uniformChanged"
+ Parameter { type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickVector3dAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["QtQuick/Vector3dAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "QVector3D" }
+ Property { name: "to"; type: "QVector3D" }
+ }
+ Component {
+ name: "QQuickViewSection"
+ prototype: "QObject"
+ exports: ["QtQuick/ViewSection 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "SectionCriteria"
+ values: {
+ "FullString": 0,
+ "FirstCharacter": 1
+ }
+ }
+ Enum {
+ name: "LabelPositioning"
+ values: {
+ "InlineLabels": 1,
+ "CurrentLabelAtStart": 2,
+ "NextLabelAtEnd": 4
+ }
+ }
+ Property { name: "property"; type: "string" }
+ Property { name: "criteria"; type: "SectionCriteria" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "labelPositioning"; type: "int" }
+ Signal { name: "sectionsChanged" }
+ }
+ Component {
+ name: "QQuickViewTransitionAttached"
+ prototype: "QObject"
+ exports: ["QtQuick/ViewTransition 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "destination"; type: "QPointF"; isReadonly: true }
+ Property { name: "targetIndexes"; type: "QList<int>"; isReadonly: true }
+ Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickWorkerScript"
+ prototype: "QObject"
+ exports: ["QtQuick/WorkerScript 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "source"; type: "QUrl" }
+ Signal {
+ name: "message"
+ Parameter { name: "messageObject"; type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "sendMessage"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickXAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/XAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickYAnimator"
+ prototype: "QQuickAnimator"
+ exports: ["QtQuick/YAnimator 2.2"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QRegExpValidator"
+ prototype: "QValidator"
+ exports: ["QtQuick/RegExpValidator 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "regExp"; type: "QRegExp" }
+ Signal {
+ name: "regExpChanged"
+ Parameter { name: "regExp"; type: "QRegExp" }
+ }
+ }
+ Component {
+ name: "QValidator"
+ prototype: "QObject"
+ Signal { name: "changed" }
+ }
+ Component {
+ name: "Qt"
+ Enum {
+ name: "GlobalColor"
+ values: {
+ "color0": 0,
+ "color1": 1,
+ "black": 2,
+ "white": 3,
+ "darkGray": 4,
+ "gray": 5,
+ "lightGray": 6,
+ "red": 7,
+ "green": 8,
+ "blue": 9,
+ "cyan": 10,
+ "magenta": 11,
+ "yellow": 12,
+ "darkRed": 13,
+ "darkGreen": 14,
+ "darkBlue": 15,
+ "darkCyan": 16,
+ "darkMagenta": 17,
+ "darkYellow": 18,
+ "transparent": 19
+ }
+ }
+ Enum {
+ name: "KeyboardModifiers"
+ values: {
+ "NoModifier": 0,
+ "ShiftModifier": 33554432,
+ "ControlModifier": 67108864,
+ "AltModifier": 134217728,
+ "MetaModifier": 268435456,
+ "KeypadModifier": 536870912,
+ "GroupSwitchModifier": 1073741824,
+ "KeyboardModifierMask": -33554432
+ }
+ }
+ Enum {
+ name: "MouseButtons"
+ values: {
+ "NoButton": 0,
+ "LeftButton": 1,
+ "RightButton": 2,
+ "MidButton": 4,
+ "MiddleButton": 4,
+ "BackButton": 8,
+ "XButton1": 8,
+ "ExtraButton1": 8,
+ "ForwardButton": 16,
+ "XButton2": 16,
+ "ExtraButton2": 16,
+ "TaskButton": 32,
+ "ExtraButton3": 32,
+ "ExtraButton4": 64,
+ "ExtraButton5": 128,
+ "ExtraButton6": 256,
+ "ExtraButton7": 512,
+ "ExtraButton8": 1024,
+ "ExtraButton9": 2048,
+ "ExtraButton10": 4096,
+ "ExtraButton11": 8192,
+ "ExtraButton12": 16384,
+ "ExtraButton13": 32768,
+ "ExtraButton14": 65536,
+ "ExtraButton15": 131072,
+ "ExtraButton16": 262144,
+ "ExtraButton17": 524288,
+ "ExtraButton18": 1048576,
+ "ExtraButton19": 2097152,
+ "ExtraButton20": 4194304,
+ "ExtraButton21": 8388608,
+ "ExtraButton22": 16777216,
+ "ExtraButton23": 33554432,
+ "ExtraButton24": 67108864,
+ "AllButtons": 134217727,
+ "MaxMouseButton": 67108864,
+ "MouseButtonMask": -1
+ }
+ }
+ Enum {
+ name: "Orientation"
+ values: {
+ "Horizontal": 1,
+ "Vertical": 2
+ }
+ }
+ Enum {
+ name: "Orientations"
+ values: {
+ "Horizontal": 1,
+ "Vertical": 2
+ }
+ }
+ Enum {
+ name: "FocusPolicy"
+ values: {
+ "NoFocus": 0,
+ "TabFocus": 1,
+ "ClickFocus": 2,
+ "StrongFocus": 11,
+ "WheelFocus": 15
+ }
+ }
+ Enum {
+ name: "SortOrder"
+ values: {
+ "AscendingOrder": 0,
+ "DescendingOrder": 1
+ }
+ }
+ Enum {
+ name: "Alignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignLeading": 1,
+ "AlignRight": 2,
+ "AlignTrailing": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8,
+ "AlignAbsolute": 16,
+ "AlignHorizontal_Mask": 31,
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128,
+ "AlignBaseline": 256,
+ "AlignVertical_Mask": 480,
+ "AlignCenter": 132
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WindowType"
+ values: {
+ "Widget": 0,
+ "Window": 1,
+ "Dialog": 3,
+ "Sheet": 5,
+ "Drawer": 7,
+ "Popup": 9,
+ "Tool": 11,
+ "ToolTip": 13,
+ "SplashScreen": 15,
+ "Desktop": 17,
+ "SubWindow": 18,
+ "ForeignWindow": 33,
+ "CoverWindow": 65,
+ "WindowType_Mask": 255,
+ "MSWindowsFixedSizeDialogHint": 256,
+ "MSWindowsOwnDC": 512,
+ "BypassWindowManagerHint": 1024,
+ "X11BypassWindowManagerHint": 1024,
+ "FramelessWindowHint": 2048,
+ "WindowTitleHint": 4096,
+ "WindowSystemMenuHint": 8192,
+ "WindowMinimizeButtonHint": 16384,
+ "WindowMaximizeButtonHint": 32768,
+ "WindowMinMaxButtonsHint": 49152,
+ "WindowContextHelpButtonHint": 65536,
+ "WindowShadeButtonHint": 131072,
+ "WindowStaysOnTopHint": 262144,
+ "WindowTransparentForInput": 524288,
+ "WindowOverridesSystemGestures": 1048576,
+ "WindowDoesNotAcceptFocus": 2097152,
+ "CustomizeWindowHint": 33554432,
+ "WindowStaysOnBottomHint": 67108864,
+ "WindowCloseButtonHint": 134217728,
+ "MacWindowToolBarButtonHint": 268435456,
+ "BypassGraphicsProxyWidget": 536870912,
+ "WindowOkButtonHint": 524288,
+ "WindowCancelButtonHint": 1048576,
+ "NoDropShadowWindowHint": 1073741824,
+ "WindowFullscreenButtonHint": -2147483648
+ }
+ }
+ Enum {
+ name: "WindowFlags"
+ values: {
+ "Widget": 0,
+ "Window": 1,
+ "Dialog": 3,
+ "Sheet": 5,
+ "Drawer": 7,
+ "Popup": 9,
+ "Tool": 11,
+ "ToolTip": 13,
+ "SplashScreen": 15,
+ "Desktop": 17,
+ "SubWindow": 18,
+ "ForeignWindow": 33,
+ "CoverWindow": 65,
+ "WindowType_Mask": 255,
+ "MSWindowsFixedSizeDialogHint": 256,
+ "MSWindowsOwnDC": 512,
+ "BypassWindowManagerHint": 1024,
+ "X11BypassWindowManagerHint": 1024,
+ "FramelessWindowHint": 2048,
+ "WindowTitleHint": 4096,
+ "WindowSystemMenuHint": 8192,
+ "WindowMinimizeButtonHint": 16384,
+ "WindowMaximizeButtonHint": 32768,
+ "WindowMinMaxButtonsHint": 49152,
+ "WindowContextHelpButtonHint": 65536,
+ "WindowShadeButtonHint": 131072,
+ "WindowStaysOnTopHint": 262144,
+ "WindowTransparentForInput": 524288,
+ "WindowOverridesSystemGestures": 1048576,
+ "WindowDoesNotAcceptFocus": 2097152,
+ "CustomizeWindowHint": 33554432,
+ "WindowStaysOnBottomHint": 67108864,
+ "WindowCloseButtonHint": 134217728,
+ "MacWindowToolBarButtonHint": 268435456,
+ "BypassGraphicsProxyWidget": 536870912,
+ "WindowOkButtonHint": 524288,
+ "WindowCancelButtonHint": 1048576,
+ "NoDropShadowWindowHint": 1073741824,
+ "WindowFullscreenButtonHint": -2147483648
+ }
+ }
+ Enum {
+ name: "WindowState"
+ values: {
+ "WindowNoState": 0,
+ "WindowMinimized": 1,
+ "WindowMaximized": 2,
+ "WindowFullScreen": 4,
+ "WindowActive": 8
+ }
+ }
+ Enum {
+ name: "WindowStates"
+ values: {
+ "WindowNoState": 0,
+ "WindowMinimized": 1,
+ "WindowMaximized": 2,
+ "WindowFullScreen": 4,
+ "WindowActive": 8
+ }
+ }
+ Enum {
+ name: "ApplicationState"
+ values: {
+ "ApplicationSuspended": 0,
+ "ApplicationHidden": 1,
+ "ApplicationInactive": 2,
+ "ApplicationActive": 4
+ }
+ }
+ Enum {
+ name: "ScreenOrientation"
+ values: {
+ "PrimaryOrientation": 0,
+ "PortraitOrientation": 1,
+ "LandscapeOrientation": 2,
+ "InvertedPortraitOrientation": 4,
+ "InvertedLandscapeOrientation": 8
+ }
+ }
+ Enum {
+ name: "ScreenOrientations"
+ values: {
+ "PrimaryOrientation": 0,
+ "PortraitOrientation": 1,
+ "LandscapeOrientation": 2,
+ "InvertedPortraitOrientation": 4,
+ "InvertedLandscapeOrientation": 8
+ }
+ }
+ Enum {
+ name: "WidgetAttribute"
+ values: {
+ "WA_Disabled": 0,
+ "WA_UnderMouse": 1,
+ "WA_MouseTracking": 2,
+ "WA_ContentsPropagated": 3,
+ "WA_OpaquePaintEvent": 4,
+ "WA_NoBackground": 4,
+ "WA_StaticContents": 5,
+ "WA_LaidOut": 7,
+ "WA_PaintOnScreen": 8,
+ "WA_NoSystemBackground": 9,
+ "WA_UpdatesDisabled": 10,
+ "WA_Mapped": 11,
+ "WA_MacNoClickThrough": 12,
+ "WA_InputMethodEnabled": 14,
+ "WA_WState_Visible": 15,
+ "WA_WState_Hidden": 16,
+ "WA_ForceDisabled": 32,
+ "WA_KeyCompression": 33,
+ "WA_PendingMoveEvent": 34,
+ "WA_PendingResizeEvent": 35,
+ "WA_SetPalette": 36,
+ "WA_SetFont": 37,
+ "WA_SetCursor": 38,
+ "WA_NoChildEventsFromChildren": 39,
+ "WA_WindowModified": 41,
+ "WA_Resized": 42,
+ "WA_Moved": 43,
+ "WA_PendingUpdate": 44,
+ "WA_InvalidSize": 45,
+ "WA_MacBrushedMetal": 46,
+ "WA_MacMetalStyle": 46,
+ "WA_CustomWhatsThis": 47,
+ "WA_LayoutOnEntireRect": 48,
+ "WA_OutsideWSRange": 49,
+ "WA_GrabbedShortcut": 50,
+ "WA_TransparentForMouseEvents": 51,
+ "WA_PaintUnclipped": 52,
+ "WA_SetWindowIcon": 53,
+ "WA_NoMouseReplay": 54,
+ "WA_DeleteOnClose": 55,
+ "WA_RightToLeft": 56,
+ "WA_SetLayoutDirection": 57,
+ "WA_NoChildEventsForParent": 58,
+ "WA_ForceUpdatesDisabled": 59,
+ "WA_WState_Created": 60,
+ "WA_WState_CompressKeys": 61,
+ "WA_WState_InPaintEvent": 62,
+ "WA_WState_Reparented": 63,
+ "WA_WState_ConfigPending": 64,
+ "WA_WState_Polished": 66,
+ "WA_WState_DND": 67,
+ "WA_WState_OwnSizePolicy": 68,
+ "WA_WState_ExplicitShowHide": 69,
+ "WA_ShowModal": 70,
+ "WA_MouseNoMask": 71,
+ "WA_GroupLeader": 72,
+ "WA_NoMousePropagation": 73,
+ "WA_Hover": 74,
+ "WA_InputMethodTransparent": 75,
+ "WA_QuitOnClose": 76,
+ "WA_KeyboardFocusChange": 77,
+ "WA_AcceptDrops": 78,
+ "WA_DropSiteRegistered": 79,
+ "WA_ForceAcceptDrops": 79,
+ "WA_WindowPropagation": 80,
+ "WA_NoX11EventCompression": 81,
+ "WA_TintedBackground": 82,
+ "WA_X11OpenGLOverlay": 83,
+ "WA_AlwaysShowToolTips": 84,
+ "WA_MacOpaqueSizeGrip": 85,
+ "WA_SetStyle": 86,
+ "WA_SetLocale": 87,
+ "WA_MacShowFocusRect": 88,
+ "WA_MacNormalSize": 89,
+ "WA_MacSmallSize": 90,
+ "WA_MacMiniSize": 91,
+ "WA_LayoutUsesWidgetRect": 92,
+ "WA_StyledBackground": 93,
+ "WA_MSWindowsUseDirect3D": 94,
+ "WA_CanHostQMdiSubWindowTitleBar": 95,
+ "WA_MacAlwaysShowToolWindow": 96,
+ "WA_StyleSheet": 97,
+ "WA_ShowWithoutActivating": 98,
+ "WA_X11BypassTransientForHint": 99,
+ "WA_NativeWindow": 100,
+ "WA_DontCreateNativeAncestors": 101,
+ "WA_MacVariableSize": 102,
+ "WA_DontShowOnScreen": 103,
+ "WA_X11NetWmWindowTypeDesktop": 104,
+ "WA_X11NetWmWindowTypeDock": 105,
+ "WA_X11NetWmWindowTypeToolBar": 106,
+ "WA_X11NetWmWindowTypeMenu": 107,
+ "WA_X11NetWmWindowTypeUtility": 108,
+ "WA_X11NetWmWindowTypeSplash": 109,
+ "WA_X11NetWmWindowTypeDialog": 110,
+ "WA_X11NetWmWindowTypeDropDownMenu": 111,
+ "WA_X11NetWmWindowTypePopupMenu": 112,
+ "WA_X11NetWmWindowTypeToolTip": 113,
+ "WA_X11NetWmWindowTypeNotification": 114,
+ "WA_X11NetWmWindowTypeCombo": 115,
+ "WA_X11NetWmWindowTypeDND": 116,
+ "WA_MacFrameworkScaled": 117,
+ "WA_SetWindowModality": 118,
+ "WA_WState_WindowOpacitySet": 119,
+ "WA_TranslucentBackground": 120,
+ "WA_AcceptTouchEvents": 121,
+ "WA_WState_AcceptedTouchBeginEvent": 122,
+ "WA_TouchPadAcceptSingleTouchEvents": 123,
+ "WA_X11DoNotAcceptFocus": 126,
+ "WA_MacNoShadow": 127,
+ "WA_AttributeCount": 128
+ }
+ }
+ Enum {
+ name: "ApplicationAttribute"
+ values: {
+ "AA_ImmediateWidgetCreation": 0,
+ "AA_MSWindowsUseDirect3DByDefault": 1,
+ "AA_DontShowIconsInMenus": 2,
+ "AA_NativeWindows": 3,
+ "AA_DontCreateNativeWidgetSiblings": 4,
+ "AA_MacPluginApplication": 5,
+ "AA_DontUseNativeMenuBar": 6,
+ "AA_MacDontSwapCtrlAndMeta": 7,
+ "AA_Use96Dpi": 8,
+ "AA_X11InitThreads": 10,
+ "AA_SynthesizeTouchForUnhandledMouseEvents": 11,
+ "AA_SynthesizeMouseForUnhandledTouchEvents": 12,
+ "AA_UseHighDpiPixmaps": 13,
+ "AA_AttributeCount": 14
+ }
+ }
+ Enum {
+ name: "ImageConversionFlags"
+ values: {
+ "ColorMode_Mask": 3,
+ "AutoColor": 0,
+ "ColorOnly": 3,
+ "MonoOnly": 2,
+ "AlphaDither_Mask": 12,
+ "ThresholdAlphaDither": 0,
+ "OrderedAlphaDither": 4,
+ "DiffuseAlphaDither": 8,
+ "NoAlpha": 12,
+ "Dither_Mask": 48,
+ "DiffuseDither": 0,
+ "OrderedDither": 16,
+ "ThresholdDither": 32,
+ "DitherMode_Mask": 192,
+ "AutoDither": 0,
+ "PreferDither": 64,
+ "AvoidDither": 128,
+ "NoOpaqueDetection": 256,
+ "NoFormatConversion": 512
+ }
+ }
+ Enum {
+ name: "BGMode"
+ values: {
+ "TransparentMode": 0,
+ "OpaqueMode": 1
+ }
+ }
+ Enum {
+ name: "Key"
+ values: {
+ "Key_Escape": 16777216,
+ "Key_Tab": 16777217,
+ "Key_Backtab": 16777218,
+ "Key_Backspace": 16777219,
+ "Key_Return": 16777220,
+ "Key_Enter": 16777221,
+ "Key_Insert": 16777222,
+ "Key_Delete": 16777223,
+ "Key_Pause": 16777224,
+ "Key_Print": 16777225,
+ "Key_SysReq": 16777226,
+ "Key_Clear": 16777227,
+ "Key_Home": 16777232,
+ "Key_End": 16777233,
+ "Key_Left": 16777234,
+ "Key_Up": 16777235,
+ "Key_Right": 16777236,
+ "Key_Down": 16777237,
+ "Key_PageUp": 16777238,
+ "Key_PageDown": 16777239,
+ "Key_Shift": 16777248,
+ "Key_Control": 16777249,
+ "Key_Meta": 16777250,
+ "Key_Alt": 16777251,
+ "Key_CapsLock": 16777252,
+ "Key_NumLock": 16777253,
+ "Key_ScrollLock": 16777254,
+ "Key_F1": 16777264,
+ "Key_F2": 16777265,
+ "Key_F3": 16777266,
+ "Key_F4": 16777267,
+ "Key_F5": 16777268,
+ "Key_F6": 16777269,
+ "Key_F7": 16777270,
+ "Key_F8": 16777271,
+ "Key_F9": 16777272,
+ "Key_F10": 16777273,
+ "Key_F11": 16777274,
+ "Key_F12": 16777275,
+ "Key_F13": 16777276,
+ "Key_F14": 16777277,
+ "Key_F15": 16777278,
+ "Key_F16": 16777279,
+ "Key_F17": 16777280,
+ "Key_F18": 16777281,
+ "Key_F19": 16777282,
+ "Key_F20": 16777283,
+ "Key_F21": 16777284,
+ "Key_F22": 16777285,
+ "Key_F23": 16777286,
+ "Key_F24": 16777287,
+ "Key_F25": 16777288,
+ "Key_F26": 16777289,
+ "Key_F27": 16777290,
+ "Key_F28": 16777291,
+ "Key_F29": 16777292,
+ "Key_F30": 16777293,
+ "Key_F31": 16777294,
+ "Key_F32": 16777295,
+ "Key_F33": 16777296,
+ "Key_F34": 16777297,
+ "Key_F35": 16777298,
+ "Key_Super_L": 16777299,
+ "Key_Super_R": 16777300,
+ "Key_Menu": 16777301,
+ "Key_Hyper_L": 16777302,
+ "Key_Hyper_R": 16777303,
+ "Key_Help": 16777304,
+ "Key_Direction_L": 16777305,
+ "Key_Direction_R": 16777312,
+ "Key_Space": 32,
+ "Key_Any": 32,
+ "Key_Exclam": 33,
+ "Key_QuoteDbl": 34,
+ "Key_NumberSign": 35,
+ "Key_Dollar": 36,
+ "Key_Percent": 37,
+ "Key_Ampersand": 38,
+ "Key_Apostrophe": 39,
+ "Key_ParenLeft": 40,
+ "Key_ParenRight": 41,
+ "Key_Asterisk": 42,
+ "Key_Plus": 43,
+ "Key_Comma": 44,
+ "Key_Minus": 45,
+ "Key_Period": 46,
+ "Key_Slash": 47,
+ "Key_0": 48,
+ "Key_1": 49,
+ "Key_2": 50,
+ "Key_3": 51,
+ "Key_4": 52,
+ "Key_5": 53,
+ "Key_6": 54,
+ "Key_7": 55,
+ "Key_8": 56,
+ "Key_9": 57,
+ "Key_Colon": 58,
+ "Key_Semicolon": 59,
+ "Key_Less": 60,
+ "Key_Equal": 61,
+ "Key_Greater": 62,
+ "Key_Question": 63,
+ "Key_At": 64,
+ "Key_A": 65,
+ "Key_B": 66,
+ "Key_C": 67,
+ "Key_D": 68,
+ "Key_E": 69,
+ "Key_F": 70,
+ "Key_G": 71,
+ "Key_H": 72,
+ "Key_I": 73,
+ "Key_J": 74,
+ "Key_K": 75,
+ "Key_L": 76,
+ "Key_M": 77,
+ "Key_N": 78,
+ "Key_O": 79,
+ "Key_P": 80,
+ "Key_Q": 81,
+ "Key_R": 82,
+ "Key_S": 83,
+ "Key_T": 84,
+ "Key_U": 85,
+ "Key_V": 86,
+ "Key_W": 87,
+ "Key_X": 88,
+ "Key_Y": 89,
+ "Key_Z": 90,
+ "Key_BracketLeft": 91,
+ "Key_Backslash": 92,
+ "Key_BracketRight": 93,
+ "Key_AsciiCircum": 94,
+ "Key_Underscore": 95,
+ "Key_QuoteLeft": 96,
+ "Key_BraceLeft": 123,
+ "Key_Bar": 124,
+ "Key_BraceRight": 125,
+ "Key_AsciiTilde": 126,
+ "Key_nobreakspace": 160,
+ "Key_exclamdown": 161,
+ "Key_cent": 162,
+ "Key_sterling": 163,
+ "Key_currency": 164,
+ "Key_yen": 165,
+ "Key_brokenbar": 166,
+ "Key_section": 167,
+ "Key_diaeresis": 168,
+ "Key_copyright": 169,
+ "Key_ordfeminine": 170,
+ "Key_guillemotleft": 171,
+ "Key_notsign": 172,
+ "Key_hyphen": 173,
+ "Key_registered": 174,
+ "Key_macron": 175,
+ "Key_degree": 176,
+ "Key_plusminus": 177,
+ "Key_twosuperior": 178,
+ "Key_threesuperior": 179,
+ "Key_acute": 180,
+ "Key_mu": 181,
+ "Key_paragraph": 182,
+ "Key_periodcentered": 183,
+ "Key_cedilla": 184,
+ "Key_onesuperior": 185,
+ "Key_masculine": 186,
+ "Key_guillemotright": 187,
+ "Key_onequarter": 188,
+ "Key_onehalf": 189,
+ "Key_threequarters": 190,
+ "Key_questiondown": 191,
+ "Key_Agrave": 192,
+ "Key_Aacute": 193,
+ "Key_Acircumflex": 194,
+ "Key_Atilde": 195,
+ "Key_Adiaeresis": 196,
+ "Key_Aring": 197,
+ "Key_AE": 198,
+ "Key_Ccedilla": 199,
+ "Key_Egrave": 200,
+ "Key_Eacute": 201,
+ "Key_Ecircumflex": 202,
+ "Key_Ediaeresis": 203,
+ "Key_Igrave": 204,
+ "Key_Iacute": 205,
+ "Key_Icircumflex": 206,
+ "Key_Idiaeresis": 207,
+ "Key_ETH": 208,
+ "Key_Ntilde": 209,
+ "Key_Ograve": 210,
+ "Key_Oacute": 211,
+ "Key_Ocircumflex": 212,
+ "Key_Otilde": 213,
+ "Key_Odiaeresis": 214,
+ "Key_multiply": 215,
+ "Key_Ooblique": 216,
+ "Key_Ugrave": 217,
+ "Key_Uacute": 218,
+ "Key_Ucircumflex": 219,
+ "Key_Udiaeresis": 220,
+ "Key_Yacute": 221,
+ "Key_THORN": 222,
+ "Key_ssharp": 223,
+ "Key_division": 247,
+ "Key_ydiaeresis": 255,
+ "Key_AltGr": 16781571,
+ "Key_Multi_key": 16781600,
+ "Key_Codeinput": 16781623,
+ "Key_SingleCandidate": 16781628,
+ "Key_MultipleCandidate": 16781629,
+ "Key_PreviousCandidate": 16781630,
+ "Key_Mode_switch": 16781694,
+ "Key_Kanji": 16781601,
+ "Key_Muhenkan": 16781602,
+ "Key_Henkan": 16781603,
+ "Key_Romaji": 16781604,
+ "Key_Hiragana": 16781605,
+ "Key_Katakana": 16781606,
+ "Key_Hiragana_Katakana": 16781607,
+ "Key_Zenkaku": 16781608,
+ "Key_Hankaku": 16781609,
+ "Key_Zenkaku_Hankaku": 16781610,
+ "Key_Touroku": 16781611,
+ "Key_Massyo": 16781612,
+ "Key_Kana_Lock": 16781613,
+ "Key_Kana_Shift": 16781614,
+ "Key_Eisu_Shift": 16781615,
+ "Key_Eisu_toggle": 16781616,
+ "Key_Hangul": 16781617,
+ "Key_Hangul_Start": 16781618,
+ "Key_Hangul_End": 16781619,
+ "Key_Hangul_Hanja": 16781620,
+ "Key_Hangul_Jamo": 16781621,
+ "Key_Hangul_Romaja": 16781622,
+ "Key_Hangul_Jeonja": 16781624,
+ "Key_Hangul_Banja": 16781625,
+ "Key_Hangul_PreHanja": 16781626,
+ "Key_Hangul_PostHanja": 16781627,
+ "Key_Hangul_Special": 16781631,
+ "Key_Dead_Grave": 16781904,
+ "Key_Dead_Acute": 16781905,
+ "Key_Dead_Circumflex": 16781906,
+ "Key_Dead_Tilde": 16781907,
+ "Key_Dead_Macron": 16781908,
+ "Key_Dead_Breve": 16781909,
+ "Key_Dead_Abovedot": 16781910,
+ "Key_Dead_Diaeresis": 16781911,
+ "Key_Dead_Abovering": 16781912,
+ "Key_Dead_Doubleacute": 16781913,
+ "Key_Dead_Caron": 16781914,
+ "Key_Dead_Cedilla": 16781915,
+ "Key_Dead_Ogonek": 16781916,
+ "Key_Dead_Iota": 16781917,
+ "Key_Dead_Voiced_Sound": 16781918,
+ "Key_Dead_Semivoiced_Sound": 16781919,
+ "Key_Dead_Belowdot": 16781920,
+ "Key_Dead_Hook": 16781921,
+ "Key_Dead_Horn": 16781922,
+ "Key_Back": 16777313,
+ "Key_Forward": 16777314,
+ "Key_Stop": 16777315,
+ "Key_Refresh": 16777316,
+ "Key_VolumeDown": 16777328,
+ "Key_VolumeMute": 16777329,
+ "Key_VolumeUp": 16777330,
+ "Key_BassBoost": 16777331,
+ "Key_BassUp": 16777332,
+ "Key_BassDown": 16777333,
+ "Key_TrebleUp": 16777334,
+ "Key_TrebleDown": 16777335,
+ "Key_MediaPlay": 16777344,
+ "Key_MediaStop": 16777345,
+ "Key_MediaPrevious": 16777346,
+ "Key_MediaNext": 16777347,
+ "Key_MediaRecord": 16777348,
+ "Key_MediaPause": 16777349,
+ "Key_MediaTogglePlayPause": 16777350,
+ "Key_HomePage": 16777360,
+ "Key_Favorites": 16777361,
+ "Key_Search": 16777362,
+ "Key_Standby": 16777363,
+ "Key_OpenUrl": 16777364,
+ "Key_LaunchMail": 16777376,
+ "Key_LaunchMedia": 16777377,
+ "Key_Launch0": 16777378,
+ "Key_Launch1": 16777379,
+ "Key_Launch2": 16777380,
+ "Key_Launch3": 16777381,
+ "Key_Launch4": 16777382,
+ "Key_Launch5": 16777383,
+ "Key_Launch6": 16777384,
+ "Key_Launch7": 16777385,
+ "Key_Launch8": 16777386,
+ "Key_Launch9": 16777387,
+ "Key_LaunchA": 16777388,
+ "Key_LaunchB": 16777389,
+ "Key_LaunchC": 16777390,
+ "Key_LaunchD": 16777391,
+ "Key_LaunchE": 16777392,
+ "Key_LaunchF": 16777393,
+ "Key_MonBrightnessUp": 16777394,
+ "Key_MonBrightnessDown": 16777395,
+ "Key_KeyboardLightOnOff": 16777396,
+ "Key_KeyboardBrightnessUp": 16777397,
+ "Key_KeyboardBrightnessDown": 16777398,
+ "Key_PowerOff": 16777399,
+ "Key_WakeUp": 16777400,
+ "Key_Eject": 16777401,
+ "Key_ScreenSaver": 16777402,
+ "Key_WWW": 16777403,
+ "Key_Memo": 16777404,
+ "Key_LightBulb": 16777405,
+ "Key_Shop": 16777406,
+ "Key_History": 16777407,
+ "Key_AddFavorite": 16777408,
+ "Key_HotLinks": 16777409,
+ "Key_BrightnessAdjust": 16777410,
+ "Key_Finance": 16777411,
+ "Key_Community": 16777412,
+ "Key_AudioRewind": 16777413,
+ "Key_BackForward": 16777414,
+ "Key_ApplicationLeft": 16777415,
+ "Key_ApplicationRight": 16777416,
+ "Key_Book": 16777417,
+ "Key_CD": 16777418,
+ "Key_Calculator": 16777419,
+ "Key_ToDoList": 16777420,
+ "Key_ClearGrab": 16777421,
+ "Key_Close": 16777422,
+ "Key_Copy": 16777423,
+ "Key_Cut": 16777424,
+ "Key_Display": 16777425,
+ "Key_DOS": 16777426,
+ "Key_Documents": 16777427,
+ "Key_Excel": 16777428,
+ "Key_Explorer": 16777429,
+ "Key_Game": 16777430,
+ "Key_Go": 16777431,
+ "Key_iTouch": 16777432,
+ "Key_LogOff": 16777433,
+ "Key_Market": 16777434,
+ "Key_Meeting": 16777435,
+ "Key_MenuKB": 16777436,
+ "Key_MenuPB": 16777437,
+ "Key_MySites": 16777438,
+ "Key_News": 16777439,
+ "Key_OfficeHome": 16777440,
+ "Key_Option": 16777441,
+ "Key_Paste": 16777442,
+ "Key_Phone": 16777443,
+ "Key_Calendar": 16777444,
+ "Key_Reply": 16777445,
+ "Key_Reload": 16777446,
+ "Key_RotateWindows": 16777447,
+ "Key_RotationPB": 16777448,
+ "Key_RotationKB": 16777449,
+ "Key_Save": 16777450,
+ "Key_Send": 16777451,
+ "Key_Spell": 16777452,
+ "Key_SplitScreen": 16777453,
+ "Key_Support": 16777454,
+ "Key_TaskPane": 16777455,
+ "Key_Terminal": 16777456,
+ "Key_Tools": 16777457,
+ "Key_Travel": 16777458,
+ "Key_Video": 16777459,
+ "Key_Word": 16777460,
+ "Key_Xfer": 16777461,
+ "Key_ZoomIn": 16777462,
+ "Key_ZoomOut": 16777463,
+ "Key_Away": 16777464,
+ "Key_Messenger": 16777465,
+ "Key_WebCam": 16777466,
+ "Key_MailForward": 16777467,
+ "Key_Pictures": 16777468,
+ "Key_Music": 16777469,
+ "Key_Battery": 16777470,
+ "Key_Bluetooth": 16777471,
+ "Key_WLAN": 16777472,
+ "Key_UWB": 16777473,
+ "Key_AudioForward": 16777474,
+ "Key_AudioRepeat": 16777475,
+ "Key_AudioRandomPlay": 16777476,
+ "Key_Subtitle": 16777477,
+ "Key_AudioCycleTrack": 16777478,
+ "Key_Time": 16777479,
+ "Key_Hibernate": 16777480,
+ "Key_View": 16777481,
+ "Key_TopMenu": 16777482,
+ "Key_PowerDown": 16777483,
+ "Key_Suspend": 16777484,
+ "Key_ContrastAdjust": 16777485,
+ "Key_LaunchG": 16777486,
+ "Key_LaunchH": 16777487,
+ "Key_TouchpadToggle": 16777488,
+ "Key_TouchpadOn": 16777489,
+ "Key_TouchpadOff": 16777490,
+ "Key_MicMute": 16777491,
+ "Key_Red": 16777492,
+ "Key_Green": 16777493,
+ "Key_Yellow": 16777494,
+ "Key_Blue": 16777495,
+ "Key_ChannelUp": 16777496,
+ "Key_ChannelDown": 16777497,
+ "Key_MediaLast": 16842751,
+ "Key_Select": 16842752,
+ "Key_Yes": 16842753,
+ "Key_No": 16842754,
+ "Key_Cancel": 16908289,
+ "Key_Printer": 16908290,
+ "Key_Execute": 16908291,
+ "Key_Sleep": 16908292,
+ "Key_Play": 16908293,
+ "Key_Zoom": 16908294,
+ "Key_Context1": 17825792,
+ "Key_Context2": 17825793,
+ "Key_Context3": 17825794,
+ "Key_Context4": 17825795,
+ "Key_Call": 17825796,
+ "Key_Hangup": 17825797,
+ "Key_Flip": 17825798,
+ "Key_ToggleCallHangup": 17825799,
+ "Key_VoiceDial": 17825800,
+ "Key_LastNumberRedial": 17825801,
+ "Key_Camera": 17825824,
+ "Key_CameraFocus": 17825825,
+ "Key_unknown": 33554431
+ }
+ }
+ Enum {
+ name: "ArrowType"
+ values: {
+ "NoArrow": 0,
+ "UpArrow": 1,
+ "DownArrow": 2,
+ "LeftArrow": 3,
+ "RightArrow": 4
+ }
+ }
+ Enum {
+ name: "PenStyle"
+ values: {
+ "NoPen": 0,
+ "SolidLine": 1,
+ "DashLine": 2,
+ "DotLine": 3,
+ "DashDotLine": 4,
+ "DashDotDotLine": 5,
+ "CustomDashLine": 6
+ }
+ }
+ Enum {
+ name: "PenCapStyle"
+ values: {
+ "FlatCap": 0,
+ "SquareCap": 16,
+ "RoundCap": 32,
+ "MPenCapStyle": 48
+ }
+ }
+ Enum {
+ name: "PenJoinStyle"
+ values: {
+ "MiterJoin": 0,
+ "BevelJoin": 64,
+ "RoundJoin": 128,
+ "SvgMiterJoin": 256,
+ "MPenJoinStyle": 448
+ }
+ }
+ Enum {
+ name: "BrushStyle"
+ values: {
+ "NoBrush": 0,
+ "SolidPattern": 1,
+ "Dense1Pattern": 2,
+ "Dense2Pattern": 3,
+ "Dense3Pattern": 4,
+ "Dense4Pattern": 5,
+ "Dense5Pattern": 6,
+ "Dense6Pattern": 7,
+ "Dense7Pattern": 8,
+ "HorPattern": 9,
+ "VerPattern": 10,
+ "CrossPattern": 11,
+ "BDiagPattern": 12,
+ "FDiagPattern": 13,
+ "DiagCrossPattern": 14,
+ "LinearGradientPattern": 15,
+ "RadialGradientPattern": 16,
+ "ConicalGradientPattern": 17,
+ "TexturePattern": 24
+ }
+ }
+ Enum {
+ name: "SizeMode"
+ values: {
+ "AbsoluteSize": 0,
+ "RelativeSize": 1
+ }
+ }
+ Enum {
+ name: "CursorShape"
+ values: {
+ "ArrowCursor": 0,
+ "UpArrowCursor": 1,
+ "CrossCursor": 2,
+ "WaitCursor": 3,
+ "IBeamCursor": 4,
+ "SizeVerCursor": 5,
+ "SizeHorCursor": 6,
+ "SizeBDiagCursor": 7,
+ "SizeFDiagCursor": 8,
+ "SizeAllCursor": 9,
+ "BlankCursor": 10,
+ "SplitVCursor": 11,
+ "SplitHCursor": 12,
+ "PointingHandCursor": 13,
+ "ForbiddenCursor": 14,
+ "WhatsThisCursor": 15,
+ "BusyCursor": 16,
+ "OpenHandCursor": 17,
+ "ClosedHandCursor": 18,
+ "DragCopyCursor": 19,
+ "DragMoveCursor": 20,
+ "DragLinkCursor": 21,
+ "LastCursor": 21,
+ "BitmapCursor": 24,
+ "CustomCursor": 25
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2
+ }
+ }
+ Enum {
+ name: "AspectRatioMode"
+ values: {
+ "IgnoreAspectRatio": 0,
+ "KeepAspectRatio": 1,
+ "KeepAspectRatioByExpanding": 2
+ }
+ }
+ Enum {
+ name: "DockWidgetArea"
+ values: {
+ "LeftDockWidgetArea": 1,
+ "RightDockWidgetArea": 2,
+ "TopDockWidgetArea": 4,
+ "BottomDockWidgetArea": 8,
+ "DockWidgetArea_Mask": 15,
+ "AllDockWidgetAreas": 15,
+ "NoDockWidgetArea": 0
+ }
+ }
+ Enum {
+ name: "DockWidgetAreas"
+ values: {
+ "LeftDockWidgetArea": 1,
+ "RightDockWidgetArea": 2,
+ "TopDockWidgetArea": 4,
+ "BottomDockWidgetArea": 8,
+ "DockWidgetArea_Mask": 15,
+ "AllDockWidgetAreas": 15,
+ "NoDockWidgetArea": 0
+ }
+ }
+ Enum {
+ name: "ToolBarArea"
+ values: {
+ "LeftToolBarArea": 1,
+ "RightToolBarArea": 2,
+ "TopToolBarArea": 4,
+ "BottomToolBarArea": 8,
+ "ToolBarArea_Mask": 15,
+ "AllToolBarAreas": 15,
+ "NoToolBarArea": 0
+ }
+ }
+ Enum {
+ name: "ToolBarAreas"
+ values: {
+ "LeftToolBarArea": 1,
+ "RightToolBarArea": 2,
+ "TopToolBarArea": 4,
+ "BottomToolBarArea": 8,
+ "ToolBarArea_Mask": 15,
+ "AllToolBarAreas": 15,
+ "NoToolBarArea": 0
+ }
+ }
+ Enum {
+ name: "DateFormat"
+ values: {
+ "TextDate": 0,
+ "ISODate": 1,
+ "SystemLocaleDate": 2,
+ "LocalDate": 2,
+ "LocaleDate": 3,
+ "SystemLocaleShortDate": 4,
+ "SystemLocaleLongDate": 5,
+ "DefaultLocaleShortDate": 6,
+ "DefaultLocaleLongDate": 7,
+ "RFC2822Date": 8
+ }
+ }
+ Enum {
+ name: "TimeSpec"
+ values: {
+ "LocalTime": 0,
+ "UTC": 1,
+ "OffsetFromUTC": 2,
+ "TimeZone": 3
+ }
+ }
+ Enum {
+ name: "DayOfWeek"
+ values: {
+ "Monday": 1,
+ "Tuesday": 2,
+ "Wednesday": 3,
+ "Thursday": 4,
+ "Friday": 5,
+ "Saturday": 6,
+ "Sunday": 7
+ }
+ }
+ Enum {
+ name: "ScrollBarPolicy"
+ values: {
+ "ScrollBarAsNeeded": 0,
+ "ScrollBarAlwaysOff": 1,
+ "ScrollBarAlwaysOn": 2
+ }
+ }
+ Enum {
+ name: "CaseSensitivity"
+ values: {
+ "CaseInsensitive": 0,
+ "CaseSensitive": 1
+ }
+ }
+ Enum {
+ name: "Corner"
+ values: {
+ "TopLeftCorner": 0,
+ "TopRightCorner": 1,
+ "BottomLeftCorner": 2,
+ "BottomRightCorner": 3
+ }
+ }
+ Enum {
+ name: "Edge"
+ values: {
+ "TopEdge": 1,
+ "LeftEdge": 2,
+ "RightEdge": 4,
+ "BottomEdge": 8
+ }
+ }
+ Enum {
+ name: "ConnectionType"
+ values: {
+ "AutoConnection": 0,
+ "DirectConnection": 1,
+ "QueuedConnection": 2,
+ "BlockingQueuedConnection": 3,
+ "UniqueConnection": 128
+ }
+ }
+ Enum {
+ name: "ShortcutContext"
+ values: {
+ "WidgetShortcut": 0,
+ "WindowShortcut": 1,
+ "ApplicationShortcut": 2,
+ "WidgetWithChildrenShortcut": 3
+ }
+ }
+ Enum {
+ name: "FillRule"
+ values: {
+ "OddEvenFill": 0,
+ "WindingFill": 1
+ }
+ }
+ Enum {
+ name: "MaskMode"
+ values: {
+ "MaskInColor": 0,
+ "MaskOutColor": 1
+ }
+ }
+ Enum {
+ name: "ClipOperation"
+ values: {
+ "NoClip": 0,
+ "ReplaceClip": 1,
+ "IntersectClip": 2
+ }
+ }
+ Enum {
+ name: "ItemSelectionMode"
+ values: {
+ "ContainsItemShape": 0,
+ "IntersectsItemShape": 1,
+ "ContainsItemBoundingRect": 2,
+ "IntersectsItemBoundingRect": 3
+ }
+ }
+ Enum {
+ name: "TransformationMode"
+ values: {
+ "FastTransformation": 0,
+ "SmoothTransformation": 1
+ }
+ }
+ Enum {
+ name: "Axis"
+ values: {
+ "XAxis": 0,
+ "YAxis": 1,
+ "ZAxis": 2
+ }
+ }
+ Enum {
+ name: "ContextMenuPolicy"
+ values: {
+ "NoContextMenu": 0,
+ "DefaultContextMenu": 1,
+ "ActionsContextMenu": 2,
+ "CustomContextMenu": 3,
+ "PreventContextMenu": 4
+ }
+ }
+ Enum {
+ name: "InputMethodQuery"
+ values: {
+ "ImEnabled": 1,
+ "ImCursorRectangle": 2,
+ "ImMicroFocus": 2,
+ "ImFont": 4,
+ "ImCursorPosition": 8,
+ "ImSurroundingText": 16,
+ "ImCurrentSelection": 32,
+ "ImMaximumTextLength": 64,
+ "ImAnchorPosition": 128,
+ "ImHints": 256,
+ "ImPreferredLanguage": 512,
+ "ImPlatformData": -2147483648,
+ "ImQueryInput": 186,
+ "ImQueryAll": -1
+ }
+ }
+ Enum {
+ name: "InputMethodQueries"
+ values: {
+ "ImEnabled": 1,
+ "ImCursorRectangle": 2,
+ "ImMicroFocus": 2,
+ "ImFont": 4,
+ "ImCursorPosition": 8,
+ "ImSurroundingText": 16,
+ "ImCurrentSelection": 32,
+ "ImMaximumTextLength": 64,
+ "ImAnchorPosition": 128,
+ "ImHints": 256,
+ "ImPreferredLanguage": 512,
+ "ImPlatformData": -2147483648,
+ "ImQueryInput": 186,
+ "ImQueryAll": -1
+ }
+ }
+ Enum {
+ name: "InputMethodHint"
+ values: {
+ "ImhNone": 0,
+ "ImhHiddenText": 1,
+ "ImhSensitiveData": 2,
+ "ImhNoAutoUppercase": 4,
+ "ImhPreferNumbers": 8,
+ "ImhPreferUppercase": 16,
+ "ImhPreferLowercase": 32,
+ "ImhNoPredictiveText": 64,
+ "ImhDate": 128,
+ "ImhTime": 256,
+ "ImhPreferLatin": 512,
+ "ImhMultiLine": 1024,
+ "ImhDigitsOnly": 65536,
+ "ImhFormattedNumbersOnly": 131072,
+ "ImhUppercaseOnly": 262144,
+ "ImhLowercaseOnly": 524288,
+ "ImhDialableCharactersOnly": 1048576,
+ "ImhEmailCharactersOnly": 2097152,
+ "ImhUrlCharactersOnly": 4194304,
+ "ImhLatinOnly": 8388608,
+ "ImhExclusiveInputMask": -65536
+ }
+ }
+ Enum {
+ name: "InputMethodHints"
+ values: {
+ "ImhNone": 0,
+ "ImhHiddenText": 1,
+ "ImhSensitiveData": 2,
+ "ImhNoAutoUppercase": 4,
+ "ImhPreferNumbers": 8,
+ "ImhPreferUppercase": 16,
+ "ImhPreferLowercase": 32,
+ "ImhNoPredictiveText": 64,
+ "ImhDate": 128,
+ "ImhTime": 256,
+ "ImhPreferLatin": 512,
+ "ImhMultiLine": 1024,
+ "ImhDigitsOnly": 65536,
+ "ImhFormattedNumbersOnly": 131072,
+ "ImhUppercaseOnly": 262144,
+ "ImhLowercaseOnly": 524288,
+ "ImhDialableCharactersOnly": 1048576,
+ "ImhEmailCharactersOnly": 2097152,
+ "ImhUrlCharactersOnly": 4194304,
+ "ImhLatinOnly": 8388608,
+ "ImhExclusiveInputMask": -65536
+ }
+ }
+ Enum {
+ name: "ToolButtonStyle"
+ values: {
+ "ToolButtonIconOnly": 0,
+ "ToolButtonTextOnly": 1,
+ "ToolButtonTextBesideIcon": 2,
+ "ToolButtonTextUnderIcon": 3,
+ "ToolButtonFollowStyle": 4
+ }
+ }
+ Enum {
+ name: "LayoutDirection"
+ values: {
+ "LeftToRight": 0,
+ "RightToLeft": 1,
+ "LayoutDirectionAuto": 2
+ }
+ }
+ Enum {
+ name: "DropAction"
+ values: {
+ "CopyAction": 1,
+ "MoveAction": 2,
+ "LinkAction": 4,
+ "ActionMask": 255,
+ "TargetMoveAction": 32770,
+ "IgnoreAction": 0
+ }
+ }
+ Enum {
+ name: "DropActions"
+ values: {
+ "CopyAction": 1,
+ "MoveAction": 2,
+ "LinkAction": 4,
+ "ActionMask": 255,
+ "TargetMoveAction": 32770,
+ "IgnoreAction": 0
+ }
+ }
+ Enum {
+ name: "CheckState"
+ values: {
+ "Unchecked": 0,
+ "PartiallyChecked": 1,
+ "Checked": 2
+ }
+ }
+ Enum {
+ name: "ItemFlags"
+ values: {
+ "NoItemFlags": 0,
+ "ItemIsSelectable": 1,
+ "ItemIsEditable": 2,
+ "ItemIsDragEnabled": 4,
+ "ItemIsDropEnabled": 8,
+ "ItemIsUserCheckable": 16,
+ "ItemIsEnabled": 32,
+ "ItemIsTristate": 64,
+ "ItemNeverHasChildren": 128
+ }
+ }
+ Enum {
+ name: "MatchFlags"
+ values: {
+ "MatchExactly": 0,
+ "MatchContains": 1,
+ "MatchStartsWith": 2,
+ "MatchEndsWith": 3,
+ "MatchRegExp": 4,
+ "MatchWildcard": 5,
+ "MatchFixedString": 8,
+ "MatchCaseSensitive": 16,
+ "MatchWrap": 32,
+ "MatchRecursive": 64
+ }
+ }
+ Enum {
+ name: "WindowModality"
+ values: {
+ "NonModal": 0,
+ "WindowModal": 1,
+ "ApplicationModal": 2
+ }
+ }
+ Enum {
+ name: "TextInteractionFlag"
+ values: {
+ "NoTextInteraction": 0,
+ "TextSelectableByMouse": 1,
+ "TextSelectableByKeyboard": 2,
+ "LinksAccessibleByMouse": 4,
+ "LinksAccessibleByKeyboard": 8,
+ "TextEditable": 16,
+ "TextEditorInteraction": 19,
+ "TextBrowserInteraction": 13
+ }
+ }
+ Enum {
+ name: "TextInteractionFlags"
+ values: {
+ "NoTextInteraction": 0,
+ "TextSelectableByMouse": 1,
+ "TextSelectableByKeyboard": 2,
+ "LinksAccessibleByMouse": 4,
+ "LinksAccessibleByKeyboard": 8,
+ "TextEditable": 16,
+ "TextEditorInteraction": 19,
+ "TextBrowserInteraction": 13
+ }
+ }
+ Enum {
+ name: "SizeHint"
+ values: {
+ "MinimumSize": 0,
+ "PreferredSize": 1,
+ "MaximumSize": 2,
+ "MinimumDescent": 3,
+ "NSizeHints": 4
+ }
+ }
+ Enum {
+ name: "GestureState"
+ values: {
+ "NoGesture": 0,
+ "GestureStarted": 1,
+ "GestureUpdated": 2,
+ "GestureFinished": 3,
+ "GestureCanceled": 4
+ }
+ }
+ Enum {
+ name: "GestureType"
+ values: {
+ "TapGesture": 1,
+ "TapAndHoldGesture": 2,
+ "PanGesture": 3,
+ "PinchGesture": 4,
+ "SwipeGesture": 5,
+ "CustomGesture": 256,
+ "LastGestureType": -1
+ }
+ }
+ Enum {
+ name: "CursorMoveStyle"
+ values: {
+ "LogicalMoveStyle": 0,
+ "VisualMoveStyle": 1
+ }
+ }
+ Enum {
+ name: "TimerType"
+ values: {
+ "PreciseTimer": 0,
+ "CoarseTimer": 1,
+ "VeryCoarseTimer": 2
+ }
+ }
+ Enum {
+ name: "ScrollPhase"
+ values: {
+ "ScrollBegin": 1,
+ "ScrollUpdate": 2,
+ "ScrollEnd": 3
+ }
+ }
+ }
+ Component { name: "QEasingCurve"; prototype: "QQmlEasingValueType" }
+}
diff --git a/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/qmldir b/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/qmldir
new file mode 100644
index 0000000000..4a79c82e76
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/qmldir
@@ -0,0 +1,4 @@
+module QtQuick
+plugin qtquick2plugin
+classname QtQuick2Plugin
+typeinfo plugins.qmltypes
diff --git a/tests/auto/qml/codemodel/importscheck/importscheck.pro b/tests/auto/qml/codemodel/importscheck/importscheck.pro
new file mode 100644
index 0000000000..b36550a10a
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/importscheck.pro
@@ -0,0 +1,19 @@
+QTC_LIB_DEPENDS += cplusplus utils
+include(../../../qttest.pri)
+include($$IDE_SOURCE_TREE/src/rpath.pri)
+DEFINES += QMLJS_BUILD_DIR
+
+QT +=script xml
+# direct dependency on qmljs for quicker turnaround when editing them
+INCLUDEPATH+=$$IDE_SOURCE_TREE/src/libs
+INCLUDEPATH+=$$IDE_SOURCE_TREE/src/libs/qmljs
+include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs-lib.pri)
+include($$IDE_SOURCE_TREE/src/libs/languageutils/languageutils-lib.pri)
+DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\"
+DEFINES+=TESTSRCDIR=\\\"$$PWD\\\"
+LIBS += "-L$$IDE_LIBRARY_PATH"
+
+TARGET = tst_qml_imports_check
+
+SOURCES += \
+ tst_importscheck.cpp
diff --git a/tests/auto/qml/codemodel/importscheck/importscheck.qbs b/tests/auto/qml/codemodel/importscheck/importscheck.qbs
new file mode 100644
index 0000000000..fe50705f06
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/importscheck.qbs
@@ -0,0 +1,16 @@
+import qbs
+import QtcAutotest
+
+QtcAutotest {
+ name: "QML code model imports check autotest"
+ Depends { name: "LanguageUtils" }
+ Depends { name: "QmlJS" }
+ Depends { name: "Utils" }
+ Depends { name: "Qt.widgets" }
+ files: "tst_importscheck.cpp"
+ cpp.defines: base.concat([
+ 'QT_CREATOR',
+ 'QTCREATORDIR="' + project.ide_source_tree + '"',
+ 'TESTSRCDIR="' + path + '"'
+ ])
+}
diff --git a/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp b/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp
new file mode 100644
index 0000000000..ed421afe27
--- /dev/null
+++ b/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp
@@ -0,0 +1,247 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+
+#include <QScopedPointer>
+#include <QLatin1String>
+#include <QGraphicsObject>
+#include <QGuiApplication>
+#include <QSettings>
+#include <QFileInfo>
+#include <QStringList>
+
+#include <qmljs/qmljsimportdependencies.h>
+#include <qmljs/qmljsinterpreter.h>
+#include <qmljs/qmljsdocument.h>
+#include <qmljs/qmljsbind.h>
+#include <qmljs/qmljslink.h>
+#include <qmljs/qmljscheck.h>
+#include <qmljs/qmljscontext.h>
+#include <qmljs/qmljsmodelmanagerinterface.h>
+#include <utils/logging.h>
+
+#include <QtTest>
+#include <algorithm>
+
+using namespace QmlJS;
+using namespace QmlJS::AST;
+using namespace QmlJS::StaticAnalysis;
+
+class tst_ImportCheck : public QObject
+{
+ Q_OBJECT
+public:
+ tst_ImportCheck();
+
+private slots:
+ void test();
+ void test_data();
+
+ void initTestCase();
+private:
+ QStringList m_basePaths;
+};
+
+void scanDir(const QString &dir)
+{
+ QFutureInterface<void> result;
+ PathsAndLanguages paths;
+ paths.maybeInsert(Utils::FileName::fromString(dir), Dialect::Qml);
+ ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), paths,
+ ModelManagerInterface::instance(), false);
+ ViewerContext vCtx = ViewerContext(QStringList(), QStringList(dir));
+ Snapshot snap = ModelManagerInterface::instance()->snapshot();
+
+ ImportDependencies *iDeps = snap.importDependencies();
+ qDebug() << "libs:";
+ foreach (const ImportKey &importK, iDeps->libraryImports(vCtx))
+ qDebug() << "libImport: " << importK.toString();
+ qDebug() << "qml files:";
+ foreach (const ImportKey &importK, iDeps->subdirImports(ImportKey(ImportType::Directory, dir),
+ vCtx))
+ qDebug() << importK.toString();
+}
+
+tst_ImportCheck::tst_ImportCheck()
+{
+}
+
+#ifdef Q_OS_MAC
+# define SHARE_PATH "/Resources"
+#else
+# define SHARE_PATH "/share/qtcreator"
+#endif
+
+QString resourcePath()
+{
+ return QDir::cleanPath(QTCREATORDIR + QLatin1String(SHARE_PATH));
+}
+
+void tst_ImportCheck::initTestCase()
+{
+ QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false"));
+ if (!ModelManagerInterface::instance())
+ new ModelManagerInterface;
+
+ // the resource path is wrong, have to load things manually
+ QFileInfo builtins(QString::fromLocal8Bit(TESTSRCDIR) + QLatin1String("/base"));
+ if (builtins.exists())
+ m_basePaths.append(builtins.filePath());
+}
+
+#define QCOMPARE_NOEXIT(actual, expected) \
+ QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__)
+
+void tst_ImportCheck::test_data()
+{
+ QTest::addColumn<QStringList>("paths");
+ QTest::addColumn<QStringList>("expectedLibraries");
+ QTest::addColumn<QStringList>("expectedFiles");
+ QTest::newRow("base") << QStringList(QLatin1String(TESTSRCDIR "/base"))
+ << (QStringList() << QLatin1String("QML 1.0")
+ << QLatin1String("QtQml 2.2")
+ << QLatin1String("QtQml 2.1")
+ << QLatin1String("QtQuick 2.0")
+ << QLatin1String("QtQml 2.0")
+ << QLatin1String("QtQuick 2.-1")
+ << QLatin1String("QtQuick 2.1")
+ << QLatin1String("QtQuick 2.2")
+ << QLatin1String("<cpp>"))
+ << QStringList();
+ QTest::newRow("001_flatQmlOnly") << QStringList(QLatin1String(TESTSRCDIR "/001_flatQmlOnly"))
+ << QStringList()
+ << QStringList();
+ QTest::newRow("002_nestedQmlOnly") << QStringList(QLatin1String(TESTSRCDIR "/002_nestedQmlOnly"))
+ << QStringList()
+ << QStringList();
+ /*QTest::newRow("003_packageQmlOnly") << QStringList(QLatin1String(TESTSRCDIR "/003_packageQmlOnly"))
+ << (QStringList() << QLatin1String("QtGraphicalEffects"))
+ << (QStringList()
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Displace.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Blend.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Glow.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml")
+ << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml"));
+ QTest::newRow("004_cppOnly copy") << QStringList(QLatin1String(TESTSRCDIR "004_cppOnly copy"))
+ << (QStringList() << QLatin1String("QML 1.0")
+ << QLatin1String("QtQml 2.2")
+ << QLatin1String("QtQml 2.1")
+ << QLatin1String("QtQuick 2.0")
+ << QLatin1String("QtQml 2.0")
+ << QLatin1String("QtQuick 2.-1")
+ << QLatin1String("QtQuick 2.1")
+ << QLatin1String("QtQuick 2.2")
+ << QLatin1String("<cpp>"))
+ << QStringList();*/
+}
+
+void tst_ImportCheck::test()
+{
+ QFETCH(QStringList, paths);
+ QFETCH(QStringList, expectedLibraries);
+ QFETCH(QStringList, expectedFiles);
+
+ QFutureInterface<void> result;
+ PathsAndLanguages lPaths;
+ foreach (const QString &path, paths)
+ lPaths.maybeInsert(Utils::FileName::fromString(path), Dialect::Qml);
+ ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), lPaths,
+ ModelManagerInterface::instance(), false);
+ ViewerContext vCtx(QStringList(), paths);
+ Snapshot snap = ModelManagerInterface::instance()->snapshot();
+
+ ImportDependencies *iDeps = snap.importDependencies();
+ QStringList detectedLibraries;
+ QStringList detectedFiles;
+ foreach (const ImportKey &importK, iDeps->libraryImports(vCtx))
+ detectedLibraries << importK.toString();
+ foreach (const QString &path, paths)
+ foreach (const ImportKey &importK, iDeps->subdirImports(ImportKey(ImportType::Directory,
+ path), vCtx))
+ detectedFiles << QFileInfo(importK.toString()).canonicalFilePath();
+
+ expectedLibraries.sort();
+ expectedFiles.sort();
+ detectedLibraries.sort();
+ detectedFiles.sort();
+ QCOMPARE(expectedLibraries, detectedLibraries);
+ QCOMPARE(expectedFiles, detectedFiles);
+}
+
+#ifdef MANUAL_IMPORT_SCANNER
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication a(argc, argv);
+ new ModelManagerInterface;
+ if (argc != 2 || !QFileInfo(QString::fromLocal8Bit(argv[1])).isDir()) {
+ printf("usage: %s dir/to/scan\n", ((argc > 0) ? argv[0] : "importScan"));
+ exit(1);
+ }
+ tst_ImportCheck checker;
+ QTimer::singleShot(1, &checker, SLOT(doScan()));
+ a.exec();
+ return 0;
+}
+
+#else
+
+QTEST_MAIN(tst_ImportCheck)
+
+#endif // MANUAL_IMPORT_SCANNER
+
+#include "tst_importscheck.moc"
diff --git a/tests/auto/qtcprocess/tst_qtcprocess.cpp b/tests/auto/qtcprocess/tst_qtcprocess.cpp
index a68b278d13..809aa9bd68 100644
--- a/tests/auto/qtcprocess/tst_qtcprocess.cpp
+++ b/tests/auto/qtcprocess/tst_qtcprocess.cpp
@@ -36,7 +36,7 @@
using namespace Utils;
-class MacroMapExpander : public AbstractQtcMacroExpander {
+class MacroMapExpander : public AbstractMacroExpander {
public:
virtual bool resolveMacro(const QString &name, QString *ret)
{
diff --git a/tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp b/tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp
index 530f8d8870..b1c6f2b709 100644
--- a/tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp
+++ b/tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp
@@ -59,16 +59,36 @@ private Q_SLOTS:
private:
const QString red;
+ const QString redBackground;
+ const QString red256;
+ const QString redBackground256;
+ const QString mustard256;
+ const QString mustardBackground256;
+ const QString gray256;
+ const QString grayBackground256;
+ const QString mustardRgb;
+ const QString mustardBackgroundRgb;
const QString bold;
const QString normal;
const QString normal1;
+ const QString eraseToEol;
};
tst_AnsiEscapeCodeHandler::tst_AnsiEscapeCodeHandler() :
red(ansiEscape("31m")),
+ redBackground(ansiEscape("41m")),
+ red256(ansiEscape("38;5;1m")),
+ redBackground256(ansiEscape("48;5;1m")),
+ mustard256(ansiEscape("38;5;220m")),
+ mustardBackground256(ansiEscape("48;5;220m")),
+ gray256(ansiEscape("38;5;250m")),
+ grayBackground256(ansiEscape("48;5;250m")),
+ mustardRgb(ansiEscape("38;2;255;204;0m")),
+ mustardBackgroundRgb(ansiEscape("48;2;255;204;0m")),
bold(ansiEscape("1m")),
normal(ansiEscape("0m")),
- normal1(ansiEscape("m"))
+ normal1(ansiEscape("m")),
+ eraseToEol(ansiEscape("K"))
{
}
@@ -100,33 +120,110 @@ void tst_AnsiEscapeCodeHandler::testSimpleFormat_data()
QTest::newRow("Pass-through") << "Hello World" << defaultFormat
<< (FormattedTextList() << FormattedText("Hello World", defaultFormat));
- // Test text-color change
QTextCharFormat redFormat;
redFormat.setForeground(QColor(170, 0, 0));
- const QString text2 = "This is " + red + "red" + normal + " text";
- QTest::newRow("Text-color change") << text2 << QTextCharFormat()
- << (FormattedTextList()
- << FormattedText("This is ", defaultFormat)
- << FormattedText("red", redFormat)
- << FormattedText(" text", defaultFormat));
-
- // Test text format change to bold
+ QTest::newRow("Text-color change (8 color)")
+ << QString("This is " + red + "red" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("red", redFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTextCharFormat redBackgroundFormat;
+ redBackgroundFormat.setBackground(QColor(170, 0, 0));
+ QTest::newRow("Background-color change (8 color)")
+ << QString("This is " + redBackground + "red" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("red", redBackgroundFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTest::newRow("Text-color change (256 color mode / 8 foreground colors)")
+ << QString("This is " + red256 + "red" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("red", redFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTest::newRow("Background-color change (256 color mode / 8 background colors)")
+ << QString("This is " + redBackground256 + "red" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("red", redBackgroundFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTextCharFormat mustardFormat;
+ mustardFormat.setForeground(QColor(255, 204, 0));
+ QTest::newRow("Text-color change (256 color mode / 216 colors)")
+ << QString("This is " + mustard256 + "mustard" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("mustard", mustardFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTextCharFormat mustardBackgroundFormat;
+ mustardBackgroundFormat.setBackground(QColor(255, 204, 0));
+ QTest::newRow("Background-color change (256 color mode / 216 colors)")
+ << QString("This is " + mustardBackground256 + "mustard" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("mustard", mustardBackgroundFormat)
+ << FormattedText(" text", defaultFormat));
+
+ uint gray = (250 - 232) * 11;
+ QTextCharFormat grayFormat;
+ grayFormat.setForeground(QColor(gray, gray, gray));
+ QTest::newRow("Text-color change (256 color mode / 24 grayscale)")
+ << QString("This is " + gray256 + "gray" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("gray", grayFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTextCharFormat grayBackgroundFormat;
+ grayBackgroundFormat.setBackground(QColor(gray, gray, gray));
+ QTest::newRow("Background-color change (256 color mode / 24 grayscale)")
+ << QString("This is " + grayBackground256 + "gray" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("gray", grayBackgroundFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTest::newRow("Text-color change (RGB color mode)")
+ << QString("This is " + mustardRgb + "mustard" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("mustard", mustardFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTest::newRow("Background-color change (RGB color mode)")
+ << QString("This is " + mustardBackgroundRgb + "mustard" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("This is ", defaultFormat)
+ << FormattedText("mustard", mustardBackgroundFormat)
+ << FormattedText(" text", defaultFormat));
+
QTextCharFormat boldFormat;
boldFormat.setFontWeight(QFont::Bold);
- const QString text3 = "A line of " + bold + "bold" + normal + " text";
- QTest::newRow("Text-format change") << text3 << QTextCharFormat()
- << (FormattedTextList()
- << FormattedText("A line of ", defaultFormat)
- << FormattedText("bold", boldFormat)
- << FormattedText(" text", defaultFormat));
-
- // Test resetting format to normal with other reset pattern
- const QString text4 = "A line of " + bold + "bold" + normal1 + " text";
- QTest::newRow("Alternative reset pattern (QTCREATORBUG-10132)") << text4 << QTextCharFormat()
- << (FormattedTextList()
- << FormattedText("A line of ", defaultFormat)
- << FormattedText("bold", boldFormat)
- << FormattedText(" text", defaultFormat));
+ QTest::newRow("Text-format change")
+ << QString("A line of " + bold + "bold" + normal + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("A line of ", defaultFormat)
+ << FormattedText("bold", boldFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTest::newRow("Alternative reset pattern (QTCREATORBUG-10132)")
+ << QString("A line of " + bold + "bold" + normal1 + " text") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("A line of ", defaultFormat)
+ << FormattedText("bold", boldFormat)
+ << FormattedText(" text", defaultFormat));
+
+ QTest::newRow("Erase to EOL is unsupported and stripped")
+ << QString("All text after this is " + eraseToEol + "not deleted") << QTextCharFormat()
+ << (FormattedTextList()
+ << FormattedText("All text after this is ", defaultFormat)
+ << FormattedText("not deleted", defaultFormat));
}
void tst_AnsiEscapeCodeHandler::testLineOverlappingFormat()
diff --git a/tests/auto/utils_stringutils/tst_stringutils.cpp b/tests/auto/utils_stringutils/tst_stringutils.cpp
index 2b5fdbda7e..82a0fd7a99 100644
--- a/tests/auto/utils_stringutils/tst_stringutils.cpp
+++ b/tests/auto/utils_stringutils/tst_stringutils.cpp
@@ -33,7 +33,7 @@
//TESTED_COMPONENT=src/libs/utils
-class TestMacroExpander : public Utils::AbstractQtcMacroExpander
+class TestMacroExpander : public Utils::AbstractMacroExpander
{
public:
virtual bool resolveMacro(const QString &name, QString *ret)
diff --git a/tests/genericprojectmanager/testdata_simpleproject/main.cpp b/tests/genericprojectmanager/testdata_simpleproject/main.cpp
new file mode 100644
index 0000000000..5047a34e39
--- /dev/null
+++ b/tests/genericprojectmanager/testdata_simpleproject/main.cpp
@@ -0,0 +1,3 @@
+int main()
+{
+}
diff --git a/tests/genericprojectmanager/testdata_simpleproject/simpleproject.config b/tests/genericprojectmanager/testdata_simpleproject/simpleproject.config
new file mode 100644
index 0000000000..9dcf447363
--- /dev/null
+++ b/tests/genericprojectmanager/testdata_simpleproject/simpleproject.config
@@ -0,0 +1 @@
+// Nothing to be seen, move along.
diff --git a/tests/genericprojectmanager/testdata_simpleproject/simpleproject.creator b/tests/genericprojectmanager/testdata_simpleproject/simpleproject.creator
new file mode 100644
index 0000000000..e94cbbd302
--- /dev/null
+++ b/tests/genericprojectmanager/testdata_simpleproject/simpleproject.creator
@@ -0,0 +1 @@
+[General]
diff --git a/tests/genericprojectmanager/testdata_simpleproject/simpleproject.files b/tests/genericprojectmanager/testdata_simpleproject/simpleproject.files
new file mode 100644
index 0000000000..f0ce4404d8
--- /dev/null
+++ b/tests/genericprojectmanager/testdata_simpleproject/simpleproject.files
@@ -0,0 +1 @@
+main.cpp
diff --git a/tests/genericprojectmanager/testdata_simpleproject/simpleproject.includes b/tests/genericprojectmanager/testdata_simpleproject/simpleproject.includes
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/genericprojectmanager/testdata_simpleproject/simpleproject.includes