Merge remote-tracking branch 'origin/4.12'
Conflicts: src/plugins/cmakeprojectmanager/tealeafreader.cpp src/plugins/cmakeprojectmanager/tealeafreader.h src/plugins/projectexplorer/miniprojecttargetselector.cpp Change-Id: I88d85be3903f57a55fddb7901e771a4822db1b85
@@ -382,14 +382,12 @@ function(enable_pch target)
|
||||
endfunction()
|
||||
|
||||
if (NOT TARGET QtCreatorPchGui AND NOT TARGET QtCreatorPchConsole)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c_cpp.in "/*empty file*/")
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c_cpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c_cpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c)
|
||||
|
||||
file(GENERATE
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c
|
||||
CONTENT "/*empty file*/")
|
||||
file(GENERATE
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp
|
||||
CONTENT "/*empty file*/")
|
||||
_add_pch_target(QtCreatorPchGui
|
||||
"${PROJECT_SOURCE_DIR}/src/shared/qtcreator_gui_pch.h" Qt5::Widgets)
|
||||
_add_pch_target(QtCreatorPchConsole
|
||||
@@ -728,9 +726,10 @@ function(add_qtc_plugin target_name)
|
||||
string(REGEX REPLACE "^.*=" "" json_value ${_arg_PLUGIN_JSON_IN})
|
||||
string(REPLACE "$$${json_key}" "${json_value}" plugin_json_in ${plugin_json_in})
|
||||
endif()
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${name}.json.cmakein" ${plugin_json_in})
|
||||
|
||||
configure_file("${CMAKE_CURRENT_BINARY_DIR}/${name}.json.cmakein" "${name}.json")
|
||||
string(CONFIGURE "${plugin_json_in}" plugin_json)
|
||||
file(GENERATE
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.json"
|
||||
CONTENT "${plugin_json}")
|
||||
endif()
|
||||
|
||||
add_library(${target_name} SHARED ${_arg_SOURCES})
|
||||
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 13 KiB |
BIN
doc/qtcreator/images/qtcreator-link-with-qt.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 22 KiB |
BIN
doc/qtcreator/images/qtcreator-locator-example.png
Normal file
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 12 KiB |
BIN
doc/qtcreator/images/qtcreator-locator-url-template.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 76 KiB |
BIN
doc/qtcreator/images/qtcreator-qt-versions.png
Normal file
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 41 KiB |
@@ -669,10 +669,18 @@
|
||||
\l{http://linterrors.com/js/the-array-literal-notation-is-preferrable}
|
||||
{The array literal notation [] is preferable}.
|
||||
|
||||
\row
|
||||
\li M324
|
||||
\li Error
|
||||
\li Hit maximum recursion limit visiting AST, the code model will be unreliable
|
||||
and most likely invalid
|
||||
\li
|
||||
|
||||
\row
|
||||
\li M400
|
||||
\li Warning
|
||||
\li Duplicate import
|
||||
\li
|
||||
|
||||
\endtable
|
||||
|
||||
|
@@ -54,12 +54,18 @@
|
||||
|
||||
\section2 Navigating Between Open Files and Symbols
|
||||
|
||||
Use the toolbar to navigate between open files and symbols in use. To browse
|
||||
backward or forward through your location history, click
|
||||
\inlineimage prev.png
|
||||
Use the toolbar, \uicontrol Window menu items, or
|
||||
\l{General Keyboard Shortcuts}{keyboard shortcuts}
|
||||
to navigate between open files and symbols in use.
|
||||
|
||||
To browse backward or forward through your
|
||||
location history, click \inlineimage prev.png
|
||||
(\uicontrol {Go Back}) and \inlineimage next.png
|
||||
(\uicontrol {Go Forward}).
|
||||
|
||||
To return to the last location where you made a change, select
|
||||
\uicontrol Window > \uicontrol {Go to Last Edit}.
|
||||
|
||||
To go to any open file, select it from the \uicontrol {Open files} drop-down
|
||||
menu (1). To open a context menu that contains commands for managing open
|
||||
files, right-click the file name or icon on the toolbar. In addition to the
|
||||
@@ -80,8 +86,7 @@
|
||||
number in the locator, separated by a colon (:).
|
||||
|
||||
\note Other convenient ways of navigating in \QC are provided
|
||||
by the \l{Keyboard Shortcuts} {keyboard shortcuts} and the
|
||||
\l{Browsing Project Contents}{sidebar}.
|
||||
by the \l{Browsing Project Contents}{sidebars}.
|
||||
|
||||
\if defined(qtcreator)
|
||||
\section2 Selecting Parse Context
|
||||
@@ -187,10 +192,10 @@
|
||||
the bookmark.
|
||||
|
||||
To go to the previous bookmark in the current session, select
|
||||
\uicontrol Tools \uicontrol Bookmarks > \uicontrol {Previous Bookmark}
|
||||
\uicontrol Tools > \uicontrol Bookmarks > \uicontrol {Previous Bookmark}
|
||||
or press \key {Ctrl+,}.
|
||||
|
||||
To go to the next bookmark in the current session, select \uicontrol Tools
|
||||
To go to the next bookmark in the current session, select \uicontrol Tools >
|
||||
\uicontrol Bookmarks > \uicontrol {Previous Bookmark} or press
|
||||
\key {Ctrl+.}.
|
||||
|
||||
@@ -265,10 +270,10 @@
|
||||
|
||||
\section1 Inspecting the Code Model
|
||||
|
||||
When you report a bug that is related to the C++ code model, the \QC
|
||||
developers might ask you to write information about the internal state of
|
||||
the code model into a log file and to deliver the file to them for
|
||||
inspection.
|
||||
When you \l{https://bugreports.qt.io/}{report a bug} that is related to the
|
||||
C++ code model, the \QC developers might ask you to write information about
|
||||
the internal state of the code model into a log file and to deliver the file
|
||||
to them for inspection.
|
||||
|
||||
To view information about the C++ code model in the
|
||||
\uicontrol {C++ Code Model Inspector} dialog and write it to a log file,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Creator documentation.
|
||||
@@ -80,11 +80,11 @@
|
||||
|
||||
\image creator-diff-editor.png "Diff editor output in the Edit mode"
|
||||
|
||||
The changes are displayed in the \uicontrol Edit mode. Color coding is used
|
||||
to mark changed lines. By default, light red indicates lines that contain
|
||||
removed text (painted a darker red) in the left pane and light green
|
||||
indicates lines that contain added text (painted a darker green) in the
|
||||
right pane.
|
||||
The changes are displayed in the \uicontrol Edit mode. Color coding is
|
||||
used to mark changed lines. By default, red indicates lines that contain
|
||||
removed text (painted another shade of red) in the left pane and green
|
||||
indicates lines that contain added text (painted another shade of green)
|
||||
in the right pane.
|
||||
|
||||
To revert the changes, right-click added text and then select
|
||||
\uicontrol {Revert Chunk} in the context menu. To apply the changes, select
|
||||
|
@@ -33,7 +33,7 @@
|
||||
|
||||
You can find the locator in the bottom left of the \QC window.
|
||||
|
||||
\image qtcreator-locator.png
|
||||
\image qtcreator-locator.png "List of locator filters"
|
||||
|
||||
To activate the locator:
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
\li Start typing the filename.
|
||||
|
||||
\image qtcreator-locator-open.png
|
||||
\image qtcreator-locator-open.png "List of files found in the locator"
|
||||
|
||||
\li Move to the filename in the list and press \key Enter.
|
||||
|
||||
@@ -148,6 +148,9 @@
|
||||
|
||||
\li Triggering menu items from the main menu (\c {t})
|
||||
|
||||
\li Searching for issues from the \l{https://bugreports.qt.io/}
|
||||
{Qt Project Bug Tracker} (\c bug).
|
||||
|
||||
\if defined(qtcreator)
|
||||
\li Running external tools (\c x)
|
||||
\li Using CMake to build the project for the current run configuration
|
||||
@@ -184,7 +187,7 @@
|
||||
|
||||
The locator lists the results.
|
||||
|
||||
\image qtcreator-navigate-popup.png
|
||||
\image qtcreator-locator-example.png "List of files matching the locator filter"
|
||||
|
||||
\endlist
|
||||
|
||||
@@ -265,7 +268,7 @@
|
||||
|
||||
\li Select \uicontrol Add to add a new entry to the list.
|
||||
|
||||
\image qtcreator-add-online-doc.png "Filter Configuration dialog"
|
||||
\image qtcreator-add-online-doc.png "List of URLs in Filter Configuration dialog"
|
||||
|
||||
\li Double-click the new entry to specify a URL and a search command.
|
||||
For example, \c {http://www.google.com/search?q=%1}.
|
||||
@@ -276,26 +279,27 @@
|
||||
|
||||
\section1 Creating Locator Filters
|
||||
|
||||
You can create custom locator filters for finding in a directory structure
|
||||
or on the web.
|
||||
|
||||
To quickly access files not directly mentioned in your project, you can
|
||||
create your own locator filters. That way you can locate files in a
|
||||
create your own directory filters. That way you can locate files in a
|
||||
directory structure you have defined.
|
||||
|
||||
To create a locator filter:
|
||||
To create custom locator filters:
|
||||
|
||||
\list 1
|
||||
|
||||
\li In the locator, select \uicontrol Options >
|
||||
\uicontrol Configure to open the \uicontrol Locator options.
|
||||
|
||||
\image qtcreator-locator-customize.png
|
||||
\image qtcreator-locator-customize.png "Locator options tab"
|
||||
|
||||
\li Click \uicontrol Add.
|
||||
\li Select \uicontrol Add > \uicontrol {Files in Directories} to add
|
||||
a directory filter or \uicontrol {URL Template} to add a URL
|
||||
filter. The settings to specify depend on the filter type.
|
||||
|
||||
\li In the \uicontrol {Filter Configuration} dialog:
|
||||
|
||||
\image qtcreator-navigate-customfilter.png
|
||||
|
||||
\list
|
||||
\image qtcreator-locator-generic-directory-filter.png "Filter Configuration dialog"
|
||||
|
||||
\li In the \uicontrol Name field, enter a name for your filter.
|
||||
|
||||
@@ -316,9 +320,7 @@
|
||||
as a part of the search string, select
|
||||
\uicontrol {Include by default}.
|
||||
|
||||
\endlist
|
||||
|
||||
\li Click \uicontrol OK.
|
||||
\li Select \uicontrol OK.
|
||||
|
||||
\endlist
|
||||
|
||||
|
@@ -38,15 +38,22 @@
|
||||
|
||||
\list
|
||||
\li \l{Completing Code}{Code completion}
|
||||
\li Sending document formatting requests to the language server to
|
||||
automatically format documents using the settings specified in
|
||||
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor}
|
||||
> \uicontrol Behavior
|
||||
\li Highlighting the symbol under cursor
|
||||
\li \l{Viewing Function Tooltips}{Viewing function tooltips}
|
||||
\li \l{Semantic Highlighting}{Semantic highlighting}, as defined in
|
||||
\l{https://github.com/microsoft/vscode-languageserver-node/pull/367}
|
||||
{Proposal of the semantic highlighting protocol extension}
|
||||
\li Navigating in the code by using the \l{Searching with the Locator}
|
||||
{locator} or \l{Moving to Symbol Definition or Declaration}
|
||||
{moving to the symbol definition}
|
||||
\li Inspecting code by viewing the document
|
||||
\l{Viewing Defined Types and Symbols}{outline}
|
||||
\li Inspecting code by viewing the document outline in the
|
||||
\l{Viewing Defined Types and Symbols}{Outline} view or
|
||||
in the \uicontrol Symbols list on the \l{Using the Editor Toolbar}
|
||||
{editor toolbar}
|
||||
\li \l{Finding Symbols}{Finding references to symbols}
|
||||
\li Code actions
|
||||
\li Integrating diagnostics from the language server
|
||||
@@ -123,7 +130,8 @@
|
||||
|
||||
The language service client has been mostly tested with Python.
|
||||
If problems arise when you try it or some other language, please select
|
||||
\uicontrol Help > \uicontrol {Report Bug} to report them in the Qt Bug
|
||||
Tracker. The reports should include \QC console output with the environment
|
||||
\uicontrol Help > \uicontrol {Report Bug} to report them in the
|
||||
\l{https://bugreports.qt.io/}{Qt Project Bug Tracker}. The reports
|
||||
should include \QC console output with the environment
|
||||
variable \c {QT_LOGGING_RULES=qtc.languageclient.*=true} set.
|
||||
*/
|
||||
|
@@ -92,6 +92,12 @@
|
||||
\QC, \QSDK and other Qt deliverables contain documentation
|
||||
as .qch files. All the documentation is accessible in the \uicontrol Help mode.
|
||||
|
||||
By default, \QC registers only the latest available version of the
|
||||
documentation for each installed Qt module. To register all installed
|
||||
documentation, select \uicontrol Tools > \uicontrol Options >
|
||||
\uicontrol Kits > \uicontrol {Qt Versions} >
|
||||
\uicontrol {Register documentation}.
|
||||
|
||||
To find information in the documentation, select:
|
||||
|
||||
\list
|
||||
@@ -210,6 +216,9 @@
|
||||
in the \uicontrol {On context help} field. To detach the help window, select
|
||||
\uicontrol {Always Show in External Window}.
|
||||
|
||||
To change this setting in a help view, select the \inlineimage linkicon.png
|
||||
toolbar button.
|
||||
|
||||
\section1 Selecting the Start Page
|
||||
|
||||
You can select the page to display when you open the \uicontrol Help mode in the
|
||||
|
@@ -73,7 +73,7 @@
|
||||
\b {Has a reported issue been addressed?}
|
||||
|
||||
You can look up any issue in the
|
||||
\l{https://bugreports.qt.io/}{Qt bug tracker}.
|
||||
\l{https://bugreports.qt.io/}{Qt Project Bug Tracker}.
|
||||
|
||||
\include widgets/creator-faq-qtdesigner.qdocinc qt designer faq
|
||||
|
||||
|
@@ -74,9 +74,12 @@
|
||||
|
||||
Each kit consists of a set of values that define one environment, such as a
|
||||
\l{glossary-device}{device}, compiler, and Qt version. If you know you have
|
||||
installed a Qt
|
||||
version, but it is not listed in \uicontrol Tools > \uicontrol Options >
|
||||
\uicontrol Kits > \uicontrol {Qt Versions}, you must add it.
|
||||
installed a Qt version, but it is not listed in \uicontrol Tools >
|
||||
\uicontrol Options > \uicontrol Kits > \uicontrol {Qt Versions}, select
|
||||
\uicontrol {Link with Qt}.
|
||||
|
||||
If the Qt version is still not listed under \uicontrol Auto-detected, select
|
||||
\uicontrol {Add} to add it manually.
|
||||
|
||||
For more information, see \l{Adding Qt Versions}.
|
||||
|
||||
|
@@ -43,7 +43,7 @@
|
||||
|
||||
For a list of fixed issues and added features, see the changelog file in
|
||||
the \c{qtcreator\dist} folder or the \l{https://bugreports.qt.io}
|
||||
{Qt Bug Tracker}.
|
||||
{Qt Project Bug Tracker}.
|
||||
|
||||
\section1 General Issues
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Creator documentation.
|
||||
@@ -42,12 +42,41 @@
|
||||
\l{glossary-device}{device} manufacturers provide special Qt versions for
|
||||
developing applications for their devices.
|
||||
|
||||
\section1 Registering Installed Qt Versions
|
||||
|
||||
\QC automatically detects the Qt versions that are registered by
|
||||
your system or by installers. To view detailed information for each Qt
|
||||
version, select it in the list and select \uicontrol Details in the
|
||||
\uicontrol {Qt version for} section. To add Qt versions, select
|
||||
\uicontrol Tools > \uicontrol Options > \uicontrol Kits >
|
||||
\uicontrol {Qt Versions}.
|
||||
\uicontrol {Qt version for} section.
|
||||
|
||||
\image qtcreator-qt-versions.png "Qt Versions tab in Kit options"
|
||||
|
||||
To remove invalid Qt versions, select \uicontrol {Clean Up}.
|
||||
|
||||
You can link to a Qt that you installed using the Qt Maintenance Tool to
|
||||
automatically register the installed Qt versions. The mechanism does not
|
||||
handle Qt versions installed by the system using some other package manager,
|
||||
such as your Linux distribution, brew on \macos, or Chocolatey on Windows,
|
||||
nor a self-built Qt.
|
||||
|
||||
To link to a Qt installation:
|
||||
|
||||
\list 1
|
||||
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Kits >
|
||||
\uicontrol {Qt Versions} > \uicontrol {Link with Qt}.
|
||||
\image qtcreator-link-with-qt.png "Choose Qt Installation dialog"
|
||||
\li In the \uicontrol {Qt installation path} field, enter the path to
|
||||
the directory where you installed Qt.
|
||||
\li Select \uicontrol {Link with Qt} to automatically register Qt
|
||||
versions and kits in the Qt installation directory.
|
||||
\li Select \uicontrol {Restart Now} to restart \QC.
|
||||
\endlist
|
||||
|
||||
To remove the automatically detected Qt versions from the list, select
|
||||
\uicontrol {Link with Qt} > \uicontrol {Remove Link}.
|
||||
|
||||
If a Qt version is still not listed under \uicontrol Auto-detected, select
|
||||
\uicontrol {Add} to add it manually.
|
||||
|
||||
You specify the Qt version to use for each \l{glossary-buildandrun-kit}
|
||||
{kit} for building and running your projects
|
||||
@@ -67,8 +96,6 @@
|
||||
|
||||
\li Select the Qt version to view and edit it.
|
||||
|
||||
\image qtcreator-qt4-qtversions-add.png
|
||||
|
||||
\li In the \uicontrol{Version name} field, edit the name that \QC
|
||||
suggests for the Qt version.
|
||||
|
||||
@@ -80,7 +107,10 @@
|
||||
|
||||
\endlist
|
||||
|
||||
\section1 Documentation
|
||||
To remove a Qt version that you added manually, select it in the
|
||||
\uicontrol Manual list and then select \uicontrol Remove.
|
||||
|
||||
\section1 Registering Documentation
|
||||
|
||||
By default, \QC registers only the latest available version of the documentation for each
|
||||
installed Qt module.
|
||||
@@ -109,13 +139,15 @@
|
||||
If your build of Qt is incomplete but you still want to use QMake as build
|
||||
system, you need to ensure the following minimum requirements to be able to use that setup with \QC.
|
||||
\list 1
|
||||
\li qmake is an executable that understands the -query command line argument.
|
||||
\li The bin and include directories have to exist. \QC fetches these directories by running \c{qmake -query}.
|
||||
\li The mkspecs directory should be complete enough to parse .pro files.
|
||||
\li qmake is an executable that understands the \c -query command line
|
||||
argument.
|
||||
\li The \c bin and \c include directories have to exist. \QC fetches
|
||||
these directories by running \c{qmake -query}.
|
||||
\li The \c mkspecs directory should be complete enough to parse .pro
|
||||
files.
|
||||
\endlist
|
||||
|
||||
If your Qt version has no libQtCore.so, \QC is unable to detect the ABI.
|
||||
If your Qt version has no \c libQtCore.so, \QC is unable to detect the ABI.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -130,8 +130,9 @@
|
||||
\row
|
||||
\li {4,1} \l{All Topics}
|
||||
\row
|
||||
\li {4,1} \note To report bugs and suggestions to the Qt Bug
|
||||
Tracker, select \uicontrol {Help > Report Bug}.
|
||||
\li {4,1} \note To report bugs and suggestions to the
|
||||
\l{https://bugreports.qt.io/}{Qt Project Bug Tracker},
|
||||
select \uicontrol {Help > Report Bug}.
|
||||
To copy and paste detailed information about your system to the
|
||||
bug report, select \uicontrol Help >
|
||||
\uicontrol {System Information}.
|
||||
|
@@ -151,7 +151,8 @@
|
||||
instead, select the \uicontrol {Switch to Text Diff Editor} (1) option from
|
||||
the toolbar. In the inline
|
||||
diff view, you can use context menu commands to apply, revert, stage, and
|
||||
unstage hunks, as well as send them to a code pasting service.
|
||||
unstage chunks or selected lines, as well as send chunks to a code pasting
|
||||
service.
|
||||
|
||||
\section2 Viewing Versioning History and Change Details
|
||||
|
||||
|
@@ -89,7 +89,8 @@
|
||||
by default. To use the unified diff view instead, select the
|
||||
\uicontrol {Switch to Unified Diff Editor} (1) option from the toolbar.
|
||||
In both views, you can use context menu commands to apply, revert, stage,
|
||||
and unstage hunks, as well as send them to a code pasting service.
|
||||
and unstage chunks or selected lines, as well as send chunks to a code
|
||||
pasting service.
|
||||
|
||||
\section2 Viewing Git Log
|
||||
|
||||
@@ -186,11 +187,18 @@
|
||||
When you have finished filling out the commit page information, click on
|
||||
\uicontrol Commit to start committing.
|
||||
|
||||
The \uicontrol {Diff Selected Files} button brings up a diff view of the
|
||||
files selected in the file list. Since the commit page is just another
|
||||
editor, you can go back to it by closing the diff view. You can also switch
|
||||
to an open diff view by selecting it in the \uicontrol {Open Documents} view
|
||||
in the sidebar.
|
||||
The \uicontrol {Diff Selected Files} button opens a \l{Viewing Git Diff}
|
||||
{diff view} of the files selected in the file list. Select
|
||||
\uicontrol {Stage Chunk} in the context menu to stage a chunk or
|
||||
\uicontrol {Stage Selection} to stage the selected lines.
|
||||
|
||||
To unstage chunks or selected lines, select \uicontrol {Unstage Chunk} or
|
||||
\uicontrol {Unstage Selection} in the context menu. To revert the changes
|
||||
in a chunk, select \uicontrol {Revert Chunk}.
|
||||
|
||||
The commit page is just another editor, and therefore you return to it when
|
||||
you close the diff view. You can also switch to an open diff view by
|
||||
selecting it in the \uicontrol {Open Documents} view in the sidebar.
|
||||
|
||||
\section2 Amending Commits
|
||||
|
||||
|
@@ -107,8 +107,9 @@
|
||||
\row
|
||||
\li {4,1} \l{All Topics}
|
||||
\row
|
||||
\li {4,1} \note To report bugs and suggestions to the Qt Bug
|
||||
Tracker, select \uicontrol {Help > Report Bug}.
|
||||
\li {4,1} \note To report bugs and suggestions to the
|
||||
\l{https://bugreports.qt.io/}{Qt Project Bug Tracker},
|
||||
select \uicontrol {Help > Report Bug}.
|
||||
To copy and paste detailed information about your system to the
|
||||
bug report, select \uicontrol Help >
|
||||
\uicontrol {System Information}.
|
||||
|
@@ -161,7 +161,7 @@
|
||||
or press \key R.
|
||||
|
||||
You can use the scale handles to adjust the local x, y, or z scale of an
|
||||
item. You can ajust the scale across one, two, or three axes, depending
|
||||
item. You can adjust the scale across one, two, or three axes, depending
|
||||
on the handle.
|
||||
|
||||
To adjust the scale across one axis, select the scale handle attached to
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
from dumper import Children
|
||||
|
||||
|
||||
def qdump__boost__bimaps__bimap(d, value):
|
||||
#leftType = value.type[0]
|
||||
#rightType = value.type[1]
|
||||
@@ -125,6 +126,7 @@ def qdump__boost__unordered__unordered_set(d, value):
|
||||
if forward:
|
||||
# boost 1.58
|
||||
code = 'pp{%s}' % innerType.name
|
||||
|
||||
def children(p):
|
||||
while True:
|
||||
p, dummy, val = d.split(code, p)
|
||||
@@ -134,6 +136,7 @@ def qdump__boost__unordered__unordered_set(d, value):
|
||||
code = '{%s}@p' % innerType.name
|
||||
(pp, ssize, fields) = d.describeStruct(code)
|
||||
offset = fields[2].offset()
|
||||
|
||||
def children(p):
|
||||
while True:
|
||||
val, pad, p = d.split(code, p - offset)
|
||||
|
@@ -35,6 +35,7 @@ sys.path.insert(1, os.path.dirname(os.path.abspath(inspect.getfile(inspect.curre
|
||||
|
||||
from dumper import DumperBase, SubItem
|
||||
|
||||
|
||||
class FakeVoidType(cdbext.Type):
|
||||
def __init__(self, name, dumper):
|
||||
cdbext.Type.__init__(self)
|
||||
@@ -49,19 +50,19 @@ class FakeVoidType(cdbext.Type):
|
||||
|
||||
def code(self):
|
||||
if self.typeName.endswith('*'):
|
||||
return TypeCode.TypeCodePointer
|
||||
return TypeCode.Pointer
|
||||
if self.typeName.endswith(']'):
|
||||
return TypeCode.TypeCodeArray
|
||||
return TypeCode.TypeCodeVoid
|
||||
return TypeCode.Array
|
||||
return TypeCode.Void
|
||||
|
||||
def unqualified(self):
|
||||
return self
|
||||
|
||||
def target(self):
|
||||
code = self.code()
|
||||
if code == TypeCode.TypeCodePointer:
|
||||
if code == TypeCode.Pointer:
|
||||
return FakeVoidType(self.typeName[:-1], self.dumper)
|
||||
if code == TypeCode.TypeCodeVoid:
|
||||
if code == TypeCode.Void:
|
||||
return self
|
||||
try:
|
||||
return FakeVoidType(self.typeName[:self.typeName.rindex('[')], self.dumper)
|
||||
@@ -89,6 +90,7 @@ class FakeVoidType(cdbext.Type):
|
||||
def templateArguments(self):
|
||||
return []
|
||||
|
||||
|
||||
class Dumper(DumperBase):
|
||||
def __init__(self):
|
||||
DumperBase.__init__(self)
|
||||
@@ -107,7 +109,7 @@ class Dumper(DumperBase):
|
||||
val.type = self.fromNativeType(nativeValue.type())
|
||||
# There is no cdb api for the size of bitfields.
|
||||
# Workaround this issue by parsing the native debugger text for integral types.
|
||||
if val.type.code == TypeCode.TypeCodeIntegral:
|
||||
if val.type.code == TypeCode.Integral:
|
||||
integerString = nativeValue.nativeDebuggerValue()
|
||||
if integerString == 'true':
|
||||
val.ldata = int(1).to_bytes(1, byteorder='little')
|
||||
@@ -125,12 +127,12 @@ class Dumper(DumperBase):
|
||||
base = 10
|
||||
signed = not val.type.name.startswith('unsigned')
|
||||
try:
|
||||
val.ldata = int(integerString, base).to_bytes(val.type.size(), \
|
||||
val.ldata = int(integerString, base).to_bytes(val.type.size(),
|
||||
byteorder='little', signed=signed)
|
||||
except:
|
||||
# read raw memory in case the integerString can not be interpreted
|
||||
pass
|
||||
if val.type.code == TypeCode.TypeCodeEnum:
|
||||
if val.type.code == TypeCode.Enum:
|
||||
val.ldisplay = self.enumValue(nativeValue)
|
||||
val.isBaseClass = val.name == val.type.name
|
||||
val.nativeValue = nativeValue
|
||||
@@ -148,7 +150,8 @@ class Dumper(DumperBase):
|
||||
c = 'u'
|
||||
else:
|
||||
return name
|
||||
typeId = c + ''.join(['{%s:%s}' % (f.name(), self.nativeTypeId(f.type())) for f in nativeType.fields()])
|
||||
typeId = c + ''.join(['{%s:%s}' % (f.name(), self.nativeTypeId(f.type()))
|
||||
for f in nativeType.fields()])
|
||||
return typeId
|
||||
|
||||
def fromNativeType(self, nativeType):
|
||||
@@ -161,21 +164,22 @@ class Dumper(DumperBase):
|
||||
nativeType = FakeVoidType(nativeType.name(), self)
|
||||
|
||||
code = nativeType.code()
|
||||
if code == TypeCode.TypeCodePointer:
|
||||
if code == TypeCode.Pointer:
|
||||
if not nativeType.name().startswith('<function>'):
|
||||
targetType = self.lookupType(nativeType.targetName(), nativeType.moduleId())
|
||||
if targetType is not None:
|
||||
return self.createPointerType(targetType)
|
||||
code = TypeCode.TypeCodeFunction
|
||||
code = TypeCode.Function
|
||||
|
||||
if code == TypeCode.TypeCodeArray:
|
||||
if code == TypeCode.Array:
|
||||
# cdb reports virtual function tables as arrays those ar handled separetly by
|
||||
# the DumperBase. Declare those types as structs prevents a lookup to a none existing type
|
||||
# the DumperBase. Declare those types as structs prevents a lookup to a
|
||||
# none existing type
|
||||
if not nativeType.name().startswith('__fptr()') and not nativeType.name().startswith('<gentype '):
|
||||
targetType = self.lookupType(nativeType.targetName(), nativeType.moduleId())
|
||||
if targetType is not None:
|
||||
return self.createArrayType(targetType, nativeType.arrayElements())
|
||||
code = TypeCode.TypeCodeStruct
|
||||
code = TypeCode.Struct
|
||||
|
||||
tdata = self.TypeData(self)
|
||||
tdata.name = nativeType.name()
|
||||
@@ -184,12 +188,12 @@ class Dumper(DumperBase):
|
||||
tdata.code = code
|
||||
tdata.moduleName = nativeType.module()
|
||||
self.registerType(typeId, tdata) # Prevent recursion in fields.
|
||||
if code == TypeCode.TypeCodeStruct:
|
||||
if code == TypeCode.Struct:
|
||||
tdata.lfields = lambda value: \
|
||||
self.listFields(nativeType, value)
|
||||
tdata.lalignment = lambda: \
|
||||
self.nativeStructAlignment(nativeType)
|
||||
if code == TypeCode.TypeCodeEnum:
|
||||
if code == TypeCode.Enum:
|
||||
tdata.enumDisplay = lambda intval, addr, form: \
|
||||
self.nativeTypeEnumDisplay(nativeType, intval, form)
|
||||
tdata.templateArguments = self.listTemplateParameters(nativeType.name())
|
||||
@@ -320,14 +324,16 @@ class Dumper(DumperBase):
|
||||
if namespaceIndex > 0:
|
||||
namespace = name[:namespaceIndex + 2]
|
||||
self.qtNamespace = lambda: namespace
|
||||
self.qtCustomEventFunc = self.parseAndEvaluate('%s!%sQObject::customEvent'
|
||||
% (self.qtCoreModuleName(), namespace)).address()
|
||||
self.qtCustomEventFunc = self.parseAndEvaluate(
|
||||
'%s!%sQObject::customEvent' %
|
||||
(self.qtCoreModuleName(), namespace)).address()
|
||||
return namespace
|
||||
|
||||
def qtVersion(self):
|
||||
qtVersion = None
|
||||
try:
|
||||
qtVersion = self.parseAndEvaluate('((void**)&%s)[2]' % self.qtHookDataSymbolName()).integer()
|
||||
qtVersion = self.parseAndEvaluate(
|
||||
'((void**)&%s)[2]' % self.qtHookDataSymbolName()).integer()
|
||||
except:
|
||||
if self.qtCoreModuleName() is not None:
|
||||
try:
|
||||
@@ -447,7 +453,7 @@ class Dumper(DumperBase):
|
||||
variables = []
|
||||
for val in cdbext.listOfLocals(self.partialVariable):
|
||||
dumperVal = self.fromNativeValue(val)
|
||||
dumperVal.lIsInScope = not dumperVal.name in self.uninitialized
|
||||
dumperVal.lIsInScope = dumperVal.name not in self.uninitialized
|
||||
variables.append(dumperVal)
|
||||
|
||||
self.handleLocals(variables)
|
||||
|
@@ -23,15 +23,18 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
|
||||
def typeTarget(type):
|
||||
target = type.target()
|
||||
if target:
|
||||
return target
|
||||
return type
|
||||
|
||||
|
||||
def stripTypeName(value):
|
||||
return typeTarget(value.type).unqualified().name
|
||||
|
||||
|
||||
def extractPointerType(d, value):
|
||||
postfix = ""
|
||||
while stripTypeName(value) == "CPlusPlus::PointerType":
|
||||
@@ -47,6 +50,7 @@ def extractPointerType(d, value):
|
||||
return "void" + postfix
|
||||
return "<unsupported>"
|
||||
|
||||
|
||||
def readTemplateName(d, value):
|
||||
name = readLiteral(d, value["_identifier"]) + "<"
|
||||
args = value["_templateArguments"]
|
||||
@@ -65,6 +69,7 @@ def readTemplateName(d, value):
|
||||
name += ">"
|
||||
return name
|
||||
|
||||
|
||||
def readLiteral(d, value):
|
||||
if not value.integer():
|
||||
return "<null>"
|
||||
@@ -78,9 +83,11 @@ def readLiteral(d, value):
|
||||
except:
|
||||
return "<unsupported>"
|
||||
|
||||
|
||||
def dumpLiteral(d, value):
|
||||
d.putValue(d.hexencode(readLiteral(d, value)), "latin1")
|
||||
|
||||
|
||||
def qdump__Core__Id(d, value):
|
||||
val = value.extractPointer()
|
||||
if True:
|
||||
@@ -93,36 +100,44 @@ def qdump__Core__Id(d, value):
|
||||
d.putValue(val)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Debugger__Internal__GdbMi(d, value):
|
||||
val = d.encodeString(value["m_name"]) + "3a002000" \
|
||||
+ d.encodeString(value["m_data"])
|
||||
d.putValue(val, "utf16")
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Debugger__Internal__DisassemblerLine(d, value):
|
||||
d.putByteArrayValue(value["m_data"])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Debugger__Internal__WatchData(d, value):
|
||||
d.putStringValue(value["iname"])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Debugger__Internal__WatchItem(d, value):
|
||||
d.putStringValue(value["iname"])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Debugger__Internal__BreakpointModelId(d, value):
|
||||
d.putValue("%s.%s" % (value["m_majorPart"].integer(), value["m_minorPart"].integer()))
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Debugger__Internal__ThreadId(d, value):
|
||||
d.putValue("%s" % value["m_id"])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__ByteArrayRef(d, value):
|
||||
d.putSimpleCharArray(value["m_start"], value["m_length"])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__Identifier(d, value):
|
||||
try:
|
||||
d.putSimpleCharArray(value["_chars"], value["_size"])
|
||||
@@ -130,14 +145,17 @@ def qdump__CPlusPlus__Identifier(d, value):
|
||||
pass
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__Symbol(d, value):
|
||||
dumpLiteral(d, value["_name"])
|
||||
d.putBetterType(value.type)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__Class(d, value):
|
||||
qdump__CPlusPlus__Symbol(d, value)
|
||||
|
||||
|
||||
def kindName(d, value):
|
||||
e = value.integer()
|
||||
if e:
|
||||
@@ -146,10 +164,12 @@ def kindName(d, value):
|
||||
else:
|
||||
return ''
|
||||
|
||||
|
||||
def qdump__CPlusPlus__IntegerType(d, value):
|
||||
d.putValue(kindName(d, value["_kind"]))
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__FullySpecifiedType(d, value):
|
||||
type = value["_type"]
|
||||
typeName = stripTypeName(type)
|
||||
@@ -159,36 +179,44 @@ def qdump__CPlusPlus__FullySpecifiedType(d, value):
|
||||
d.putValue(d.hexencode(extractPointerType(d, type)), "latin1")
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__NamedType(d, value):
|
||||
dumpLiteral(d, value["_name"])
|
||||
d.putBetterType(value.type)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__PointerType(d, value):
|
||||
d.putValue(d.hexencode(extractPointerType(d, value)), "latin1")
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__TemplateNameId(d, value):
|
||||
dumpLiteral(d, value)
|
||||
d.putBetterType(value.type)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__QualifiedNameId(d, value):
|
||||
dumpLiteral(d, value)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__Literal(d, value):
|
||||
dumpLiteral(d, value)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__StringLiteral(d, value):
|
||||
d.putSimpleCharArray(value["_chars"], value["_size"])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__Internal__Value(d, value):
|
||||
d.putValue(value["l"])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Utils__FilePath(d, value):
|
||||
try:
|
||||
if not d.extractPointer(value["m_url"]): # there is no valid URL
|
||||
@@ -199,21 +227,26 @@ def qdump__Utils__FilePath(d, value):
|
||||
d.putStringValue(value) # support FileName before 4.10 as well
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Utils__FileName(d, value):
|
||||
qdump__Utils__FilePath(d, value)
|
||||
|
||||
|
||||
def qdump__Utils__ElfSection(d, value):
|
||||
d.putByteArrayValue(value["name"])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Utils__Port(d, value):
|
||||
d.putValue(d.extractInt(value))
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__Utf8String(d, value):
|
||||
d.putByteArrayValue(value['byteArray'])
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__Token(d, value):
|
||||
k = value["f"]["kind"]
|
||||
e = k.lvalue
|
||||
@@ -228,6 +261,7 @@ def qdump__CPlusPlus__Token(d, value):
|
||||
d.putValue(type)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__CPlusPlus__Internal__PPToken(d, value):
|
||||
data, size, alloc = d.byteArrayData(value["m_src"])
|
||||
length = value["f"]["utf16chars"].integer()
|
||||
@@ -237,6 +271,7 @@ def qdump__CPlusPlus__Internal__PPToken(d, value):
|
||||
d.putValue(d.readMemory(data + offset, min(100, length)), "latin1")
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__ProString(d, value):
|
||||
try:
|
||||
s = value["m_string"]
|
||||
@@ -249,10 +284,12 @@ def qdump__ProString(d, value):
|
||||
d.putEmptyValue()
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__ProKey(d, value):
|
||||
qdump__ProString(d, value)
|
||||
d.putBetterType(value.type)
|
||||
|
||||
|
||||
def qdump__Core__GeneratedFile(d, value):
|
||||
d.putStringValue(value["m_d"]["d"]["path"])
|
||||
d.putPlainChildren(value)
|
||||
@@ -275,14 +312,18 @@ def qdump__Core__GeneratedFile(d, value):
|
||||
# d.putStringValue(value["d"]["m_unexpandedDisplayName"])
|
||||
# d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__ProjectExplorer__ProjectNode(d, value):
|
||||
qdump__ProjectExplorer__FolderNode(d, value)
|
||||
|
||||
|
||||
def qdump__CMakeProjectManager__Internal__CMakeProjectNode(d, value):
|
||||
qdump__ProjectExplorer__FolderNode(d, value)
|
||||
|
||||
|
||||
def qdump__QmakeProjectManager__QmakePriFileNode(d, value):
|
||||
qdump__ProjectExplorer__FolderNode(d, value)
|
||||
|
||||
|
||||
def qdump__QmakeProjectManager__QmakeProFileNode(d, value):
|
||||
qdump__ProjectExplorer__FolderNode(d, value)
|
||||
|
@@ -25,7 +25,6 @@
|
||||
|
||||
import os
|
||||
import codecs
|
||||
import copy
|
||||
import collections
|
||||
import struct
|
||||
import sys
|
||||
@@ -33,7 +32,6 @@ import base64
|
||||
import re
|
||||
import time
|
||||
import inspect
|
||||
import threading
|
||||
from utils import DisplayFormat, TypeCode
|
||||
|
||||
try:
|
||||
@@ -53,12 +51,13 @@ else:
|
||||
toInteger = long
|
||||
|
||||
|
||||
class ReportItem:
|
||||
class ReportItem():
|
||||
"""
|
||||
Helper structure to keep temporary 'best' information about a value
|
||||
or a type scheduled to be reported. This might get overridden be
|
||||
subsequent better guesses during a putItem() run.
|
||||
"""
|
||||
|
||||
def __init__(self, value=None, encoding=None, priority=-100, elided=None):
|
||||
self.value = value
|
||||
self.priority = priority
|
||||
@@ -70,7 +69,7 @@ class ReportItem:
|
||||
% (self.value, self.encoding, self.priority, self.elided)
|
||||
|
||||
|
||||
class Timer:
|
||||
class Timer():
|
||||
def __init__(self, d, desc):
|
||||
self.d = d
|
||||
self.desc = desc + '-' + d.currentIName
|
||||
@@ -83,7 +82,7 @@ class Timer:
|
||||
self.d.timings.append([self.desc, elapsed])
|
||||
|
||||
|
||||
class Children:
|
||||
class Children():
|
||||
def __init__(self, d, numChild=1, childType=None, childNumChild=None,
|
||||
maxNumChild=None, addrBase=None, addrStep=None):
|
||||
self.d = d
|
||||
@@ -132,7 +131,7 @@ class Children:
|
||||
return True
|
||||
|
||||
|
||||
class SubItem:
|
||||
class SubItem():
|
||||
def __init__(self, d, component):
|
||||
self.d = d
|
||||
self.name = component
|
||||
@@ -144,19 +143,22 @@ class SubItem:
|
||||
def __exit__(self, exType, exValue, exTraceBack):
|
||||
return self.d.exitSubItem(self, exType, exValue, exTraceBack)
|
||||
|
||||
|
||||
class TopLevelItem(SubItem):
|
||||
def __init__(self, d, iname):
|
||||
self.d = d
|
||||
self.iname = iname
|
||||
self.name = None
|
||||
|
||||
|
||||
class UnnamedSubItem(SubItem):
|
||||
def __init__(self, d, component):
|
||||
self.d = d
|
||||
self.iname = '%s.%s' % (self.d.currentIName, component)
|
||||
self.name = None
|
||||
|
||||
class DumperBase:
|
||||
|
||||
class DumperBase():
|
||||
@staticmethod
|
||||
def warn(message):
|
||||
print('bridgemessage={msg="%s"},' % message.replace('"', '$').encode('latin1'))
|
||||
@@ -259,7 +261,7 @@ class DumperBase:
|
||||
|
||||
def resetCaches(self):
|
||||
# This is a cache mapping from 'type name' to 'display alternatives'.
|
||||
self.qqFormats = { 'QVariant (QVariantMap)' : [DisplayFormat.CompactMapFormat] }
|
||||
self.qqFormats = {'QVariant (QVariantMap)': [DisplayFormat.CompactMap]}
|
||||
|
||||
# This is a cache of all known dumpers.
|
||||
self.qqDumpers = {} # Direct type match
|
||||
@@ -326,13 +328,13 @@ class DumperBase:
|
||||
item.savedValue = self.currentValue
|
||||
item.savedType = self.currentType
|
||||
self.currentIName = item.iname
|
||||
self.currentValue = ReportItem();
|
||||
self.currentType = ReportItem();
|
||||
self.currentValue = ReportItem()
|
||||
self.currentType = ReportItem()
|
||||
|
||||
def exitSubItem(self, item, exType, exValue, exTraceBack):
|
||||
#DumperBase.warn('CURRENT VALUE: %s: %s %s' %
|
||||
# (self.currentIName, self.currentValue, self.currentType))
|
||||
if not exType is None:
|
||||
if exType is not None:
|
||||
if self.passExceptions:
|
||||
self.showException('SUBITEM', exType, exValue, exTraceBack)
|
||||
self.putSpecialValue('notaccessible')
|
||||
@@ -346,7 +348,7 @@ class DumperBase:
|
||||
if self.currentValue.value is None:
|
||||
self.put('value="",encoding="notaccessible",numchild="0",')
|
||||
else:
|
||||
if not self.currentValue.encoding is None:
|
||||
if self.currentValue.encoding is not None:
|
||||
self.put('valueencoded="%s",' % self.currentValue.encoding)
|
||||
if self.currentValue.elided:
|
||||
self.put('valueelided="%s",' % self.currentValue.elided)
|
||||
@@ -437,7 +439,7 @@ class DumperBase:
|
||||
tdata.name = typeId
|
||||
tdata.typeId = typeId
|
||||
tdata.lbitsize = 16
|
||||
tdata.code = TypeCode.TypeCodeIntegral
|
||||
tdata.code = TypeCode.Integral
|
||||
self.registerType(typeId, tdata)
|
||||
|
||||
typeId = 'QChar'
|
||||
@@ -445,8 +447,9 @@ class DumperBase:
|
||||
tdata.name = typeId
|
||||
tdata.typeId = typeId
|
||||
tdata.lbitsize = 16
|
||||
tdata.code = TypeCode.TypeCodeStruct
|
||||
tdata.lfields = [self.Field(dumper=self, name='ucs', type='unsigned short', bitsize=16, bitpos=0)]
|
||||
tdata.code = TypeCode.Struct
|
||||
tdata.lfields = [self.Field(dumper=self, name='ucs',
|
||||
type='unsigned short', bitsize=16, bitpos=0)]
|
||||
tdata.lalignment = 2
|
||||
tdata.templateArguments = []
|
||||
self.registerType(typeId, tdata)
|
||||
@@ -625,12 +628,12 @@ class DumperBase:
|
||||
return elided, self.readMemory(data, shown)
|
||||
|
||||
def putCharArrayValue(self, data, size, charSize,
|
||||
displayFormat = DisplayFormat.AutomaticFormat):
|
||||
displayFormat=DisplayFormat.Automatic):
|
||||
bytelen = size * charSize
|
||||
elided, shown = self.computeLimit(bytelen, self.displayStringLimit)
|
||||
mem = self.readMemory(data, shown)
|
||||
if charSize == 1:
|
||||
if displayFormat in (DisplayFormat.Latin1StringFormat, DisplayFormat.SeparateLatin1StringFormat):
|
||||
if displayFormat in (DisplayFormat.Latin1String, DisplayFormat.SeparateLatin1String):
|
||||
encodingType = 'latin1'
|
||||
else:
|
||||
encodingType = 'utf8'
|
||||
@@ -644,12 +647,15 @@ class DumperBase:
|
||||
|
||||
self.putValue(mem, encodingType, elided=elided)
|
||||
|
||||
if displayFormat in (DisplayFormat.SeparateLatin1StringFormat, DisplayFormat.SeparateUtf8StringFormat, DisplayFormat.SeparateFormat):
|
||||
if displayFormat in (
|
||||
DisplayFormat.SeparateLatin1String,
|
||||
DisplayFormat.SeparateUtf8String,
|
||||
DisplayFormat.Separate):
|
||||
elided, shown = self.computeLimit(bytelen, 100000)
|
||||
self.putDisplay(encodingType + ':separate', self.readMemory(data, shown))
|
||||
|
||||
def putCharArrayHelper(self, data, size, charType,
|
||||
displayFormat = DisplayFormat.AutomaticFormat,
|
||||
displayFormat=DisplayFormat.Automatic,
|
||||
makeExpandable=True):
|
||||
charSize = charType.size()
|
||||
self.putCharArrayValue(data, size, charSize, displayFormat=displayFormat)
|
||||
@@ -672,7 +678,8 @@ class DumperBase:
|
||||
return self.byteArrayDataHelper(self.extractPointer(value))
|
||||
|
||||
def putByteArrayValue(self, value):
|
||||
elided, data = self.encodeByteArrayHelper(self.extractPointer(value), self.displayStringLimit)
|
||||
elided, data = self.encodeByteArrayHelper(
|
||||
self.extractPointer(value), self.displayStringLimit)
|
||||
self.putValue(data, 'latin1', elided=elided)
|
||||
|
||||
def encodeString(self, value, limit=0):
|
||||
@@ -861,7 +868,6 @@ class DumperBase:
|
||||
with SubItem(self, item.name):
|
||||
self.putItem(item)
|
||||
|
||||
|
||||
def putMembersItem(self, value, sortorder=10):
|
||||
with SubItem(self, '[members]'):
|
||||
self.putField('sortgroup', sortorder)
|
||||
@@ -921,20 +927,20 @@ class DumperBase:
|
||||
self.putNumChild(count)
|
||||
|
||||
def resultToMi(self, value):
|
||||
if type(value) is bool:
|
||||
if isinstance(value, bool):
|
||||
return '"%d"' % int(value)
|
||||
if type(value) is dict:
|
||||
if isinstance(value, dict):
|
||||
return '{' + ','.join(['%s=%s' % (k, self.resultToMi(v))
|
||||
for (k, v) in list(value.items())]) + '}'
|
||||
if type(value) is list:
|
||||
if isinstance(value, list):
|
||||
return '[' + ','.join([self.resultToMi(k)
|
||||
for k in list(value.items())]) + ']'
|
||||
return '"%s"' % value
|
||||
|
||||
def variablesToMi(self, value, prefix):
|
||||
if type(value) is bool:
|
||||
if isinstance(value, bool):
|
||||
return '"%d"' % int(value)
|
||||
if type(value) is dict:
|
||||
if isinstance(value, dict):
|
||||
pairs = []
|
||||
for (k, v) in list(value.items()):
|
||||
if k == 'iname':
|
||||
@@ -946,7 +952,7 @@ class DumperBase:
|
||||
v = self.variablesToMi(v, prefix)
|
||||
pairs.append('%s=%s' % (k, v))
|
||||
return '{' + ','.join(pairs) + '}'
|
||||
if type(value) is list:
|
||||
if isinstance(value, list):
|
||||
index = 0
|
||||
pairs = []
|
||||
for item in value:
|
||||
@@ -1105,12 +1111,19 @@ class DumperBase:
|
||||
itemCount = s[s.find('[') + 1:s.find(']')]
|
||||
if not itemCount:
|
||||
itemCount = '100'
|
||||
arrayByteSize = int(itemCount) * innerType.size();
|
||||
arrayByteSize = int(itemCount) * innerType.size()
|
||||
|
||||
n = arrayByteSize // innerType.size()
|
||||
p = value.address()
|
||||
if displayFormat != DisplayFormat.RawFormat and p:
|
||||
if innerType.name in ('char', 'wchar_t', 'unsigned char', 'signed char', 'CHAR', 'WCHAR'):
|
||||
if displayFormat != DisplayFormat.Raw and p:
|
||||
if innerType.name in (
|
||||
'char',
|
||||
'wchar_t',
|
||||
'unsigned char',
|
||||
'signed char',
|
||||
'CHAR',
|
||||
'WCHAR'
|
||||
):
|
||||
self.putCharArrayHelper(p, n, innerType, self.currentItemFormat(),
|
||||
makeExpandable=False)
|
||||
else:
|
||||
@@ -1158,7 +1171,7 @@ class DumperBase:
|
||||
|
||||
def tryPutPrettyItem(self, typeName, value):
|
||||
value.check()
|
||||
if self.useFancy and self.currentItemFormat() != DisplayFormat.RawFormat:
|
||||
if self.useFancy and self.currentItemFormat() != DisplayFormat.Raw:
|
||||
self.putType(typeName)
|
||||
|
||||
nsStrippedType = self.stripNamespaceFromType(typeName)\
|
||||
@@ -1204,7 +1217,7 @@ class DumperBase:
|
||||
|
||||
# This is shared by pointer and array formatting.
|
||||
def tryPutSimpleFormattedPointer(self, ptr, typeName, innerType, displayFormat, limit):
|
||||
if displayFormat == DisplayFormat.AutomaticFormat:
|
||||
if displayFormat == DisplayFormat.Automatic:
|
||||
if innerType.name in ('char', 'signed char', 'unsigned char', 'CHAR'):
|
||||
# Use UTF-8 as default for char *.
|
||||
self.putType(typeName)
|
||||
@@ -1224,45 +1237,45 @@ class DumperBase:
|
||||
self.putValue(data, 'ucs4', elided=elided)
|
||||
return True
|
||||
|
||||
if displayFormat == DisplayFormat.Latin1StringFormat:
|
||||
if displayFormat == DisplayFormat.Latin1String:
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(ptr, 1, limit)
|
||||
self.putValue(data, 'latin1', elided=elided)
|
||||
return True
|
||||
|
||||
if displayFormat == DisplayFormat.SeparateLatin1StringFormat:
|
||||
if displayFormat == DisplayFormat.SeparateLatin1String:
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(ptr, 1, limit)
|
||||
self.putValue(data, 'latin1', elided=elided)
|
||||
self.putDisplay('latin1:separate', data)
|
||||
return True
|
||||
|
||||
if displayFormat == DisplayFormat.Utf8StringFormat:
|
||||
if displayFormat == DisplayFormat.Utf8String:
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(ptr, 1, limit)
|
||||
self.putValue(data, 'utf8', elided=elided)
|
||||
return True
|
||||
|
||||
if displayFormat == DisplayFormat.SeparateUtf8StringFormat:
|
||||
if displayFormat == DisplayFormat.SeparateUtf8String:
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(ptr, 1, limit)
|
||||
self.putValue(data, 'utf8', elided=elided)
|
||||
self.putDisplay('utf8:separate', data)
|
||||
return True
|
||||
|
||||
if displayFormat == DisplayFormat.Local8BitStringFormat:
|
||||
if displayFormat == DisplayFormat.Local8BitString:
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(ptr, 1, limit)
|
||||
self.putValue(data, 'local8bit', elided=elided)
|
||||
return True
|
||||
|
||||
if displayFormat == DisplayFormat.Utf16StringFormat:
|
||||
if displayFormat == DisplayFormat.Utf16String:
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(ptr, 2, limit)
|
||||
self.putValue(data, 'utf16', elided=elided)
|
||||
return True
|
||||
|
||||
if displayFormat == DisplayFormat.Ucs4StringFormat:
|
||||
if displayFormat == DisplayFormat.Ucs4String:
|
||||
self.putType(typeName)
|
||||
(elided, data) = self.encodeCArray(ptr, 4, limit)
|
||||
self.putValue(data, 'ucs4', elided=elided)
|
||||
@@ -1324,7 +1337,7 @@ class DumperBase:
|
||||
self.putNumChild(0)
|
||||
return
|
||||
|
||||
if displayFormat == DisplayFormat.RawFormat:
|
||||
if displayFormat == DisplayFormat.Raw:
|
||||
# Explicitly requested bald pointer.
|
||||
#DumperBase.warn('RAW')
|
||||
self.putType(typeName)
|
||||
@@ -1337,21 +1350,21 @@ class DumperBase:
|
||||
return
|
||||
|
||||
limit = self.displayStringLimit
|
||||
if displayFormat in (DisplayFormat.SeparateLatin1StringFormat, DisplayFormat.SeparateUtf8StringFormat):
|
||||
if displayFormat in (DisplayFormat.SeparateLatin1String, DisplayFormat.SeparateUtf8String):
|
||||
limit = 1000000
|
||||
if self.tryPutSimpleFormattedPointer(pointer, typeName,
|
||||
innerType, displayFormat, limit):
|
||||
self.putNumChild(1)
|
||||
return
|
||||
|
||||
if DisplayFormat.Array10Format <= displayFormat and displayFormat <= DisplayFormat.Array1000Format:
|
||||
n = (10, 100, 1000, 10000)[displayFormat - DisplayFormat.Array10Format]
|
||||
if DisplayFormat.Array10 <= displayFormat and displayFormat <= DisplayFormat.Array1000:
|
||||
n = (10, 100, 1000, 10000)[displayFormat - DisplayFormat.Array10]
|
||||
self.putType(typeName)
|
||||
self.putItemCount(n)
|
||||
self.putArrayData(value.pointer(), n, innerType)
|
||||
return
|
||||
|
||||
if innerType.code == TypeCode.TypeCodeFunction:
|
||||
if innerType.code == TypeCode.Function:
|
||||
# A function pointer.
|
||||
self.putSymbolValue(pointer)
|
||||
self.putType(typeName)
|
||||
@@ -1363,7 +1376,14 @@ class DumperBase:
|
||||
#DumperBase.warn('INNER: %s' % innerType.name)
|
||||
if self.autoDerefPointers:
|
||||
# Generic pointer type with AutomaticFormat, but never dereference char types:
|
||||
if innerType.name not in ('char', 'signed char', 'unsigned char', 'wchar_t', 'CHAR', 'WCHAR'):
|
||||
if innerType.name not in (
|
||||
'char',
|
||||
'signed char',
|
||||
'unsigned char',
|
||||
'wchar_t',
|
||||
'CHAR',
|
||||
'WCHAR'
|
||||
):
|
||||
self.putDerefedPointer(value)
|
||||
return
|
||||
|
||||
@@ -1615,7 +1635,6 @@ class DumperBase:
|
||||
self.knownStaticMetaObjects[someTypeName] = result
|
||||
return result
|
||||
|
||||
|
||||
if not self.useFancy:
|
||||
return 0
|
||||
|
||||
@@ -1891,7 +1910,8 @@ class DumperBase:
|
||||
self.putNumChild(1)
|
||||
if self.isExpanded():
|
||||
with Children(self):
|
||||
self.putQObjectGutsHelper(0, 0, -1, metaObjectPtr, 'QMetaObject')
|
||||
self.putQObjectGutsHelper(
|
||||
0, 0, -1, metaObjectPtr, 'QMetaObject')
|
||||
|
||||
if False:
|
||||
with SubItem(self, '[connections]'):
|
||||
@@ -1914,7 +1934,8 @@ class DumperBase:
|
||||
continue
|
||||
j += 1
|
||||
with SubItem(self, j):
|
||||
name = self.metaString(metaObjectPtr, t[0], revision)
|
||||
name = self.metaString(
|
||||
metaObjectPtr, t[0], revision)
|
||||
self.putType(' ')
|
||||
self.putValue(name)
|
||||
self.putNumChild(1)
|
||||
@@ -1929,7 +1950,6 @@ class DumperBase:
|
||||
putt('[globalindex]', str(globalOffset + i))
|
||||
#self.putQObjectConnections(dd)
|
||||
|
||||
|
||||
if isQMetaObject or isQObject:
|
||||
with SubItem(self, '[properties]'):
|
||||
self.putField('sortgroup', 5)
|
||||
@@ -2066,7 +2086,6 @@ class DumperBase:
|
||||
self.putField('sortgroup', 11)
|
||||
self.putValue(globalOffset + localIndex)
|
||||
|
||||
|
||||
def putQObjectConnections(self, dd):
|
||||
with SubItem(self, '[connections]'):
|
||||
ptrSize = self.ptrSize()
|
||||
@@ -2101,12 +2120,12 @@ class DumperBase:
|
||||
break
|
||||
|
||||
def currentItemFormat(self, typeName=None):
|
||||
displayFormat = self.formats.get(self.currentIName, DisplayFormat.AutomaticFormat)
|
||||
if displayFormat == DisplayFormat.AutomaticFormat:
|
||||
displayFormat = self.formats.get(self.currentIName, DisplayFormat.Automatic)
|
||||
if displayFormat == DisplayFormat.Automatic:
|
||||
if typeName is None:
|
||||
typeName = self.currentType.value
|
||||
needle = None if typeName is None else self.stripForFormat(typeName)
|
||||
displayFormat = self.typeformats.get(needle, DisplayFormat.AutomaticFormat)
|
||||
displayFormat = self.typeformats.get(needle, DisplayFormat.Automatic)
|
||||
return displayFormat
|
||||
|
||||
def putSubItem(self, component, value): # -> ReportItem
|
||||
@@ -2158,7 +2177,7 @@ class DumperBase:
|
||||
if n > maxNumChild:
|
||||
self.putField('plotelided', n) # FIXME: Act on that in frontend
|
||||
n = maxNumChild
|
||||
if self.currentItemFormat() == DisplayFormat.ArrayPlotFormat and innerType.isSimpleType():
|
||||
if self.currentItemFormat() == DisplayFormat.ArrayPlot and innerType.isSimpleType():
|
||||
enc = innerType.simpleEncoding()
|
||||
if enc:
|
||||
self.putField('editencoding', enc)
|
||||
@@ -2198,7 +2217,7 @@ class DumperBase:
|
||||
|
||||
def extractPointer(self, value):
|
||||
try:
|
||||
if value.type.code == TypeCode.TypeCodeArray:
|
||||
if value.type.code == TypeCode.Array:
|
||||
return value.address()
|
||||
except:
|
||||
pass
|
||||
@@ -2262,7 +2281,7 @@ class DumperBase:
|
||||
return i
|
||||
return len(s)
|
||||
|
||||
match = re.search('(\.)(\(.+?\))?(\.)', exp)
|
||||
match = re.search(r'(\.)(\(.+?\))?(\.)', exp)
|
||||
if match:
|
||||
s = match.group(2)
|
||||
left_e = match.start(1)
|
||||
@@ -2295,8 +2314,8 @@ class DumperBase:
|
||||
shadowed = {}
|
||||
for value in variables:
|
||||
if value.name == 'argv':
|
||||
if value.type.code == TypeCode.TypeCodePointer:
|
||||
if value.type.ltarget.code == TypeCode.TypeCodePointer:
|
||||
if value.type.code == TypeCode.Pointer:
|
||||
if value.type.ltarget.code == TypeCode.Pointer:
|
||||
if value.type.ltarget.ltarget.name == 'char':
|
||||
self.putSpecialArgv(value)
|
||||
continue
|
||||
@@ -2653,19 +2672,19 @@ class DumperBase:
|
||||
|
||||
# Try on possibly typedefed type first.
|
||||
if self.tryPutPrettyItem(typeName, value):
|
||||
if typeobj.code == TypeCode.TypeCodePointer:
|
||||
if typeobj.code == TypeCode.Pointer:
|
||||
self.putOriginalAddress(value.address())
|
||||
else:
|
||||
self.putAddress(value.address())
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeTypedef:
|
||||
if typeobj.code == TypeCode.Typedef:
|
||||
#DumperBase.warn('TYPEDEF VALUE: %s' % value.stringify())
|
||||
self.putItem(value.detypedef())
|
||||
self.putBetterType(typeName)
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodePointer:
|
||||
if typeobj.code == TypeCode.Pointer:
|
||||
self.putFormattedPointer(value)
|
||||
if value.summary and self.useFancy:
|
||||
self.putValue(self.hexencode(value.summary), 'utf8:1:0')
|
||||
@@ -2673,34 +2692,35 @@ class DumperBase:
|
||||
|
||||
self.putAddress(value.address())
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeFunction:
|
||||
if typeobj.code == TypeCode.Function:
|
||||
#DumperBase.warn('FUNCTION VALUE: %s' % value)
|
||||
self.putType(typeobj)
|
||||
self.putSymbolValue(value.pointer())
|
||||
self.putNumChild(0)
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeEnum:
|
||||
if typeobj.code == TypeCode.Enum:
|
||||
#DumperBase.warn('ENUM VALUE: %s' % value.stringify())
|
||||
self.putType(typeobj.name)
|
||||
self.putValue(value.display())
|
||||
self.putNumChild(0)
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeArray:
|
||||
if typeobj.code == TypeCode.Array:
|
||||
#DumperBase.warn('ARRAY VALUE: %s' % value)
|
||||
self.putCStyleArray(value)
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeBitfield:
|
||||
if typeobj.code == TypeCode.Bitfield:
|
||||
#DumperBase.warn('BITFIELD VALUE: %s %d %s' % (value.name, value.lvalue, typeName))
|
||||
self.putNumChild(0)
|
||||
dd = typeobj.ltarget.typeData().enumDisplay
|
||||
self.putValue(str(value.lvalue) if dd is None else dd(value.lvalue, value.laddress, '%d'))
|
||||
self.putValue(str(value.lvalue) if dd is None else dd(
|
||||
value.lvalue, value.laddress, '%d'))
|
||||
self.putType(typeName)
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeIntegral:
|
||||
if typeobj.code == TypeCode.Integral:
|
||||
#DumperBase.warn('INTEGER: %s %s' % (value.name, value))
|
||||
val = value.value()
|
||||
self.putNumChild(0)
|
||||
@@ -2708,14 +2728,14 @@ class DumperBase:
|
||||
self.putType(typeName)
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeFloat:
|
||||
if typeobj.code == TypeCode.Float:
|
||||
#DumperBase.warn('FLOAT VALUE: %s' % value)
|
||||
self.putValue(value.value())
|
||||
self.putNumChild(0)
|
||||
self.putType(typeobj.name)
|
||||
return
|
||||
|
||||
if typeobj.code in (TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
|
||||
if typeobj.code in (TypeCode.Reference, TypeCode.RValueReference):
|
||||
#DumperBase.warn('REFERENCE VALUE: %s' % value)
|
||||
val = value.dereference()
|
||||
if val.laddress != 0:
|
||||
@@ -2725,13 +2745,13 @@ class DumperBase:
|
||||
self.putBetterType(typeName)
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeComplex:
|
||||
if typeobj.code == TypeCode.Complex:
|
||||
self.putType(typeobj)
|
||||
self.putValue(value.display())
|
||||
self.putNumChild(0)
|
||||
return
|
||||
|
||||
if typeobj.code == TypeCode.TypeCodeFortranString:
|
||||
if typeobj.code == TypeCode.FortranString:
|
||||
self.putValue(self.hexencode(value.data()), 'latin1')
|
||||
self.putNumChild(0)
|
||||
self.putType(typeobj)
|
||||
@@ -2810,7 +2830,7 @@ class DumperBase:
|
||||
self.typesReported[typename] = True
|
||||
self.typesToReport[typename] = typeobj
|
||||
|
||||
class Value:
|
||||
class Value():
|
||||
def __init__(self, dumper):
|
||||
self.dumper = dumper
|
||||
self.name = None
|
||||
@@ -2883,14 +2903,14 @@ class DumperBase:
|
||||
return '<unknown data>'
|
||||
|
||||
def pointer(self):
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
return self.detypedef().pointer()
|
||||
return self.extractInteger(self.dumper.ptrSize() * 8, True)
|
||||
|
||||
def integer(self, bitsize=None):
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
return self.detypedef().integer()
|
||||
elif self.type.code == TypeCode.TypeCodeBitfield:
|
||||
elif self.type.code == TypeCode.Bitfield:
|
||||
return self.lvalue
|
||||
# Could be something like 'short unsigned int'
|
||||
unsigned = self.type.name == 'unsigned' \
|
||||
@@ -2903,7 +2923,7 @@ class DumperBase:
|
||||
def floatingPoint(self):
|
||||
if self.nativeValue is not None and not self.dumper.isCdb:
|
||||
return str(self.nativeValue)
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
return self.detypedef().floatingPoint()
|
||||
if self.type.size() == 8:
|
||||
return self.extractSomething('d', 64)
|
||||
@@ -2949,17 +2969,17 @@ class DumperBase:
|
||||
|
||||
def value(self):
|
||||
if self.type is not None:
|
||||
if self.type.code == TypeCode.TypeCodeEnum:
|
||||
if self.type.code == TypeCode.Enum:
|
||||
return self.displayEnum()
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
return self.detypedef().value()
|
||||
if self.type.code == TypeCode.TypeCodeIntegral:
|
||||
if self.type.code == TypeCode.Integral:
|
||||
return self.integer()
|
||||
if self.type.code == TypeCode.TypeCodeBitfield:
|
||||
if self.type.code == TypeCode.Bitfield:
|
||||
return self.integer()
|
||||
if self.type.code == TypeCode.TypeCodeFloat:
|
||||
if self.type.code == TypeCode.Float:
|
||||
return self.floatingPoint()
|
||||
if self.type.code == TypeCode.TypeCodePointer:
|
||||
if self.type.code == TypeCode.Pointer:
|
||||
return self.pointer()
|
||||
return None
|
||||
|
||||
@@ -2968,28 +2988,31 @@ class DumperBase:
|
||||
|
||||
def findMemberByName(self, name):
|
||||
self.check()
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
return self.findMemberByName(self.detypedef())
|
||||
if self.type.code in (TypeCode.TypeCodePointer, TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
|
||||
if self.type.code in (
|
||||
TypeCode.Pointer,
|
||||
TypeCode.Reference,
|
||||
TypeCode.RValueReference):
|
||||
res = self.dereference().findMemberByName(name)
|
||||
if res is not None:
|
||||
return res
|
||||
if self.type.code == TypeCode.TypeCodeStruct:
|
||||
if self.type.code == TypeCode.Struct:
|
||||
#DumperBase.warn('SEARCHING FOR MEMBER: %s IN %s' % (name, self.type.name))
|
||||
members = self.members(True)
|
||||
#DumperBase.warn('MEMBERS: %s' % members)
|
||||
for member in members:
|
||||
#DumperBase.warn('CHECKING FIELD %s' % member.name)
|
||||
if member.type.code == TypeCode.TypeCodeTypedef:
|
||||
if member.type.code == TypeCode.Typedef:
|
||||
member = member.detypedef()
|
||||
if member.name == name:
|
||||
return member
|
||||
for member in members:
|
||||
if member.type.code == TypeCode.TypeCodeTypedef:
|
||||
if member.type.code == TypeCode.Typedef:
|
||||
member = member.detypedef()
|
||||
if member.name == name: # Could be base class.
|
||||
return member
|
||||
if member.type.code == TypeCode.TypeCodeStruct:
|
||||
if member.type.code == TypeCode.Struct:
|
||||
res = member.findMemberByName(name)
|
||||
if res is not None:
|
||||
return res
|
||||
@@ -2998,11 +3021,11 @@ class DumperBase:
|
||||
def __getitem__(self, index):
|
||||
#DumperBase.warn('GET ITEM %s %s' % (self, index))
|
||||
self.check()
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
#DumperBase.warn('GET ITEM STRIP TYPEDEFS TO %s' % self.type.ltarget)
|
||||
return self.cast(self.type.ltarget).__getitem__(index)
|
||||
if isinstance(index, str):
|
||||
if self.type.code == TypeCode.TypeCodePointer:
|
||||
if self.type.code == TypeCode.Pointer:
|
||||
#DumperBase.warn('GET ITEM %s DEREFERENCE TO %s' % (self, self.dereference()))
|
||||
return self.dereference().__getitem__(index)
|
||||
res = self.findMemberByName(index)
|
||||
@@ -3013,10 +3036,10 @@ class DumperBase:
|
||||
elif isinstance(index, self.dumper.Field):
|
||||
field = index
|
||||
elif self.dumper.isInt(index):
|
||||
if self.type.code == TypeCode.TypeCodeArray:
|
||||
if self.type.code == TypeCode.Array:
|
||||
addr = self.laddress + int(index) * self.type.ltarget.size()
|
||||
return self.dumper.createValue(addr, self.type.ltarget)
|
||||
if self.type.code == TypeCode.TypeCodePointer:
|
||||
if self.type.code == TypeCode.Pointer:
|
||||
addr = self.pointer() + int(index) * self.type.ltarget.size()
|
||||
return self.dumper.createValue(addr, self.type.ltarget)
|
||||
return self.members(False)[index]
|
||||
@@ -3025,7 +3048,7 @@ class DumperBase:
|
||||
field.check()
|
||||
|
||||
#DumperBase.warn('EXTRACT FIELD: %s, BASE 0x%x' % (field, self.address()))
|
||||
if self.type.code == TypeCode.TypeCodePointer:
|
||||
if self.type.code == TypeCode.Pointer:
|
||||
#DumperBase.warn('IS TYPEDEFED POINTER!')
|
||||
res = self.dereference()
|
||||
#DumperBase.warn('WAS POINTER: %s' % res)
|
||||
@@ -3042,9 +3065,9 @@ class DumperBase:
|
||||
#DumperBase.warn('EXTRACTOR SUCCEEDED: %s ' % val)
|
||||
return val
|
||||
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
return self.cast(self.type.ltarget).extractField(field)
|
||||
if self.type.code in (TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
|
||||
if self.type.code in (TypeCode.Reference, TypeCode.RValueReference):
|
||||
return self.dereference().extractField(field)
|
||||
#DumperBase.warn('FIELD: %s ' % field)
|
||||
val = self.dumper.Value(self.dumper)
|
||||
@@ -3065,7 +3088,7 @@ class DumperBase:
|
||||
fieldOffset = fieldBitpos // 8
|
||||
fieldType = field.fieldType()
|
||||
|
||||
if fieldType.code == TypeCode.TypeCodeBitfield:
|
||||
if fieldType.code == TypeCode.Bitfield:
|
||||
fieldBitpos -= fieldOffset * 8
|
||||
ldata = self.data()
|
||||
data = 0
|
||||
@@ -3089,7 +3112,7 @@ class DumperBase:
|
||||
else:
|
||||
self.dumper.check(False)
|
||||
|
||||
if fieldType.code in (TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
|
||||
if fieldType.code in (TypeCode.Reference, TypeCode.RValueReference):
|
||||
if val.laddress is not None:
|
||||
val = self.dumper.createReferenceValue(val.laddress, fieldType.ltarget)
|
||||
val.name = field.name
|
||||
@@ -3104,7 +3127,7 @@ class DumperBase:
|
||||
# implementations.
|
||||
def members(self, includeBases):
|
||||
#DumperBase.warn("LISTING MEMBERS OF %s" % self)
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
return self.detypedef().members(includeBases)
|
||||
|
||||
tdata = self.type.typeData()
|
||||
@@ -3136,7 +3159,7 @@ class DumperBase:
|
||||
self.check()
|
||||
if self.dumper.isInt(other):
|
||||
stripped = self.type.stripTypedefs()
|
||||
if stripped.code == TypeCode.TypeCodePointer:
|
||||
if stripped.code == TypeCode.Pointer:
|
||||
address = self.pointer() + stripped.dereference().size() * other
|
||||
val = self.dumper.Value(self.dumper)
|
||||
val.laddress = None
|
||||
@@ -3149,16 +3172,16 @@ class DumperBase:
|
||||
self.check()
|
||||
if self.type.name == other.type.name:
|
||||
stripped = self.type.stripTypedefs()
|
||||
if stripped.code == TypeCode.TypeCodePointer:
|
||||
if stripped.code == TypeCode.Pointer:
|
||||
return (self.pointer() - other.pointer()) // stripped.dereference().size()
|
||||
raise RuntimeError('BAD DATA TO SUB TO: %s %s' % (self.type, other))
|
||||
|
||||
def dereference(self):
|
||||
self.check()
|
||||
if self.type.code == TypeCode.TypeCodeTypedef:
|
||||
if self.type.code == TypeCode.Typedef:
|
||||
return self.detypedef().dereference()
|
||||
val = self.dumper.Value(self.dumper)
|
||||
if self.type.code in (TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
|
||||
if self.type.code in (TypeCode.Reference, TypeCode.RValueReference):
|
||||
val.summary = self.summary
|
||||
if self.nativeValue is None:
|
||||
val.laddress = self.pointer()
|
||||
@@ -3167,7 +3190,7 @@ class DumperBase:
|
||||
val.type = self.dumper.nativeDynamicType(val.laddress, self.type.dereference())
|
||||
else:
|
||||
val = self.dumper.nativeValueDereferenceReference(self)
|
||||
elif self.type.code == TypeCode.TypeCodePointer:
|
||||
elif self.type.code == TypeCode.Pointer:
|
||||
if self.nativeValue is None:
|
||||
val.laddress = self.pointer()
|
||||
val.type = self.dumper.nativeDynamicType(val.laddress, self.type.dereference())
|
||||
@@ -3184,7 +3207,7 @@ class DumperBase:
|
||||
|
||||
def detypedef(self):
|
||||
self.check()
|
||||
if self.type.code != TypeCode.TypeCodeTypedef:
|
||||
if self.type.code != TypeCode.Typedef:
|
||||
raise RuntimeError("WRONG")
|
||||
val = self.copy()
|
||||
val.type = self.type.ltarget
|
||||
@@ -3282,6 +3305,7 @@ class DumperBase:
|
||||
(pp, size, fields) = self.dumper.describeStruct(pattern)
|
||||
#DumperBase.warn('SIZE: %s ' % size)
|
||||
result = struct.unpack_from(self.dumper.packCode + pp, self.data(size))
|
||||
|
||||
def structFixer(field, thing):
|
||||
#DumperBase.warn('STRUCT MEMBER: %s' % type(thing))
|
||||
if field.isStruct:
|
||||
@@ -3330,7 +3354,7 @@ class DumperBase:
|
||||
#DumperBase.warn('REGISTER ALIAS %s FOR %s' % (aliasId, existingTypeId))
|
||||
self.typeData[aliasId] = self.typeData[existingTypeId]
|
||||
|
||||
class TypeData:
|
||||
class TypeData():
|
||||
def __init__(self, dumper):
|
||||
self.dumper = dumper
|
||||
self.lfields = None # None or Value -> list of member Values
|
||||
@@ -3359,7 +3383,7 @@ class DumperBase:
|
||||
tdata.moduleName = self.moduleName
|
||||
return tdata
|
||||
|
||||
class Type:
|
||||
class Type():
|
||||
def __init__(self, dumper, typeId):
|
||||
self.typeId = typeId
|
||||
self.dumper = dumper
|
||||
@@ -3424,7 +3448,7 @@ class DumperBase:
|
||||
tdata = self.typeData()
|
||||
if tdata is None:
|
||||
return None
|
||||
if tdata.code != TypeCode.TypeCodeStruct:
|
||||
if tdata.code != TypeCode.Struct:
|
||||
return None
|
||||
try:
|
||||
vtbl = self.dumper.extractPointer(address)
|
||||
@@ -3448,12 +3472,13 @@ class DumperBase:
|
||||
def check(self):
|
||||
tdata = self.typeData()
|
||||
if tdata is None:
|
||||
raise RuntimeError('TYPE WITHOUT DATA: %s ALL: %s' % (self.typeId, self.dumper.typeData.keys()))
|
||||
raise RuntimeError('TYPE WITHOUT DATA: %s ALL: %s' %
|
||||
(self.typeId, self.dumper.typeData.keys()))
|
||||
if tdata.name is None:
|
||||
raise RuntimeError('TYPE WITHOUT NAME: %s' % self.typeId)
|
||||
|
||||
def dereference(self):
|
||||
if self.code == TypeCode.TypeCodeTypedef:
|
||||
if self.code == TypeCode.Typedef:
|
||||
return self.ltarget.dereference()
|
||||
self.check()
|
||||
return self.ltarget
|
||||
@@ -3501,18 +3526,18 @@ class DumperBase:
|
||||
return res
|
||||
|
||||
def isSimpleType(self):
|
||||
return self.code in (TypeCode.TypeCodeIntegral, TypeCode.TypeCodeFloat, TypeCode.TypeCodeEnum)
|
||||
return self.code in (TypeCode.Integral, TypeCode.Float, TypeCode.Enum)
|
||||
|
||||
def alignment(self):
|
||||
tdata = self.typeData()
|
||||
if tdata.code == TypeCode.TypeCodeTypedef:
|
||||
if tdata.code == TypeCode.Typedef:
|
||||
return tdata.ltarget.alignment()
|
||||
if tdata.code in (TypeCode.TypeCodeIntegral, TypeCode.TypeCodeFloat, TypeCode.TypeCodeEnum):
|
||||
if tdata.code in (TypeCode.Integral, TypeCode.Float, TypeCode.Enum):
|
||||
if tdata.name in ('double', 'long long', 'unsigned long long'):
|
||||
# Crude approximation.
|
||||
return 8 if self.dumper.isWindowsTarget() else self.dumper.ptrSize()
|
||||
return self.size()
|
||||
if tdata.code in (TypeCode.TypeCodePointer, TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
|
||||
if tdata.code in (TypeCode.Pointer, TypeCode.Reference, TypeCode.RValueReference):
|
||||
return self.dumper.ptrSize()
|
||||
if tdata.lalignment is not None:
|
||||
#if isinstance(tdata.lalignment, function): # Does not work that way.
|
||||
@@ -3528,7 +3553,7 @@ class DumperBase:
|
||||
return self.typeData().ltarget
|
||||
|
||||
def stripTypedefs(self):
|
||||
if isinstance(self, self.dumper.Type) and self.code != TypeCode.TypeCodeTypedef:
|
||||
if isinstance(self, self.dumper.Type) and self.code != TypeCode.Typedef:
|
||||
#DumperBase.warn('NO TYPEDEF: %s' % self)
|
||||
return self
|
||||
return self.ltarget
|
||||
@@ -3545,7 +3570,7 @@ class DumperBase:
|
||||
raise RuntimeError('DONT KNOW SIZE: %s' % self)
|
||||
|
||||
def isMovableType(self):
|
||||
if self.code in (TypeCode.TypeCodePointer, TypeCode.TypeCodeIntegral, TypeCode.TypeCodeFloat):
|
||||
if self.code in (TypeCode.Pointer, TypeCode.Integral, TypeCode.Float):
|
||||
return True
|
||||
strippedName = self.dumper.stripNamespaceFromType(self.name)
|
||||
if strippedName in (
|
||||
@@ -3649,7 +3674,7 @@ class DumperBase:
|
||||
tdata.name = targetType.name + '*'
|
||||
tdata.typeId = typeId
|
||||
tdata.lbitsize = 8 * self.ptrSize()
|
||||
tdata.code = TypeCode.TypeCodePointer
|
||||
tdata.code = TypeCode.Pointer
|
||||
tdata.ltarget = targetType
|
||||
self.registerType(typeId, tdata)
|
||||
return self.Type(self, typeId)
|
||||
@@ -3662,7 +3687,7 @@ class DumperBase:
|
||||
tdata = self.TypeData(self)
|
||||
tdata.name = targetType.name + ' &'
|
||||
tdata.typeId = typeId
|
||||
tdata.code = TypeCode.TypeCodeReference
|
||||
tdata.code = TypeCode.Reference
|
||||
tdata.ltarget = targetType
|
||||
tdata.lbitsize = 8 * self.ptrSize() # Needed for Gdb13393 test.
|
||||
#tdata.lbitsize = None
|
||||
@@ -3677,7 +3702,7 @@ class DumperBase:
|
||||
tdata = self.TypeData(self)
|
||||
tdata.name = targetType.name + ' &&'
|
||||
tdata.typeId = typeId
|
||||
tdata.code = TypeCode.TypeCodeRValueReference
|
||||
tdata.code = TypeCode.RValueReference
|
||||
tdata.ltarget = targetType
|
||||
tdata.lbitsize = None
|
||||
self.registerType(typeId, tdata)
|
||||
@@ -3700,7 +3725,7 @@ class DumperBase:
|
||||
tdata = self.TypeData(self)
|
||||
tdata.name = type_name
|
||||
tdata.typeId = type_id
|
||||
tdata.code = TypeCode.TypeCodeArray
|
||||
tdata.code = TypeCode.Array
|
||||
tdata.ltarget = targetType
|
||||
tdata.lbitsize = targetType.lbitsize * count
|
||||
self.registerType(type_id, tdata)
|
||||
@@ -3714,7 +3739,7 @@ class DumperBase:
|
||||
tdata = self.TypeData(self)
|
||||
tdata.name = '%s : %d' % (targetType.typeId, bitsize)
|
||||
tdata.typeId = typeId
|
||||
tdata.code = TypeCode.TypeCodeBitfield
|
||||
tdata.code = TypeCode.Bitfield
|
||||
tdata.ltarget = targetType
|
||||
tdata.lbitsize = bitsize
|
||||
self.registerType(typeId, tdata)
|
||||
@@ -3732,7 +3757,7 @@ class DumperBase:
|
||||
tdata = self.TypeData(self)
|
||||
tdata.name = typeName
|
||||
tdata.typeId = typeId
|
||||
tdata.code = TypeCode.TypeCodeTypedef
|
||||
tdata.code = TypeCode.Typedef
|
||||
tdata.ltarget = targetType
|
||||
tdata.lbitsize = targetType.lbitsize
|
||||
#tdata.lfields = targetType.lfields
|
||||
@@ -3779,7 +3804,6 @@ class DumperBase:
|
||||
if size is not None:
|
||||
typish = ns + typish
|
||||
|
||||
|
||||
tdata = self.typeData.get(typish, None)
|
||||
if tdata is not None:
|
||||
return self.Type(self, typish)
|
||||
@@ -3840,7 +3864,7 @@ class DumperBase:
|
||||
def createVectorItem(self, data, innerTypish):
|
||||
return self.createContainerItem(data, innerTypish, 'QVector')
|
||||
|
||||
class StructBuilder:
|
||||
class StructBuilder():
|
||||
def __init__(self, dumper):
|
||||
self.dumper = dumper
|
||||
self.pattern = ''
|
||||
|
@@ -35,7 +35,6 @@ import re
|
||||
import sys
|
||||
import struct
|
||||
import tempfile
|
||||
import types
|
||||
|
||||
from dumper import DumperBase, Children, toInteger, TopLevelItem
|
||||
from utils import TypeCode
|
||||
@@ -46,6 +45,7 @@ from utils import TypeCode
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
|
||||
def safePrint(output):
|
||||
try:
|
||||
print(output)
|
||||
@@ -61,18 +61,19 @@ def safePrint(output):
|
||||
out += c
|
||||
print(out)
|
||||
|
||||
|
||||
def registerCommand(name, func):
|
||||
|
||||
class Command(gdb.Command):
|
||||
def __init__(self):
|
||||
super(Command, self).__init__(name, gdb.COMMAND_OBSCURE)
|
||||
|
||||
def invoke(self, args, from_tty):
|
||||
safePrint(func(args))
|
||||
|
||||
Command()
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Convenience
|
||||
@@ -83,18 +84,24 @@ def registerCommand(name, func):
|
||||
class PPCommand(gdb.Command):
|
||||
def __init__(self):
|
||||
super(PPCommand, self).__init__('pp', gdb.COMMAND_OBSCURE)
|
||||
|
||||
def invoke(self, args, from_tty):
|
||||
print(theCliDumper.fetchVariable(args))
|
||||
|
||||
|
||||
PPCommand()
|
||||
|
||||
# Just convenience for 'python print gdb.parse_and_eval(...)'
|
||||
|
||||
|
||||
class PPPCommand(gdb.Command):
|
||||
def __init__(self):
|
||||
super(PPPCommand, self).__init__('ppp', gdb.COMMAND_OBSCURE)
|
||||
|
||||
def invoke(self, args, from_tty):
|
||||
print(gdb.parse_and_eval(args))
|
||||
|
||||
|
||||
PPPCommand()
|
||||
|
||||
|
||||
@@ -109,14 +116,17 @@ def scanStack(p, n):
|
||||
p += f.type.sizeof
|
||||
return r
|
||||
|
||||
|
||||
class ScanStackCommand(gdb.Command):
|
||||
def __init__(self):
|
||||
super(ScanStackCommand, self).__init__('scanStack', gdb.COMMAND_OBSCURE)
|
||||
|
||||
def invoke(self, args, from_tty):
|
||||
if len(args) == 0:
|
||||
args = 20
|
||||
safePrint(scanStack(gdb.parse_and_eval('$sp'), int(args)))
|
||||
|
||||
|
||||
ScanStackCommand()
|
||||
|
||||
|
||||
@@ -126,7 +136,7 @@ ScanStackCommand()
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
class PlainDumper:
|
||||
class PlainDumper():
|
||||
def __init__(self, printer):
|
||||
self.printer = printer
|
||||
self.typeCache = {}
|
||||
@@ -162,6 +172,7 @@ class PlainDumper:
|
||||
break
|
||||
d.putNumChild(1)
|
||||
|
||||
|
||||
def importPlainDumpers(args):
|
||||
if args == 'off':
|
||||
try:
|
||||
@@ -172,11 +183,11 @@ def importPlainDumpers(args):
|
||||
else:
|
||||
theDumper.importPlainDumpers()
|
||||
|
||||
|
||||
registerCommand('importPlainDumpers', importPlainDumpers)
|
||||
|
||||
|
||||
|
||||
class OutputSaver:
|
||||
class OutputSaver():
|
||||
def __init__(self, d):
|
||||
self.d = d
|
||||
|
||||
@@ -185,7 +196,7 @@ class OutputSaver:
|
||||
self.d.output = ''
|
||||
|
||||
def __exit__(self, exType, exValue, exTraceBack):
|
||||
if self.d.passExceptions and not exType is None:
|
||||
if self.d.passExceptions and exType is not None:
|
||||
self.d.showException('OUTPUTSAVER', exType, exValue, exTraceBack)
|
||||
self.d.output = self.savedOutput
|
||||
else:
|
||||
@@ -194,7 +205,6 @@ class OutputSaver:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# The Dumper Class
|
||||
@@ -249,7 +259,7 @@ class Dumper(DumperBase):
|
||||
# is surprisingly expensive.
|
||||
val.nativeValue = nativeValue
|
||||
#DumperBase.warn('CREATED PTR 1: %s' % val)
|
||||
if not nativeValue.address is None:
|
||||
if nativeValue.address is not None:
|
||||
val.laddress = toInteger(nativeValue.address)
|
||||
#DumperBase.warn('CREATED PTR 2: %s' % val)
|
||||
return val
|
||||
@@ -272,7 +282,7 @@ class Dumper(DumperBase):
|
||||
val = self.Value(self)
|
||||
|
||||
val.nativeValue = nativeValue
|
||||
if not nativeValue.address is None:
|
||||
if nativeValue.address is not None:
|
||||
val.laddress = toInteger(nativeValue.address)
|
||||
else:
|
||||
size = nativeType.sizeof
|
||||
@@ -355,29 +365,29 @@ class Dumper(DumperBase):
|
||||
tdata.typeId = typeId
|
||||
tdata.lbitsize = nativeType.sizeof * 8
|
||||
tdata.code = {
|
||||
#gdb.TYPE_CODE_TYPEDEF : TypeCodeTypedef, # Handled above.
|
||||
gdb.TYPE_CODE_METHOD : TypeCode.TypeCodeFunction,
|
||||
gdb.TYPE_CODE_VOID : TypeCode.TypeCodeVoid,
|
||||
gdb.TYPE_CODE_FUNC : TypeCode.TypeCodeFunction,
|
||||
gdb.TYPE_CODE_METHODPTR : TypeCode.TypeCodeFunction,
|
||||
gdb.TYPE_CODE_MEMBERPTR : TypeCode.TypeCodeFunction,
|
||||
#gdb.TYPE_CODE_PTR : TypeCode.TypeCodePointer, # Handled above.
|
||||
#gdb.TYPE_CODE_REF : TypeCode.TypeCodeReference, # Handled above.
|
||||
gdb.TYPE_CODE_BOOL : TypeCode.TypeCodeIntegral,
|
||||
gdb.TYPE_CODE_CHAR : TypeCode.TypeCodeIntegral,
|
||||
gdb.TYPE_CODE_INT : TypeCode.TypeCodeIntegral,
|
||||
gdb.TYPE_CODE_FLT : TypeCode.TypeCodeFloat,
|
||||
gdb.TYPE_CODE_ENUM : TypeCode.TypeCodeEnum,
|
||||
#gdb.TYPE_CODE_ARRAY : TypeCode.TypeCodeArray,
|
||||
gdb.TYPE_CODE_STRUCT : TypeCode.TypeCodeStruct,
|
||||
gdb.TYPE_CODE_UNION : TypeCode.TypeCodeStruct,
|
||||
gdb.TYPE_CODE_COMPLEX : TypeCode.TypeCodeComplex,
|
||||
gdb.TYPE_CODE_STRING : TypeCode.TypeCodeFortranString,
|
||||
#gdb.TYPE_CODE_TYPEDEF : TypeCode.Typedef, # Handled above.
|
||||
gdb.TYPE_CODE_METHOD: TypeCode.Function,
|
||||
gdb.TYPE_CODE_VOID: TypeCode.Void,
|
||||
gdb.TYPE_CODE_FUNC: TypeCode.Function,
|
||||
gdb.TYPE_CODE_METHODPTR: TypeCode.Function,
|
||||
gdb.TYPE_CODE_MEMBERPTR: TypeCode.Function,
|
||||
#gdb.TYPE_CODE_PTR : TypeCode.Pointer, # Handled above.
|
||||
#gdb.TYPE_CODE_REF : TypeCode.Reference, # Handled above.
|
||||
gdb.TYPE_CODE_BOOL: TypeCode.Integral,
|
||||
gdb.TYPE_CODE_CHAR: TypeCode.Integral,
|
||||
gdb.TYPE_CODE_INT: TypeCode.Integral,
|
||||
gdb.TYPE_CODE_FLT: TypeCode.Float,
|
||||
gdb.TYPE_CODE_ENUM: TypeCode.Enum,
|
||||
#gdb.TYPE_CODE_ARRAY : TypeCode.Array,
|
||||
gdb.TYPE_CODE_STRUCT: TypeCode.Struct,
|
||||
gdb.TYPE_CODE_UNION: TypeCode.Struct,
|
||||
gdb.TYPE_CODE_COMPLEX: TypeCode.Complex,
|
||||
gdb.TYPE_CODE_STRING: TypeCode.FortranString,
|
||||
}[code]
|
||||
if tdata.code == TypeCode.TypeCodeEnum:
|
||||
if tdata.code == TypeCode.Enum:
|
||||
tdata.enumDisplay = lambda intval, addr, form: \
|
||||
self.nativeTypeEnumDisplay(nativeType, intval, form)
|
||||
if tdata.code == TypeCode.TypeCodeStruct:
|
||||
if tdata.code == TypeCode.Struct:
|
||||
tdata.lalignment = lambda: \
|
||||
self.nativeStructAlignment(nativeType)
|
||||
tdata.lfields = lambda value: \
|
||||
@@ -460,7 +470,6 @@ class Dumper(DumperBase):
|
||||
align = handleItem(f.type, align)
|
||||
return align
|
||||
|
||||
|
||||
#except:
|
||||
# # Happens in the BoostList dumper for a 'const bool'
|
||||
# # item named 'constant_time_size'. There isn't anything we can do
|
||||
@@ -469,7 +478,6 @@ class Dumper(DumperBase):
|
||||
|
||||
#yield value.extractField(field)
|
||||
|
||||
|
||||
def memberFromNativeFieldAndValue(self, nativeField, nativeValue, fieldName, value):
|
||||
nativeMember = self.nativeMemberFromField(nativeValue, nativeField)
|
||||
if nativeMember is None:
|
||||
@@ -567,8 +575,6 @@ class Dumper(DumperBase):
|
||||
bitsize=bitsize, bitpos=bitpos, type=fieldType,
|
||||
extractor=extractor)
|
||||
|
||||
|
||||
|
||||
def listLocals(self, partialVar):
|
||||
frame = gdb.selected_frame()
|
||||
|
||||
@@ -597,7 +603,7 @@ class Dumper(DumperBase):
|
||||
if name in ('__in_chrg', '__PRETTY_FUNCTION__'):
|
||||
continue
|
||||
|
||||
if not partialVar is None and partialVar != name:
|
||||
if partialVar is not None and partialVar != name:
|
||||
continue
|
||||
|
||||
# 'NotImplementedError: Symbol type not yet supported in
|
||||
@@ -650,7 +656,7 @@ class Dumper(DumperBase):
|
||||
|
||||
# The outermost block in a function has the function member
|
||||
# FIXME: check whether this is guaranteed.
|
||||
if not block.function is None:
|
||||
if block.function is not None:
|
||||
break
|
||||
|
||||
block = block.superblock
|
||||
@@ -777,7 +783,7 @@ class Dumper(DumperBase):
|
||||
|
||||
def makeStdString(init):
|
||||
# Works only for small allocators, but they are usually empty.
|
||||
gdb.execute('set $d=(std::string*)calloc(sizeof(std::string), 2)');
|
||||
gdb.execute('set $d=(std::string*)calloc(sizeof(std::string), 2)')
|
||||
gdb.execute('call($d->basic_string("' + init +
|
||||
'",*(std::allocator<char>*)(1+$d)))')
|
||||
value = gdb.parse_and_eval('$d').dereference()
|
||||
@@ -896,6 +902,7 @@ class Dumper(DumperBase):
|
||||
|
||||
def createSpecialBreakpoints(self, args):
|
||||
self.specialBreakpoints = []
|
||||
|
||||
def newSpecial(spec):
|
||||
# GDB < 8.1 does not have the 'qualified' parameter here,
|
||||
# GDB >= 8.1 applies some generous pattern matching, hitting
|
||||
@@ -913,7 +920,9 @@ class Dumper(DumperBase):
|
||||
class SpecialBreakpoint(gdb.Breakpoint):
|
||||
def __init__(self, spec):
|
||||
super(SpecialBreakpoint, self).__init__(spec,
|
||||
gdb.BP_BREAKPOINT, internal=True, qualified=True)
|
||||
gdb.BP_BREAKPOINT,
|
||||
internal=True,
|
||||
qualified=True)
|
||||
self.spec = spec
|
||||
|
||||
def stop(self):
|
||||
@@ -999,7 +1008,6 @@ class Dumper(DumperBase):
|
||||
# oldthread.switch()
|
||||
#return out + ']'
|
||||
|
||||
|
||||
def importPlainDumper(self, printer):
|
||||
name = printer.name.replace('::', '__')
|
||||
self.qqDumpers[name] = PlainDumper(printer)
|
||||
@@ -1024,9 +1032,9 @@ class Dumper(DumperBase):
|
||||
def handleNewObjectFile(self, objfile):
|
||||
name = objfile.filename
|
||||
if self.isWindowsTarget():
|
||||
qtCoreMatch = re.match('.*Qt5?Core[^/.]*d?\.dll', name)
|
||||
qtCoreMatch = re.match(r'.*Qt5?Core[^/.]*d?\.dll', name)
|
||||
else:
|
||||
qtCoreMatch = re.match('.*/libQt5?Core[^/.]*\.so', name)
|
||||
qtCoreMatch = re.match(r'.*/libQt5?Core[^/.]*\.so', name)
|
||||
|
||||
if qtCoreMatch is not None:
|
||||
self.addDebugLibs(objfile)
|
||||
@@ -1043,7 +1051,6 @@ class Dumper(DumperBase):
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def handleQtCoreLoaded(self, objfile):
|
||||
fd, tmppath = tempfile.mkstemp()
|
||||
os.close(fd)
|
||||
@@ -1063,14 +1070,14 @@ class Dumper(DumperBase):
|
||||
if line.find('msgHandlerGrabbed ') >= 0:
|
||||
# [11] b 0x7ffff683c000 _ZN4MynsL17msgHandlerGrabbedE
|
||||
# section .tbss Myns::msgHandlerGrabbed qlogging.cpp
|
||||
ns = re.split('_ZN?(\d*)(\w*)L17msgHandlerGrabbedE? ', line)[2]
|
||||
ns = re.split(r'_ZN?(\d*)(\w*)L17msgHandlerGrabbedE? ', line)[2]
|
||||
if len(ns):
|
||||
ns += '::'
|
||||
break
|
||||
if line.find('currentThreadData ') >= 0:
|
||||
# [ 0] b 0x7ffff67d3000 _ZN2UUL17currentThreadDataE
|
||||
# section .tbss UU::currentThreadData qthread_unix.cpp\\n
|
||||
ns = re.split('_ZN?(\d*)(\w*)L17currentThreadDataE? ', line)[2]
|
||||
ns = re.split(r'_ZN?(\d*)(\w*)L17currentThreadDataE? ', line)[2]
|
||||
if len(ns):
|
||||
ns += '::'
|
||||
break
|
||||
@@ -1179,14 +1186,14 @@ class Dumper(DumperBase):
|
||||
|
||||
def lookupNativeType(self, typeName):
|
||||
nativeType = self.lookupNativeTypeHelper(typeName)
|
||||
if not nativeType is None:
|
||||
if nativeType is not None:
|
||||
self.check(isinstance(nativeType, gdb.Type))
|
||||
return nativeType
|
||||
|
||||
def lookupNativeTypeHelper(self, typeName):
|
||||
typeobj = self.typeCache.get(typeName)
|
||||
#DumperBase.warn('LOOKUP 1: %s -> %s' % (typeName, typeobj))
|
||||
if not typeobj is None:
|
||||
if typeobj is not None:
|
||||
return typeobj
|
||||
|
||||
if typeName == 'void':
|
||||
@@ -1212,7 +1219,7 @@ class Dumper(DumperBase):
|
||||
ts = typeName
|
||||
ts = ts.replace('{anonymous}', '(anonymous namespace)')
|
||||
typeobj = self.lookupNativeType(ts)
|
||||
if not typeobj is None:
|
||||
if typeobj is not None:
|
||||
self.typeCache[typeName] = typeobj
|
||||
self.typesToReport[typeName] = typeobj
|
||||
return typeobj
|
||||
@@ -1248,7 +1255,7 @@ class Dumper(DumperBase):
|
||||
|
||||
if ts.endswith('*'):
|
||||
typeobj = self.lookupNativeType(ts[0:-1])
|
||||
if not typeobj is None:
|
||||
if typeobj is not None:
|
||||
typeobj = typeobj.pointer()
|
||||
self.typeCache[typeName] = typeobj
|
||||
self.typesToReport[typeName] = typeobj
|
||||
@@ -1271,7 +1278,7 @@ class Dumper(DumperBase):
|
||||
#DumperBase.warn("LOOKING UP '%s' FAILED" % ts)
|
||||
pass
|
||||
|
||||
if not typeobj is None:
|
||||
if typeobj is not None:
|
||||
#DumperBase.warn('CACHING: %s' % typeobj)
|
||||
self.typeCache[typeName] = typeobj
|
||||
self.typesToReport[typeName] = typeobj
|
||||
@@ -1347,7 +1354,7 @@ class Dumper(DumperBase):
|
||||
if sal:
|
||||
line = sal.line
|
||||
symtab = sal.symtab
|
||||
if not symtab is None:
|
||||
if symtab is not None:
|
||||
objfile = fromNativePath(symtab.objfile.filename)
|
||||
fullname = symtab.fullname()
|
||||
if fullname is None:
|
||||
@@ -1423,7 +1430,6 @@ class Dumper(DumperBase):
|
||||
'from __main__ import theDumper', number=10))
|
||||
|
||||
|
||||
|
||||
class CliDumper(Dumper):
|
||||
def __init__(self):
|
||||
Dumper.__init__(self)
|
||||
@@ -1473,6 +1479,7 @@ theCliDumper = CliDumper()
|
||||
def threadnames(arg):
|
||||
return theDumper.threadnames(int(arg))
|
||||
|
||||
|
||||
registerCommand('threadnames', threadnames)
|
||||
|
||||
#######################################################################
|
||||
@@ -1481,6 +1488,7 @@ registerCommand('threadnames', threadnames)
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
|
||||
class InterpreterMessageBreakpoint(gdb.Breakpoint):
|
||||
def __init__(self):
|
||||
spec = 'qt_qmlDebugMessageAvailable'
|
||||
@@ -1501,6 +1509,7 @@ class InterpreterMessageBreakpoint(gdb.Breakpoint):
|
||||
def new_objfile_handler(event):
|
||||
return theDumper.handleNewObjectFile(event.new_objfile)
|
||||
|
||||
|
||||
gdb.events.new_objfile.connect(new_objfile_handler)
|
||||
|
||||
|
||||
|
@@ -52,6 +52,7 @@ from dumper import DumperBase, SubItem, Children, TopLevelItem
|
||||
|
||||
qqWatchpointOffset = 10000
|
||||
|
||||
|
||||
def fileNameAsString(file):
|
||||
return str(file) if file.IsValid() else ''
|
||||
|
||||
@@ -60,6 +61,7 @@ def check(exp):
|
||||
if not exp:
|
||||
raise RuntimeError('Check failed')
|
||||
|
||||
|
||||
class Dumper(DumperBase):
|
||||
def __init__(self, debugger=None):
|
||||
DumperBase.__init__(self)
|
||||
@@ -176,7 +178,7 @@ class Dumper(DumperBase):
|
||||
else:
|
||||
val = self.Value(self)
|
||||
address = nativeValue.GetLoadAddress()
|
||||
if not address is None:
|
||||
if address is not None:
|
||||
val.laddress = address
|
||||
if True:
|
||||
data = nativeValue.GetData()
|
||||
@@ -434,32 +436,32 @@ class Dumper(DumperBase):
|
||||
tdata.lbitsize = nativeType.GetByteSize() * 8
|
||||
if code == lldb.eTypeClassBuiltin:
|
||||
if utils.isFloatingPointTypeName(typeName):
|
||||
tdata.code = TypeCode.TypeCodeFloat
|
||||
tdata.code = TypeCode.Float
|
||||
elif utils.isIntegralTypeName(typeName):
|
||||
tdata.code = TypeCode.TypeCodeIntegral
|
||||
tdata.code = TypeCode.Integral
|
||||
elif typeName in ('__int128', 'unsigned __int128'):
|
||||
tdata.code = TypeCode.TypeCodeIntegral
|
||||
tdata.code = TypeCode.Integral
|
||||
elif typeName == 'void':
|
||||
tdata.code = TypeCode.TypeCodeVoid
|
||||
tdata.code = TypeCode.Void
|
||||
else:
|
||||
self.warn('UNKNOWN TYPE KEY: %s: %s' % (typeName, code))
|
||||
elif code == lldb.eTypeClassEnumeration:
|
||||
tdata.code = TypeCode.TypeCodeEnum
|
||||
tdata.code = TypeCode.Enum
|
||||
tdata.enumDisplay = lambda intval, addr, form: \
|
||||
self.nativeTypeEnumDisplay(nativeType, intval, form)
|
||||
elif code in (lldb.eTypeClassComplexInteger, lldb.eTypeClassComplexFloat):
|
||||
tdata.code = TypeCode.TypeCodeComplex
|
||||
tdata.code = TypeCode.Complex
|
||||
elif code in (lldb.eTypeClassClass, lldb.eTypeClassStruct, lldb.eTypeClassUnion):
|
||||
tdata.code = TypeCode.TypeCodeStruct
|
||||
tdata.code = TypeCode.Struct
|
||||
tdata.lalignment = lambda: \
|
||||
self.nativeStructAlignment(nativeType)
|
||||
tdata.lfields = lambda value: \
|
||||
self.listMembers(value, nativeType)
|
||||
tdata.templateArguments = self.listTemplateParametersHelper(nativeType)
|
||||
elif code == lldb.eTypeClassFunction:
|
||||
tdata.code = TypeCode.TypeCodeFunction
|
||||
tdata.code = TypeCode.Function
|
||||
elif code == lldb.eTypeClassMemberPointer:
|
||||
tdata.code = TypeCode.TypeCodeMemberPointer
|
||||
tdata.code = TypeCode.MemberPointer
|
||||
|
||||
self.registerType(typeId, tdata) # Fix up fields and template args
|
||||
# warn('CREATE TYPE: %s' % typeId)
|
||||
@@ -489,7 +491,8 @@ class Dumper(DumperBase):
|
||||
# eTemplateArgumentKindExpression,
|
||||
# eTemplateArgumentKindPack
|
||||
if kind == lldb.eTemplateArgumentKindType:
|
||||
innerType = nativeType.GetTemplateArgumentType(i).GetUnqualifiedType().GetCanonicalType()
|
||||
innerType = nativeType.GetTemplateArgumentType(
|
||||
i).GetUnqualifiedType().GetCanonicalType()
|
||||
targs.append(self.fromNativeType(innerType))
|
||||
#elif kind == lldb.eTemplateArgumentKindIntegral:
|
||||
# innerType = nativeType.GetTemplateArgumentType(i).GetUnqualifiedType().GetCanonicalType()
|
||||
@@ -753,7 +756,7 @@ class Dumper(DumperBase):
|
||||
def lookupNativeType(self, name):
|
||||
#DumperBase.warn('LOOKUP TYPE NAME: %s' % name)
|
||||
typeobj = self.typeCache.get(name)
|
||||
if not typeobj is None:
|
||||
if typeobj is not None:
|
||||
#DumperBase.warn('CACHED: %s' % name)
|
||||
return typeobj
|
||||
typeobj = self.target.FindFirstType(name)
|
||||
@@ -927,7 +930,7 @@ class Dumper(DumperBase):
|
||||
# better to mirror that and wait for the spontaneous stop.
|
||||
self.reportState('enginerunandinferiorrunok')
|
||||
elif self.startMode_ == DebuggerStartMode.AttachCore:
|
||||
coreFile = args.get('coreFile', '');
|
||||
coreFile = args.get('coreFile', '')
|
||||
self.process = self.target.LoadCore(coreFile)
|
||||
if self.process.IsValid():
|
||||
self.reportState('enginerunokandinferiorunrunnable')
|
||||
@@ -952,8 +955,8 @@ class Dumper(DumperBase):
|
||||
broadcaster.AddListener(listener, lldb.SBProcess.eBroadcastBitStateChanged)
|
||||
listener.StartListeningForEvents(broadcaster, lldb.SBProcess.eBroadcastBitStateChanged)
|
||||
broadcaster.AddListener(listener, lldb.SBTarget.eBroadcastBitBreakpointChanged)
|
||||
listener.StartListeningForEvents(broadcaster, lldb.SBTarget.eBroadcastBitBreakpointChanged)
|
||||
|
||||
listener.StartListeningForEvents(
|
||||
broadcaster, lldb.SBTarget.eBroadcastBitBreakpointChanged)
|
||||
|
||||
def loop(self):
|
||||
event = lldb.SBEvent()
|
||||
@@ -968,7 +971,6 @@ class Dumper(DumperBase):
|
||||
#if listener.WaitForEventForBroadcaster(0, broadcaster, event):
|
||||
# self.handleEvent(event)
|
||||
|
||||
|
||||
def describeError(self, error):
|
||||
desc = lldb.SBStream()
|
||||
error.GetDescription(desc)
|
||||
@@ -1118,11 +1120,9 @@ class Dumper(DumperBase):
|
||||
# logview pane feature.
|
||||
self.report('token(\"%s\")' % args["token"])
|
||||
|
||||
|
||||
def reportBreakpointUpdate(self, bp):
|
||||
self.report('breakpointmodified={%s}' % self.describeBreakpoint(bp))
|
||||
|
||||
|
||||
def readRawMemory(self, address, size):
|
||||
if size == 0:
|
||||
return bytes()
|
||||
@@ -1295,7 +1295,6 @@ class Dumper(DumperBase):
|
||||
self.process.Kill()
|
||||
self.reportResult('', args)
|
||||
|
||||
|
||||
def handleBreakpointEvent(self, event):
|
||||
eventType = lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event)
|
||||
# handle only the resolved locations for now..
|
||||
@@ -1304,7 +1303,6 @@ class Dumper(DumperBase):
|
||||
if bp is not None:
|
||||
self.reportBreakpointUpdate(bp)
|
||||
|
||||
|
||||
def handleEvent(self, event):
|
||||
if lldb.SBBreakpoint.EventIsBreakpointEvent(event):
|
||||
self.handleBreakpointEvent(event)
|
||||
@@ -1321,7 +1319,8 @@ class Dumper(DumperBase):
|
||||
flavor = event.GetDataFlavor()
|
||||
state = lldb.SBProcess.GetStateFromEvent(event)
|
||||
bp = lldb.SBBreakpoint.GetBreakpointFromEvent(event)
|
||||
skipEventReporting = eventType in (lldb.SBProcess.eBroadcastBitSTDOUT, lldb.SBProcess.eBroadcastBitSTDERR)
|
||||
skipEventReporting = eventType in (
|
||||
lldb.SBProcess.eBroadcastBitSTDOUT, lldb.SBProcess.eBroadcastBitSTDERR)
|
||||
self.report('event={type="%s",data="%s",msg="%s",flavor="%s",state="%s",bp="%s"}'
|
||||
% (eventType, out.GetData(), msg, flavor, self.stateName(state), bp))
|
||||
|
||||
@@ -1347,7 +1346,7 @@ class Dumper(DumperBase):
|
||||
resolver()
|
||||
self.report("AUTO-CONTINUE AFTER RESOLVING")
|
||||
self.reportState("inferiorstopok")
|
||||
self.process.Continue();
|
||||
self.process.Continue()
|
||||
return
|
||||
if functionName == "::qt_qmlDebugMessageAvailable()":
|
||||
self.report("ASYNC MESSAGE FROM SERVICE")
|
||||
@@ -1355,7 +1354,7 @@ class Dumper(DumperBase):
|
||||
if not res:
|
||||
self.report("EVENT NEEDS NO STOP")
|
||||
self.reportState("stopped")
|
||||
self.process.Continue();
|
||||
self.process.Continue()
|
||||
return
|
||||
if self.isInterrupting_:
|
||||
self.isInterrupting_ = False
|
||||
@@ -1904,12 +1903,14 @@ class Tester(Dumper):
|
||||
|
||||
# ------------------------------ For use in LLDB ------------------------------
|
||||
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
__module__ = sys.modules[__name__]
|
||||
DEBUG = False if not hasattr(__module__, 'DEBUG') else DEBUG
|
||||
|
||||
class LogMixin:
|
||||
|
||||
class LogMixin():
|
||||
@staticmethod
|
||||
def log(message='', log_caller=False, frame=1, args=''):
|
||||
if not DEBUG:
|
||||
@@ -1928,10 +1929,12 @@ class LogMixin:
|
||||
def log_fn(arg_str=''):
|
||||
LogMixin.log(log_caller=True, frame=2, args=arg_str)
|
||||
|
||||
|
||||
class DummyDebugger(object):
|
||||
def __getattr__(self, attr):
|
||||
raise AttributeError("Debugger should not be needed to create summaries")
|
||||
|
||||
|
||||
class SummaryDumper(Dumper, LogMixin):
|
||||
_instance = None
|
||||
_lock = threading.RLock()
|
||||
@@ -2021,6 +2024,7 @@ class SummaryDumper(Dumper, LogMixin):
|
||||
|
||||
return summary
|
||||
|
||||
|
||||
class SummaryProvider(LogMixin):
|
||||
|
||||
DEFAULT_SUMMARY = ''
|
||||
@@ -2028,7 +2032,7 @@ class SummaryProvider(LogMixin):
|
||||
|
||||
@staticmethod
|
||||
def provide_summary(valobj, internal_dict, options=None):
|
||||
if not __name__ in internal_dict:
|
||||
if __name__ not in internal_dict:
|
||||
# When disabling the import of the Qt summary providers, the
|
||||
# summary functions are still registered with LLDB, and we will
|
||||
# get callbacks to provide summaries, but at this point the child
|
||||
@@ -2122,8 +2126,15 @@ class SummaryProvider(LogMixin):
|
||||
return "<failed to decode '%s' as '%s'>" % (summaryValue, encoding)
|
||||
|
||||
# FIXME: Support these
|
||||
other_encodings = ['int', 'uint', 'float', 'juliandate', 'juliandateandmillisecondssincemidnight',
|
||||
'millisecondssincemidnight', 'ipv6addressandhexscopeid', 'datetimeinternal']
|
||||
other_encodings = [
|
||||
'int',
|
||||
'uint',
|
||||
'float',
|
||||
'juliandate',
|
||||
'juliandateandmillisecondssincemidnight',
|
||||
'millisecondssincemidnight',
|
||||
'ipv6addressandhexscopeid',
|
||||
'datetimeinternal']
|
||||
|
||||
summaryValue += " <encoding='%s'>" % encoding
|
||||
|
||||
@@ -2136,6 +2147,7 @@ class SummaryProvider(LogMixin):
|
||||
|
||||
return summaryValue.strip()
|
||||
|
||||
|
||||
class SyntheticChildrenProvider(SummaryProvider):
|
||||
def __init__(self, valobj, dict):
|
||||
SummaryProvider.__init__(self, valobj, expand=True)
|
||||
@@ -2196,8 +2208,8 @@ class SyntheticChildrenProvider(SummaryProvider):
|
||||
|
||||
# Create as void* so that the value is fully initialized before
|
||||
# we trigger our own summary/child providers recursively.
|
||||
value = self.valobj.synthetic_child_from_address(name, address,
|
||||
SummaryProvider.VOID_PTR_TYPE).Cast(value_type)
|
||||
value = self.valobj.synthetic_child_from_address(
|
||||
name, address, SummaryProvider.VOID_PTR_TYPE).Cast(value_type)
|
||||
else:
|
||||
self.log("Don't know how to create value for child %s" % child)
|
||||
# FIXME: Figure out if we ever will hit this case, and deal with it
|
||||
@@ -2219,7 +2231,7 @@ class SyntheticChildrenProvider(SummaryProvider):
|
||||
|
||||
dereference_child = None
|
||||
for child in self.summary['children']:
|
||||
if not child or not type(child) is dict:
|
||||
if not child or not isinstance(child, dict):
|
||||
continue
|
||||
|
||||
# Skip base classes, they are built-in children
|
||||
@@ -2257,6 +2269,7 @@ class SyntheticChildrenProvider(SummaryProvider):
|
||||
self.valobj = self.create_value(dereference_child)
|
||||
self.update()
|
||||
|
||||
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
# Module is being imported in an LLDB session
|
||||
dumper = SummaryDumper.initialize()
|
||||
@@ -2266,24 +2279,24 @@ def __lldb_init_module(debugger, internal_dict):
|
||||
# Concrete types
|
||||
summary_function = "%s.%s.%s" % (__name__, 'SummaryProvider', 'provide_summary')
|
||||
types = map(lambda x: x.replace('__', '::'), dumper.qqDumpers)
|
||||
debugger.HandleCommand("type summary add -F %s -w %s %s" \
|
||||
debugger.HandleCommand("type summary add -F %s -w %s %s"
|
||||
% (summary_function, type_category, ' '.join(types)))
|
||||
|
||||
regex_types = list(map(lambda x: "'" + x + "'", dumper.qqDumpersEx.keys()))
|
||||
if regex_types:
|
||||
debugger.HandleCommand("type summary add -x -F %s -w %s %s" \
|
||||
debugger.HandleCommand("type summary add -x -F %s -w %s %s"
|
||||
% (summary_function, type_category, ' '.join(regex_types)))
|
||||
|
||||
# Global catch-all for Qt classes
|
||||
debugger.HandleCommand("type summary add -x '^Q.*$' -F %s -w %s" \
|
||||
debugger.HandleCommand("type summary add -x '^Q.*$' -F %s -w %s"
|
||||
% (summary_function, type_category))
|
||||
|
||||
# Named summary ('frame variable foo --summary Qt')
|
||||
debugger.HandleCommand("type summary add --name Qt -F %s -w %s" \
|
||||
debugger.HandleCommand("type summary add --name Qt -F %s -w %s"
|
||||
% (summary_function, type_category))
|
||||
|
||||
# Synthetic children
|
||||
debugger.HandleCommand("type synthetic add -x '^Q.*$' -l %s -w %s" \
|
||||
debugger.HandleCommand("type synthetic add -x '^Q.*$' -l %s -w %s"
|
||||
% ("lldbbridge.SyntheticChildrenProvider", type_category))
|
||||
|
||||
debugger.HandleCommand('type category enable %s' % type_category)
|
||||
|
@@ -33,36 +33,43 @@ import re
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
|
||||
def qdump____m128(d, value):
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
d.putArrayData(value.address(), 4, d.lookupType('float'))
|
||||
|
||||
|
||||
def qdump____m256(d, value):
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
d.putArrayData(value.address(), 8, d.lookupType('float'))
|
||||
|
||||
|
||||
def qdump____m512(d, value):
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
d.putArrayData(value.address(), 16, d.lookupType('float'))
|
||||
|
||||
|
||||
def qdump____m128d(d, value):
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
d.putArrayData(value.address(), 2, d.lookupType('double'))
|
||||
|
||||
|
||||
def qdump____m256d(d, value):
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
d.putArrayData(value.address(), 4, d.lookupType('double'))
|
||||
|
||||
|
||||
def qdump____m512d(d, value):
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
d.putArrayData(value.address(), 8, d.lookupType('double'))
|
||||
|
||||
|
||||
def qdump____m128i(d, value):
|
||||
data = d.hexencode(value.data(16))
|
||||
d.putValue(':'.join('%04x' % int(data[i:i + 4], 16) for i in range(0, 32, 4)))
|
||||
@@ -74,6 +81,7 @@ def qdump____m128i(d, value):
|
||||
d.putArrayItem('uint32x4', addr, 4, 'unsigned int')
|
||||
d.putArrayItem('uint64x2', addr, 2, 'unsigned long long')
|
||||
|
||||
|
||||
def qdump____m256i(d, value):
|
||||
data = d.hexencode(value.data(32))
|
||||
d.putValue(':'.join('%04x' % int(data[i:i + 4], 16) for i in range(0, 64, 4)))
|
||||
@@ -85,6 +93,7 @@ def qdump____m256i(d, value):
|
||||
d.putArrayItem('uint32x8', addr, 8, 'unsigned int')
|
||||
d.putArrayItem('uint64x4', addr, 4, 'unsigned long long')
|
||||
|
||||
|
||||
def qdump____m512i(d, value):
|
||||
data = d.hexencode(value.data(64))
|
||||
d.putValue(':'.join('%04x' % int(data[i:i + 4], 16) for i in range(0, 64, 4))
|
||||
@@ -100,8 +109,10 @@ def qdump____m512i(d, value):
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
|
||||
def qform__std__array():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__gsl__span(d, value):
|
||||
size, pointer = value.split('pp')
|
||||
@@ -109,6 +120,7 @@ def qdump__gsl__span(d, value):
|
||||
if d.isExpanded():
|
||||
d.putPlotData(pointer, size, value.type[0])
|
||||
|
||||
|
||||
def qdump__gsl__byte(d, value):
|
||||
d.putNumChild(0)
|
||||
d.putValue(value.integer())
|
||||
@@ -122,6 +134,7 @@ def qdump__gsl__byte(d, value):
|
||||
#def qform__Eigen__Matrix():
|
||||
# return 'Transposed'
|
||||
|
||||
|
||||
def qdump__Eigen__Matrix(d, value):
|
||||
innerType = value.type[0]
|
||||
argRow = value.type[1]
|
||||
@@ -185,9 +198,10 @@ def qdump__NimStringDesc(d, value):
|
||||
d.putBetterType('string')
|
||||
d.putCharArrayHelper(data, size, d.createType('char'), 'utf8')
|
||||
|
||||
def qdump__NimGenericSequence__(d, value, regex = '^TY[\d]+$'):
|
||||
|
||||
def qdump__NimGenericSequence__(d, value, regex=r'^TY[\d]+$'):
|
||||
code = value.type.stripTypedefs().code
|
||||
if code == TypeCode.TypeCodeStruct:
|
||||
if code == TypeCode.Struct:
|
||||
size, reserved = d.split('pp', value)
|
||||
data = value.address() + 2 * d.ptrSize()
|
||||
typeobj = value['data'].type.dereference()
|
||||
@@ -198,6 +212,7 @@ def qdump__NimGenericSequence__(d, value, regex = '^TY[\d]+$'):
|
||||
d.putEmptyValue()
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__TNimNode(d, value):
|
||||
name = value['name'].pointer()
|
||||
d.putSimpleCharArray(name) if name != 0 else d.putEmptyValue()
|
||||
@@ -222,6 +237,7 @@ def qdump__TNimNode(d, value):
|
||||
def cleanDType(type):
|
||||
return str(type).replace('uns long long', 'string')
|
||||
|
||||
|
||||
def qdump_Array(d, value):
|
||||
n = value['length']
|
||||
p = value['ptr']
|
||||
@@ -322,6 +338,7 @@ def qdump__KDSoapValue1(d, value):
|
||||
d.putStringValue(inner['m_name'])
|
||||
d.putPlainChildren(inner)
|
||||
|
||||
|
||||
def qdump__KDSoapValue(d, value):
|
||||
p = (value.cast(d.lookupType('char*')) + 4).dereference().cast(d.lookupType('QString'))
|
||||
d.putStringValue(p)
|
||||
@@ -528,6 +545,7 @@ def qdump__PyVarObject(d, value):
|
||||
def qdump__QtcDumperTest_FieldAccessByIndex(d, value):
|
||||
d.putValue(value["d"][2].integer())
|
||||
|
||||
|
||||
def qdump__QtcDumperTest_PointerArray(d, value):
|
||||
foos = value["foos"]
|
||||
d.putItemCount(10)
|
||||
@@ -536,6 +554,7 @@ def qdump__QtcDumperTest_PointerArray(d, value):
|
||||
for i in d.childRange():
|
||||
d.putSubItem(i, foos[i])
|
||||
|
||||
|
||||
def qdump__QtcDumperTest_BufArray(d, value):
|
||||
maxItems = 1000
|
||||
buffer = value['buffer']
|
||||
@@ -549,6 +568,7 @@ def qdump__QtcDumperTest_BufArray(d, value):
|
||||
for i in d.childRange():
|
||||
d.putSubItem(i, (buffer + (i * objsize)).dereference().cast(valueType))
|
||||
|
||||
|
||||
def qdump__QtcDumperTest_List__NodeX(d, value):
|
||||
typename = value.type.unqualified().name
|
||||
pos0 = typename.find('<')
|
||||
@@ -563,6 +583,7 @@ def qdump__QtcDumperTest_List__NodeX(d, value):
|
||||
d.putFields(value)
|
||||
#d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QtcDumperTest_List(d, value):
|
||||
innerType = value.type[0]
|
||||
d.putNumChild(1)
|
||||
@@ -574,6 +595,7 @@ def qdump__QtcDumperTest_List(d, value):
|
||||
d.putFields(value)
|
||||
#d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QtcDumperTest_String(d, value):
|
||||
with Children(d):
|
||||
first = d.hexdecode(d.putSubItem('first', value['first']).value)
|
||||
|
@@ -26,12 +26,15 @@
|
||||
from dumper import Children, SubItem
|
||||
from utils import TypeCode, DisplayFormat
|
||||
|
||||
|
||||
def qdump__cv__Size_(d, value):
|
||||
d.putValue('(%s, %s)' % (value[0].display(), value[1].display()))
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qform__cv__Mat():
|
||||
return [DisplayFormat.SeparateFormat]
|
||||
return [DisplayFormat.Separate]
|
||||
|
||||
|
||||
def qdump__cv__Mat(d, value):
|
||||
(flag, dims, rows, cols, data, refcount, datastart, dataend,
|
||||
@@ -44,7 +47,7 @@ def qdump__cv__Mat(d, value):
|
||||
d.putPlainChildren(value)
|
||||
return
|
||||
|
||||
if d.currentItemFormat() == DisplayFormat.SeparateFormat:
|
||||
if d.currentItemFormat() == DisplayFormat.Separate:
|
||||
rs = steps[0] * innerSize
|
||||
cs = cols * innerSize
|
||||
dform = 'arraydata:separate:int:%d::2:%d:%d' % (innerSize, cols, rows)
|
||||
@@ -54,7 +57,7 @@ def qdump__cv__Mat(d, value):
|
||||
d.putValue('(%s x %s)' % (rows, cols))
|
||||
if d.isExpanded():
|
||||
with Children(d):
|
||||
innerType = d.createType(TypeCode.TypeCodeIntegral, innerSize)
|
||||
innerType = d.createType(TypeCode.Integral, innerSize)
|
||||
for i in range(rows):
|
||||
for j in range(cols):
|
||||
with SubItem(d, None):
|
||||
|
@@ -41,7 +41,7 @@ class QuitException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class QtcInternalBreakpoint:
|
||||
class QtcInternalBreakpoint():
|
||||
"""Breakpoint class.
|
||||
Breakpoints are indexed by number through bpbynumber and by
|
||||
the file,line tuple using bplist. The former points to a
|
||||
@@ -193,7 +193,7 @@ class _rstr(str):
|
||||
return self
|
||||
|
||||
|
||||
class QtcInternalDumper:
|
||||
class QtcInternalDumper():
|
||||
identchars = string.ascii_letters + string.digits + '_'
|
||||
lastcmd = ''
|
||||
use_rawinput = 1
|
||||
|
@@ -28,6 +28,7 @@ import re
|
||||
from dumper import Children, SubItem, UnnamedSubItem, toInteger
|
||||
from utils import DisplayFormat
|
||||
|
||||
|
||||
def qdump__QAtomicInt(d, value):
|
||||
d.putValue(value.integer())
|
||||
d.putNumChild(0)
|
||||
@@ -44,33 +45,36 @@ def qdump__QAtomicPointer(d, value):
|
||||
|
||||
|
||||
def qform__QByteArray():
|
||||
return [DisplayFormat.Latin1StringFormat, DisplayFormat.SeparateLatin1StringFormat,
|
||||
DisplayFormat.Utf8StringFormat, DisplayFormat.SeparateUtf8StringFormat ]
|
||||
return [DisplayFormat.Latin1String, DisplayFormat.SeparateLatin1String,
|
||||
DisplayFormat.Utf8String, DisplayFormat.SeparateUtf8String]
|
||||
|
||||
|
||||
def qedit__QByteArray(d, value, data):
|
||||
d.call('void', value, 'resize', str(len(data)))
|
||||
(base, size, alloc) = d.stringData(value)
|
||||
d.setValues(base, 'char', [ord(c) for c in data])
|
||||
|
||||
|
||||
def qdump__QByteArray(d, value):
|
||||
data, size, alloc = d.byteArrayData(value)
|
||||
d.check(alloc == 0 or (0 <= size and size <= alloc and alloc <= 100000000))
|
||||
d.putNumChild(size)
|
||||
elided, p = d.encodeByteArrayHelper(d.extractPointer(value), d.displayStringLimit)
|
||||
displayFormat = d.currentItemFormat()
|
||||
if displayFormat == DisplayFormat.AutomaticFormat or displayFormat == DisplayFormat.Latin1StringFormat:
|
||||
if displayFormat == DisplayFormat.Automatic or displayFormat == DisplayFormat.Latin1String:
|
||||
d.putValue(p, 'latin1', elided=elided)
|
||||
elif displayFormat == DisplayFormat.SeparateLatin1StringFormat:
|
||||
elif displayFormat == DisplayFormat.SeparateLatin1String:
|
||||
d.putValue(p, 'latin1', elided=elided)
|
||||
d.putDisplay('latin1:separate', d.encodeByteArray(value, limit=100000))
|
||||
elif displayFormat == DisplayFormat.Utf8StringFormat:
|
||||
elif displayFormat == DisplayFormat.Utf8String:
|
||||
d.putValue(p, 'utf8', elided=elided)
|
||||
elif displayFormat == DisplayFormat.SeparateUtf8StringFormat:
|
||||
elif displayFormat == DisplayFormat.SeparateUtf8String:
|
||||
d.putValue(p, 'utf8', elided=elided)
|
||||
d.putDisplay('utf8:separate', d.encodeByteArray(value, limit=100000))
|
||||
if d.isExpanded():
|
||||
d.putArrayData(data, size, d.charType())
|
||||
|
||||
|
||||
def qdump__QArrayData(d, value):
|
||||
data, size, alloc = d.byteArrayDataHelper(value.address())
|
||||
d.check(alloc == 0 or (0 <= size and size <= alloc and alloc <= 100000000))
|
||||
@@ -78,6 +82,7 @@ def qdump__QArrayData(d, value):
|
||||
d.putNumChild(1)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QByteArrayData(d, value):
|
||||
qdump__QArrayData(d, value)
|
||||
|
||||
@@ -103,14 +108,15 @@ def qdump__QChar(d, value):
|
||||
|
||||
|
||||
def qform_X_QAbstractItemModel():
|
||||
return [DisplayFormat.SimpleFormat, DisplayFormat.EnhancedFormat]
|
||||
return [DisplayFormat.Simple, DisplayFormat.Enhanced]
|
||||
|
||||
|
||||
def qdump_X_QAbstractItemModel(d, value):
|
||||
displayFormat = d.currentItemFormat()
|
||||
if displayFormat == DisplayFormat.SimpleFormat:
|
||||
if displayFormat == DisplayFormat.Simple:
|
||||
d.putPlainChildren(value)
|
||||
return
|
||||
#displayFormat == EnhancedFormat:
|
||||
#displayFormat == Enhanced:
|
||||
# Create a default-constructed QModelIndex on the stack.
|
||||
try:
|
||||
ri = d.pokeValue(d.qtNamespace() + 'QModelIndex', '-1, -1, 0, 0')
|
||||
@@ -136,12 +142,14 @@ def qdump_X_QAbstractItemModel(d, value):
|
||||
i = i + 1
|
||||
#gdb.execute('call free($ri)')
|
||||
|
||||
|
||||
def qform_X_QModelIndex():
|
||||
return [DisplayFormat.SimpleFormat, DisplayFormat.EnhancedFormat]
|
||||
return [DisplayFormat.Simple, DisplayFormat.Enhanced]
|
||||
|
||||
|
||||
def qdump_X_QModelIndex(d, value):
|
||||
displayFormat = d.currentItemFormat()
|
||||
if displayFormat == DisplayFormat.SimpleFormat:
|
||||
if displayFormat == DisplayFormat.Simple:
|
||||
d.putPlainChildren(value)
|
||||
return
|
||||
r = value['r']
|
||||
@@ -193,6 +201,7 @@ def qdump_X_QModelIndex(d, value):
|
||||
d.putCallItem('parent', '@QModelIndex', value, 'parent')
|
||||
#gdb.execute('call free($mi)')
|
||||
|
||||
|
||||
def qdump__Qt__ItemDataRole(d, value):
|
||||
d.putEnumValue(value.integer(), {
|
||||
0: "Qt::DisplayRole",
|
||||
@@ -221,10 +230,12 @@ def qdump__Qt__ItemDataRole(d, value):
|
||||
0x100: "Qt::UserRole"
|
||||
})
|
||||
|
||||
|
||||
def qdump__QStandardItemData(d, value):
|
||||
role, pad, val = value.split('{@Qt::ItemDataRole}@{QVariant}')
|
||||
d.putPairContents(role.value(), (role, val), 'role', 'value')
|
||||
|
||||
|
||||
def qdump__QStandardItem(d, value):
|
||||
vtable, dptr = value.split('pp')
|
||||
# There used to be a virtual destructor that got removed in
|
||||
@@ -325,7 +336,14 @@ def qdump__QDateTime(d, value):
|
||||
spec = (status & 0x30) >> 4
|
||||
isValid = True
|
||||
|
||||
d.putValue('%s/%s/%s/%s/%s/%s' % (msecs, spec, offsetFromUtc, timeZone, status, tiVersion),
|
||||
d.putValue(
|
||||
'%s/%s/%s/%s/%s/%s' %
|
||||
(msecs,
|
||||
spec,
|
||||
offsetFromUtc,
|
||||
timeZone,
|
||||
status,
|
||||
tiVersion),
|
||||
'datetimeinternal')
|
||||
else:
|
||||
if d.isWindowsTarget():
|
||||
@@ -507,6 +525,7 @@ def qdump__QEvent(d, value):
|
||||
# Show the rest of the class fields as usual.
|
||||
d.putFields(value)
|
||||
|
||||
|
||||
def qdump__QKeyEvent(d, value):
|
||||
# QEvent fields
|
||||
# virtual table pointer
|
||||
@@ -757,7 +776,8 @@ def qdump__QFixed(d, value):
|
||||
|
||||
|
||||
def qform__QFiniteStack():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__QFiniteStack(d, value):
|
||||
array, alloc, size = value.split('pii')
|
||||
@@ -775,14 +795,17 @@ def qdump__QFlags(d, value):
|
||||
|
||||
|
||||
def qform__QHash():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__QHash(d, value):
|
||||
qdumpHelper_QHash(d, value, value.type[0], value.type[1])
|
||||
|
||||
|
||||
def qdump__QVariantHash(d, value):
|
||||
qdumpHelper_QHash(d, value, d.createType('QString'), d.createType('QVariant'))
|
||||
|
||||
|
||||
def qdumpHelper_QHash(d, value, keyType, valueType):
|
||||
def hashDataFirstNode():
|
||||
b = buckets
|
||||
@@ -835,11 +858,13 @@ def qdumpHelper_QHash(d, value, keyType, valueType):
|
||||
|
||||
|
||||
def qform__QHashNode():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__QHashNode(d, value):
|
||||
d.putPairItem(None, value)
|
||||
|
||||
|
||||
def qHashIteratorHelper(d, value):
|
||||
typeName = value.type.name
|
||||
hashTypeName = typeName[0:typeName.rfind('::')]
|
||||
@@ -861,9 +886,11 @@ def qHashIteratorHelper(d, value):
|
||||
d.putSubItem('key', key)
|
||||
d.putSubItem('value', val)
|
||||
|
||||
|
||||
def qdump__QHash__const_iterator(d, value):
|
||||
qHashIteratorHelper(d, value)
|
||||
|
||||
|
||||
def qdump__QHash__iterator(d, value):
|
||||
qHashIteratorHelper(d, value)
|
||||
|
||||
@@ -921,7 +948,7 @@ def qdump__QHostAddress(d, value):
|
||||
a, n3 = divmod(a, 256)
|
||||
a, n2 = divmod(a, 256)
|
||||
a, n1 = divmod(a, 256)
|
||||
d.putValue('%d.%d.%d.%d' % (n1, n2, n3, n4));
|
||||
d.putValue('%d.%d.%d.%d' % (n1, n2, n3, n4))
|
||||
else:
|
||||
d.putValue('<unspecified protocol %s>' % protocol)
|
||||
|
||||
@@ -941,15 +968,19 @@ def qdump__QIPv6Address(d, value):
|
||||
d.putValue(':'.join('%x' % int(data[i:i + 4], 16) for i in range(0, 32, 4)))
|
||||
d.putArrayData(value.address(), 16, d.lookupType('unsigned char'))
|
||||
|
||||
|
||||
def qform__QList():
|
||||
return [DisplayFormat.DirectQListStorageFormat, DisplayFormat.IndirectQListStorageFormat]
|
||||
return [DisplayFormat.DirectQListStorage, DisplayFormat.IndirectQListStorage]
|
||||
|
||||
|
||||
def qdump__QList(d, value):
|
||||
return qdumpHelper_QList(d, value, value.type[0])
|
||||
|
||||
|
||||
def qdump__QVariantList(d, value):
|
||||
qdumpHelper_QList(d, value, d.createType('QVariant'))
|
||||
|
||||
|
||||
def qdumpHelper_QList(d, value, innerType):
|
||||
base = d.extractPointer(value)
|
||||
(ref, alloc, begin, end) = d.split('IIII', base)
|
||||
@@ -972,9 +1003,9 @@ def qdumpHelper_QList(d, value, innerType):
|
||||
# in the frontend.
|
||||
# So as first approximation only do the 'isLarge' check:
|
||||
displayFormat = d.currentItemFormat()
|
||||
if displayFormat == DisplayFormat.DirectQListStorageFormat:
|
||||
if displayFormat == DisplayFormat.DirectQListStorage:
|
||||
isInternal = True
|
||||
elif displayFormat == DisplayFormat.IndirectQListStorageFormat:
|
||||
elif displayFormat == DisplayFormat.IndirectQListStorage:
|
||||
isInternal = False
|
||||
else:
|
||||
isInternal = innerSize <= stepSize and innerType.isMovableType()
|
||||
@@ -994,14 +1025,16 @@ def qdumpHelper_QList(d, value, innerType):
|
||||
x = d.createValue(p, innerType)
|
||||
d.putSubItem(i, x)
|
||||
|
||||
|
||||
def qform__QImage():
|
||||
return [DisplayFormat.SimpleFormat, DisplayFormat.SeparateFormat]
|
||||
return [DisplayFormat.Simple, DisplayFormat.Separate]
|
||||
|
||||
|
||||
def qdump__QImage(d, value):
|
||||
if d.qtVersion() < 0x050000:
|
||||
(vtbl, painters, imageData) = value.split('ppp');
|
||||
(vtbl, painters, imageData) = value.split('ppp')
|
||||
else:
|
||||
(vtbl, painters, reserved, imageData) = value.split('pppp');
|
||||
(vtbl, painters, reserved, imageData) = value.split('pppp')
|
||||
|
||||
if imageData == 0:
|
||||
d.putValue('(invalid)')
|
||||
@@ -1024,7 +1057,7 @@ def qdump__QImage(d, value):
|
||||
d.putType('void *')
|
||||
|
||||
displayFormat = d.currentItemFormat()
|
||||
if displayFormat == DisplayFormat.SeparateFormat:
|
||||
if displayFormat == DisplayFormat.Separate:
|
||||
d.putDisplay('imagedata:separate', '%08x%08x%08x%08x' % (width, height, nbytes, iformat)
|
||||
+ d.readMemory(bits, nbytes))
|
||||
|
||||
@@ -1032,8 +1065,8 @@ def qdump__QImage(d, value):
|
||||
def qdump__QLinkedList(d, value):
|
||||
dd = d.extractPointer(value)
|
||||
ptrSize = d.ptrSize()
|
||||
n = d.extractInt(dd + 4 + 2 * ptrSize);
|
||||
ref = d.extractInt(dd + 2 * ptrSize);
|
||||
n = d.extractInt(dd + 4 + 2 * ptrSize)
|
||||
ref = d.extractInt(dd + 2 * ptrSize)
|
||||
d.check(0 <= n and n <= 100 * 1000 * 1000)
|
||||
d.check(-1 <= ref and ref <= 1000)
|
||||
d.putItemCount(n)
|
||||
@@ -1045,8 +1078,10 @@ def qdump__QLinkedList(d, value):
|
||||
d.putSubItem(i, d.createValue(pp + 2 * ptrSize, innerType))
|
||||
pp = d.extractPointer(pp)
|
||||
|
||||
|
||||
qqLocalesCount = None
|
||||
|
||||
|
||||
def qdump__QLocale(d, value):
|
||||
if d.isMsvcTarget(): # as long as this dumper relies on calling functions skip it for cdb
|
||||
return
|
||||
@@ -1167,41 +1202,52 @@ def qdumpHelper_Qt5_QMap(d, value, keyType, valueType):
|
||||
|
||||
|
||||
def qform__QMap():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__QMap(d, value):
|
||||
qdumpHelper_QMap(d, value, value.type[0], value.type[1])
|
||||
|
||||
|
||||
def qdumpHelper_QMap(d, value, keyType, valueType):
|
||||
if d.qtVersion() < 0x50000:
|
||||
qdumpHelper_Qt4_QMap(d, value, keyType, valueType)
|
||||
else:
|
||||
qdumpHelper_Qt5_QMap(d, value, keyType, valueType)
|
||||
|
||||
|
||||
def qform__QMultiMap():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__QMultiMap(d, value):
|
||||
qdump__QMap(d, value)
|
||||
|
||||
|
||||
def qform__QVariantMap():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__QVariantMap(d, value):
|
||||
qdumpHelper_QMap(d, value, d.createType('QString'), d.createType('QVariant'))
|
||||
|
||||
|
||||
def qdump__QMetaMethod(d, value):
|
||||
d.putQMetaStuff(value, 'QMetaMethod')
|
||||
|
||||
|
||||
def qdump__QMetaEnum(d, value):
|
||||
d.putQMetaStuff(value, 'QMetaEnum')
|
||||
|
||||
|
||||
def qdump__QMetaProperty(d, value):
|
||||
d.putQMetaStuff(value, 'QMetaProperty')
|
||||
|
||||
|
||||
def qdump__QMetaClassInfo(d, value):
|
||||
d.putQMetaStuff(value, 'QMetaClassInfo')
|
||||
|
||||
|
||||
def qdump__QMetaObject(d, value):
|
||||
d.putEmptyValue()
|
||||
d.putNumChild(1)
|
||||
@@ -1236,11 +1282,12 @@ def qdump__QProcEnvKey(d, value):
|
||||
d.putByteArrayValue(value)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QPixmap(d, value):
|
||||
if d.qtVersion() < 0x050000:
|
||||
(vtbl, painters, dataPtr) = value.split('ppp');
|
||||
(vtbl, painters, dataPtr) = value.split('ppp')
|
||||
else:
|
||||
(vtbl, painters, reserved, dataPtr) = s = d.split('pppp', value);
|
||||
(vtbl, painters, reserved, dataPtr) = s = d.split('pppp', value)
|
||||
if dataPtr == 0:
|
||||
d.putValue('(invalid)')
|
||||
else:
|
||||
@@ -1265,14 +1312,14 @@ def qdump__QPointF(d, value):
|
||||
|
||||
|
||||
def qdump__QRect(d, value):
|
||||
pp = lambda l: ('+' if l >= 0 else '') + str(l)
|
||||
def pp(l): return ('+' if l >= 0 else '') + str(l)
|
||||
(x1, y1, x2, y2) = d.split('iiii', value)
|
||||
d.putValue('%sx%s%s%s' % (x2 - x1 + 1, y2 - y1 + 1, pp(x1), pp(y1)))
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QRectF(d, value):
|
||||
pp = lambda l: ('+' if l >= 0 else '') + str(l)
|
||||
def pp(l): return ('+' if l >= 0 else '') + str(l)
|
||||
(x, y, w, h) = value.split('dddd')
|
||||
d.putValue('%sx%s%s%s' % (w, h, pp(x), pp(y)))
|
||||
d.putPlainChildren(value)
|
||||
@@ -1422,11 +1469,11 @@ def qdump__QSharedDataPointer(d, value):
|
||||
d.putItem(d_ptr.dereference())
|
||||
|
||||
|
||||
|
||||
def qdump__QSize(d, value):
|
||||
d.putValue('(%s, %s)' % value.split('ii'))
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QSizeF(d, value):
|
||||
d.putValue('(%s, %s)' % value.split('dd'))
|
||||
d.putPlainChildren(value)
|
||||
@@ -1445,6 +1492,7 @@ def qdump__QSizePolicy__Policy(d, value):
|
||||
13: 'QSizePolicy::Ignored (ShrinkFlag|GrowFlag|IgnoreFlag)',
|
||||
})
|
||||
|
||||
|
||||
def qdump__QSizePolicy(d, value):
|
||||
bits = value.integer()
|
||||
d.putEmptyValue(-99)
|
||||
@@ -1458,21 +1506,25 @@ def qdump__QSizePolicy(d, value):
|
||||
|
||||
|
||||
def qform__QStack():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__QStack(d, value):
|
||||
qdump__QVector(d, value)
|
||||
|
||||
|
||||
def qdump__QPolygonF(d, value):
|
||||
data, size, alloc = d.vectorDataHelper(d.extractPointer(value))
|
||||
d.putItemCount(size)
|
||||
d.putPlotData(data, size, d.createType('QPointF'))
|
||||
|
||||
|
||||
def qdump__QPolygon(d, value):
|
||||
data, size, alloc = d.vectorDataHelper(d.extractPointer(value))
|
||||
d.putItemCount(size)
|
||||
d.putPlotData(data, size, d.createType('QPoint'))
|
||||
|
||||
|
||||
def qdump__QGraphicsPolygonItem(d, value):
|
||||
(vtbl, dptr) = value.split('pp')
|
||||
# Assume sizeof(QGraphicsPolygonItemPrivate) == 400
|
||||
@@ -1486,36 +1538,42 @@ def qdump__QGraphicsPolygonItem(d, value):
|
||||
d.putItemCount(size)
|
||||
d.putPlotData(data, size, d.createType('QPointF'))
|
||||
|
||||
|
||||
def qedit__QString(d, value, data):
|
||||
d.call('void', value, 'resize', str(len(data)))
|
||||
(base, size, alloc) = d.stringData(value)
|
||||
d.setValues(base, 'short', [ord(c) for c in data])
|
||||
|
||||
|
||||
def qform__QString():
|
||||
return [DisplayFormat.SimpleFormat, DisplayFormat.SeparateFormat]
|
||||
return [DisplayFormat.Simple, DisplayFormat.Separate]
|
||||
|
||||
|
||||
def qdump__QString(d, value):
|
||||
d.putStringValue(value)
|
||||
(data, size, alloc) = d.stringData(value)
|
||||
d.putNumChild(size)
|
||||
displayFormat = d.currentItemFormat()
|
||||
if displayFormat == DisplayFormat.SeparateFormat:
|
||||
if displayFormat == DisplayFormat.Separate:
|
||||
d.putDisplay('utf16:separate', d.encodeString(value, limit=100000))
|
||||
if d.isExpanded():
|
||||
d.putArrayData(data, size, d.createType('QChar'))
|
||||
|
||||
|
||||
def qdump__QStaticStringData(d, value):
|
||||
size = value.type[0]
|
||||
(ref, size, alloc, pad, offset, data) = value.split('iii@p%ss' % (2 * size))
|
||||
d.putValue(d.hexencode(data), 'utf16')
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QTypedArrayData(d, value):
|
||||
if value.type[0].name == 'unsigned short':
|
||||
qdump__QStringData(d, value)
|
||||
else:
|
||||
qdump__QArrayData(d, value)
|
||||
|
||||
|
||||
def qdump__QStringData(d, value):
|
||||
(ref, size, alloc, pad, offset) = value.split('III@p')
|
||||
elided, shown = d.computeLimit(size, d.displayStringLimit)
|
||||
@@ -1524,10 +1582,12 @@ def qdump__QStringData(d, value):
|
||||
d.putNumChild(1)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QHashedString(d, value):
|
||||
qdump__QString(d, value)
|
||||
d.putBetterType(value.type)
|
||||
|
||||
|
||||
def qdump__QQmlRefCount(d, value):
|
||||
d.putItem(value['refCount'])
|
||||
d.putBetterType(value.type)
|
||||
@@ -1536,7 +1596,7 @@ def qdump__QQmlRefCount(d, value):
|
||||
def qdump__QStringRef(d, value):
|
||||
(stringptr, pos, size) = value.split('pii')
|
||||
if stringptr == 0:
|
||||
d.putValue('(null)');
|
||||
d.putValue('(null)')
|
||||
d.putNumChild(0)
|
||||
return
|
||||
(data, ssize, alloc) = d.stringData(d.createValue(stringptr, 'QString'))
|
||||
@@ -1596,7 +1656,8 @@ def qdump__QTextDocument(d, value):
|
||||
|
||||
|
||||
def qform__QUrl():
|
||||
return [DisplayFormat.SimpleFormat, DisplayFormat.SeparateFormat]
|
||||
return [DisplayFormat.Simple, DisplayFormat.Separate]
|
||||
|
||||
|
||||
def qdump__QUrl(d, value):
|
||||
privAddress = d.extractPointer(value)
|
||||
@@ -1637,7 +1698,7 @@ def qdump__QUrl(d, value):
|
||||
d.putValue(url, 'utf16')
|
||||
|
||||
displayFormat = d.currentItemFormat()
|
||||
if displayFormat == DisplayFormat.SeparateFormat:
|
||||
if displayFormat == DisplayFormat.Separate:
|
||||
d.putDisplay('utf16:separate', url)
|
||||
|
||||
d.putNumChild(1)
|
||||
@@ -1666,36 +1727,43 @@ def qdumpHelper_QVariant_0(d, value):
|
||||
d.putBetterType('%sQVariant (invalid)' % d.qtNamespace())
|
||||
d.putValue('(invalid)')
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_1(d, value):
|
||||
# QVariant::Bool
|
||||
d.putBetterType('%sQVariant (bool)' % d.qtNamespace())
|
||||
d.putValue('true' if value.to('b') else 'false')
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_2(d, value):
|
||||
# QVariant::Int
|
||||
d.putBetterType('%sQVariant (int)' % d.qtNamespace())
|
||||
d.putValue(value.to('i'))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_3(d, value):
|
||||
# uint
|
||||
d.putBetterType('%sQVariant (uint)' % d.qtNamespace())
|
||||
d.putValue(value.to('I'))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_4(d, value):
|
||||
# qlonglong
|
||||
d.putBetterType('%sQVariant (qlonglong)' % d.qtNamespace())
|
||||
d.putValue(value.to('q'))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_5(d, value):
|
||||
# qulonglong
|
||||
d.putBetterType('%sQVariant (qulonglong)' % d.qtNamespace())
|
||||
d.putValue(value.to('Q'))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_6(d, value):
|
||||
# QVariant::Double
|
||||
d.putBetterType('%sQVariant (double)' % d.qtNamespace())
|
||||
d.putValue(value.to('d'))
|
||||
|
||||
|
||||
qdumpHelper_QVariants_A = [
|
||||
qdumpHelper_QVariant_0,
|
||||
qdumpHelper_QVariant_1,
|
||||
@@ -1732,11 +1800,13 @@ qdumpHelper_QVariants_B = [
|
||||
'QVariantHash', # 28
|
||||
]
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_31(d, value):
|
||||
# QVariant::VoidStar
|
||||
d.putBetterType('%sQVariant (void *)' % d.qtNamespace())
|
||||
d.putValue('0x%x' % d.extractPointer(value))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_32(d, value):
|
||||
# QVariant::Long
|
||||
d.putBetterType('%sQVariant (long)' % d.qtNamespace())
|
||||
@@ -1745,16 +1815,19 @@ def qdumpHelper_QVariant_32(d, value):
|
||||
else:
|
||||
d.putValue('%s' % d.extractInt64(value)) # sic!
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_33(d, value):
|
||||
# QVariant::Short
|
||||
d.putBetterType('%sQVariant (short)' % d.qtNamespace())
|
||||
d.putValue('%s' % d.extractShort(value))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_34(d, value):
|
||||
# QVariant::Char
|
||||
d.putBetterType('%sQVariant (char)' % d.qtNamespace())
|
||||
d.putValue('%s' % d.extractByte(value))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_35(d, value):
|
||||
# QVariant::ULong
|
||||
d.putBetterType('%sQVariant (unsigned long)' % d.qtNamespace())
|
||||
@@ -1763,21 +1836,25 @@ def qdumpHelper_QVariant_35(d, value):
|
||||
else:
|
||||
d.putValue('%s' % d.extractUInt64(value)) # sic!
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_36(d, value):
|
||||
# QVariant::UShort
|
||||
d.putBetterType('%sQVariant (unsigned short)' % d.qtNamespace())
|
||||
d.putValue('%s' % d.extractUShort(value))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_37(d, value):
|
||||
# QVariant::UChar
|
||||
d.putBetterType('%sQVariant (unsigned char)' % d.qtNamespace())
|
||||
d.putValue('%s' % d.extractByte(value))
|
||||
|
||||
|
||||
def qdumpHelper_QVariant_38(d, value):
|
||||
# QVariant::Float
|
||||
d.putBetterType('%sQVariant (float)' % d.qtNamespace())
|
||||
d.putValue(value.to('f'))
|
||||
|
||||
|
||||
qdumpHelper_QVariants_D = [
|
||||
qdumpHelper_QVariant_31,
|
||||
qdumpHelper_QVariant_32,
|
||||
@@ -1819,6 +1896,7 @@ qdumpHelper_QVariants_F = [
|
||||
'QPolygonF' # 86
|
||||
]
|
||||
|
||||
|
||||
def qdump__QVariant(d, value):
|
||||
(data, typeStuff) = d.split('8sI', value)
|
||||
variantType = typeStuff & 0x3fffffff
|
||||
@@ -1885,7 +1963,6 @@ def qdump__QVariant(d, value):
|
||||
|
||||
return innert
|
||||
|
||||
|
||||
# User types.
|
||||
ns = d.qtNamespace()
|
||||
d.putEmptyValue(-99)
|
||||
@@ -1926,7 +2003,7 @@ def qdump__QVariant(d, value):
|
||||
val.laddress = value.laddress
|
||||
d.putSubItem('data', val)
|
||||
|
||||
if not innerType is None:
|
||||
if innerType is not None:
|
||||
d.putBetterType('%sQVariant (%s)' % (ns, innerType))
|
||||
return None
|
||||
|
||||
@@ -1939,7 +2016,7 @@ def qedit__QVector(d, value, data):
|
||||
|
||||
|
||||
def qform__QVector():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__QVector(d, value):
|
||||
@@ -1949,6 +2026,7 @@ def qdump__QVector(d, value):
|
||||
d.putItemCount(size)
|
||||
d.putPlotData(data, size, value.type[0])
|
||||
|
||||
|
||||
if False:
|
||||
def qdump__QObjectConnectionList(d, value):
|
||||
dd = d.extractPointer(value)
|
||||
@@ -1968,15 +2046,18 @@ def qdump__QVarLengthArray(d, value):
|
||||
def qdump__QSharedPointer(d, value):
|
||||
qdump_QWeakPointerHelper(d, value, False)
|
||||
|
||||
|
||||
def qdump__QWeakPointer(d, value):
|
||||
qdump_QWeakPointerHelper(d, value, True)
|
||||
|
||||
|
||||
def qdump__QPointer(d, value):
|
||||
# actually, we'd use value['wp'] instead of value, but since we
|
||||
# only split() on the result and the (sub-)object address is the
|
||||
# same it does not matter but saves some cycles.
|
||||
qdump_QWeakPointerHelper(d, value, True, value.type[0])
|
||||
|
||||
|
||||
def qdump_QWeakPointerHelper(d, value, isWeak, innerType=None):
|
||||
if isWeak:
|
||||
(d_ptr, val) = value.split('pp')
|
||||
@@ -2019,6 +2100,7 @@ def qdump__QXmlAttributes__Attribute(d, value):
|
||||
d.putSubItem('localname', localname)
|
||||
d.putSubItem('value', val)
|
||||
|
||||
|
||||
def qdump__QXmlAttributes(d, value):
|
||||
(vptr, atts) = value.split('pP')
|
||||
innerType = d.createType(d.qtNamespace() + 'QXmlAttributes::Attribute', 4 * d.ptrSize())
|
||||
@@ -2053,7 +2135,7 @@ def qdump__QXmlStreamAttribute(d, value):
|
||||
#######################################################################
|
||||
|
||||
def extractQmlData(d, value):
|
||||
#if value.type.code == TypeCode.TypeCodePointer:
|
||||
#if value.type.code == TypeCode.Pointer:
|
||||
# value = value.dereference()
|
||||
base = value.split('p')[0]
|
||||
#mmdata = d.split('Q', base)[0]
|
||||
@@ -2066,6 +2148,7 @@ def extractQmlData(d, value):
|
||||
#DumperBase.warn('TYOE DATA: %s' % typeName)
|
||||
return d.createValue(base, typeName)
|
||||
|
||||
|
||||
def qdump__QV4__Heap__Base(d, value):
|
||||
mm_data = value.extractPointer()
|
||||
d.putValue('[%s]' % mm_data)
|
||||
@@ -2078,6 +2161,7 @@ def qdump__QV4__Heap__Base(d, value):
|
||||
with SubItem(d, 'nextFree'):
|
||||
d.putItem(d.createValue(mm_data & (~3), value.type))
|
||||
|
||||
|
||||
def qdump__QV4__Heap__String(d, value):
|
||||
# Note: There's also the 'Identifier' case. And the largestSubLength != 0 case.
|
||||
(baseClass, textOrLeft, idOrRight, subtype, stringHash, largestSub, length, mm) \
|
||||
@@ -2088,6 +2172,7 @@ def qdump__QV4__Heap__String(d, value):
|
||||
with Children(d):
|
||||
d.putFields(value)
|
||||
|
||||
|
||||
def qmlPutHeapChildren(d, value):
|
||||
d.putItem(extractQmlData(d, value))
|
||||
|
||||
@@ -2095,6 +2180,7 @@ def qmlPutHeapChildren(d, value):
|
||||
def qdump__QV4__Object(d, value):
|
||||
qmlPutHeapChildren(d, value)
|
||||
|
||||
|
||||
def qdump__QV4__FunctionObject(d, value):
|
||||
#qmlPutHeapChildren(d, value)
|
||||
d.putEmptyValue()
|
||||
@@ -2105,21 +2191,27 @@ def qdump__QV4__FunctionObject(d, value):
|
||||
d.putCallItem('sourceLocation', '@QQmlSourceLocation',
|
||||
value, 'sourceLocation')
|
||||
|
||||
|
||||
def qdump__QV4__CompilationUnit(d, value):
|
||||
qmlPutHeapChildren(d, value)
|
||||
|
||||
|
||||
def qdump__QV4__CallContext(d, value):
|
||||
qmlPutHeapChildren(d, value)
|
||||
|
||||
|
||||
def qdump__QV4__ScriptFunction(d, value):
|
||||
qmlPutHeapChildren(d, value)
|
||||
|
||||
|
||||
def qdump__QV4__SimpleScriptFunction(d, value):
|
||||
qdump__QV4__FunctionObject(d, value)
|
||||
|
||||
|
||||
def qdump__QV4__ExecutionContext(d, value):
|
||||
qmlPutHeapChildren(d, value)
|
||||
|
||||
|
||||
def qdump__QQmlSourceLocation(d, value):
|
||||
(sourceFile, line, col) = value.split('pHH')
|
||||
(data, size, alloc) = d.stringData(value)
|
||||
@@ -2141,10 +2233,12 @@ def qdump__QQmlSourceLocation(d, value):
|
||||
def qdump__QV4__String(d, value):
|
||||
qmlPutHeapChildren(d, value)
|
||||
|
||||
|
||||
def qdump__QV4__Identifier(d, value):
|
||||
d.putStringValue(value)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QV4__PropertyHash(d, value):
|
||||
data = value.extractPointer()
|
||||
(ref, alloc, size, numBits, entries) = d.split('iiiip', data)
|
||||
@@ -2161,14 +2255,17 @@ def qdump__QV4__PropertyHash(d, value):
|
||||
d.putItemCount(n)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QV4__InternalClass__Transition(d, value):
|
||||
identifier = d.createValue(value.extractPointer(), d.qtNamespace() + 'QV4::Identifier')
|
||||
d.putStringValue(identifier)
|
||||
d.putPlainChildren(value)
|
||||
|
||||
|
||||
def qdump__QV4__InternalClassTransition(d, value):
|
||||
qdump__QV4__InternalClass__Transition(d, value)
|
||||
|
||||
|
||||
def qdump__QV4__SharedInternalClassData(d, value):
|
||||
(ref, alloc, size, pad, data) = value.split('iIIip')
|
||||
val = d.createValue(data, value.type[0])
|
||||
@@ -2181,6 +2278,7 @@ def qdump__QV4__SharedInternalClassData(d, value):
|
||||
d.putIntItem('refcount', ref)
|
||||
d.putValue(short.value, short.encoding)
|
||||
|
||||
|
||||
def qdump__QV4__IdentifierTable(d, value):
|
||||
(engine, alloc, size, numBits, pad, entries) = value.split('piiiip')
|
||||
n = 0
|
||||
@@ -2226,12 +2324,14 @@ def QV4_getValue(d, jsval): # (Dumper, QJSValue *jsval) -> QV4::Value *
|
||||
return 0
|
||||
return dd
|
||||
|
||||
|
||||
def QV4_getVariant(d, jsval): # (Dumper, QJSValue *jsval) -> QVariant *
|
||||
dd = d.split('Q', jsval)[0]
|
||||
if dd & 1:
|
||||
return dd & ~3
|
||||
return 0
|
||||
|
||||
|
||||
def QV4_valueForData(d, jsval): # (Dumper, QJSValue *jsval) -> QV4::Value *
|
||||
v = QV4_getValue(d, jsval)
|
||||
if v:
|
||||
@@ -2239,6 +2339,7 @@ def QV4_valueForData(d, jsval): # (Dumper, QJSValue *jsval) -> QV4::Value *
|
||||
d.warn('Not implemented: VARIANT')
|
||||
return 0
|
||||
|
||||
|
||||
def QV4_putObjectValue(d, objectPtr):
|
||||
ns = d.qtNamespace()
|
||||
base = d.extractPointer(objectPtr)
|
||||
@@ -2249,7 +2350,7 @@ def QV4_putObjectValue(d, objectPtr):
|
||||
with Children(d):
|
||||
with SubItem(d, '[raw]'):
|
||||
d.putValue('[0x%x]' % objectPtr)
|
||||
d.putType(' ');
|
||||
d.putType(' ')
|
||||
d.putNumChild(0)
|
||||
d.putIntItem('inlineMemberOffset', inlineMemberOffset)
|
||||
d.putIntItem('inlineMemberSize', inlineMemberSize)
|
||||
@@ -2260,6 +2361,7 @@ def QV4_putObjectValue(d, objectPtr):
|
||||
d.putSubItem('OBJ', d.createValue(objectPtr, ns + 'QV4::Object'))
|
||||
#d.putFields(value)
|
||||
|
||||
|
||||
def qdump__QV4_Object(d, value):
|
||||
ns = d.qtNamespace()
|
||||
d.putEmptyValue()
|
||||
@@ -2271,12 +2373,14 @@ def qdump__QV4_Object(d, value):
|
||||
memberData, arrayData) = d.split('IIpppp', base)
|
||||
d.putValue('PTR: 0x%x' % objectPtr)
|
||||
|
||||
|
||||
def qdump__QV4__Value(d, value):
|
||||
if d.ptrSize() == 4:
|
||||
qdump_32__QV4__Value(d, value)
|
||||
else:
|
||||
qdump_64__QV4__Value(d, value)
|
||||
|
||||
|
||||
def qdump_32__QV4__Value(d, value):
|
||||
# QV4_Masks_SilentNaNBit = 0x00040000
|
||||
# QV4_Masks_NaN_Mask = 0x7ff80000
|
||||
@@ -2311,15 +2415,15 @@ def qdump_32__QV4__Value(d, value):
|
||||
with Children(d):
|
||||
with SubItem(d, '[raw]'):
|
||||
d.putValue('[0x%x]' % v)
|
||||
d.putType(' ');
|
||||
d.putType(' ')
|
||||
d.putNumChild(0)
|
||||
with SubItem(d, '[val]'):
|
||||
d.putValue('[0x%x]' % val)
|
||||
d.putType(' ');
|
||||
d.putType(' ')
|
||||
d.putNumChild(0)
|
||||
with SubItem(d, '[tag]'):
|
||||
d.putValue('[0x%x]' % tag)
|
||||
d.putType(' ');
|
||||
d.putType(' ')
|
||||
d.putNumChild(0)
|
||||
#with SubItem(d, '[vtable]'):
|
||||
# d.putItem(d.createValue(vtable, ns + 'QV4::VTable'))
|
||||
@@ -2327,6 +2431,7 @@ def qdump_32__QV4__Value(d, value):
|
||||
# d.putNumChild(0)
|
||||
d.putFields(value)
|
||||
|
||||
|
||||
def qdump_64__QV4__Value(d, value):
|
||||
dti = d.qtDeclarativeTypeInfoVersion()
|
||||
new = dti is not None and dti >= 2
|
||||
@@ -2439,14 +2544,15 @@ def qdump_64__QV4__Value(d, value):
|
||||
with Children(d):
|
||||
with SubItem(d, '[raw]'):
|
||||
d.putValue('[0x%x]' % v)
|
||||
d.putType(' ');
|
||||
d.putType(' ')
|
||||
d.putNumChild(0)
|
||||
with SubItem(d, '[vtable]'):
|
||||
d.putItem(d.createValue(vtable, ns + 'QV4::VTable'))
|
||||
d.putType(' ');
|
||||
d.putType(' ')
|
||||
d.putNumChild(0)
|
||||
d.putFields(value)
|
||||
|
||||
|
||||
def qdump__QV__PropertyHashData(d, value):
|
||||
(ref, alloc, size, numBits, entries) = value.split('IIIIp')
|
||||
d.putItemCount(size)
|
||||
@@ -2454,6 +2560,7 @@ def qdump__QV__PropertyHashData(d, value):
|
||||
with Children(d):
|
||||
d.putFields(value)
|
||||
|
||||
|
||||
def qdump__QV__PropertyHash(d, value):
|
||||
qdump__QV__PropertyHashData(d, d.createValue(d.extractPointer(), value.type.name + 'Data'))
|
||||
|
||||
@@ -2467,6 +2574,7 @@ def qdump__QV4__Scoped(d, value):
|
||||
# d.putSubItem('[]', d.createValue(value.extractPointer(), innerType))
|
||||
# d.putFields(value)
|
||||
|
||||
|
||||
def qdump__QV4__ScopedString(d, value):
|
||||
innerType = value.type[0]
|
||||
qdump__QV4__String(d, d.createValue(value.extractPointer(), innerType))
|
||||
@@ -2478,6 +2586,7 @@ def qdump__QJSValue(d, value):
|
||||
else:
|
||||
qdump_64__QJSValue(d, value)
|
||||
|
||||
|
||||
def qdump_32__QJSValue(d, value):
|
||||
ns = d.qtNamespace()
|
||||
dd = value.split('I')[0]
|
||||
@@ -2498,10 +2607,11 @@ def qdump_32__QJSValue(d, value):
|
||||
with Children(d):
|
||||
with SubItem(d, '[raw]'):
|
||||
d.putValue('[0x%x]' % dd)
|
||||
d.putType(' ');
|
||||
d.putType(' ')
|
||||
d.putNumChild(0)
|
||||
d.putFields(value)
|
||||
|
||||
|
||||
def qdump_64__QJSValue(d, value):
|
||||
ns = d.qtNamespace()
|
||||
dd = value.split('Q')[0]
|
||||
@@ -2520,10 +2630,11 @@ def qdump_64__QJSValue(d, value):
|
||||
with Children(d):
|
||||
with SubItem(d, '[raw]'):
|
||||
d.putValue('[0x%x]' % dd)
|
||||
d.putType(' ');
|
||||
d.putType(' ')
|
||||
d.putNumChild(0)
|
||||
d.putFields(value)
|
||||
|
||||
|
||||
def qdump__QQmlBinding(d, value):
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
@@ -2566,7 +2677,6 @@ def jstagAsString(tag):
|
||||
return 'Unknown'
|
||||
|
||||
|
||||
|
||||
def qdump__QTJSC__JSValue(d, value):
|
||||
d.putEmptyValue()
|
||||
d.putNumChild(1)
|
||||
@@ -2597,6 +2707,7 @@ def qdump__QTJSC__JSValue(d, value):
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def qdump__QScriptValue(d, value):
|
||||
# structure:
|
||||
# engine QScriptEnginePrivate
|
||||
@@ -2698,6 +2809,7 @@ def qdump__QQmlAccessorProperties__Properties(d, value):
|
||||
def qdumpHelper_qle_cutBits(value, offset, length):
|
||||
return (value >> offset) & ((1 << length) - 1)
|
||||
|
||||
|
||||
def qdump__QJsonPrivate__qle_bitfield(d, value):
|
||||
offset = value.type[0]
|
||||
length = value.type[1]
|
||||
@@ -2705,6 +2817,7 @@ def qdump__QJsonPrivate__qle_bitfield(d, value):
|
||||
d.putValue('%s' % qdumpHelper_qle_cutBits(val, offset, length))
|
||||
d.putNumChild(0)
|
||||
|
||||
|
||||
def qdumpHelper_qle_signedbitfield_value(d, value):
|
||||
offset = value.type[0]
|
||||
length = value.type[1]
|
||||
@@ -2714,10 +2827,12 @@ def qdumpHelper_qle_signedbitfield_value(d, value):
|
||||
val -= (1 << (length - 1))
|
||||
return val
|
||||
|
||||
|
||||
def qdump__QJsonPrivate__qle_signedbitfield(d, value):
|
||||
d.putValue('%s' % qdumpHelper_qle_signedbitfield_value(d, value))
|
||||
d.putNumChild(0)
|
||||
|
||||
|
||||
def qdump__QJsonPrivate__q_littleendian(d, value):
|
||||
d.putValue('%s' % value['val'].integer())
|
||||
d.putNumChild(0)
|
||||
@@ -2767,7 +2882,7 @@ def qdumpHelper_QJsonValue(d, data, base, pv):
|
||||
return
|
||||
if t == 3:
|
||||
d.putType('QJsonValue (String)')
|
||||
data = base + v;
|
||||
data = base + v
|
||||
if latinOrIntValue:
|
||||
length = d.extractUShort(data)
|
||||
d.putValue(d.readMemory(data + 2, length), 'latin1')
|
||||
|
15
share/qtcreator/debugger/setup.cfg
Normal file
@@ -0,0 +1,15 @@
|
||||
[pycodestyle]
|
||||
max-line-length = 100
|
||||
ignore =
|
||||
# E222 - multiple spaces after operator: Used for alignments
|
||||
E222,
|
||||
# E241 - multiple spaces after ',': Used for alignments
|
||||
E241,
|
||||
# E265 - block comment should start with '# ': We have a bunch of #warn(foo) lines
|
||||
# a space after # would leave an incorrect indentation after uncommenting
|
||||
E265,
|
||||
# E402 - module level import not at top of file: Sometimes we need to adjust the sys.path before
|
||||
# we can import
|
||||
E402,
|
||||
# E722 - do not use bare except, specify exception instead: TODO
|
||||
E722
|
@@ -26,8 +26,10 @@
|
||||
from utils import DisplayFormat
|
||||
from dumper import Children, SubItem
|
||||
|
||||
|
||||
def qform__std__array():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__std__array(d, value):
|
||||
size = value.type[1]
|
||||
@@ -37,7 +39,8 @@ def qdump__std__array(d, value):
|
||||
|
||||
|
||||
def qform__std____1__array():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__std____1__array(d, value):
|
||||
qdump__std__array(d, value)
|
||||
@@ -66,6 +69,7 @@ def qdump__std__complex(d, value):
|
||||
d.putSubItem("real", real)
|
||||
d.putSubItem("imag", imag)
|
||||
|
||||
|
||||
def qdump__std____1__complex(d, value):
|
||||
qdump__std__complex(d, value)
|
||||
|
||||
@@ -108,6 +112,7 @@ def qdump__std__deque(d, value):
|
||||
pcur = pfirst
|
||||
pnode = newnode
|
||||
|
||||
|
||||
def qdump__std____1__deque(d, value):
|
||||
mptr, mfirst, mbegin, mend, start, size = value.split("pppptt")
|
||||
d.check(0 <= size and size <= 1000 * 1000 * 1000)
|
||||
@@ -123,6 +128,7 @@ def qdump__std____1__deque(d, value):
|
||||
base = d.extractPointer(mfirst + k * ptrSize)
|
||||
d.putSubItem(i, d.createValue(base + j * innerSize, innerType))
|
||||
|
||||
|
||||
def qdump__std__deque__QNX(d, value):
|
||||
innerType = value.type[0]
|
||||
innerSize = innerType.size()
|
||||
@@ -157,7 +163,8 @@ def qdump__std__deque__QNX(d, value):
|
||||
if mapsize <= block:
|
||||
block -= mapsize
|
||||
d.putSubItem(i, map[block][offset])
|
||||
myoff += 1;
|
||||
myoff += 1
|
||||
|
||||
|
||||
def qdump__std__deque__MSVC(d, value):
|
||||
innerType = value.type[0]
|
||||
@@ -187,6 +194,7 @@ def qdump__std__deque__MSVC(d, value):
|
||||
d.putSubItem(i, d.createValue(address, innerType))
|
||||
myoff += 1
|
||||
|
||||
|
||||
def qdump__std____debug__deque(d, value):
|
||||
qdump__std__deque(d, value)
|
||||
|
||||
@@ -218,6 +226,7 @@ def qdump__std__list(d, value):
|
||||
d.putSubItem(i, d.createValue(p + 2 * d.ptrSize(), innerType))
|
||||
p = d.extractPointer(p)
|
||||
|
||||
|
||||
def qdump__std__list__QNX(d, value):
|
||||
(proxy, head, size) = value.split("ppp")
|
||||
d.putItemCount(size, 1000)
|
||||
@@ -230,12 +239,15 @@ def qdump__std__list__QNX(d, value):
|
||||
d.putSubItem(i, d.createValue(p + 2 * d.ptrSize(), innerType))
|
||||
p = d.extractPointer(p)
|
||||
|
||||
|
||||
def qdump__std____debug__list(d, value):
|
||||
qdump__std__list(d, value)
|
||||
|
||||
|
||||
def qdump__std____cxx11__list(d, value):
|
||||
qdump__std__list(d, value)
|
||||
|
||||
|
||||
def qdump__std____1__list(d, value):
|
||||
if value.type.size() == 3 * d.ptrSize():
|
||||
# C++11 only.
|
||||
@@ -260,8 +272,10 @@ def qdump__std____1__list(d, value):
|
||||
(prev, p, val) = d.split(typeCode, p)
|
||||
d.putSubItem(i, val)
|
||||
|
||||
|
||||
def qform__std__map():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__std__map(d, value):
|
||||
if d.isQnxTarget() or d.isMsvcTarget():
|
||||
@@ -299,6 +313,7 @@ def qdump__std__map(d, value):
|
||||
break
|
||||
node = node["_M_left"]
|
||||
|
||||
|
||||
def qdump_std__map__helper(d, value):
|
||||
(proxy, head, size) = value.split("ppp")
|
||||
d.check(0 <= size and size <= 100 * 1000 * 1000)
|
||||
@@ -307,8 +322,10 @@ def qdump_std__map__helper(d, value):
|
||||
keyType = value.type[0]
|
||||
valueType = value.type[1]
|
||||
pairType = value.type[3][0]
|
||||
|
||||
def helper(node):
|
||||
(left, parent, right, color, isnil, pad, pair) = d.split("pppcc@{%s}" % (pairType.name), node)
|
||||
(left, parent, right, color, isnil, pad, pair) = d.split(
|
||||
"pppcc@{%s}" % (pairType.name), node)
|
||||
if left != head:
|
||||
for res in helper(left):
|
||||
yield res
|
||||
@@ -322,24 +339,31 @@ def qdump_std__map__helper(d, value):
|
||||
for (pair, i) in zip(helper(root), d.childRange()):
|
||||
d.putPairItem(i, pair)
|
||||
|
||||
|
||||
def qdump__std____debug__map(d, value):
|
||||
qdump__std__map(d, value)
|
||||
|
||||
|
||||
def qdump__std____debug__set(d, value):
|
||||
qdump__std__set(d, value)
|
||||
|
||||
|
||||
def qdump__std__multiset(d, value):
|
||||
qdump__std__set(d, value)
|
||||
|
||||
|
||||
def qdump__std____cxx1998__map(d, value):
|
||||
qdump__std__map(d, value)
|
||||
|
||||
|
||||
def qform__std__multimap():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__std__multimap(d, value):
|
||||
return qdump__std__map(d, value)
|
||||
|
||||
|
||||
def qdumpHelper__std__tree__iterator(d, value, isSet=False):
|
||||
treeTypeName = None
|
||||
if value.type.name.endswith("::iterator"):
|
||||
@@ -375,30 +399,39 @@ def qdumpHelper__std__tree__iterator(d, value, isSet=False):
|
||||
d.putSubItem("right", d.createValue(right, nodeType))
|
||||
d.putSubItem("parent", d.createValue(parent, nodeType))
|
||||
|
||||
|
||||
def qdump__std___Rb_tree_iterator(d, value):
|
||||
qdumpHelper__std__tree__iterator(d, value)
|
||||
|
||||
|
||||
def qdump__std___Rb_tree_const_iterator(d, value):
|
||||
qdumpHelper__std__tree__iterator(d, value)
|
||||
|
||||
|
||||
def qdump__std__map__iterator(d, value):
|
||||
qdumpHelper__std__tree__iterator(d, value)
|
||||
|
||||
|
||||
def qdump____gnu_debug___Safe_iterator(d, value):
|
||||
d.putItem(value["_M_current"])
|
||||
|
||||
|
||||
def qdump__std__map__const_iterator(d, value):
|
||||
qdumpHelper__std__tree__iterator(d, value)
|
||||
|
||||
|
||||
def qdump__std__set__iterator(d, value):
|
||||
qdumpHelper__std__tree__iterator(d, value, True)
|
||||
|
||||
|
||||
def qdump__std__set__const_iterator(d, value):
|
||||
qdumpHelper__std__tree__iterator(d, value, True)
|
||||
|
||||
|
||||
def qdump__std____cxx1998__set(d, value):
|
||||
qdump__std__set(d, value)
|
||||
|
||||
|
||||
def qdumpHelper__std__tree__iterator_MSVC(d, value):
|
||||
d.putNumChild(1)
|
||||
d.putEmptyValue()
|
||||
@@ -416,9 +449,11 @@ def qdumpHelper__std__tree__iterator_MSVC(d, value):
|
||||
else:
|
||||
d.putSubItem("value", child)
|
||||
|
||||
|
||||
def qdump__std___Tree_const_iterator(d, value):
|
||||
qdumpHelper__std__tree__iterator_MSVC(d, value)
|
||||
|
||||
|
||||
def qdump__std___Tree_iterator(d, value):
|
||||
qdumpHelper__std__tree__iterator_MSVC(d, value)
|
||||
|
||||
@@ -453,14 +488,17 @@ def qdump__std__set(d, value):
|
||||
while node["_M_left"].pointer() != 0:
|
||||
node = node["_M_left"]
|
||||
|
||||
|
||||
def qdump__std__set__QNX(d, value):
|
||||
(proxy, head, size) = value.split("ppp")
|
||||
d.check(0 <= size and size <= 100 * 1000 * 1000)
|
||||
d.putItemCount(size)
|
||||
if d.isExpanded():
|
||||
childType = value.type[0]
|
||||
|
||||
def helper(node):
|
||||
(left, parent, right, color, isnil, pad, value) = d.split("pppcc@{%s}" % childType.name, node)
|
||||
(left, parent, right, color, isnil, pad, value) = d.split(
|
||||
"pppcc@{%s}" % childType.name, node)
|
||||
if left != head:
|
||||
for res in helper(left):
|
||||
yield res
|
||||
@@ -474,6 +512,7 @@ def qdump__std__set__QNX(d, value):
|
||||
for (item, i) in zip(helper(root), d.childRange()):
|
||||
d.putSubItem(i, item)
|
||||
|
||||
|
||||
def std1TreeMin(d, node):
|
||||
#_NodePtr __tree_min(_NodePtr __x):
|
||||
# while (__x->__left_ != nullptr)
|
||||
@@ -485,6 +524,7 @@ def std1TreeMin(d, node):
|
||||
node = left
|
||||
return node
|
||||
|
||||
|
||||
def std1TreeIsLeftChild(d, node):
|
||||
# bool __tree_is_left_child(_NodePtr __x):
|
||||
# return __x == __x->__parent_->__left_;
|
||||
@@ -508,6 +548,7 @@ def std1TreeNext(d, node):
|
||||
node = node['__parent_']
|
||||
return node['__parent_']
|
||||
|
||||
|
||||
def qdump__std____1__set(d, value):
|
||||
(proxy, head, size) = value.split("ppp")
|
||||
|
||||
@@ -534,11 +575,14 @@ def qdump__std____1__set(d, value):
|
||||
for (i, data) in zip(d.childRange(), in_order_traversal(head)):
|
||||
d.putSubItem(i, data)
|
||||
|
||||
|
||||
def qdump__std____1__multiset(d, value):
|
||||
qdump__std____1__set(d, value)
|
||||
|
||||
|
||||
def qform__std____1__map():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__std____1__map(d, value):
|
||||
try:
|
||||
@@ -574,12 +618,15 @@ def qdump__std____1__map(d, value):
|
||||
for (i, pair) in zip(d.childRange(), in_order_traversal(head)):
|
||||
d.putPairItem(i, pair, 'key', 'value')
|
||||
|
||||
|
||||
def qform__std____1__multimap():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__std____1__multimap(d, value):
|
||||
qdump__std____1__map(d, value)
|
||||
|
||||
|
||||
def qdump__std____1__map__iterator(d, value):
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
@@ -588,9 +635,11 @@ def qdump__std____1__map__iterator(d, value):
|
||||
d.putSubItem('first', node['first'])
|
||||
d.putSubItem('second', node['second'])
|
||||
|
||||
|
||||
def qdump__std____1__map__const_iterator(d, value):
|
||||
qdump__std____1__map__iterator(d, value)
|
||||
|
||||
|
||||
def qdump__std____1__set__iterator(d, value):
|
||||
d.putEmptyValue()
|
||||
d.putNumChild(1)
|
||||
@@ -606,27 +655,34 @@ def qdump__std____1__set__iterator(d, value):
|
||||
node = node.cast(keyType)
|
||||
d.putSubItem('value', node)
|
||||
|
||||
|
||||
def qdump__std____1__set_const_iterator(d, value):
|
||||
qdump__std____1__set__iterator(d, value)
|
||||
|
||||
|
||||
def qdump__std__stack(d, value):
|
||||
d.putItem(value["c"])
|
||||
d.putBetterType(value.type)
|
||||
|
||||
|
||||
def qdump__std____debug__stack(d, value):
|
||||
qdump__std__stack(d, value)
|
||||
|
||||
|
||||
def qdump__std____1__stack(d, value):
|
||||
d.putItem(value["c"])
|
||||
d.putBetterType(value.type)
|
||||
|
||||
|
||||
def qform__std__string():
|
||||
return [DisplayFormat.Latin1StringFormat, DisplayFormat.SeparateLatin1StringFormat,
|
||||
DisplayFormat.Utf8StringFormat, DisplayFormat.SeparateUtf8StringFormat ]
|
||||
return [DisplayFormat.Latin1String, DisplayFormat.SeparateLatin1String,
|
||||
DisplayFormat.Utf8String, DisplayFormat.SeparateUtf8String]
|
||||
|
||||
|
||||
def qdump__std__string(d, value):
|
||||
qdumpHelper_std__string(d, value, d.createType("char"), d.currentItemFormat())
|
||||
|
||||
|
||||
def qdumpHelper_std__string(d, value, charType, format):
|
||||
if d.isQnxTarget():
|
||||
qdumpHelper__std__string__QNX(d, value, charType, format)
|
||||
@@ -654,6 +710,7 @@ def qdumpHelper_std__string(d, value, charType, format):
|
||||
d.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
|
||||
d.putCharArrayHelper(data, size, charType, format)
|
||||
|
||||
|
||||
def qdumpHelper__std__string__QNX(d, value, charType, format):
|
||||
size = value['_Mysize']
|
||||
alloc = value['_Myres']
|
||||
@@ -668,16 +725,18 @@ def qdumpHelper__std__string__QNX(d, value, charType, format):
|
||||
d.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
|
||||
d.putCharArrayHelper(sizePtr, size, charType, format)
|
||||
|
||||
|
||||
def qdumpHelper__std__string__MSVC(d, value, charType, format):
|
||||
(proxy, buffer, size, alloc) = value.split("p16spp");
|
||||
_BUF_SIZE = int(16 / charType.size());
|
||||
(proxy, buffer, size, alloc) = value.split("p16spp")
|
||||
_BUF_SIZE = int(16 / charType.size())
|
||||
d.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
|
||||
if _BUF_SIZE <= alloc:
|
||||
(proxy, data) = value.split("pp");
|
||||
(proxy, data) = value.split("pp")
|
||||
else:
|
||||
data = value.address() + d.ptrSize()
|
||||
d.putCharArrayHelper(data, size, charType, format)
|
||||
|
||||
|
||||
def qdump__std____1__string(d, value):
|
||||
firstByte = value.split('b')[0]
|
||||
if int(firstByte & 1) == 0:
|
||||
@@ -707,9 +766,11 @@ def qdump__std____1__wstring(d, value):
|
||||
def qdump__std____weak_ptr(d, value):
|
||||
return qdump__std__shared_ptr(d, value)
|
||||
|
||||
|
||||
def qdump__std__weak_ptr(d, value):
|
||||
return qdump__std__shared_ptr(d, value)
|
||||
|
||||
|
||||
def qdump__std____1__weak_ptr(d, value):
|
||||
return qdump__std____1__shared_ptr(d, value)
|
||||
|
||||
@@ -727,6 +788,7 @@ def qdump__std__shared_ptr(d, value):
|
||||
d.putItem(i.dereference())
|
||||
d.putBetterType(value.type)
|
||||
|
||||
|
||||
def qdump__std____1__shared_ptr(d, value):
|
||||
i = value["__ptr_"]
|
||||
if i.pointer() == 0:
|
||||
@@ -736,6 +798,7 @@ def qdump__std____1__shared_ptr(d, value):
|
||||
d.putItem(i.dereference())
|
||||
d.putBetterType(value.type)
|
||||
|
||||
|
||||
def qdump__std__unique_ptr(d, value):
|
||||
p = d.extractPointer(value)
|
||||
if p == 0:
|
||||
@@ -745,6 +808,7 @@ def qdump__std__unique_ptr(d, value):
|
||||
d.putItem(d.createValue(p, value.type[0]))
|
||||
d.putBetterType(value.type)
|
||||
|
||||
|
||||
def qdump__std____1__unique_ptr(d, value):
|
||||
qdump__std__unique_ptr(d, value)
|
||||
|
||||
@@ -760,11 +824,14 @@ def qdump__std__pair(d, value):
|
||||
d.putField('keyencoded', key.encoding)
|
||||
d.putValue(value.value, value.encoding)
|
||||
|
||||
|
||||
def qform__std__unordered_map():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qform__std____debug__unordered_map():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__std__unordered_map(d, value):
|
||||
if d.isQnxTarget() or d.isMsvcTarget():
|
||||
@@ -806,6 +873,7 @@ def qdump__std__unordered_map(d, value):
|
||||
p, pad, key, pad, val = d.split(typeCode, p)
|
||||
d.putPairItem(i, (key, val))
|
||||
|
||||
|
||||
def qdump__std____debug__unordered_map(d, value):
|
||||
qdump__std__unordered_map(d, value)
|
||||
|
||||
@@ -813,12 +881,15 @@ def qdump__std____debug__unordered_map(d, value):
|
||||
def qform__std__unordered_multimap():
|
||||
return qform__std__unordered_map()
|
||||
|
||||
|
||||
def qform__std____debug__unordered_multimap():
|
||||
return qform__std____debug__unordered_map()
|
||||
|
||||
|
||||
def qdump__std__unordered_multimap(d, value):
|
||||
qdump__std__unordered_map(d, value)
|
||||
|
||||
|
||||
def qdump__std____debug__unordered_multimap(d, value):
|
||||
qdump__std__unordered_multimap(d, value)
|
||||
|
||||
@@ -861,8 +932,10 @@ def qdump__std__unordered_set(d, value):
|
||||
d.putSubItem(i, d.createValue(p + ptrSize - offset, valueType))
|
||||
p = d.extractPointer(p + offset)
|
||||
|
||||
|
||||
def qform__std____1__unordered_map():
|
||||
return [DisplayFormat.CompactMapFormat]
|
||||
return [DisplayFormat.CompactMap]
|
||||
|
||||
|
||||
def qdump__std____1__unordered_map(d, value):
|
||||
(size, _) = value["__table_"]["__p2_"].split("pp")
|
||||
@@ -909,15 +982,18 @@ def qdump__std____1__unordered_set(d, value):
|
||||
def qdump__std____debug__unordered_set(d, value):
|
||||
qdump__std__unordered_set(d, value)
|
||||
|
||||
|
||||
def qdump__std__unordered_multiset(d, value):
|
||||
qdump__std__unordered_set(d, value)
|
||||
|
||||
|
||||
def qdump__std____debug__unordered_multiset(d, value):
|
||||
qdump__std__unordered_multiset(d, value)
|
||||
|
||||
|
||||
def qform__std__valarray():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__std__valarray(d, value):
|
||||
if d.isMsvcTarget():
|
||||
@@ -929,7 +1005,8 @@ def qdump__std__valarray(d, value):
|
||||
|
||||
|
||||
def qform__std____1__valarray():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__std____1__valarray(d, value):
|
||||
innerType = value.type[0]
|
||||
@@ -940,7 +1017,8 @@ def qdump__std____1__valarray(d, value):
|
||||
|
||||
|
||||
def qform__std__vector():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qedit__std__vector(d, value, data):
|
||||
import gdb
|
||||
@@ -954,12 +1032,14 @@ def qedit__std__vector(d, value, data):
|
||||
cmd = "set (%s[%d])*$d={%s}" % (innerType, n, data)
|
||||
gdb.execute(cmd)
|
||||
|
||||
|
||||
def qdump__std__vector(d, value):
|
||||
if d.isQnxTarget() or d.isMsvcTarget():
|
||||
qdumpHelper__std__vector__QNX(d, value)
|
||||
else:
|
||||
qdumpHelper__std__vector(d, value, False)
|
||||
|
||||
|
||||
def qdumpHelper__std__vector(d, value, isLibCpp):
|
||||
innerType = value.type[0]
|
||||
isBool = innerType.name == 'bool'
|
||||
@@ -1007,6 +1087,7 @@ def qdumpHelper__std__vector(d, value, isLibCpp):
|
||||
else:
|
||||
d.putPlotData(start, size, innerType)
|
||||
|
||||
|
||||
def qdumpHelper__std__vector__QNX(d, value):
|
||||
innerType = value.type[0]
|
||||
isBool = innerType.name == 'bool'
|
||||
@@ -1036,14 +1117,18 @@ def qdumpHelper__std__vector__QNX(d, value):
|
||||
else:
|
||||
d.putPlotData(start, size, innerType)
|
||||
|
||||
|
||||
def qform__std____1__vector():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__std____1__vector(d, value):
|
||||
qdumpHelper__std__vector(d, value, True)
|
||||
|
||||
|
||||
def qform__std____debug__vector():
|
||||
return [DisplayFormat.ArrayPlotFormat]
|
||||
return [DisplayFormat.ArrayPlot]
|
||||
|
||||
|
||||
def qdump__std____debug__vector(d, value):
|
||||
qdump__std__vector(d, value)
|
||||
@@ -1067,37 +1152,48 @@ def qdump__std__initializer_list(d, value):
|
||||
if d.isExpanded():
|
||||
d.putPlotData(start, size, innerType)
|
||||
|
||||
|
||||
def qedit__std__string(d, value, data):
|
||||
d.call('void', value, 'assign', '"%s"' % data.replace('"', '\\"'))
|
||||
|
||||
|
||||
def qedit__string(d, expr, value):
|
||||
qedit__std__string(d, expr, value)
|
||||
|
||||
|
||||
def qedit__std____cxx11__string(d, expr, value):
|
||||
qedit__std__string(d, expr, value)
|
||||
|
||||
|
||||
def qedit__std__wstring(d, value, data):
|
||||
d.call('void', value, 'assign', 'L"%s"' % data.replace('"', '\\"'))
|
||||
|
||||
|
||||
def qedit__wstring(d, expr, value):
|
||||
qedit__std__wstring(d, expr, value)
|
||||
|
||||
|
||||
def qedit__std____cxx11__wstring(d, expr, value):
|
||||
qedit__std__wstring(d, expr, value)
|
||||
|
||||
|
||||
def qdump__string(d, value):
|
||||
qdump__std__string(d, value)
|
||||
|
||||
|
||||
def qform__std__wstring():
|
||||
return [DisplayFormat.SimpleFormat, DisplayFormat.SeparateFormat]
|
||||
return [DisplayFormat.Simple, DisplayFormat.Separate]
|
||||
|
||||
|
||||
def qdump__std__wstring(d, value):
|
||||
qdumpHelper_std__string(d, value, d.createType('wchar_t'), d.currentItemFormat())
|
||||
|
||||
|
||||
def qdump__std__basic_string(d, value):
|
||||
innerType = value.type[0]
|
||||
qdumpHelper_std__string(d, value, innerType, d.currentItemFormat())
|
||||
|
||||
|
||||
def qdump__std____cxx11__basic_string(d, value):
|
||||
innerType = value.type[0]
|
||||
try:
|
||||
@@ -1110,21 +1206,27 @@ def qdump__std____cxx11__basic_string(d, value):
|
||||
d.check(0 <= size) # and size <= alloc and alloc <= 100*1000*1000)
|
||||
d.putCharArrayHelper(data, size, innerType, d.currentItemFormat())
|
||||
|
||||
|
||||
def qform__std____cxx11__string(d, value):
|
||||
qform__std__string(d, value)
|
||||
|
||||
|
||||
def qdump__std____cxx11__string(d, value):
|
||||
(data, size) = value.split("pI")
|
||||
d.check(0 <= size) # and size <= alloc and alloc <= 100*1000*1000)
|
||||
d.putCharArrayHelper(data, size, d.charType(), d.currentItemFormat())
|
||||
|
||||
# Needed only to trigger the form report above.
|
||||
|
||||
|
||||
def qform__std____cxx11__string():
|
||||
return qform__std__string()
|
||||
|
||||
|
||||
def qform__std____cxx11__wstring():
|
||||
return qform__std__wstring()
|
||||
|
||||
|
||||
def qdump__std____1__basic_string(d, value):
|
||||
innerType = value.type[0].name
|
||||
if innerType == "char":
|
||||
@@ -1134,12 +1236,15 @@ def qdump__std____1__basic_string(d, value):
|
||||
else:
|
||||
d.warn("UNKNOWN INNER TYPE %s" % innerType)
|
||||
|
||||
|
||||
def qdump__wstring(d, value):
|
||||
qdump__std__wstring(d, value)
|
||||
|
||||
|
||||
def qdump__std____1__once_flag(d, value):
|
||||
qdump__std__once_flag(d, value)
|
||||
|
||||
|
||||
def qdump__std__once_flag(d, value):
|
||||
d.putValue(value.split("i")[0])
|
||||
d.putBetterType(value.type)
|
||||
@@ -1174,14 +1279,17 @@ def qdump__uint8_t(d, value):
|
||||
d.putNumChild(0)
|
||||
d.putValue(value.integer())
|
||||
|
||||
|
||||
def qdump__int8_t(d, value):
|
||||
d.putNumChild(0)
|
||||
d.putValue(value.integer())
|
||||
|
||||
|
||||
def qdump__std__byte(d, value):
|
||||
d.putNumChild(0)
|
||||
d.putValue(value.integer())
|
||||
|
||||
|
||||
def qdump__std__optional(d, value):
|
||||
innerType = value.type[0]
|
||||
(payload, pad, initialized) = d.split('{%s}@b' % innerType.name, value)
|
||||
@@ -1192,5 +1300,6 @@ def qdump__std__optional(d, value):
|
||||
d.putSpecialValue("uninitialized")
|
||||
d.putNumChild(0)
|
||||
|
||||
|
||||
def qdump__std__experimental__optional(d, value):
|
||||
qdump__std__optional(d, value)
|
||||
|
@@ -26,7 +26,7 @@
|
||||
# Debugger start modes. Keep in sync with DebuggerStartMode in debuggerconstants.h
|
||||
|
||||
|
||||
class DebuggerStartMode:
|
||||
class DebuggerStartMode():
|
||||
(
|
||||
NoStartMode,
|
||||
StartInternal,
|
||||
@@ -41,33 +41,33 @@ class DebuggerStartMode:
|
||||
|
||||
|
||||
# Known special formats. Keep in sync with DisplayFormat in debuggerprotocol.h
|
||||
class DisplayFormat:
|
||||
class DisplayFormat():
|
||||
(
|
||||
AutomaticFormat,
|
||||
RawFormat,
|
||||
SimpleFormat,
|
||||
EnhancedFormat,
|
||||
SeparateFormat,
|
||||
Latin1StringFormat,
|
||||
SeparateLatin1StringFormat,
|
||||
Utf8StringFormat,
|
||||
SeparateUtf8StringFormat,
|
||||
Local8BitStringFormat,
|
||||
Utf16StringFormat,
|
||||
Ucs4StringFormat,
|
||||
Array10Format,
|
||||
Array100Format,
|
||||
Array1000Format,
|
||||
Array10000Format,
|
||||
ArrayPlotFormat,
|
||||
CompactMapFormat,
|
||||
DirectQListStorageFormat,
|
||||
IndirectQListStorageFormat,
|
||||
Automatic,
|
||||
Raw,
|
||||
Simple,
|
||||
Enhanced,
|
||||
Separate,
|
||||
Latin1String,
|
||||
SeparateLatin1String,
|
||||
Utf8String,
|
||||
SeparateUtf8String,
|
||||
Local8BitString,
|
||||
Utf16String,
|
||||
Ucs4String,
|
||||
Array10,
|
||||
Array100,
|
||||
Array1000,
|
||||
Array10000,
|
||||
ArrayPlot,
|
||||
CompactMap,
|
||||
DirectQListStorage,
|
||||
IndirectQListStorage,
|
||||
) = range(0, 20)
|
||||
|
||||
|
||||
# Breakpoints. Keep synchronized with BreakpointType in breakpoint.h
|
||||
class BreakpointType:
|
||||
class BreakpointType():
|
||||
(
|
||||
UnknownType,
|
||||
BreakpointByFileAndLine,
|
||||
@@ -87,24 +87,24 @@ class BreakpointType:
|
||||
|
||||
|
||||
# Internal codes for types keep in sync with cdbextensions pytype.cpp
|
||||
class TypeCode:
|
||||
class TypeCode():
|
||||
(
|
||||
TypeCodeTypedef,
|
||||
TypeCodeStruct,
|
||||
TypeCodeVoid,
|
||||
TypeCodeIntegral,
|
||||
TypeCodeFloat,
|
||||
TypeCodeEnum,
|
||||
TypeCodePointer,
|
||||
TypeCodeArray,
|
||||
TypeCodeComplex,
|
||||
TypeCodeReference,
|
||||
TypeCodeFunction,
|
||||
TypeCodeMemberPointer,
|
||||
TypeCodeFortranString,
|
||||
TypeCodeUnresolvable,
|
||||
TypeCodeBitfield,
|
||||
TypeCodeRValueReference,
|
||||
Typedef,
|
||||
Struct,
|
||||
Void,
|
||||
Integral,
|
||||
Float,
|
||||
Enum,
|
||||
Pointer,
|
||||
Array,
|
||||
Complex,
|
||||
Reference,
|
||||
Function,
|
||||
MemberPointer,
|
||||
FortranString,
|
||||
Unresolvable,
|
||||
Bitfield,
|
||||
RValueReference,
|
||||
) = range(0, 16)
|
||||
|
||||
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
int angleDelta() const { return m_angleDelta; }
|
||||
|
||||
private:
|
||||
QEvent::Type m_type;
|
||||
QEvent::Type m_type = QEvent::None;
|
||||
QPoint m_pos;
|
||||
Qt::MouseButton m_button = Qt::NoButton;
|
||||
Qt::MouseButtons m_buttons = Qt::NoButton;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
DirectionalDraggable {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
Node {
|
||||
@@ -45,12 +45,12 @@ Node {
|
||||
|
||||
Connections {
|
||||
target: camera
|
||||
onSceneTransformChanged: updateScale()
|
||||
function onSceneTransformChanged() { updateScale() }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: _generalHelper
|
||||
onOverlayUpdateNeeded: updateScale()
|
||||
function onOverlayUpdateNeeded() { updateScale() }
|
||||
}
|
||||
|
||||
function getScale(baseScale)
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
|
||||
View3D {
|
||||
id: axisHelperView
|
||||
@@ -37,7 +37,7 @@ View3D {
|
||||
Node {
|
||||
OrthographicCamera {
|
||||
id: axisHelperCamera
|
||||
rotation: editCameraCtrl.camera ? editCameraCtrl.camera.rotation : Qt.vector3d(0, 0, 0)
|
||||
rotation: editCameraCtrl.camera ? editCameraCtrl.camera.rotation : Qt.quaternion(1, 0, 0, 0)
|
||||
position: editCameraCtrl.camera ? editCameraCtrl.camera.position.minus(editCameraCtrl._lookAtPoint)
|
||||
.normalized().times(600) : Qt.vector3d(0, 0, 0)
|
||||
}
|
||||
@@ -54,7 +54,7 @@ View3D {
|
||||
|
||||
AxisHelperArm {
|
||||
id: armX
|
||||
rotation: Qt.vector3d(0, 0, -90)
|
||||
eulerRotation: Qt.vector3d(0, 0, -90)
|
||||
color: Qt.rgba(1, 0, 0, 1)
|
||||
hoverColor: Qt.lighter(Qt.rgba(1, 0, 0, 1))
|
||||
view3D: axisHelperView
|
||||
@@ -64,7 +64,7 @@ View3D {
|
||||
|
||||
AxisHelperArm {
|
||||
id: armY
|
||||
rotation: Qt.vector3d(0, 0, 0)
|
||||
eulerRotation: Qt.vector3d(0, 0, 0)
|
||||
color: Qt.rgba(0, 0.6, 0, 1)
|
||||
hoverColor: Qt.lighter(Qt.rgba(0, 0.6, 0, 1))
|
||||
view3D: axisHelperView
|
||||
@@ -74,7 +74,7 @@ View3D {
|
||||
|
||||
AxisHelperArm {
|
||||
id: armZ
|
||||
rotation: Qt.vector3d(90, 0, 0)
|
||||
eulerRotation: Qt.vector3d(90, 0, 0)
|
||||
color: Qt.rgba(0, 0, 1, 1)
|
||||
hoverColor: Qt.lighter(Qt.rgba(0, 0, 1, 1))
|
||||
view3D: axisHelperView
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
|
||||
Node {
|
||||
id: armRoot
|
||||
|
61
share/qtcreator/qml/qmlpuppet/mockfiles/CameraFrustum.qml
Normal file
@@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** 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 The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.15
|
||||
import CameraGeometry 1.0
|
||||
|
||||
Model {
|
||||
id: cameraFrustum
|
||||
|
||||
property alias geometryName: cameraGeometry.name // Name must be unique for each geometry
|
||||
property alias viewPortRect: cameraGeometry.viewPortRect
|
||||
property Node targetNode: null
|
||||
property Node scene: null
|
||||
property bool selected: false
|
||||
|
||||
function updateGeometry()
|
||||
{
|
||||
cameraGeometry.update();
|
||||
}
|
||||
|
||||
position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0)
|
||||
rotation: targetNode ? targetNode.sceneRotation : Qt.quaternion(1, 0, 0, 0)
|
||||
|
||||
geometry: cameraGeometry
|
||||
materials: [
|
||||
DefaultMaterial {
|
||||
id: defaultMaterial
|
||||
emissiveColor: cameraFrustum.selected ? "#FF0000" : "#555555"
|
||||
lighting: DefaultMaterial.NoLighting
|
||||
cullingMode: Material.DisableCulling
|
||||
}
|
||||
]
|
||||
|
||||
CameraGeometry {
|
||||
id: cameraGeometry
|
||||
camera: cameraFrustum.scene && cameraFrustum.targetNode ? cameraFrustum.targetNode : null
|
||||
}
|
||||
}
|
@@ -24,37 +24,33 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import CameraGeometry 1.0
|
||||
|
||||
IconGizmo {
|
||||
id: cameraGizmo
|
||||
|
||||
property var frustumModel: null
|
||||
|
||||
iconSource: "qrc:///qtquickplugin/mockfiles/images/editor_camera.png"
|
||||
property alias geometryName: cameraGeometry.name // Name must be unique for each geometry
|
||||
property alias viewPortRect: cameraGeometry.viewPortRect
|
||||
|
||||
function connectFrustum(frustum)
|
||||
{
|
||||
frustumModel = frustum;
|
||||
|
||||
frustum.selected = selected;
|
||||
frustum.selected = Qt.binding(function() {return selected;});
|
||||
|
||||
frustum.scene = scene;
|
||||
frustum.scene = Qt.binding(function() {return scene;});
|
||||
|
||||
frustum.targetNode = targetNode;
|
||||
frustum.targetNode = Qt.binding(function() {return targetNode;});
|
||||
|
||||
frustum.visible = visible;
|
||||
frustum.visible = Qt.binding(function() {return visible;});
|
||||
}
|
||||
|
||||
onActiveSceneChanged: {
|
||||
if (activeScene == scene)
|
||||
cameraGeometry.update();
|
||||
}
|
||||
|
||||
Model {
|
||||
id: gizmoModel
|
||||
geometry: cameraGeometry
|
||||
visible: cameraGizmo.visible
|
||||
materials: [
|
||||
DefaultMaterial {
|
||||
id: defaultMaterial
|
||||
emissiveColor: cameraGizmo.selected ? "#FF0000" : "#555555"
|
||||
lighting: DefaultMaterial.NoLighting
|
||||
cullingMode: Material.DisableCulling
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
CameraGeometry {
|
||||
id: cameraGeometry
|
||||
camera: cameraGizmo.scene && cameraGizmo.targetNode ? cameraGizmo.targetNode : null
|
||||
if (frustumModel && activeScene == scene)
|
||||
frustumModel.updateGeometry();
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
Model {
|
||||
@@ -61,8 +61,6 @@ Model {
|
||||
var maskedPosition = Qt.vector3d(planePos.x, 0, 0);
|
||||
_posPressed = planePos.x;
|
||||
_scenePosPressed = mouseArea.dragHelper.mapPositionToScene(maskedPosition);
|
||||
if (targetNode.orientation === Node.RightHanded)
|
||||
_scenePosPressed.z = -_scenePosPressed.z;
|
||||
_targetStartPos = mouseArea.pivotScenePosition(targetNode);
|
||||
pressed(mouseArea);
|
||||
}
|
||||
@@ -71,8 +69,6 @@ Model {
|
||||
{
|
||||
var maskedPosition = Qt.vector3d(planePos.x, 0, 0);
|
||||
var scenePointerPos = mouseArea.dragHelper.mapPositionToScene(maskedPosition);
|
||||
if (targetNode.orientation === Node.RightHanded)
|
||||
scenePointerPos.z = -scenePointerPos.z;
|
||||
return scenePointerPos.minus(_scenePosPressed);
|
||||
}
|
||||
|
||||
@@ -99,7 +95,7 @@ Model {
|
||||
y: -1.5
|
||||
width: 12
|
||||
height: 3
|
||||
rotation: Qt.vector3d(0, 0, 90)
|
||||
eulerRotation: Qt.vector3d(0, 0, 90)
|
||||
grabsMouse: targetNode
|
||||
active: rootModel.active
|
||||
dragHelper: rootModel.dragHelper
|
||||
@@ -116,7 +112,7 @@ Model {
|
||||
y: -1.5
|
||||
width: 12
|
||||
height: 3
|
||||
rotation: Qt.vector3d(0, 90, 90)
|
||||
eulerRotation: Qt.vector3d(0, 90, 90)
|
||||
grabsMouse: targetNode
|
||||
active: rootModel.active
|
||||
dragHelper: rootModel.dragHelper
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
|
||||
Item {
|
||||
id: cameraCtrl
|
||||
@@ -43,8 +43,8 @@ Item {
|
||||
property int _button
|
||||
property real _zoomFactor: 1
|
||||
property Camera _prevCamera: null
|
||||
readonly property vector3d _defaultCameraPosition: Qt.vector3d(0, 600, -600)
|
||||
readonly property vector3d _defaultCameraRotation: Qt.vector3d(45, 0, 0)
|
||||
readonly property vector3d _defaultCameraPosition: Qt.vector3d(0, 600, 600)
|
||||
readonly property vector3d _defaultCameraRotation: Qt.vector3d(-45, 0, 0)
|
||||
readonly property real _defaultCameraLookAtDistance: _defaultCameraPosition.length()
|
||||
|
||||
function restoreCameraState(cameraState)
|
||||
@@ -68,7 +68,7 @@ Item {
|
||||
_lookAtPoint = Qt.vector3d(0, 0, 0);
|
||||
_zoomFactor = 1;
|
||||
camera.position = _defaultCameraPosition;
|
||||
camera.rotation = _defaultCameraRotation;
|
||||
camera.eulerRotation = _defaultCameraRotation;
|
||||
_generalHelper.zoomCamera(camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
|
||||
_zoomFactor, false);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ Item {
|
||||
if (!camera)
|
||||
return;
|
||||
|
||||
camera.rotation = rotation;
|
||||
camera.eulerRotation = rotation;
|
||||
var newLookAtAndZoom = _generalHelper.focusObjectToCamera(
|
||||
camera, _defaultCameraLookAtDistance, targetObject, view3d, _zoomFactor, updateZoom);
|
||||
_lookAtPoint = newLookAtAndZoom.toVector3d();
|
||||
@@ -151,7 +151,7 @@ Item {
|
||||
onPressed: {
|
||||
if (cameraCtrl.camera && mouse.modifiers === Qt.AltModifier) {
|
||||
cameraCtrl._dragging = true;
|
||||
cameraCtrl._startRotation = cameraCtrl.camera.rotation;
|
||||
cameraCtrl._startRotation = cameraCtrl.camera.eulerRotation;
|
||||
cameraCtrl._startPosition = cameraCtrl.camera.position;
|
||||
cameraCtrl._startLookAtPoint = _lookAtPoint;
|
||||
cameraCtrl._pressPoint = Qt.vector3d(mouse.x, mouse.y, 0);
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import QtQuick.Controls 2.0
|
||||
import QtGraphicalEffects 1.0
|
||||
import MouseArea3D 1.0
|
||||
@@ -62,14 +62,16 @@ Item {
|
||||
onUsePerspectiveChanged: _generalHelper.storeToolState(sceneId, "usePerspective", usePerspective)
|
||||
onShowEditLightChanged: _generalHelper.storeToolState(sceneId,"showEditLight", showEditLight)
|
||||
onGlobalOrientationChanged: _generalHelper.storeToolState(sceneId, "globalOrientation", globalOrientation)
|
||||
onActiveSceneChanged: updateActiveScene();
|
||||
|
||||
onActiveSceneChanged: {
|
||||
function updateActiveScene()
|
||||
{
|
||||
if (editView) {
|
||||
// Destroy is async, so make sure we don't get any more updates for the old editView
|
||||
_generalHelper.enableItemUpdate(editView, false);
|
||||
editView.destroy();
|
||||
}
|
||||
if (activeScene) {
|
||||
|
||||
// importScene cannot be updated after initial set, so we need to reconstruct entire View3D
|
||||
var component = Qt.createComponent("SceneView3D.qml");
|
||||
if (component.status === Component.Ready) {
|
||||
@@ -87,6 +89,13 @@ Item {
|
||||
updateToolStates(_generalHelper.getToolStates(sceneId), true);
|
||||
}
|
||||
}
|
||||
|
||||
function clearActiveScene()
|
||||
{
|
||||
activeScene = null;
|
||||
sceneId = "";
|
||||
|
||||
updateActiveScene();
|
||||
}
|
||||
|
||||
// Disables edit view update if scene doesn't match current activeScene.
|
||||
@@ -102,7 +111,7 @@ Item {
|
||||
if (editView) {
|
||||
var targetNode = selectedNodes.length > 0
|
||||
? selectionBoxes[0].model : null;
|
||||
cameraControl.focusObject(targetNode, editView.camera.rotation, true);
|
||||
cameraControl.focusObject(targetNode, editView.camera.eulerRotation, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +252,7 @@ Item {
|
||||
// No free gizmos available, create a new one
|
||||
var component = Qt.createComponent("LightGizmo.qml");
|
||||
if (component.status === Component.Ready) {
|
||||
var gizmo = component.createObject(overlayScene,
|
||||
var gizmo = component.createObject(overlayView,
|
||||
{"view3D": overlayView, "targetNode": obj,
|
||||
"selectedNodes": selectedNodes, "scene": scene,
|
||||
"activeScene": activeScene});
|
||||
@@ -265,19 +274,24 @@ Item {
|
||||
}
|
||||
}
|
||||
// No free gizmos available, create a new one
|
||||
var component = Qt.createComponent("CameraGizmo.qml");
|
||||
if (component.status === Component.Ready) {
|
||||
var gizmoComponent = Qt.createComponent("CameraGizmo.qml");
|
||||
var frustumComponent = Qt.createComponent("CameraFrustum.qml");
|
||||
if (gizmoComponent.status === Component.Ready && frustumComponent.status === Component.Ready) {
|
||||
var geometryName = _generalHelper.generateUniqueName("CameraGeometry");
|
||||
var gizmo = component.createObject(
|
||||
var frustum = frustumComponent.createObject(
|
||||
overlayScene,
|
||||
{"view3D": overlayView, "targetNode": obj, "geometryName": geometryName,
|
||||
"viewPortRect": viewPortRect, "selectedNodes": selectedNodes,
|
||||
"scene": scene, "activeScene": activeScene});
|
||||
{"geometryName": geometryName, "viewPortRect": viewPortRect});
|
||||
var gizmo = gizmoComponent.createObject(
|
||||
overlayView,
|
||||
{"view3D": overlayView, "targetNode": obj,
|
||||
"selectedNodes": selectedNodes, "scene": scene, "activeScene": activeScene});
|
||||
|
||||
cameraGizmos[cameraGizmos.length] = gizmo;
|
||||
gizmo.clicked.connect(handleObjectClicked);
|
||||
gizmo.viewPortRect = Qt.binding(function() {return viewPortRect;});
|
||||
gizmo.selectedNodes = Qt.binding(function() {return selectedNodes;});
|
||||
gizmo.activeScene = Qt.binding(function() {return activeScene;});
|
||||
frustum.viewPortRect = Qt.binding(function() {return viewPortRect;});
|
||||
gizmo.connectFrustum(frustum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +355,7 @@ Item {
|
||||
clipFar: viewRoot.editView ? viewRoot.editView.perpectiveCamera.clipFar : 1000
|
||||
clipNear: viewRoot.editView ? viewRoot.editView.perpectiveCamera.clipNear : 1
|
||||
position: viewRoot.editView ? viewRoot.editView.perpectiveCamera.position : Qt.vector3d(0, 0, 0)
|
||||
rotation: viewRoot.editView ? viewRoot.editView.perpectiveCamera.rotation : Qt.vector3d(0, 0, 0)
|
||||
rotation: viewRoot.editView ? viewRoot.editView.perpectiveCamera.rotation : Qt.quaternion(1, 0, 0, 0)
|
||||
}
|
||||
|
||||
OrthographicCamera {
|
||||
@@ -349,7 +363,7 @@ Item {
|
||||
clipFar: viewRoot.editView ? viewRoot.editView.orthoCamera.clipFar : 1000
|
||||
clipNear: viewRoot.editView ? viewRoot.editView.orthoCamera.clipNear : 1
|
||||
position: viewRoot.editView ? viewRoot.editView.orthoCamera.position : Qt.vector3d(0, 0, 0)
|
||||
rotation: viewRoot.editView ? viewRoot.editView.orthoCamera.rotation : Qt.vector3d(0, 0, 0)
|
||||
rotation: viewRoot.editView ? viewRoot.editView.orthoCamera.rotation : Qt.quaternion(1, 0, 0, 0)
|
||||
scale: viewRoot.editView ? viewRoot.editView.orthoCamera.scale : Qt.vector3d(0, 0, 0)
|
||||
}
|
||||
|
||||
@@ -395,15 +409,14 @@ Item {
|
||||
view3D: overlayView
|
||||
dragHelper: gizmoDragHelper
|
||||
|
||||
onRotateCommit: viewRoot.commitObjectProperty(viewRoot.selectedNode, "rotation")
|
||||
onRotateChange: viewRoot.changeObjectProperty(viewRoot.selectedNode, "rotation")
|
||||
onRotateCommit: viewRoot.commitObjectProperty(viewRoot.selectedNode, "eulerRotation")
|
||||
onRotateChange: viewRoot.changeObjectProperty(viewRoot.selectedNode, "eulerRotation")
|
||||
}
|
||||
|
||||
AutoScaleHelper {
|
||||
id: autoScale
|
||||
view3D: overlayView
|
||||
position: moveGizmo.scenePosition
|
||||
orientation: moveGizmo.orientation
|
||||
}
|
||||
|
||||
Line3D {
|
||||
@@ -412,27 +425,20 @@ Item {
|
||||
name: "3D Edit View Pivot Line"
|
||||
color: "#ddd600"
|
||||
|
||||
function flipIfNeeded(vec) {
|
||||
if (!viewRoot.selectedNode || viewRoot.selectedNode.orientation === Node.LeftHanded)
|
||||
return vec;
|
||||
else
|
||||
return Qt.vector3d(vec.x, vec.y, -vec.z);
|
||||
}
|
||||
|
||||
startPos: viewRoot.selectedNode ? flipIfNeeded(viewRoot.selectedNode.scenePosition)
|
||||
startPos: viewRoot.selectedNode ? viewRoot.selectedNode.scenePosition
|
||||
: Qt.vector3d(0, 0, 0)
|
||||
Connections {
|
||||
target: viewRoot
|
||||
onSelectedNodeChanged: {
|
||||
pivotLine.endPos = pivotLine.flipIfNeeded(gizmoDragHelper.pivotScenePosition(
|
||||
viewRoot.selectedNode));
|
||||
function onSelectedNodeChanged()
|
||||
{
|
||||
pivotLine.endPos = gizmoDragHelper.pivotScenePosition(viewRoot.selectedNode);
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: viewRoot.selectedNode
|
||||
onSceneTransformChanged: {
|
||||
pivotLine.endPos = pivotLine.flipIfNeeded(gizmoDragHelper.pivotScenePosition(
|
||||
viewRoot.selectedNode));
|
||||
function onSceneTransformChanged()
|
||||
{
|
||||
pivotLine.endPos = gizmoDragHelper.pivotScenePosition(viewRoot.selectedNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,6 +535,32 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: rotateGizmoLabel
|
||||
color: "white"
|
||||
x: rotateGizmo.currentMousePos.x - (10 + width)
|
||||
y: rotateGizmo.currentMousePos.y - (10 + height)
|
||||
width: rotateGizmoLabelText.width + 4
|
||||
height: rotateGizmoLabelText.height + 4
|
||||
border.width: 1
|
||||
visible: rotateGizmo.dragging
|
||||
parent: rotateGizmo.view3D
|
||||
|
||||
Text {
|
||||
id: rotateGizmoLabelText
|
||||
text: {
|
||||
var l = Qt.locale();
|
||||
if (rotateGizmo.targetNode) {
|
||||
var degrees = rotateGizmo.currentAngle * (180 / Math.PI);
|
||||
return qsTr(Number(degrees).toLocaleString(l, 'f', 1));
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
EditCameraController {
|
||||
id: cameraControl
|
||||
camera: viewRoot.editView ? viewRoot.editView.camera : null
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import GridGeometry 1.0
|
||||
|
||||
Node {
|
||||
@@ -34,7 +34,7 @@ Node {
|
||||
property alias step: gridGeometry.step
|
||||
property alias subdivAlpha: subGridMaterial.opacity
|
||||
|
||||
rotation.x: 90
|
||||
eulerRotation.x: 90
|
||||
|
||||
// Note: Only one instance of HelperGrid is supported, as the geometry names are fixed
|
||||
|
||||
@@ -89,7 +89,7 @@ Node {
|
||||
]
|
||||
}
|
||||
Model { // X Axis
|
||||
rotation.z: 90
|
||||
eulerRotation.z: 90
|
||||
geometry: GridGeometry {
|
||||
lines: gridGeometry.lines
|
||||
step: gridGeometry.step
|
||||
|
@@ -24,10 +24,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import QtGraphicalEffects 1.12
|
||||
|
||||
Node {
|
||||
Item {
|
||||
id: iconGizmo
|
||||
|
||||
property Node activeScene: null
|
||||
@@ -50,16 +50,13 @@ Node {
|
||||
signal positionCommit()
|
||||
signal clicked(Node node, bool multi)
|
||||
|
||||
position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0)
|
||||
rotation: targetNode ? targetNode.sceneRotation : Qt.vector3d(0, 0, 0)
|
||||
visible: activeScene === scene && (targetNode ? targetNode.visible : false)
|
||||
|
||||
Overlay2D {
|
||||
id: iconOverlay
|
||||
targetNode: iconGizmo
|
||||
targetNode: iconGizmo.targetNode
|
||||
targetView: view3D
|
||||
visible: iconGizmo.visible && !isBehindCamera
|
||||
parent: view3D
|
||||
|
||||
Rectangle {
|
||||
id: iconRect
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
|
||||
IconGizmo {
|
||||
id: lightGizmo
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import LineGeometry 1.0
|
||||
|
||||
Node {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
Node {
|
||||
@@ -40,13 +40,13 @@ Node {
|
||||
property MouseArea3D dragHelper: null
|
||||
|
||||
position: dragHelper.pivotScenePosition(targetNode)
|
||||
orientation: targetNode ? targetNode.orientation : Node.LeftHanded
|
||||
|
||||
onTargetNodeChanged: position = dragHelper.pivotScenePosition(targetNode)
|
||||
|
||||
Connections {
|
||||
target: moveGizmo.targetNode
|
||||
onSceneTransformChanged: {
|
||||
function onSceneTransformChanged()
|
||||
{
|
||||
moveGizmo.position = moveGizmo.dragHelper.pivotScenePosition(moveGizmo.targetNode);
|
||||
}
|
||||
}
|
||||
@@ -55,14 +55,11 @@ Node {
|
||||
signal positionMove()
|
||||
|
||||
Node {
|
||||
rotation: globalOrientation || !moveGizmo.targetNode ? Qt.vector3d(0, 0, 0)
|
||||
rotation: globalOrientation || !moveGizmo.targetNode ? Qt.quaternion(1, 0, 0, 0)
|
||||
: moveGizmo.targetNode.sceneRotation
|
||||
rotationOrder: moveGizmo.targetNode ? moveGizmo.targetNode.rotationOrder : Node.YXZ
|
||||
orientation: moveGizmo.orientation
|
||||
|
||||
Arrow {
|
||||
id: arrowX
|
||||
rotation: Qt.vector3d(0, 0, -90)
|
||||
eulerRotation: Qt.vector3d(0, 0, -90)
|
||||
targetNode: moveGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1))
|
||||
: Qt.rgba(1, 0, 0, 1)
|
||||
@@ -76,7 +73,7 @@ Node {
|
||||
|
||||
Arrow {
|
||||
id: arrowY
|
||||
rotation: Qt.vector3d(0, 0, 0)
|
||||
eulerRotation: Qt.vector3d(0, 0, 0)
|
||||
targetNode: moveGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1))
|
||||
: Qt.rgba(0, 0.6, 0, 1)
|
||||
@@ -90,7 +87,7 @@ Node {
|
||||
|
||||
Arrow {
|
||||
id: arrowZ
|
||||
rotation: Qt.vector3d(90, 0, 0)
|
||||
eulerRotation: Qt.vector3d(90, 0, 0)
|
||||
targetNode: moveGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1))
|
||||
: Qt.rgba(0, 0, 1, 1)
|
||||
@@ -108,7 +105,7 @@ Node {
|
||||
y: 10
|
||||
z: 10
|
||||
|
||||
rotation: Qt.vector3d(0, 90, 0)
|
||||
eulerRotation: Qt.vector3d(0, 90, 0)
|
||||
targetNode: moveGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1))
|
||||
: Qt.rgba(1, 0, 0, 1)
|
||||
@@ -126,7 +123,7 @@ Node {
|
||||
x: 10
|
||||
z: 10
|
||||
|
||||
rotation: Qt.vector3d(90, 0, 0)
|
||||
eulerRotation: Qt.vector3d(90, 0, 0)
|
||||
targetNode: moveGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1))
|
||||
: Qt.rgba(0, 0.6, 0, 1)
|
||||
@@ -144,7 +141,7 @@ Node {
|
||||
x: 10
|
||||
y: 10
|
||||
|
||||
rotation: Qt.vector3d(0, 0, 0)
|
||||
eulerRotation: Qt.vector3d(0, 0, 0)
|
||||
targetNode: moveGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1))
|
||||
: Qt.rgba(0, 0, 1, 1)
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -39,29 +39,26 @@ Item {
|
||||
|
||||
Connections {
|
||||
target: targetNode
|
||||
onSceneTransformChanged: updateOverlay()
|
||||
function onSceneTransformChanged() { updateOverlay() }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: targetView.camera
|
||||
onSceneTransformChanged: updateOverlay()
|
||||
function onSceneTransformChanged() { updateOverlay() }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: _generalHelper
|
||||
onOverlayUpdateNeeded: updateOverlay()
|
||||
function onOverlayUpdateNeeded() { updateOverlay() }
|
||||
}
|
||||
|
||||
function updateOverlay()
|
||||
{
|
||||
var scenePos = targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0);
|
||||
// Need separate variable as scenePos is reference to read-only property
|
||||
var scenePosZ = scenePos.z
|
||||
if (targetNode && targetNode.orientation === Node.RightHanded)
|
||||
scenePosZ = -scenePosZ;
|
||||
var scenePosWithOffset = Qt.vector3d(scenePos.x + offset.x,
|
||||
scenePos.y + offset.y,
|
||||
scenePosZ + offset.z);
|
||||
scenePos.z + offset.z);
|
||||
var viewPos = targetView ? targetView.mapFrom3DScene(scenePosWithOffset)
|
||||
: Qt.vector3d(0, 0, 0);
|
||||
root.x = viewPos.x;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
Model {
|
||||
@@ -48,7 +48,6 @@ Model {
|
||||
signal dragged(var mouseArea, vector3d sceneRelativeDistance, vector2d relativeDistance)
|
||||
signal released(var mouseArea, vector3d sceneRelativeDistance, vector2d relativeDistance)
|
||||
|
||||
rotationOrder: Node.XYZr
|
||||
source: "#Rectangle"
|
||||
|
||||
DefaultMaterial {
|
||||
@@ -66,8 +65,6 @@ Model {
|
||||
|
||||
_planePosPressed = planePos;
|
||||
_scenePosPressed = mouseArea.dragHelper.mapPositionToScene(planePos.toVector3d());
|
||||
if (targetNode.orientation === Node.RightHanded)
|
||||
_scenePosPressed.z = -_scenePosPressed.z;
|
||||
_targetStartPos = mouseArea.pivotScenePosition(targetNode);
|
||||
pressed(mouseArea);
|
||||
}
|
||||
@@ -75,8 +72,6 @@ Model {
|
||||
function calcRelativeDistance(mouseArea, planePos)
|
||||
{
|
||||
var scenePointerPos = mouseArea.dragHelper.mapPositionToScene(planePos.toVector3d());
|
||||
if (targetNode.orientation === Node.RightHanded)
|
||||
scenePointerPos.z = -scenePointerPos.z;
|
||||
return scenePointerPos.minus(_scenePosPressed);
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
PlanarDraggable {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
PlanarDraggable {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
Node {
|
||||
@@ -41,13 +41,13 @@ Node {
|
||||
property point currentMousePos
|
||||
|
||||
position: dragHelper.pivotScenePosition(targetNode)
|
||||
orientation: targetNode ? targetNode.orientation : Node.LeftHanded
|
||||
|
||||
onTargetNodeChanged: position = dragHelper.pivotScenePosition(targetNode)
|
||||
|
||||
Connections {
|
||||
target: rotateGizmo.targetNode
|
||||
onSceneTransformChanged: {
|
||||
function onSceneTransformChanged()
|
||||
{
|
||||
rotateGizmo.position = rotateGizmo.dragHelper.pivotScenePosition(rotateGizmo.targetNode);
|
||||
}
|
||||
}
|
||||
@@ -70,44 +70,16 @@ Node {
|
||||
copyRingProperties(rotRingZ)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: angleLabel
|
||||
color: "white"
|
||||
x: rotateGizmo.currentMousePos.x - (10 + width)
|
||||
y: rotateGizmo.currentMousePos.y - (10 + height)
|
||||
width: gizmoLabelText.width + 4
|
||||
height: gizmoLabelText.height + 4
|
||||
border.width: 1
|
||||
visible: rotateGizmo.dragging
|
||||
parent: rotateGizmo.view3D
|
||||
|
||||
Text {
|
||||
id: gizmoLabelText
|
||||
text: {
|
||||
var l = Qt.locale();
|
||||
if (rotateGizmo.targetNode) {
|
||||
var degrees = currentAngle * (180 / Math.PI);
|
||||
return qsTr(Number(degrees).toLocaleString(l, 'f', 1));
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
Node {
|
||||
id: rotNode
|
||||
rotation: globalOrientation || !rotateGizmo.targetNode ? Qt.vector3d(0, 0, 0)
|
||||
rotation: globalOrientation || !rotateGizmo.targetNode ? Qt.quaternion(1, 0, 0, 0)
|
||||
: rotateGizmo.targetNode.sceneRotation
|
||||
rotationOrder: rotateGizmo.targetNode ? rotateGizmo.targetNode.rotationOrder : Node.YXZ
|
||||
orientation: rotateGizmo.orientation
|
||||
visible: !rotateGizmo.dragging && !freeRotator.dragging
|
||||
|
||||
RotateRing {
|
||||
id: rotRingX
|
||||
objectName: "Rotate Ring X"
|
||||
rotation: Qt.vector3d(0, 90, 0)
|
||||
eulerRotation: Qt.vector3d(0, 90, 0)
|
||||
targetNode: rotateGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1))
|
||||
: Qt.rgba(1, 0, 0, 1)
|
||||
@@ -125,7 +97,7 @@ Node {
|
||||
RotateRing {
|
||||
id: rotRingY
|
||||
objectName: "Rotate Ring Y"
|
||||
rotation: Qt.vector3d(90, 0, 0)
|
||||
eulerRotation: Qt.vector3d(90, 0, 0)
|
||||
targetNode: rotateGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1))
|
||||
: Qt.rgba(0, 0.6, 0, 1)
|
||||
@@ -145,7 +117,7 @@ Node {
|
||||
RotateRing {
|
||||
id: rotRingZ
|
||||
objectName: "Rotate Ring Z"
|
||||
rotation: Qt.vector3d(0, 0, 0)
|
||||
eulerRotation: Qt.vector3d(0, 0, 0)
|
||||
targetNode: rotateGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1))
|
||||
: Qt.rgba(0, 0, 1, 1)
|
||||
@@ -174,7 +146,6 @@ Node {
|
||||
view3D: rotateGizmo.view3D
|
||||
active: false
|
||||
visible: rotRingX.dragging || rotRingY.dragging || rotRingZ.dragging
|
||||
orientation: rotateGizmo.orientation
|
||||
}
|
||||
|
||||
RotateRing {
|
||||
@@ -223,16 +194,14 @@ Node {
|
||||
// Need to recreate vector as we need to adjust it and we can't do that on reference of
|
||||
// scenePosition, which is read-only property
|
||||
var scenePos = rotateGizmo.dragHelper.pivotScenePosition(rotateGizmo.targetNode);
|
||||
if (rotateGizmo.targetNode && rotateGizmo.targetNode.orientation === Node.RightHanded)
|
||||
scenePos.z = -scenePos.z
|
||||
_targetPosOnScreen = view3D.mapFrom3DScene(scenePos);
|
||||
_targetPosOnScreen.z = 0;
|
||||
_pointerPosPressed = Qt.vector3d(screenPos.x, screenPos.y, 0);
|
||||
|
||||
// Recreate vector so we don't follow the changes in targetNode.rotation
|
||||
_startRotation = Qt.vector3d(rotateGizmo.targetNode.rotation.x,
|
||||
rotateGizmo.targetNode.rotation.y,
|
||||
rotateGizmo.targetNode.rotation.z);
|
||||
_startRotation = Qt.vector3d(rotateGizmo.targetNode.eulerRotation.x,
|
||||
rotateGizmo.targetNode.eulerRotation.y,
|
||||
rotateGizmo.targetNode.eulerRotation.z);
|
||||
dragging = true;
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
Model {
|
||||
@@ -80,18 +80,16 @@ Model {
|
||||
// Need to recreate vector as we need to adjust it and we can't do that on reference of
|
||||
// scenePosition, which is read-only property
|
||||
var scenePos = mouseAreaMain.pivotScenePosition(targetNode);
|
||||
if (targetNode && targetNode.orientation === Node.RightHanded)
|
||||
scenePos.z = -scenePos.z
|
||||
|
||||
_targetPosOnScreen = view3D.mapFrom3DScene(scenePos);
|
||||
_targetPosOnScreen.z = 0;
|
||||
_pointerPosPressed = Qt.vector3d(screenPos.x, screenPos.y, 0);
|
||||
_trackBall = angle < 0.1;
|
||||
|
||||
// Recreate vector so we don't follow the changes in targetNode.rotation
|
||||
_startRotation = Qt.vector3d(targetNode.rotation.x,
|
||||
targetNode.rotation.y,
|
||||
targetNode.rotation.z);
|
||||
// Recreate vector so we don't follow the changes in targetNode.eulerRotation
|
||||
_startRotation = Qt.vector3d(targetNode.eulerRotation.x,
|
||||
targetNode.eulerRotation.y,
|
||||
targetNode.eulerRotation.z);
|
||||
currentAngle = 0;
|
||||
currentMousePos = screenPos;
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
Node {
|
||||
@@ -39,13 +39,13 @@ Node {
|
||||
property MouseArea3D dragHelper: null
|
||||
|
||||
position: dragHelper.pivotScenePosition(targetNode)
|
||||
orientation: targetNode ? targetNode.orientation : Node.LeftHanded
|
||||
|
||||
onTargetNodeChanged: position = dragHelper.pivotScenePosition(targetNode)
|
||||
|
||||
Connections {
|
||||
target: scaleGizmo.targetNode
|
||||
onSceneTransformChanged: {
|
||||
function onSceneTransformChanged()
|
||||
{
|
||||
scaleGizmo.position = scaleGizmo.dragHelper.pivotScenePosition(scaleGizmo.targetNode);
|
||||
}
|
||||
}
|
||||
@@ -54,13 +54,11 @@ Node {
|
||||
signal scaleChange()
|
||||
|
||||
Node {
|
||||
rotation: !targetNode ? Qt.vector3d(0, 0, 0) : targetNode.sceneRotation
|
||||
rotationOrder: scaleGizmo.targetNode ? scaleGizmo.targetNode.rotationOrder : Node.YXZ
|
||||
orientation: scaleGizmo.orientation
|
||||
rotation: !targetNode ? Qt.quaternion(1, 0, 0, 0) : targetNode.sceneRotation
|
||||
|
||||
ScaleRod {
|
||||
id: scaleRodX
|
||||
rotation: Qt.vector3d(0, 0, -90)
|
||||
eulerRotation: Qt.vector3d(0, 0, -90)
|
||||
axis: Qt.vector3d(1, 0, 0)
|
||||
targetNode: scaleGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1))
|
||||
@@ -75,7 +73,7 @@ Node {
|
||||
|
||||
ScaleRod {
|
||||
id: scaleRodY
|
||||
rotation: Qt.vector3d(0, 0, 0)
|
||||
eulerRotation: Qt.vector3d(0, 0, 0)
|
||||
axis: Qt.vector3d(0, 1, 0)
|
||||
targetNode: scaleGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1))
|
||||
@@ -90,7 +88,7 @@ Node {
|
||||
|
||||
ScaleRod {
|
||||
id: scaleRodZ
|
||||
rotation: Qt.vector3d(90, 0, 0)
|
||||
eulerRotation: Qt.vector3d(90, 0, 0)
|
||||
axis: Qt.vector3d(0, 0, 1)
|
||||
targetNode: scaleGizmo.targetNode
|
||||
color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1))
|
||||
@@ -109,7 +107,7 @@ Node {
|
||||
y: 10
|
||||
z: 10
|
||||
|
||||
rotation: Qt.vector3d(0, 90, 0)
|
||||
eulerRotation: Qt.vector3d(0, 90, 0)
|
||||
axisX: Qt.vector3d(0, 0, -1)
|
||||
axisY: Qt.vector3d(0, 1, 0)
|
||||
targetNode: scaleGizmo.targetNode
|
||||
@@ -129,7 +127,7 @@ Node {
|
||||
x: 10
|
||||
z: 10
|
||||
|
||||
rotation: Qt.vector3d(90, 0, 0)
|
||||
eulerRotation: Qt.vector3d(90, 0, 0)
|
||||
axisX: Qt.vector3d(1, 0, 0)
|
||||
axisY: Qt.vector3d(0, 0, 1)
|
||||
targetNode: scaleGizmo.targetNode
|
||||
@@ -149,7 +147,7 @@ Node {
|
||||
x: 10
|
||||
y: 10
|
||||
|
||||
rotation: Qt.vector3d(0, 0, 0)
|
||||
eulerRotation: Qt.vector3d(0, 0, 0)
|
||||
axisX: Qt.vector3d(1, 0, 0)
|
||||
axisY: Qt.vector3d(0, 1, 0)
|
||||
targetNode: scaleGizmo.targetNode
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import MouseArea3D 1.0
|
||||
|
||||
DirectionalDraggable {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick3D 1.14
|
||||
import QtQuick3D 1.15
|
||||
|
||||
View3D {
|
||||
id: sceneView
|
||||
@@ -74,18 +74,18 @@ View3D {
|
||||
// point.
|
||||
PerspectiveCamera {
|
||||
id: scenePerspectiveCamera
|
||||
z: -600
|
||||
z: 600
|
||||
y: 600
|
||||
rotation.x: 45
|
||||
eulerRotation.x: -45
|
||||
clipFar: 100000
|
||||
clipNear: 1
|
||||
}
|
||||
|
||||
OrthographicCamera {
|
||||
id: sceneOrthoCamera
|
||||
z: -600
|
||||
z: 600
|
||||
y: 600
|
||||
rotation.x: 45
|
||||
eulerRotation.x: -45
|
||||
clipFar: 100000
|
||||
clipNear: -10000
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick3D 1.0
|
||||
import QtQuick3D 1.15
|
||||
import SelectionBoxGeometry 1.0
|
||||
|
||||
Node {
|
||||
@@ -48,11 +48,9 @@ Node {
|
||||
geometry: selectionBoxGeometry
|
||||
|
||||
scale: selectionBox.targetNode ? selectionBox.targetNode.scale : Qt.vector3d(1, 1, 1)
|
||||
rotation: selectionBox.targetNode ? selectionBox.targetNode.rotation : Qt.vector3d(0, 0, 0)
|
||||
rotation: selectionBox.targetNode ? selectionBox.targetNode.rotation : Qt.quaternion(1, 0, 0, 0)
|
||||
position: selectionBox.targetNode ? selectionBox.targetNode.position : Qt.vector3d(0, 0, 0)
|
||||
pivot: selectionBox.targetNode ? selectionBox.targetNode.pivot : Qt.vector3d(0, 0, 0)
|
||||
orientation: selectionBox.targetNode ? selectionBox.targetNode.orientation : Node.LeftHanded
|
||||
rotationOrder: selectionBox.targetNode ? selectionBox.targetNode.rotationOrder : Node.YXZ
|
||||
|
||||
visible: selectionBox.targetNode && !selectionBoxGeometry.isEmpty
|
||||
|
||||
|
@@ -28,9 +28,9 @@
|
||||
|
||||
#include "selectionboxgeometry.h"
|
||||
|
||||
#include <QtQuick3D/qquick3dobject.h>
|
||||
#include <QtQuick3D/private/qquick3dorthographiccamera_p.h>
|
||||
#include <QtQuick3D/private/qquick3dperspectivecamera_p.h>
|
||||
#include <QtQuick3D/private/qquick3dobject_p_p.h>
|
||||
#include <QtQuick3D/private/qquick3dcamera_p.h>
|
||||
#include <QtQuick3D/private/qquick3dnode_p.h>
|
||||
#include <QtQuick3D/private/qquick3dmodel_p.h>
|
||||
@@ -85,17 +85,17 @@ void GeneralHelper::orbitCamera(QQuick3DCamera *camera, const QVector3D &startRo
|
||||
if (dragVector.length() < 0.001f)
|
||||
return;
|
||||
|
||||
camera->setRotation(startRotation);
|
||||
QVector3D newRotation(dragVector.y(), dragVector.x(), 0.f);
|
||||
camera->setEulerRotation(startRotation);
|
||||
QVector3D newRotation(-dragVector.y(), -dragVector.x(), 0.f);
|
||||
newRotation *= 0.5f; // Emprically determined multiplier for nice drag
|
||||
newRotation += startRotation;
|
||||
|
||||
camera->setRotation(newRotation);
|
||||
camera->setEulerRotation(newRotation);
|
||||
|
||||
const QVector3D oldLookVector = camera->position() - lookAtPoint;
|
||||
QMatrix4x4 m = camera->sceneTransform();
|
||||
const float *dataPtr(m.data());
|
||||
QVector3D newLookVector(-dataPtr[8], -dataPtr[9], -dataPtr[10]);
|
||||
QVector3D newLookVector(dataPtr[8], dataPtr[9], dataPtr[10]);
|
||||
newLookVector.normalize();
|
||||
newLookVector *= oldLookVector.length();
|
||||
|
||||
@@ -187,7 +187,6 @@ QVector4D GeneralHelper::focusObjectToCamera(QQuick3DCamera *camera, float defau
|
||||
|
||||
// Adjust lookAt to look directly at the center of the object bounds
|
||||
lookAt = renderModel->globalTransform.map(center);
|
||||
lookAt.setZ(-lookAt.z()); // Render node transforms have inverted z
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +195,7 @@ QVector4D GeneralHelper::focusObjectToCamera(QQuick3DCamera *camera, float defau
|
||||
// Reset camera position to default zoom
|
||||
QMatrix4x4 m = camera->sceneTransform();
|
||||
const float *dataPtr(m.data());
|
||||
QVector3D newLookVector(-dataPtr[8], -dataPtr[9], -dataPtr[10]);
|
||||
QVector3D newLookVector(dataPtr[8], dataPtr[9], dataPtr[10]);
|
||||
newLookVector.normalize();
|
||||
newLookVector *= defaultLookAtDistance;
|
||||
|
||||
|
@@ -81,10 +81,10 @@ QSSGRenderGraphObject *LineGeometry::updateSpatialNode(QSSGRenderGraphObject *no
|
||||
|
||||
dataPtr[0] = m_startPos[0];
|
||||
dataPtr[1] = m_startPos[1];
|
||||
dataPtr[2] = -m_startPos[2];
|
||||
dataPtr[2] = m_startPos[2];
|
||||
dataPtr[3] = m_endPos[0];
|
||||
dataPtr[4] = m_endPos[1];
|
||||
dataPtr[5] = -m_endPos[2];
|
||||
dataPtr[5] = m_endPos[2];
|
||||
|
||||
geometry->addAttribute(QSSGRenderGeometry::Attribute::PositionSemantic, 0,
|
||||
QSSGRenderGeometry::Attribute::ComponentType::F32Type);
|
||||
|
@@ -396,16 +396,12 @@ qreal QmlDesigner::Internal::MouseArea3D::getNewRotationAngle(
|
||||
if (dragVector.length() < 0.001f)
|
||||
return prevAngle;
|
||||
|
||||
// Get camera to node direction in node orientation
|
||||
// Get camera to node direction
|
||||
QVector3D cameraToNodeDir = getCameraToNodeDir(node);
|
||||
if (trackBall) {
|
||||
// Only the distance in plane direction is relevant in trackball drag
|
||||
QVector3D dragDir = QVector3D::crossProduct(getNormal(), cameraToNodeDir).normalized();
|
||||
QVector3D scenePos = pivotScenePosition(node);
|
||||
if (node->orientation() == QQuick3DNode::RightHanded) {
|
||||
scenePos.setZ(-scenePos.z());
|
||||
dragDir = -dragDir;
|
||||
}
|
||||
QVector3D screenDragDir = m_view3D->mapFrom3DScene(scenePos + dragDir);
|
||||
screenDragDir.setZ(0);
|
||||
dragDir = (screenDragDir - nodePos).normalized();
|
||||
@@ -420,12 +416,10 @@ qreal QmlDesigner::Internal::MouseArea3D::getNewRotationAngle(
|
||||
|
||||
// Determine drag direction left/right
|
||||
QVector3D dragNormal = QVector3D::crossProduct(nodeToPress, nodeToCurrent).normalized();
|
||||
if (node->orientation() == QQuick3DNode::RightHanded)
|
||||
dragNormal = -dragNormal;
|
||||
angle *= QVector3D::dotProduct(QVector3D(0.f, 0.f, 1.f), dragNormal) < 0 ? -1.0 : 1.0;
|
||||
|
||||
// Determine drag ring orientation relative to camera
|
||||
angle *= QVector3D::dotProduct(getNormal(), cameraToNodeDir) < 0 ? 1.0 : -1.0;
|
||||
angle *= QVector3D::dotProduct(getNormal(), cameraToNodeDir) < 0 ? -1.0 : 1.0;
|
||||
|
||||
qreal adjustedPrevAngle = prevAngle;
|
||||
const qreal PI_2 = M_PI * 2.0;
|
||||
@@ -451,10 +445,8 @@ void QmlDesigner::Internal::MouseArea3D::applyRotationAngleToNode(
|
||||
QQuick3DNode *node, const QVector3D &startRotation, qreal angle)
|
||||
{
|
||||
if (!qFuzzyIsNull(angle)) {
|
||||
node->setRotation(startRotation);
|
||||
node->setEulerRotation(startRotation);
|
||||
QVector3D normal = getNormal();
|
||||
if (orientation() != node->orientation())
|
||||
normal.setZ(-normal.z());
|
||||
node->rotate(qRadiansToDegrees(angle), normal, QQuick3DNode::SceneSpace);
|
||||
}
|
||||
}
|
||||
@@ -468,20 +460,15 @@ void MouseArea3D::applyFreeRotation(QQuick3DNode *node, const QVector3D &startRo
|
||||
return;
|
||||
|
||||
const float *dataPtr(sceneTransform().data());
|
||||
QVector3D xAxis = QVector3D(-dataPtr[0], -dataPtr[1], -dataPtr[2]).normalized();
|
||||
QVector3D yAxis = QVector3D(-dataPtr[4], -dataPtr[5], -dataPtr[6]).normalized();
|
||||
if (node->orientation() == QQuick3DNode::RightHanded) {
|
||||
xAxis = QVector3D(-xAxis.x(), -xAxis.y(), xAxis.z());
|
||||
yAxis = QVector3D(-yAxis.x(), -yAxis.y(), yAxis.z());
|
||||
}
|
||||
|
||||
QVector3D xAxis = QVector3D(dataPtr[0], dataPtr[1], dataPtr[2]).normalized();
|
||||
QVector3D yAxis = QVector3D(dataPtr[4], dataPtr[5], dataPtr[6]).normalized();
|
||||
QVector3D finalAxis = (dragVector.x() * yAxis + dragVector.y() * xAxis);
|
||||
|
||||
qreal degrees = qRadiansToDegrees(qreal(finalAxis.length()) * mouseDragMultiplier());
|
||||
|
||||
finalAxis.normalize();
|
||||
|
||||
node->setRotation(startRotation);
|
||||
node->setEulerRotation(startRotation);
|
||||
node->rotate(degrees, finalAxis, QQuick3DNode::SceneSpace);
|
||||
}
|
||||
|
||||
@@ -513,8 +500,6 @@ double MouseArea3D::getRelativeScale(QQuick3DNode *node) const
|
||||
// view and scene, will tell us what the distance independent scale should be.
|
||||
|
||||
QVector3D nodePos(node->scenePosition());
|
||||
if (orientation() == QQuick3DNode::RightHanded)
|
||||
nodePos.setZ(-nodePos.z());
|
||||
|
||||
DoubleVec3D posInView1(m_view3D->mapFrom3DScene(nodePos));
|
||||
|
||||
@@ -718,12 +703,9 @@ QVector3D MouseArea3D::getCameraToNodeDir(QQuick3DNode *node) const
|
||||
QVector3D dir;
|
||||
if (qobject_cast<QQuick3DOrthographicCamera *>(m_view3D->camera())) {
|
||||
dir = -m_view3D->camera()->cameraNode()->getDirection();
|
||||
dir.setZ(-dir.z());
|
||||
} else {
|
||||
QVector3D camPos = m_view3D->camera()->scenePosition();
|
||||
QVector3D nodePos = pivotScenePosition(node);
|
||||
if (node->orientation() == QQuick3DNode::RightHanded)
|
||||
nodePos.setZ(-nodePos.z());
|
||||
dir = (nodePos - camPos).normalized();
|
||||
}
|
||||
return dir;
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include <QtQuick3DRuntimeRender/private/qssgrendercontextcore_p.h>
|
||||
#include <QtQuick3DRuntimeRender/private/qssgrenderbuffermanager_p.h>
|
||||
#include <QtQuick3D/private/qquick3dmodel_p.h>
|
||||
#include <QtQuick3D/private/qquick3dobject_p_p.h>
|
||||
#include <QtQuick3D/qquick3dobject.h>
|
||||
#include <QtQuick/qquickwindow.h>
|
||||
#include <QtCore/qvector.h>
|
||||
|
||||
@@ -367,10 +367,6 @@ void SelectionBoxGeometry::trackNodeChanges(QQuick3DNode *node)
|
||||
this, &SelectionBoxGeometry::update, Qt::QueuedConnection);
|
||||
m_connections << QObject::connect(node, &QQuick3DNode::pivotChanged,
|
||||
this, &SelectionBoxGeometry::update, Qt::QueuedConnection);
|
||||
m_connections << QObject::connect(node, &QQuick3DNode::orientationChanged,
|
||||
this, &SelectionBoxGeometry::update, Qt::QueuedConnection);
|
||||
m_connections << QObject::connect(node, &QQuick3DNode::rotationOrderChanged,
|
||||
this, &SelectionBoxGeometry::update, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
INCLUDEPATH += $$PWD/
|
||||
|
||||
qtHaveModule(quick3d) {
|
||||
versionAtLeast(QT_VERSION, 5.15.0):qtHaveModule(quick3d) {
|
||||
QT *= quick3d-private
|
||||
DEFINES *= QUICK3D_MODULE
|
||||
}
|
||||
|
@@ -174,6 +174,7 @@ void Qt5InformationNodeInstanceServer::createEditView3D()
|
||||
#ifdef QUICK3D_MODULE
|
||||
static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW");
|
||||
|
||||
qmlRegisterRevision<QQuick3DNode, 1>("MouseArea3D", 1, 0);
|
||||
qmlRegisterType<QmlDesigner::Internal::MouseArea3D>("MouseArea3D", 1, 0, "MouseArea3D");
|
||||
qmlRegisterType<QmlDesigner::Internal::CameraGeometry>("CameraGeometry", 1, 0, "CameraGeometry");
|
||||
qmlRegisterType<QmlDesigner::Internal::GridGeometry>("GridGeometry", 1, 0, "GridGeometry");
|
||||
@@ -420,14 +421,22 @@ void Qt5InformationNodeInstanceServer::updateActiveSceneToEditView3D()
|
||||
sceneIdVar = QVariant::fromValue(sceneId);
|
||||
sceneIdProperty.write(sceneIdVar);
|
||||
|
||||
QVariantMap toolStates;
|
||||
|
||||
// if m_active3DScene is null, QQmlProperty::write() doesn't work so invoke the updateActiveScene
|
||||
// qml method directly
|
||||
if (!m_active3DScene) {
|
||||
QMetaObject::invokeMethod(m_editView3DRootItem, "clearActiveScene", Qt::QueuedConnection);
|
||||
toolStates.insert("sceneInstanceId", QVariant::fromValue(-1));
|
||||
} else {
|
||||
QQmlProperty sceneProperty(m_editView3DRootItem, "activeScene", context());
|
||||
sceneProperty.write(activeSceneVar);
|
||||
|
||||
auto helper = qobject_cast<QmlDesigner::Internal::GeneralHelper *>(m_3dHelper);
|
||||
QVariantMap toolStates;
|
||||
if (helper)
|
||||
toolStates = helper->getToolStates(sceneId);
|
||||
toolStates.insert("sceneInstanceId", QVariant::fromValue(sceneInstance.instanceId()));
|
||||
}
|
||||
|
||||
nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::ActiveSceneChanged,
|
||||
toolStates});
|
||||
@@ -514,7 +523,6 @@ void Qt5InformationNodeInstanceServer::doRender3DEditView()
|
||||
{
|
||||
static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW");
|
||||
if (m_editView3DRootItem && !showEditView) {
|
||||
auto t = std::chrono::steady_clock::now();
|
||||
if (!m_editView3DContentItem) {
|
||||
m_editView3DContentItem = QQmlProperty::read(m_editView3DRootItem, "contentItem").value<QQuickItem *>();
|
||||
if (m_editView3DContentItem) {
|
||||
@@ -544,10 +552,6 @@ void Qt5InformationNodeInstanceServer::doRender3DEditView()
|
||||
// send the rendered image to creator process
|
||||
nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::Render3DView,
|
||||
QVariant::fromValue(imgContainer)});
|
||||
qDebug() << "\x1b[42m \x1b[1m" << __FUNCTION__
|
||||
<< ", t=" << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now()-t).count()
|
||||
<< "\x1b[m";
|
||||
|
||||
if (m_needRender) {
|
||||
m_renderTimer.start(0);
|
||||
m_needRender = false;
|
||||
@@ -880,7 +884,7 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
|
||||
m_active3DScene = m_3DSceneMap.begin().key();
|
||||
m_active3DView = findView3DForSceneRoot(m_active3DScene);
|
||||
}
|
||||
if (m_active3DScene) {
|
||||
|
||||
createEditView3D();
|
||||
if (!m_editView3DRootItem) {
|
||||
m_active3DScene = nullptr;
|
||||
@@ -905,7 +909,6 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
|
||||
updateActiveSceneToEditView3D();
|
||||
|
||||
createCameraAndLightGizmos(instanceList);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(instanceList)
|
||||
Q_UNUSED(toolStates)
|
||||
|
@@ -129,7 +129,7 @@ void Quick3DNodeInstance::setPickable(bool enable, bool checkParent, bool applyT
|
||||
checkChildren(node);
|
||||
}
|
||||
}
|
||||
if (nodeType == QQuick3DObject::Model)
|
||||
if (nodeType == QQuick3DObject::Type::Model)
|
||||
setPropertyVariant("pickable", enable); // allow 3D objects to receive mouse clicks
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
<file>mockfiles/Arrow.qml</file>
|
||||
<file>mockfiles/AutoScaleHelper.qml</file>
|
||||
<file>mockfiles/MoveGizmo.qml</file>
|
||||
<file>mockfiles/CameraFrustum.qml</file>
|
||||
<file>mockfiles/CameraGizmo.qml</file>
|
||||
<file>mockfiles/LightGizmo.qml</file>
|
||||
<file>mockfiles/IconGizmo.qml</file>
|
||||
|
@@ -37,14 +37,17 @@ Section {
|
||||
|
||||
Label {
|
||||
text: qsTr("Origin")
|
||||
disabledState: !backendValues.transformOrigin.isAvailable
|
||||
}
|
||||
|
||||
OriginControl {
|
||||
backendValue: backendValues.transformOrigin
|
||||
enabled: backendValues.transformOrigin.isAvailable
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Scale")
|
||||
disabledState: !backendValues.scale.isAvailable
|
||||
}
|
||||
|
||||
SecondColumnLayout {
|
||||
@@ -57,12 +60,14 @@ Section {
|
||||
minimumValue: -10
|
||||
maximumValue: 10
|
||||
Layout.preferredWidth: 140
|
||||
enabled: backendValues.scale.isAvailable
|
||||
}
|
||||
ExpandingSpacer {
|
||||
}
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Rotation")
|
||||
disabledState: !backendValues.rotation.isAvailable
|
||||
}
|
||||
SecondColumnLayout {
|
||||
SpinBox {
|
||||
@@ -73,6 +78,7 @@ Section {
|
||||
minimumValue: -360
|
||||
maximumValue: 360
|
||||
Layout.preferredWidth: 140
|
||||
enabled: backendValues.rotation.isAvailable
|
||||
}
|
||||
ExpandingSpacer {
|
||||
}
|
||||
@@ -110,12 +116,14 @@ Section {
|
||||
Label {
|
||||
visible: majorQtQuickVersion > 1
|
||||
text: qsTr("Smooth")
|
||||
disabledState: !backendValues.smooth.isAvailable
|
||||
}
|
||||
SecondColumnLayout {
|
||||
visible: majorQtQuickVersion > 1
|
||||
CheckBox {
|
||||
backendValue: backendValues.smooth
|
||||
text: qsTr("Smooth sampling active")
|
||||
enabled: backendValues.smooth.isAvailable
|
||||
}
|
||||
ExpandingSpacer {
|
||||
}
|
||||
@@ -124,12 +132,14 @@ Section {
|
||||
Label {
|
||||
visible: majorQtQuickVersion > 1
|
||||
text: qsTr("Antialiasing")
|
||||
disabledState: !backendValues.antialiasing.isAvailable
|
||||
}
|
||||
SecondColumnLayout {
|
||||
visible: majorQtQuickVersion > 1
|
||||
CheckBox {
|
||||
backendValue: backendValues.antialiasing
|
||||
text: qsTr("Anti-aliasing active")
|
||||
enabled: backendValues.antialiasing.isAvailable
|
||||
}
|
||||
ExpandingSpacer {
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: qsTr("Layer")
|
||||
visible: backendValues.layer_effect.isAvailable
|
||||
|
||||
SectionLayout {
|
||||
columns: 2
|
||||
|
@@ -50,6 +50,7 @@ Column {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: qsTr("Border Color")
|
||||
visible: backendValues.border_color.isAvailable
|
||||
|
||||
ColorEditor {
|
||||
caption: qsTr("Border Color")
|
||||
@@ -63,6 +64,7 @@ Column {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: "Rectangle"
|
||||
visible: backendValues.border_color.isAvailable
|
||||
|
||||
SectionLayout {
|
||||
rows: 2
|
||||
|
@@ -37,7 +37,8 @@ Label {
|
||||
property alias toolTip: toolTipArea.tooltip
|
||||
|
||||
width: Math.max(Math.min(240, parent.width - 280), 50)
|
||||
color: StudioTheme.Values.themeTextColor
|
||||
color: label.disabledState ? StudioTheme.Values.themeDisabledTextColor : StudioTheme.Values.themeTextColor
|
||||
|
||||
elide: Text.ElideRight
|
||||
|
||||
font.pixelSize: StudioTheme.Values.myFontSize
|
||||
@@ -46,9 +47,27 @@ Label {
|
||||
Layout.minimumWidth: width
|
||||
Layout.maximumWidth: width
|
||||
|
||||
leftPadding: label.disabledState ? 10 : 0
|
||||
rightPadding: label.disabledState ? 10 : 0
|
||||
|
||||
property bool disabledState: false
|
||||
|
||||
Text {
|
||||
text: "["
|
||||
color: StudioTheme.Values.themeTextColor//StudioTheme.Values.themeDisabledTextColor
|
||||
visible: label.disabledState
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "]"
|
||||
color: StudioTheme.Values.themeTextColor//StudioTheme.Values.themeDisabledTextColor//
|
||||
visible: label.disabledState
|
||||
x: label.contentWidth + 10 + contentWidth
|
||||
}
|
||||
|
||||
ToolTipArea {
|
||||
id: toolTipArea
|
||||
anchors.fill: parent
|
||||
tooltip: label.text
|
||||
tooltip: label.disabledState ? qsTr("This property is not available in this configuration.") : label.text
|
||||
}
|
||||
}
|
||||
|
@@ -42,6 +42,8 @@ Item {
|
||||
readonly property color selectedColor: Theme.qmlDesignerBackgroundColorDarkAlternate()
|
||||
readonly property color unselectedColor: Theme.qmlDesignerBackgroundColorDarker()
|
||||
|
||||
property bool enabled: true
|
||||
|
||||
ExtendedFunctionLogic {
|
||||
id: extFuncLogic
|
||||
backendValue: originControl.backendValue
|
||||
@@ -69,6 +71,7 @@ Item {
|
||||
}
|
||||
|
||||
Grid {
|
||||
opacity: originControl.enabled ? 1 : 0.5
|
||||
rows: 3
|
||||
columns: 3
|
||||
spacing: 5
|
||||
@@ -76,6 +79,7 @@ Item {
|
||||
id: grid
|
||||
|
||||
function setValue(myValue) {
|
||||
if (originControl.enabled)
|
||||
originControl.backendValue.setEnumeration("Item", myValue)
|
||||
}
|
||||
|
||||
|
@@ -84,6 +84,7 @@ QtObject {
|
||||
property string themeControlBackground: "#242424"
|
||||
property string themeControlOutline: "#404040"
|
||||
property string themeTextColor: "#ffffff"
|
||||
property string themeDisabledTextColor: "#909090"
|
||||
|
||||
property string themePanelBackground: "#2a2a2a"
|
||||
property string themeHoverHighlight: "#313131"
|
||||
|
@@ -59,12 +59,13 @@ namespace ADS
|
||||
/**
|
||||
* Private data class of DockAreaTabBar class (pimpl)
|
||||
*/
|
||||
struct DockAreaTabBarPrivate
|
||||
class DockAreaTabBarPrivate
|
||||
{
|
||||
public:
|
||||
DockAreaTabBar *q;
|
||||
DockAreaWidget *m_dockArea;
|
||||
QWidget *m_tabsContainerWidget;
|
||||
QBoxLayout *m_tabsLayout;
|
||||
DockAreaWidget *m_dockArea = nullptr;
|
||||
QWidget *m_tabsContainerWidget = nullptr;
|
||||
QBoxLayout *m_tabsLayout = nullptr;
|
||||
int m_currentIndex = -1;
|
||||
|
||||
/**
|
||||
@@ -87,8 +88,7 @@ namespace ADS
|
||||
* Convenience function to access last tab
|
||||
*/
|
||||
DockWidgetTab *lastTab() const {return q->tab(q->count() - 1);}
|
||||
};
|
||||
// struct DockAreaTabBarPrivate
|
||||
}; // class DockAreaTabBarPrivate
|
||||
|
||||
DockAreaTabBarPrivate::DockAreaTabBarPrivate(DockAreaTabBar *parent)
|
||||
: q(parent)
|
||||
|
@@ -43,7 +43,7 @@ namespace ADS {
|
||||
|
||||
class DockAreaWidget;
|
||||
class DockWidgetTab;
|
||||
struct DockAreaTabBarPrivate;
|
||||
class DockAreaTabBarPrivate;
|
||||
class DockAreaTitleBar;
|
||||
class FloatingDockContainer;
|
||||
class AbstractFloatingWidget;
|
||||
@@ -62,7 +62,7 @@ class ADS_EXPORT DockAreaTabBar : public QScrollArea
|
||||
Q_OBJECT
|
||||
private:
|
||||
DockAreaTabBarPrivate *d; ///< private data (pimpl)
|
||||
friend struct DockAreaTabBarPrivate;
|
||||
friend class DockAreaTabBarPrivate;
|
||||
friend class DockAreaTitleBar;
|
||||
|
||||
void onTabClicked();
|
||||
|
@@ -64,17 +64,17 @@ namespace ADS
|
||||
/**
|
||||
* Private data class of DockAreaTitleBar class (pimpl)
|
||||
*/
|
||||
struct DockAreaTitleBarPrivate
|
||||
class DockAreaTitleBarPrivate
|
||||
{
|
||||
public:
|
||||
DockAreaTitleBar *q;
|
||||
QPointer<TitleBarButtonType> m_tabsMenuButton;
|
||||
QPointer<TitleBarButtonType> m_undockButton;
|
||||
QPointer<TitleBarButtonType> m_closeButton;
|
||||
QBoxLayout *m_layout;
|
||||
DockAreaWidget *m_dockArea;
|
||||
DockAreaTabBar *m_tabBar;
|
||||
QBoxLayout *m_layout = nullptr;
|
||||
DockAreaWidget *m_dockArea = nullptr;
|
||||
DockAreaTabBar *m_tabBar = nullptr;
|
||||
bool m_menuOutdated = true;
|
||||
QMenu *m_tabsMenu;
|
||||
QList<TitleBarButtonType *> m_dockWidgetActionsButtons;
|
||||
|
||||
QPoint m_dragStartMousePos;
|
||||
@@ -124,8 +124,7 @@ namespace ADS
|
||||
* Makes the dock area floating
|
||||
*/
|
||||
AbstractFloatingWidget *makeAreaFloating(const QPoint &offset, eDragState dragState);
|
||||
}; // struct DockAreaTitleBarPrivate
|
||||
|
||||
}; // class DockAreaTitleBarPrivate
|
||||
|
||||
DockAreaTitleBarPrivate::DockAreaTitleBarPrivate(DockAreaTitleBar *parent)
|
||||
: q(parent)
|
||||
|
@@ -48,7 +48,7 @@ namespace ADS {
|
||||
|
||||
class DockAreaTabBar;
|
||||
class DockAreaWidget;
|
||||
struct DockAreaTitleBarPrivate;
|
||||
class DockAreaTitleBarPrivate;
|
||||
|
||||
using TitleBarButtonType = QToolButton;
|
||||
|
||||
@@ -106,7 +106,7 @@ class ADS_EXPORT DockAreaTitleBar : public QFrame
|
||||
Q_OBJECT
|
||||
private:
|
||||
DockAreaTitleBarPrivate *d; ///< private data (pimpl)
|
||||
friend struct DockAreaTitleBarPrivate;
|
||||
friend class DockAreaTitleBarPrivate;
|
||||
|
||||
void onTabsMenuAboutToShow();
|
||||
void onCloseButtonClicked();
|
||||
|
@@ -67,9 +67,9 @@ private:
|
||||
friend class DockContainerWidget;
|
||||
friend class DockContainerWidgetPrivate;
|
||||
friend class DockWidgetTab;
|
||||
friend struct DockWidgetPrivate;
|
||||
friend class DockWidgetPrivate;
|
||||
friend class DockWidget;
|
||||
friend struct DockManagerPrivate;
|
||||
friend class DockManagerPrivate;
|
||||
friend class DockManager;
|
||||
|
||||
void onTabCloseRequested(int index);
|
||||
|
@@ -50,12 +50,12 @@ class DockContainerWidgetPrivate;
|
||||
class DockAreaWidget;
|
||||
class DockWidget;
|
||||
class DockManager;
|
||||
struct DockManagerPrivate;
|
||||
class DockManagerPrivate;
|
||||
class FloatingDockContainer;
|
||||
struct FloatingDockContainerPrivate;
|
||||
class FloatingDockContainerPrivate;
|
||||
class FloatingDragPreview;
|
||||
struct FloatingDragPreviewPrivate;
|
||||
class DockingStateReader;
|
||||
class FloatingDragPreviewPrivate;
|
||||
|
||||
/**
|
||||
* Container that manages a number of dock areas with single dock widgets
|
||||
@@ -71,14 +71,14 @@ private:
|
||||
DockContainerWidgetPrivate *d; ///< private data (pimpl)
|
||||
friend class DockContainerWidgetPrivate;
|
||||
friend class DockManager;
|
||||
friend struct DockManagerPrivate;
|
||||
friend class DockManagerPrivate;
|
||||
friend class DockAreaWidget;
|
||||
friend struct DockAreaWidgetPrivate;
|
||||
friend class FloatingDockContainer;
|
||||
friend struct FloatingDockContainerPrivate;
|
||||
friend class FloatingDockContainerPrivate;
|
||||
friend class DockWidget;
|
||||
friend class FloatingDragPreview;
|
||||
friend struct FloatingDragPreviewPrivate;
|
||||
friend class FloatingDragPreviewPrivate;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@@ -77,13 +77,14 @@ namespace ADS
|
||||
/**
|
||||
* Private data class of DockManager class (pimpl)
|
||||
*/
|
||||
struct DockManagerPrivate
|
||||
class DockManagerPrivate
|
||||
{
|
||||
public:
|
||||
DockManager *q;
|
||||
QList<FloatingDockContainer *> m_floatingWidgets;
|
||||
QList<DockContainerWidget *> m_containers;
|
||||
DockOverlay *m_containerOverlay;
|
||||
DockOverlay *m_dockAreaOverlay;
|
||||
DockOverlay *m_containerOverlay = nullptr;
|
||||
DockOverlay *m_dockAreaOverlay = nullptr;
|
||||
QMap<QString, DockWidget *> m_dockWidgetsMap;
|
||||
bool m_restoringState = false;
|
||||
QVector<FloatingDockContainer *> m_uninitializedFloatingWidgets;
|
||||
@@ -94,7 +95,7 @@ namespace ADS
|
||||
QHash<QString, QDateTime> m_workspaceDateTimes;
|
||||
QString m_workspaceToRestoreAtStartup;
|
||||
bool m_autorestoreLastWorkspace; // This option is set in the Workspace Manager!
|
||||
QSettings *m_settings;
|
||||
QSettings *m_settings = nullptr;
|
||||
|
||||
/**
|
||||
* Private data constructor
|
||||
@@ -144,8 +145,7 @@ namespace ADS
|
||||
bool restoreContainer(int index, DockingStateReader &stream, bool testing);
|
||||
|
||||
void workspaceLoadingProgress();
|
||||
};
|
||||
// struct DockManagerPrivate
|
||||
}; // class DockManagerPrivate
|
||||
|
||||
DockManagerPrivate::DockManagerPrivate(DockManager *parent)
|
||||
: q(parent)
|
||||
@@ -188,6 +188,8 @@ namespace ADS
|
||||
}
|
||||
DockingStateReader stateReader(state);
|
||||
stateReader.readNextStartElement();
|
||||
if (!stateReader.readNextStartElement())
|
||||
return false;
|
||||
if (stateReader.name() != "QtAdvancedDockingSystem") {
|
||||
return false;
|
||||
}
|
||||
|
@@ -66,16 +66,16 @@ const char STARTUP_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/StartupWorkspace";
|
||||
const char AUTO_RESTORE_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/AutoRestoreLastWorkspace";
|
||||
} // namespace Constants
|
||||
|
||||
struct DockManagerPrivate;
|
||||
class DockManagerPrivate;
|
||||
class FloatingDockContainer;
|
||||
struct FloatingDockContainerPrivate;
|
||||
class FloatingDockContainerPrivate;
|
||||
class DockComponentsFactory;
|
||||
class DockContainerWidget;
|
||||
class DockContainerWidgetPrivate;
|
||||
class DockOverlay;
|
||||
class DockAreaTabBar;
|
||||
class DockWidgetTab;
|
||||
struct DockWidgetTabPrivate;
|
||||
class DockWidgetTabPrivate;
|
||||
struct DockAreaWidgetPrivate;
|
||||
class IconProvider;
|
||||
|
||||
@@ -96,17 +96,17 @@ class ADS_EXPORT DockManager : public DockContainerWidget
|
||||
Q_OBJECT
|
||||
private:
|
||||
DockManagerPrivate *d; ///< private data (pimpl)
|
||||
friend struct DockManagerPrivate;
|
||||
friend class DockManagerPrivate;
|
||||
friend class FloatingDockContainer;
|
||||
friend struct FloatingDockContainerPrivate;
|
||||
friend class FloatingDockContainerPrivate;
|
||||
friend class DockContainerWidget;
|
||||
friend class DockContainerWidgetPrivate;
|
||||
friend class DockAreaTabBar;
|
||||
friend class DockWidgetTab;
|
||||
friend struct DockAreaWidgetPrivate;
|
||||
friend struct DockWidgetTabPrivate;
|
||||
friend class DockWidgetTabPrivate;
|
||||
friend class FloatingDragPreview;
|
||||
friend struct FloatingDragPreviewPrivate;
|
||||
friend class FloatingDragPreviewPrivate;
|
||||
friend class DockAreaTitleBar;
|
||||
|
||||
protected:
|
||||
|
@@ -59,11 +59,12 @@ namespace ADS {
|
||||
/**
|
||||
* Private data class of DockOverlay
|
||||
*/
|
||||
struct DockOverlayPrivate
|
||||
class DockOverlayPrivate
|
||||
{
|
||||
public:
|
||||
DockOverlay *q;
|
||||
DockWidgetAreas m_allowedAreas = InvalidDockWidgetArea;
|
||||
DockOverlayCross *m_cross;
|
||||
DockOverlayCross *m_cross = nullptr;
|
||||
QPointer<QWidget> m_targetWidget;
|
||||
DockWidgetArea m_lastLocation = InvalidDockWidgetArea;
|
||||
bool m_dropPreviewEnabled = true;
|
||||
@@ -81,13 +82,14 @@ namespace ADS {
|
||||
/**
|
||||
* Private data of DockOverlayCross class
|
||||
*/
|
||||
struct DockOverlayCrossPrivate
|
||||
class DockOverlayCrossPrivate
|
||||
{
|
||||
public:
|
||||
DockOverlayCross *q;
|
||||
DockOverlay::eMode m_mode = DockOverlay::ModeDockAreaOverlay;
|
||||
DockOverlay *m_dockOverlay;
|
||||
DockOverlay *m_dockOverlay = nullptr;
|
||||
QHash<DockWidgetArea, QWidget *> m_dropIndicatorWidgets;
|
||||
QGridLayout *m_gridLayout;
|
||||
QGridLayout *m_gridLayout = nullptr;
|
||||
QColor m_iconColors[5];
|
||||
bool m_updateRequired = false;
|
||||
double m_lastDevicePixelRatio = 0.1;
|
||||
@@ -335,7 +337,7 @@ namespace ADS {
|
||||
pixmap.setDevicePixelRatio(devicePixelRatio);
|
||||
return pixmap;
|
||||
}
|
||||
};
|
||||
}; // class DockOverlayCrossPrivate
|
||||
|
||||
DockOverlay::DockOverlay(QWidget *parent, eMode mode)
|
||||
: QFrame(parent)
|
||||
|
@@ -48,7 +48,7 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace ADS {
|
||||
|
||||
struct DockOverlayPrivate;
|
||||
class DockOverlayPrivate;
|
||||
class DockOverlayCross;
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ class ADS_EXPORT DockOverlay : public QFrame
|
||||
Q_OBJECT
|
||||
private:
|
||||
DockOverlayPrivate *d; //< private data class
|
||||
friend struct DockOverlayPrivate;
|
||||
friend class DockOverlayPrivate;
|
||||
friend class DockOverlayCross;
|
||||
|
||||
public:
|
||||
@@ -130,7 +130,7 @@ protected:
|
||||
virtual void hideEvent(QHideEvent *event) override;
|
||||
};
|
||||
|
||||
struct DockOverlayCrossPrivate;
|
||||
class DockOverlayCrossPrivate;
|
||||
/**
|
||||
* DockOverlayCross shows a cross with 5 different drop area possibilities.
|
||||
* I could have handled everything inside DockOverlay, but because of some
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
|
||||
private:
|
||||
DockOverlayCrossPrivate *d;
|
||||
friend struct DockOverlayCrossPrivate;
|
||||
friend class DockOverlayCrossPrivate;
|
||||
friend class DockOverlay;
|
||||
|
||||
protected:
|
||||
|
@@ -63,8 +63,9 @@ namespace ADS
|
||||
/**
|
||||
* Private data class of DockWidget class (pimpl)
|
||||
*/
|
||||
struct DockWidgetPrivate
|
||||
class DockWidgetPrivate
|
||||
{
|
||||
public:
|
||||
DockWidget *q = nullptr;
|
||||
QBoxLayout *m_layout = nullptr;
|
||||
QWidget *m_widget = nullptr;
|
||||
@@ -114,8 +115,7 @@ namespace ADS
|
||||
* Setup the main scroll area
|
||||
*/
|
||||
void setupScrollArea();
|
||||
};
|
||||
// struct DockWidgetPrivate
|
||||
}; // class DockWidgetPrivate
|
||||
|
||||
DockWidgetPrivate::DockWidgetPrivate(DockWidget *parent)
|
||||
: q(parent)
|
||||
@@ -336,9 +336,9 @@ namespace ADS
|
||||
|
||||
void DockWidget::toggleViewInternal(bool open)
|
||||
{
|
||||
DockContainerWidget *dockContainerWidget = dockContainer();
|
||||
DockWidget *topLevelDockWidgetBefore = dockContainerWidget
|
||||
? dockContainerWidget->topLevelDockWidget()
|
||||
const DockContainerWidget *const beforeDockContainerWidget = dockContainer();
|
||||
DockWidget *topLevelDockWidgetBefore = beforeDockContainerWidget
|
||||
? beforeDockContainerWidget->topLevelDockWidget()
|
||||
: nullptr;
|
||||
|
||||
if (open) {
|
||||
@@ -359,12 +359,14 @@ namespace ADS
|
||||
// Here we need to call the dockContainer() function again, because if
|
||||
// this dock widget was unassigned before the call to showDockWidget() then
|
||||
// it has a dock container now
|
||||
dockContainerWidget = dockContainer();
|
||||
const DockContainerWidget *const dockContainerWidget = dockContainer();
|
||||
DockWidget *topLevelDockWidgetAfter = dockContainerWidget
|
||||
? dockContainerWidget->topLevelDockWidget()
|
||||
: nullptr;
|
||||
DockWidget::emitTopLevelEventForWidget(topLevelDockWidgetAfter, true);
|
||||
FloatingDockContainer *floatingContainer = dockContainerWidget->floatingWidget();
|
||||
FloatingDockContainer *floatingContainer = dockContainerWidget
|
||||
? dockContainerWidget->floatingWidget()
|
||||
: nullptr;
|
||||
if (floatingContainer)
|
||||
floatingContainer->updateWindowTitle();
|
||||
|
||||
|
@@ -46,7 +46,7 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace ADS {
|
||||
|
||||
struct DockWidgetPrivate;
|
||||
class DockWidgetPrivate;
|
||||
class DockWidgetTab;
|
||||
class DockManager;
|
||||
class DockContainerWidget;
|
||||
@@ -63,7 +63,7 @@ class ADS_EXPORT DockWidget : public QFrame
|
||||
Q_OBJECT
|
||||
private:
|
||||
DockWidgetPrivate *d; ///< private data (pimpl)
|
||||
friend struct DockWidgetPrivate;
|
||||
friend class DockWidgetPrivate;
|
||||
|
||||
/**
|
||||
* Adjusts the toolbar icon sizes according to the floating state
|
||||
@@ -75,12 +75,12 @@ protected:
|
||||
friend class DockAreaWidget;
|
||||
friend class FloatingDockContainer;
|
||||
friend class DockManager;
|
||||
friend struct DockManagerPrivate;
|
||||
friend class DockManagerPrivate;
|
||||
friend class DockContainerWidgetPrivate;
|
||||
friend class DockAreaTabBar;
|
||||
friend class DockWidgetTab;
|
||||
friend struct DockWidgetTabPrivate;
|
||||
friend struct DockAreaTitleBarPrivate;
|
||||
friend class DockWidgetTabPrivate;
|
||||
friend class DockAreaTitleBarPrivate;
|
||||
|
||||
/**
|
||||
* Assigns the dock manager that manages this dock widget
|
||||
|
@@ -67,12 +67,13 @@ namespace ADS
|
||||
/**
|
||||
* Private data class of DockWidgetTab class (pimpl)
|
||||
*/
|
||||
struct DockWidgetTabPrivate
|
||||
class DockWidgetTabPrivate
|
||||
{
|
||||
public:
|
||||
DockWidgetTab *q;
|
||||
DockWidget *m_dockWidget;
|
||||
DockWidget *m_dockWidget = nullptr;
|
||||
QLabel *m_iconLabel = nullptr;
|
||||
TabLabelType *m_titleLabel;
|
||||
TabLabelType *m_titleLabel = nullptr;
|
||||
QPoint m_globalDragStartMousePosition;
|
||||
QPoint m_dragStartMousePosition;
|
||||
bool m_isActiveTab = false;
|
||||
@@ -81,7 +82,6 @@ namespace ADS
|
||||
AbstractFloatingWidget *m_floatingWidget = nullptr;
|
||||
QIcon m_icon;
|
||||
QAbstractButton *m_closeButton = nullptr;
|
||||
QSpacerItem *m_iconTextSpacer;
|
||||
QPoint m_tabDragStartPosition;
|
||||
|
||||
/**
|
||||
@@ -155,8 +155,7 @@ namespace ADS
|
||||
m_globalDragStartMousePosition = globalPos;
|
||||
m_dragStartMousePosition = q->mapFromGlobal(globalPos);
|
||||
}
|
||||
};
|
||||
// struct DockWidgetTabPrivate
|
||||
}; // class DockWidgetTabPrivate
|
||||
|
||||
DockWidgetTabPrivate::DockWidgetTabPrivate(DockWidgetTab *parent)
|
||||
: q(parent)
|
||||
|
@@ -43,7 +43,7 @@ namespace ADS {
|
||||
|
||||
class DockWidget;
|
||||
class DockAreaWidget;
|
||||
struct DockWidgetTabPrivate;
|
||||
class DockWidgetTabPrivate;
|
||||
|
||||
/**
|
||||
* A dock widget tab that shows a title and an icon.
|
||||
@@ -57,7 +57,7 @@ class ADS_EXPORT DockWidgetTab : public QFrame
|
||||
|
||||
private:
|
||||
DockWidgetTabPrivate *d; ///< private data (pimpl)
|
||||
friend struct DockWidgetTabPrivate;
|
||||
friend class DockWidgetTabPrivate;
|
||||
friend class DockWidget;
|
||||
void onDockWidgetFeaturesChanged();
|
||||
void detachDockWidget();
|
||||
|
@@ -62,10 +62,11 @@ namespace ADS
|
||||
/**
|
||||
* Private data class of FloatingDockContainer class (pimpl)
|
||||
*/
|
||||
struct FloatingDockContainerPrivate
|
||||
class FloatingDockContainerPrivate
|
||||
{
|
||||
public:
|
||||
FloatingDockContainer *q;
|
||||
DockContainerWidget *m_dockContainer;
|
||||
DockContainerWidget *m_dockContainer = nullptr;
|
||||
unsigned int m_zOrderIndex = ++zOrderCounter;
|
||||
QPointer<DockManager> m_dockManager;
|
||||
eDragState m_draggingState = DraggingInactive;
|
||||
@@ -125,8 +126,7 @@ namespace ADS
|
||||
q->setWindowIcon(QApplication::windowIcon());
|
||||
}
|
||||
}
|
||||
};
|
||||
// struct FloatingDockContainerPrivate
|
||||
}; // class FloatingDockContainerPrivate
|
||||
|
||||
FloatingDockContainerPrivate::FloatingDockContainerPrivate(FloatingDockContainer *parent)
|
||||
: q(parent)
|
||||
|
@@ -48,18 +48,18 @@ using FloatingWidgetBaseType = QWidget;
|
||||
|
||||
namespace ADS {
|
||||
|
||||
struct FloatingDockContainerPrivate;
|
||||
class FloatingDockContainerPrivate;
|
||||
class DockManager;
|
||||
struct DockManagerPrivate;
|
||||
class DockManagerPrivate;
|
||||
class DockAreaWidget;
|
||||
class DockContainerWidget;
|
||||
class DockWidget;
|
||||
class DockManager;
|
||||
class DockAreaTabBar;
|
||||
class DockWidgetTab;
|
||||
struct DockWidgetTabPrivate;
|
||||
class DockWidgetTabPrivate;
|
||||
class DockAreaTitleBar;
|
||||
struct DockAreaTitleBarPrivate;
|
||||
class DockAreaTitleBarPrivate;
|
||||
class FloatingWidgetTitleBar;
|
||||
class DockingStateReader;
|
||||
|
||||
@@ -111,14 +111,14 @@ class ADS_EXPORT FloatingDockContainer : public FloatingWidgetBaseType,
|
||||
Q_OBJECT
|
||||
private:
|
||||
FloatingDockContainerPrivate *d; ///< private data (pimpl)
|
||||
friend struct FloatingDockContainerPrivate;
|
||||
friend class FloatingDockContainerPrivate;
|
||||
friend class DockManager;
|
||||
friend struct DockManagerPrivate;
|
||||
friend class DockManagerPrivate;
|
||||
friend class DockAreaTabBar;
|
||||
friend struct DockWidgetTabPrivate;
|
||||
friend class DockWidgetTabPrivate;
|
||||
friend class DockWidgetTab;
|
||||
friend class DockAreaTitleBar;
|
||||
friend struct DockAreaTitleBarPrivate;
|
||||
friend class DockAreaTitleBarPrivate;
|
||||
friend class DockWidget;
|
||||
friend class DockAreaWidget;
|
||||
friend class FloatingWidgetTitleBar;
|
||||
|
@@ -56,16 +56,16 @@ namespace ADS
|
||||
/**
|
||||
* Private data class (pimpl)
|
||||
*/
|
||||
struct FloatingDragPreviewPrivate
|
||||
class FloatingDragPreviewPrivate
|
||||
{
|
||||
public:
|
||||
FloatingDragPreview *q;
|
||||
QWidget *m_content;
|
||||
QWidget *m_content = nullptr;
|
||||
DockAreaWidget *m_contentSourceArea = nullptr;
|
||||
DockContainerWidget *m_contenSourceContainer = nullptr;
|
||||
QPoint m_dragStartMousePosition;
|
||||
DockManager *m_dockManager;
|
||||
DockManager *m_dockManager = nullptr;
|
||||
DockContainerWidget *m_dropContainer = nullptr;
|
||||
qreal m_windowOpacity;
|
||||
bool m_hidden = false;
|
||||
QPixmap m_contentPreviewPixmap;
|
||||
|
||||
@@ -91,8 +91,7 @@ namespace ADS
|
||||
m_dockManager->dockAreaOverlay()->hideOverlay();
|
||||
q->close();
|
||||
}
|
||||
};
|
||||
// struct FloatingDragPreviewPrivate
|
||||
}; // class FloatingDragPreviewPrivate
|
||||
|
||||
void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &globalPosition)
|
||||
{
|
||||
|
@@ -43,7 +43,7 @@ namespace ADS {
|
||||
|
||||
class DockWidget;
|
||||
class DockAreaWidget;
|
||||
struct FloatingDragPreviewPrivate;
|
||||
class FloatingDragPreviewPrivate;
|
||||
|
||||
/**
|
||||
* A floating overlay is a temporary floating widget that is just used to
|
||||
@@ -56,7 +56,7 @@ class FloatingDragPreview : public QWidget, public AbstractFloatingWidget
|
||||
Q_OBJECT
|
||||
private:
|
||||
FloatingDragPreviewPrivate *d;
|
||||
friend struct FloatingDragPreviewPrivate;
|
||||
friend class FloatingDragPreviewPrivate;
|
||||
|
||||
/**
|
||||
* Cancel non opaque undocking if application becomes inactive
|
||||
|