Merge remote-tracking branch 'origin/4.1'

Change-Id: Ia442f30f387fe9292217582260bbe79e54608810
This commit is contained in:
Orgad Shaneh
2016-08-05 11:59:28 +03:00
committed by Ulf Hermann
125 changed files with 1416 additions and 1407 deletions

1
.qmake.conf Normal file
View File

@@ -0,0 +1 @@
CONFIG += c++14

13
dist/changes-4.1.0.md vendored
View File

@@ -21,6 +21,8 @@ Editing
* Added highlighting of automatically inserted characters
* Added option for skipping automatically inserted character, and changed
it to be done only if the cursor stays before the character
* Added `Modnokai Night Shift v2`, `Qt Creator Dark`,
`Solarized Dark` and `Solarized Light` editor schemes
* Fixed that replacing could change selection (QTCREATORBUG-15623)
All Projects
@@ -90,6 +92,7 @@ Qt Quick Designer
* Added support for Qt Quick Controls 2 styles
* Added `Move to Component` action
* Added `Add New Signal Handler` action
* Added support of Qt Creator themes in the Designer UI
* Improved performance
* Improved error dialog (QTCREATORBUG-15772)
* Fixed crumble bar for component navigation
@@ -152,11 +155,14 @@ Credits for these changes go to:
Albert Astals Cid
Alessandro Portale
Alexander Drozdov
Alexandru Croitor
Andre Hartmann
André Pönitz
Antoine Poliakov
Anton Kudryavtsev
Arnold Dumas
BogDan Vatra
Brett Stottlemyer
Christian Kandeler
Christian Stenger
Cristian Adam
@@ -171,20 +177,25 @@ Jake Petroules
Jaroslaw Kobus
Jean Gressmann
Jochen Becher
Lars Knoll
Leena Miettinen
Lorenz Haas
Lukas Holecek
Marc Mutz
Marc Reilly
Marco Benelli
Marco Bubke
Marc Reilly
Mashrab Kuvatov
Mat Sutcliffe
Maurice Kalinowski
Nazar Gerasymchuk
Nikita Baryshnikov
Nikolai Kosjar
Orgad Shaneh
Oswald Buddenhagen
Philip Lorenz
Robert Löhning
Serhii Moroz
Shinnok
Takumi ASAKI
Thiago Macieira

View File

@@ -156,7 +156,7 @@
\section2 Taking Screen Shots
\QC has the native look and feel on Windows, Linux, and OS X, and therefore,
\QC has the native look and feel on Windows, Linux, and \macos, and therefore,
screen shots can end up looking very different, depending on who takes them
and which system they use. To try to preserve a consistent look and feel in
the \QC Manual, observe the guidelines listed in this section when taking
@@ -207,7 +207,7 @@
You can use a web service, such as \l{https://tinypng.com}, or an image
optimization tool to shrink the images. For example, you can use the Radical
Image Optimization Tool (RIOT) on Windows (very efficient) or ImageOptim on
OS X (much less efficient), or some other tool available on Linux.
\macos (much less efficient), or some other tool available on Linux.
With ImageOptim, you simply drag and drop the image files to the
application. The following section describes the settings to use for RIOT.
@@ -278,7 +278,7 @@
\list
\li nmake docs (on Windows)
\li make docs (on Linux and OS X)
\li make docs (on Linux and \macos)
\endlist
The \QC Manual HTML files are generated in the \c {doc/html} directory.
@@ -286,7 +286,7 @@
\c {doc/html-dev} directory. The help files (\c {.qch}) are generated in the
\c {share/doc/qtcreator} directory in the \QC build directory on Windows and
Linux, and in the \c {bin/Qt Creator.app/Contents/Resources/app} directory
on OS X. You can view the HTML files in a browser and the help files in
on \macos. You can view the HTML files in a browser and the help files in
the \QC \uicontrol Help mode. For more information about adding the help
files to \QC, see
\l{http://doc.qt.io/qtcreator/creator-help.html#adding-external-documentation}

View File

@@ -12,6 +12,7 @@ macro.hr.HTML = "<hr />"
macro.iacute.HTML = "&iacute;"
macro.key = "\\b"
macro.menu = "\\b"
macro.macos = "macOS"
macro.note = "\\b{Note:}"
macro.oslash.HTML = "&oslash;"
macro.ouml.HTML = "&ouml;"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -47,7 +47,7 @@
for which you set up a project in \QC and applications for which you do not
have a project.
Valgrind tools are supported locally only on Linux and OS X. However,
Valgrind tools are supported locally only on Linux and \macos. However,
according to Valgrind.org, support on OS X 10.8 and 10.9 is experimental and
mostly broken. You can run the tools on a remote Linux machine or device
from any development host.

View File

@@ -64,7 +64,7 @@
the Symbol Server provided by Microsoft to the symbol search path of the
debugger. For more information, see \l{Setting CDB Paths on Windows}.
\note To use the Free Software Foundation (FSF) version of GDB on OS X, you
\note To use the Free Software Foundation (FSF) version of GDB on \macos, you
must sign it and modify your \l{glossary-buildandrun-kit}{kit} settings.
This section explains the options you have for debugging C++ code and
@@ -79,7 +79,7 @@
Qt Creator supports native debuggers when working with compiled code. On
most supported platforms, the GNU Symbolic Debugger GDB can be used. On
Microsoft Windows, when using the Microsoft tool chain the Microsoft Console
Debugger CDB, is needed. On OS X, the LLDB debugger can be used. Basic
Debugger CDB, is needed. On \macos, the LLDB debugger can be used. Basic
support for LLDB is also available on Linux, but it is restricted by LLDB's
capabilities there, and considered experimental.
@@ -99,7 +99,7 @@
\li GCC, ICC
\li GDB
\row
\li OS X
\li \macos
\li GCC, Clang
\li LLDB, FSF GDB (experimental)
\row
@@ -130,11 +130,11 @@
\section2 Supported LLDB Versions
The LLDB native debugger has similar functionality to the GDB debugger. LLDB
is the default debugger in Xcode on OS X for supporting C++ on the desktop.
is the default debugger in Xcode on \macos for supporting C++ on the desktop.
LLDB is typically used with the Clang compiler (even though you can use it
with GCC, too).
On OS X you can use the LLDB version delivered with Xcode or build from source.
On \macos you can use the LLDB version delivered with Xcode or build from source.
The minimum supported version is LLDB 320.4.
On Linux, the minimum supported version is LLDB 3.8.
@@ -184,7 +184,7 @@
most Linux distributions the GDB builds shipped with the system
are sufficient. You can also build your own. Follow the
instructions in \l{http://wiki.qt.io/QtCreator_Build_Gdb}
{Building GDB}. Builds of GDB shipped with Xcode on OS X are no
{Building GDB}. Builds of GDB shipped with Xcode on \macos are no
longer supported.
\row
@@ -211,7 +211,7 @@
\l{Setting CDB Paths on Windows}.
\row
\li Debugging tools for OS X
\li Debugging tools for \macos
\li The Qt binary distribution contains both debug and release
variants of the libraries. But you have to explicitly tell the
runtime linker that you want to use the debug libraries even if
@@ -223,7 +223,7 @@
\uicontrol Projects mode. In the run configuration, select
\uicontrol{Use debug version of frameworks}.
For more detailed information about debugging on OS X,
For more detailed information about debugging on \macos,
see: \l{http://developer.apple.com/library/mac/#technotes/tn2124/_index.html#//apple_ref/doc/uid/DTS10003391}
{Mac OS X Debugging Magic}.
@@ -282,9 +282,9 @@
directly from version control or the web, enter the following string in
the \uicontrol {Source Paths} field: \c srv*.
\section1 Setting up FSF GDB for OS X
\section1 Setting up FSF GDB for \macos
To use FSF GDB on OS X, you must sign it and add it to the \QC
To use FSF GDB on \macos, you must sign it and add it to the \QC
\l{glossary-buildandrun-kit}{kits}.
\list 1

View File

@@ -448,18 +448,18 @@
\li To finish debugging, press \key {Shift+F5}.
\li To execute a line of code as a whole, press \key F10
(\key {Command+Shift+O} on OS X).
(\key {Command+Shift+O} on \macos).
\li To step into a function or a subfunction, press \key F11
(\key {Command+Shift+I} on OS X).
(\key {Command+Shift+I} on \macos).
\li To leave the current function or subfunction, press \key {Shift+F11}
(\key {Command+Shift+T} on OS X).
(\key {Command+Shift+T} on \macos).
\li To continue running the program, press \key F5.
\li To run to the line containing the cursor, press \key {Ctrl+F10}
(\key {Shift+F8} on OS X).
(\key {Shift+F8} on \macos).
\li To run to the selected function when you are stepping into a nested
function, press \key {Ctrl+F6}.
@@ -521,7 +521,7 @@
\list
\li In the code editor, click the left margin or press \key F9
(\key F8 for OS X) at a particular line you want the
(\key F8 for \macos) at a particular line you want the
program to stop.
\li In the \uicontrol Breakpoints view, double-click in the empty
@@ -685,7 +685,7 @@
\row
\li GDB and LLDB, and therefore \QC's debugger, also work for optimized
builds on Linux and OS X. Optimization can lead to re-ordering
builds on Linux and \macos. Optimization can lead to re-ordering
of instructions or removal of some local variables, causing the
\uicontrol {Locals and Expressions} view to show unexpected
data.
@@ -780,11 +780,11 @@
For more information, see \l{Using Command Line Options}.
\section2 Stepping into Frameworks in OS X
\section2 Stepping into Frameworks in \macos
In OS X, external libraries are usually built into so-called Frameworks,
In \macos, external libraries are usually built into so-called Frameworks,
which may contain both release and debug versions of the library. When you
run applications on the OS X desktop, the release version of Frameworks is
run applications on the \macos desktop, the release version of Frameworks is
used by default. To step into Frameworks, select the
\uicontrol {Use debug versions of Frameworks} option in the project run
settings.
@@ -801,7 +801,7 @@
The \uicontrol Modules view displays information that the debugger plugin
has about modules included in the application that is being debugged. A
module is a dynamic link library (\c {.dll}) in Windows, a shared object
(\c {.so}) in Linux, and a dynamic shared library (\c {.dylib}) in OS X.
(\c {.so}) in Linux, and a dynamic shared library (\c {.dylib}) in \macos.
In addition, the view displays symbols within the modules and indicates
where each module was loaded.

View File

@@ -76,8 +76,26 @@
\li Restart \QC to be able to use the plugin.
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Beautifier
to specify settings for the tool you want to use.
\li Select \uicontrol Tools > \uicontrol Options >
\uicontrol Beautifier to specify settings for beautifying files.
\li Select the \uicontrol {Enable auto format on file save} check box to
automatically beautify files when you save them using the tool you
select in the \uicontrol Tool field.
\image qt-creator-beautifier-options-general.png
\li In the \uicontrol {Restrict to MIME types} field, define the MIME
types of the files to beautify, separated by semicolons. Leave the
field empty to apply the tool on all files.
\li Select the \uicontrol {Restrict to files contained in the current
project} check box to only beautify files that belong to the
current project.
\li Select \uicontrol {Artistic Style}, \uicontrol {Clang Format}, or
\uicontrol Uncrustify to specify settings for the tool you want to
use.
\image beautifier_options.png
@@ -86,10 +104,6 @@
\uicontrol {Clang Format command}, or
\uicontrol {Uncrustify command} field.
\li In the \uicontrol {Restrict to MIME types} field, define the MIME
types of the files to beautify, separated by semicolons. Leave the
field empty to apply the tool on all files.
\li In the \uicontrol Options group, select the configuration file that
defines the style to use in the source files. If you select several
options, they are applied from top down.
@@ -117,8 +131,8 @@
\endlist
\li Select \uicontrol Tools > \uicontrol Beautifier >
\uicontrol {Artistic Style}, \uicontrol ClangFormat, or
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Beautifier
> \uicontrol {Artistic Style}, \uicontrol ClangFormat, or
\uicontrol Uncrustify > \uicontrol {Format Current File} to format
the currently open file.
@@ -133,21 +147,4 @@
file in this case when using Clang, select the
\uicontrol {Format entire file if no text was selected} check box in the
\uicontrol {Clang Format} options.
To automatically format files when they are saved, select \uicontrol Tools >
\uicontrol Beautifier > \uicontrol General:
\list 1
\li In the \uicontrol Tool field, select the tool for formatting.
\li In the \uicontrol {Restrict to MIME types} field, specify a
semicolon-separated list of MIME types. One of these types must
match the MIME type of the file that is auto formatted.
An empty list accepts all files.
\li Select the \uicontrol {Restrict to files contained in the current
project} check box to only auto format files in the current project.
\endlist
*/

View File

@@ -84,8 +84,37 @@
include several files, processing a single file and all the included files
can take a while.
To make parsing faster, pre-compiled headers are ignored by default. You can
specify that Clang processes them in \uicontrol {Code Model} options.
To make parsing faster, pre-compiled headers are ignored by default. To
specify that Clang processes them, select \uicontrol Tools >
\uicontrol Options > \uicontrol C++ > \uicontrol {Code Model}, and
deselect the \uicontrol {Ignore pre-compiled headers} check box.
When Clang encounters risky or possibly erroneous constructions, it issues
warnings. To request or suppress warnings, select \uicontrol Tools >
\uicontrol Options > \uicontrol C++ > \uicontrol {Code Model}. You can
either select one of the predefined configurations, or create a copy of a
configuration and edit it to fit your needs:
\list
\li \uicontrol {Pedantic Warnings} uses the \c -Wpendantic option that
requests all the warnings demanded by strict ISO C and ISO C++.
\li \uicontrol {Warnings for Questionable Constructs} combines the
\c -Wall and \c -Wextra options to request all warnings about easily
avoidable questionable constructions and some additional warnings.
\li \uicontrol {Warnings for Almost Everything} uses the \c -Weverything
option with negative options to suppress some warnings.
\endlist
You can edit the predefined configurations to request specific warnings
beginning with \c -W. Each of these warnings also has a negative version
that begins with \c -Wno. Keep in mind that some options turn on other
options. For more information, see
\l{https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html}
{Options to Request or Suppress Warnings} or the GCC or Clang manual pages.
The following services are currently implemented in the experimental Clang
code model plugin:
@@ -147,8 +176,17 @@
\li Restart \QC to be able to use the plugin.
\li To process pre-compiled headers before processing any project files,
deselect the \uicontrol {Ignore pre-compiled headers} check box.
\li To specify settings for the Clang code model, select
\uicontrol Tools > \uicontrol Options > \uicontrol C++ >
\uicontrol {Code Model}.
\image qtcreator-clang-code-model-options.png
\li In the \uicontrol {Configuration to use} list, select the
warnings to request.
\li To have Clang process pre-compiled headers, deselect the
\uicontrol {Ignore pre-compiled headers} check box.
\endlist

View File

@@ -65,7 +65,7 @@
alphabetic order.
To jump to a line and column in the current file, select the line and column
indicator (3) or press \key {Ctrl+L} (or \key {Cmd+L} on OS X) to open the
indicator (3) or press \key {Ctrl+L} (or \key {Cmd+L} on \macos) to open the
locator. Enter the line number and column number in the locator, separated
by a colon (:).

View File

@@ -142,6 +142,17 @@
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} >
\uicontrol Display and deselect \uicontrol {Animate matching parentheses}.
You can use keyboard shortcuts to move within and between blocks. To go to
block end, press \key {Ctrl+]} and to go to block start, press
\key {Ctrl+[}. To also select the lines from the cursor position to the end
or beginning of the block, press \key {Ctrl+Shift+]} and
\key {Ctrl+Shift+[}, respectively.
To select the current block, press \key Ctrl+U. A second key press extends
the selection to the parent block. To undo the last selection, press
\key {Ctrl+Alt+Shift+U}. To enable smart block selection, select
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} >
\uicontrol Behavior > \uicontrol {Enable smart selection changing}.
*/
@@ -193,7 +204,7 @@
schemas. \QC looks for a JSON schema file with a
name that matches the name of the JSON instance file in the user
configuration folder. For example, \c {~/config/QtProject/qtcreator/json} on
Linux and OS X and
Linux and \macos and
\c {C:\Users\username\AppData\Roaming\QtCreator\qtcreator\json}
in Windows. To check JSON data structure, copy the JSON schema file to the
above folder.
@@ -491,6 +502,12 @@
expressions only
\li
\row
\li M128
\li Error
\li A state cannot have the specified child item
\li
\row
\li M201
\li Hint
@@ -894,6 +911,8 @@
\li QML code snippets, which specify QML code constructs
\li Nim code snippets, which specify Nim code constructs
\endlist
\section3 Adding and Editing Snippets
@@ -1036,9 +1055,9 @@
copy the URL of the post on the code pasting service to the
clipboard when you paste a post.
\li Select the \uicontrol {Display Output pane after sending a post} to
display the URL in the \uicontrol {General Messages} output pane
when you paste a post.
\li Select the \uicontrol {Display Output pane after sending a post}
check box to display the URL in the \uicontrol {General Messages}
output pane when you paste a post.
\endlist
@@ -1240,6 +1259,8 @@
identifiers, type names, or left or right \c const or \c volatile
keywords.
\li Name getter functions.
\endlist
You can use the live preview to see how the options change the indentation.
@@ -1423,6 +1444,14 @@
\image qtcreator-pointers-references.png "Pointers and References options"
\section1 Naming Getters
To prefer getter names without the string \e get, select the
\uicontrol {Prefer getter names without "get"} check box in the
\uicontrol {Getter and Setter} tab.
\image qtcreator-code-style-getter-setter.png
*/
@@ -1548,6 +1577,8 @@
\li \uicontrol {Files in File System} recursively searches files
matching the defined file pattern in the selected directory.
\image qtcreator-search-filesystem.png
Select the \uicontrol {Use Git Grep} check box to use Git to
only search tracked files in the Git work tree. To restrict
the search to the HEAD, a tag, a local or remote branch, or
@@ -2442,7 +2473,7 @@
\list
\li Press \key {Ctrl+K} (\key {Cmd+K} on OS X).
\li Press \key {Ctrl+K} (\key {Cmd+K} on \macos).
\li Select \uicontrol Tools > \uicontrol Locate.

View File

@@ -61,7 +61,7 @@
\endlist
On OS X:
On \macos:
\list

View File

@@ -81,7 +81,7 @@
\section1 Using External Text Editors
You can open files for editing in the default text editor for your system:
Notepad on Windows and vi on Linux and OS X.
Notepad on Windows and vi on Linux and \macos.
To open the file you are currently viewing in an external editor, select
\uicontrol Tools > \uicontrol External > \uicontrol Text >
\uicontrol {Edit with Notepad} or \uicontrol {Edit with vi}, depending on
@@ -157,7 +157,7 @@
The tool configurations that you add and modify are stored in XML format in
the user configuration folder. For example,
\c {~/config/QtProject/qtcreator/externaltools}
on Linux and OS X and
on Linux and \macos and
\c {C:\Users\username\AppData\Roaming\QtProject\qtcreator\externaltools}
in Windows. To share a configuration with other users, copy an XML
configuration file to the folder.

View File

@@ -200,19 +200,19 @@
\li Ctrl+6
\row
\li Toggle \uicontrol{Issues} pane
\li Alt+1 (Cmd+1 on OS X)
\li Alt+1 (Cmd+1 on \macos)
\row
\li Toggle \uicontrol{Search Results} pane
\li Alt+2 (Cmd+2 on OS X)
\li Alt+2 (Cmd+2 on \macos)
\row
\li Toggle \uicontrol{Application Output} pane
\li Alt+3 (Cmd+3 on OS X)
\li Alt+3 (Cmd+3 on \macos)
\row
\li Toggle \uicontrol{Compile Output} pane
\li Alt+4 (Cmd+4 on OS X)
\li Alt+4 (Cmd+4 on \macos)
\row
\li Toggle other output panes
\li Alt+number (Cmd+number on OS X)
\li Alt+number (Cmd+number on \macos)
Where the number is the number of the output pane.
\row
@@ -241,7 +241,7 @@
\li Ctrl+Shift+F11
\row
\li Toggle the sidebar
\li Alt+0 (Cmd+0 on OS X)
\li Alt+0 (Cmd+0 on \macos)
\row
\li Undo
\li Ctrl+Z
@@ -337,11 +337,25 @@
\li Go to block start
\li Ctrl+[
\row
\li Go to block end with selection
\li Ctrl+}
\li Go to block end and select the lines between the current cursor
position and the end of the block
\li Ctrl+Shift+]
\row
\li Go to block start with selection
\li Ctrl+{
\li Go to block start and select the lines between the current
cursor position and the beginning of the block
\li Ctrl+Shift+[
\row
\li Select the current block
The second press extends the selection to the parent block. To
enable this behavior, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Text Editor} >
\uicontrol Behavior >
\uicontrol {Enable smart selection changing}.
\li Ctrl+U
\row
\li Undo the latest smart block selection
\li Ctrl+Alt+Shift+U
\row
\li Move current line down
\li Ctrl+Shift+Down
@@ -354,11 +368,6 @@
\row
\li Rewrap paragraph
\li Ctrl+E, R
\row
\li Select the current block
The second press extends the selection to the parent block
\li Ctrl+U
\row
\li Enable text wrapping
\li Ctrl+E, Ctrl+W
@@ -469,6 +478,37 @@
\li Alt+V, n, where n is the number of the user action, from 1 to 9
\endtable
\section3 Emacs Shortcuts
You can specify shortcuts for executing actions in a way that is familiar to
\l{https://www.gnu.org/software/emacs/manual/html_node/emacs/index.html}
{Emacs} editor users. The actions are not bound to any key combinations by
default. The following actions are available:
\list
\li Copy
\li Cut
\li Delete Character
\li Exchange Cursor and Mark
\li Go to File End
\li Go to File Start
\li Go to Line End
\li Go to Line Start
\li Go to Next Character
\li Go to Next Line
\li Go to Next Word
\li Go to Previous Character
\li Go to Previous Line
\li Go to Previous Word
\li Insert Line and Indent
\li Kill Line
\li Kill Word
\li Mark
\li Scroll Half Screen Down
\li Scroll Half Screen Up
\li Yank
\endlist
\section2 Image Viewer Shortcuts
\table

View File

@@ -61,8 +61,8 @@
\key Ctrl+Tab.
To move forward in the location history, press \key {Alt+Right}
(\key {Cmd+Opt+Right} on OS X). To move backward, press \key {Alt+Left}
(\key {Cmd+Opt+Left} on OS X). For example, if you use the \uicontrol Locator
(\key {Cmd+Opt+Right} on \macos). To move backward, press \key {Alt+Left}
(\key {Cmd+Opt+Left} on \macos). For example, if you use the \uicontrol Locator
to jump to a symbol in the same file, you can jump back to your original
location in that file by pressing \key {Alt+Left}.
@@ -96,13 +96,13 @@
\list
\li \uicontrol{Issues} pane Alt+1 (Cmd+1 on OS X)
\li \uicontrol{Issues} pane Alt+1 (Cmd+1 on \macos)
\li \uicontrol{Search Results} pane Alt+2 (Cmd+2 on OS X)
\li \uicontrol{Search Results} pane Alt+2 (Cmd+2 on \macos)
\li \uicontrol{Application Output} pane Alt+3 (Cmd+3 on OS X)
\li \uicontrol{Application Output} pane Alt+3 (Cmd+3 on \macos)
\li \uicontrol{Compile Output} pane Alt+4 (Cmd+4 on OS X)
\li \uicontrol{Compile Output} pane Alt+4 (Cmd+4 on \macos)
\endlist
@@ -136,7 +136,7 @@
To toggle the sidebar in the \uicontrol Edit and \uicontrol Debug modes, click
\inlineimage sidebaricon.png
or press \key Alt+0 (\key Cmd+0 on OS X).
or press \key Alt+0 (\key Cmd+0 on \macos).
For more information on using the sidebar, see
\l {Browsing Project Contents}.
@@ -152,7 +152,7 @@
select the symbol in the list. For more information on using the locator,
see \l{Searching with the Locator}.
Press \key Ctrl (\key Cmd on OS X) and click a symbol to move directly to
Press \key Ctrl (\key Cmd on \macos) and click a symbol to move directly to
the definition or the declaration of the symbol. You can also move the
cursor on the symbol and press \key {F2}. For more information, see
\l{Moving to Symbol Definition or Declaration}.

View File

@@ -157,7 +157,7 @@
\li To toggle the sidebar, click \inlineimage sidebaricon.png
(\uicontrol {Hide Sidebar/Show Sidebar}) or press \key Alt+0
(\key Cmd+0 on OS X).
(\key Cmd+0 on \macos).
\li To split the sidebar, click \inlineimage splitbutton_horizontal.png
(\uicontrol {Split}). Select new content to view in the split view.
@@ -574,7 +574,7 @@
\e options or \e preferences. In this manual, the names and locations on
Windows and Linux are usually used to keep the instructions short. Here are
some places to check if you cannot find a function, dialog, or keyboard
shortcut on OS X when following the instructions:
shortcut on \macos when following the instructions:
\table
\header

View File

@@ -668,7 +668,7 @@
To start a graphical interface to Git, select \uicontrol Tools > \uicontrol Git >
\uicontrol {Git Tools} > \uicontrol {Git Gui}.
\note On OS X, the default Git installation does not contain Git Gui. To
\note On \macos, the default Git installation does not contain Git Gui. To
use Git Gui, install it separately. To start Git Gui from \QC, select
\uicontrol Preferences > \uicontrol {Version Control} > \uicontrol Git, and set the path to
the environment that contains Git Gui in the \uicontrol {Prepend to PATH} field.

View File

@@ -129,7 +129,7 @@
The location depends on the platform. On Linux and other Unix platforms, the files
are located in \c {~/.config/QtProject} and \c {~/.local/share/data/QtProject/qtcreator}.
On OS X, the files are located in \c {~/.config/QtProject} and
On \macos, the files are located in \c {~/.config/QtProject} and
\c {~/Library/Application Support/QtProject/Qt Creator}.
On Windows XP, the files are located in
@@ -152,7 +152,7 @@
for the application. Many plugins specify either the path to the tool they
need or the environment they run in.
This is especially relevant for the OS X where \c {/usr/local/bin} might
This is especially relevant for the \macos where \c {/usr/local/bin} might
not be in the path when \QC is started.
\b {How do I change the interface language for \QC?}
@@ -193,7 +193,7 @@
\b {If I have a choice of GDB versions, which should I use?}
On Linux and Windows, use the Python-enabled GDB versions that are
installed when you install \QC and \QSDK. On OS X, GDB is no longer
installed when you install \QC and \QSDK. On \macos, GDB is no longer
officially supported. To build your own Python-enabled GDB, follow the
instructions in
\l{https://wiki.qt.io/QtCreator_Build_Gdb}{Building GDB}.
@@ -218,7 +218,7 @@
\b {How can I make use of my multi-core CPU with \QC?}
On Linux and OS X, go to \uicontrol Project mode, select your configuration
On Linux and \macos, go to \uicontrol Project mode, select your configuration
in the \uicontrol {Build Settings}, locate the \uicontrol {Build Steps}, and add the
following value, where \c{<num>} is the amount of cores in your CPU:
\c{-j <num>}
@@ -259,7 +259,7 @@
\b {Where is application output shown in \QC?}
\b {On Unix (Linux and OS X):} \c qDebug() and related functions use
\b {On Unix (Linux and \macos):} \c qDebug() and related functions use
the standard output and error output. When you run or debug the
application, you can view the output in the \uicontrol{Application Output} pane.

View File

@@ -35,7 +35,7 @@
You can connect iOS devices to a Mac computer with a USB cable to
build and run applications on them from \QC.
To be able to use \QC on OS X, you must install Xcode, and therefore,
To be able to use \QC on \macos, you must install Xcode, and therefore,
you already have the tool chain for building applications for iOS. \QC
automatically detects the tool chain and creates the necessary
\l{glossary-buildandrun-kit}{kits} for building and running applications on

View File

@@ -113,7 +113,7 @@
\list
\li Xcode tools for your OS X version available on the
\li Xcode tools for your \macos version available on the
Mac App Store.
\endlist

View File

@@ -43,7 +43,7 @@
\li {3,1} Development Platform
\header
\li Linux
\li OS X
\li \macos
\li Windows
\row

View File

@@ -41,7 +41,7 @@
and deploy configurations, select \uicontrol Tools > \uicontrol Options >
\uicontrol {Build & Run}. By
default, the \uicontrol {Always build project before deploying it} and the
\uicontrol {Always deploy project before running it} options are enabled.
\uicontrol {Always deploy project before running it} options (1) are enabled.
Therefore, when you select the \uicontrol Run function, \QC checks for changes in
the project files and also builds and deploys the project if necessary.

View File

@@ -47,6 +47,13 @@
You can add paths to other CMake executables and use them in different
build and run \l{glossary-buildandrun-kit}{kits}.
\QC automatically runs CMake to regenerate makefiles when you edit a
\c CMakeLists.txt configuration file in a project. If the project uses
several configuration files, you can disable the automatic generation of
makefiles by selecting \uicontrol Tools > \uicontrol Options >
\uicontrol {Build & Run} > \uicontrol CMake. Makefiles are automatically
regenerated when you build the project.
\section1 Adding CMake Tools
\QC supports CMake version 3.0, or later. For best results you should use
@@ -67,6 +74,10 @@
\li In the \uicontrol Path field, specify the path to the CMake
executable.
\li Deselect the \uicontrol {Autorun CMake} check box to prevent \QC
from running CMake when you make changes to \c {CMakeLists.txt}
files.
\li Select \uicontrol Apply to save your changes.
\li Select the \uicontrol Kits tab to add the CMake tool to a build and
@@ -94,7 +105,7 @@
\li In the \uicontrol {Create in} field, enter the path for the project
files, and then select \uicontrol Next (or \uicontrol Continue on
OS X).
\macos).
\li In the \uicontrol {Build system} field, select \uicontrol CMake, and
then select \uicontrol Next.
@@ -103,7 +114,7 @@
application for, and then select \uicontrol Next.
\li Review the project settings, and click \uicontrol{Finish} (or
\uicontrol Done on OS X).
\uicontrol Done on \macos).
\li Select \uicontrol {Run CMake} to generate a .cbp file.
@@ -159,7 +170,7 @@
\section1 Building CMake Projects
To build CMake projects, select \uicontrol {Build Project} or press
\key Ctrl+B (or \key Cmd+B on OS X).
\key Ctrl+B (or \key Cmd+B on \macos).
\QC builds CMake projects by running \c make, \c mingw32-make, \c nmake, or
\c ninja depending on the selected kit.
@@ -206,7 +217,7 @@
\image qtcreator-cmake-run-settings.png
To run CMake projects, select \uicontrol Run or press \key Ctrl+R (or
\key Cmd+R on OS X).
\key Cmd+R on \macos).
\section1 Deploying CMake Projects to Embedded Linux Devices

View File

@@ -51,7 +51,7 @@
\list
\li GNU Compiler Collection (GCC) is a compiler for Linux and
OS X.
\macos.
\li MinGW (Minimalist GNU for Windows) is a native software port of GCC
and GNU Binutils for use in the development of native Microsoft
@@ -62,7 +62,7 @@
for Linux.
\li Clang is a C, C++, Objective C, and Objective C++ front-end for the
LLVM compiler for Windows, Linux, and OS X.
LLVM compiler for Windows, Linux, and \macos.
\li QCC is the interface for compiling C++ applications for QNX.

View File

@@ -77,7 +77,7 @@
\li the local user's configuration folder,
\c {$HOME/.config/QtProject/qtcreator/templates/wizards} on Linux
and OS X or \c {%APPDATA%\QtProject\qtcreator\templates\wizards} on
and \macos or \c {%APPDATA%\QtProject\qtcreator\templates\wizards} on
Windows
\endlist

View File

@@ -63,10 +63,10 @@
(PRE_TARGETDEPS) in the project file.
Depending on the development platform, some options might be detected
automatically. For example, on OS X, the library type (\uicontrol Library or
automatically. For example, on \macos, the library type (\uicontrol Library or
\uicontrol Framework) is detected automatically and the option is hidden. However,
if you develop on another platform than OS X and want to build your
project for OS X, you must specify the library type.
if you develop on another platform than \macos and want to build your
project for \macos, you must specify the library type.
The default convention on Windows is that the debug and release versions
of a library have the same name, but are placed in different subdirectories,

View File

@@ -74,6 +74,8 @@
\li \l{Configuring Fonts}
\li \l{Highlighting and Folding Blocks}
\li \l{Viewing Function Tooltips}
\endlist

View File

@@ -19,7 +19,7 @@
you use deployment steps.
The \uicontrol {Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)} option
(only available on OS X) enables you to debug (for example, step into)
(only available on \macos) enables you to debug (for example, step into)
linked frameworks, such as the Qt framework itself. You do not need this
option for debugging your application code.

View File

@@ -16,7 +16,7 @@
\QC uses the compiler specified in the QNX tool chain to build the
application.
\note Debugging is currently only fully supported on Linux and OS X.
\note Debugging is currently only fully supported on Linux and \macos.
It is not possible to insert breakpoints during runtime on Windows.
\section2 Troubleshooting Errors

View File

@@ -41,7 +41,7 @@
(IDE) for application developers to create applications for multiple
desktop, \l {http://doc.qt.io/QtForDeviceCreation/index.html}{embedded},
and mobile device platforms, such as \l{Connecting Android Devices}{Android}
and \l{Connecting iOS Devices}{iOS}. It is available for Linux, OS X and
and \l{Connecting iOS Devices}{iOS}. It is available for Linux, \macos and
Windows
operating systems. For more information, see \l{Supported Platforms}.

View File

@@ -10,7 +10,7 @@
\li In the \uicontrol {Create in} field, enter the path for the project
files, and then select \uicontrol Next (or \uicontrol Continue on
OS X).
\macos).
\li In the \uicontrol {Minimal required Qt version} field, select
\uicontrol {Qt 5.4}, or later.
@@ -30,12 +30,12 @@
Tools > \uicontrol Options > \uicontrol {Build & Run} >
\uicontrol Kits (on Windows and Linux) or in \uicontrol {Qt Creator}
> \uicontrol Preferences \uicontrol {Build & Run} > \uicontrol Kits
(on OS X).
(on \macos).
\li Select \uicontrol Next.
\li Review the project settings, and click \uicontrol{Finish} (or
\uicontrol Done on OS X).
\uicontrol Done on \macos).
\endlist

View File

@@ -115,7 +115,7 @@
\uicontrol Kits.
\li Review the project settings, and click \uicontrol Finish (on Windows
and Linux) or \uicontrol Done (on OS X) to create the project.
and Linux) or \uicontrol Done (on \macos) to create the project.
\endlist

View File

@@ -61,7 +61,7 @@
\li In the \uicontrol {Create in} field, enter the path for the project files.
For example, \c {C:\Qt\examples}, and then click \uicontrol{Next} (on
Windows and Linux) or \uicontrol Continue (on OS X).
Windows and Linux) or \uicontrol Continue (on \macos).
The \uicontrol {Kit Selection} dialog opens.
@@ -73,7 +73,7 @@
\note If only one kit is specified in \uicontrol Tools > \uicontrol Options >
\uicontrol {Build & Run} > \uicontrol Kits (on Windows and Linux) or in
\uicontrol {Qt Creator} > \uicontrol Preferences \uicontrol {Build & Run} > \uicontrol Kits
(on OS X), this dialog is skipped.
(on \macos), this dialog is skipped.
The \uicontrol{Class Information} dialog opens.
@@ -95,7 +95,7 @@
\image qtcreator-new-project-summary-qt-gui.png "Project Management dialog"
\li Review the project settings, and click \uicontrol{Finish} (on Windows and
Linux) or \uicontrol Done (on OS X) to create the project.
Linux) or \uicontrol Done (on \macos) to create the project.
\endlist
@@ -164,7 +164,7 @@
\li Press \key {Ctrl+A} (or \key {Cmd+A}) to select the widgets and
click \uicontrol{Lay out Horizontally} (or press \uicontrol{Ctrl+H} on Linux or
Windows or \key {Ctrl+Shift+H} on OS X) to apply a horizontal
Windows or \key {Ctrl+Shift+H} on \macos) to apply a horizontal
layout (QHBoxLayout).
\image qtcreator-texfinder-ui-horizontal-layout.png "Applying horizontal layout"

View File

@@ -59,8 +59,8 @@
The integrated \QD fetches plugins from the \c {\bin\plugins\designer}
directory in the \QC installation directory on Windows and Linux. For
information about how to configure plugins on OS X, see
\l{Configuring Qt Designer Plugins on OS X}.
information about how to configure plugins on \macos, see
\l{Configuring Qt Designer Plugins on \macos}.
To check which plugins were loaded successfully and which failed, choose
\uicontrol Tools > \uicontrol {Form Editor} >
@@ -72,16 +72,16 @@
of \c bin. To check which plugins were loaded successfully and which failed,
choose \uicontrol Help > \uicontrol {About Plugins}.
\section2 Configuring Qt Designer Plugins on OS X
\section2 Configuring Qt Designer Plugins on \macos
On OS X, a GUI application must be built and run from a bundle. A bundle
On \macos, a GUI application must be built and run from a bundle. A bundle
is a directory structure that appears as a single entity when viewed in the
Finder. A bundle for an application typcially contains the executable and
all the resources it needs.
\QC uses its own set of Qt Libraries located in the bundle, and therefore,
you need to configure the \QD plugins that you want to use with \QC.
Fore more information about how to deploy applications to OS X, see
For more information about how to deploy applications to \macos, see
\l{Qt for OS X - Deployment}.
The following example illustrates how to configure version 5.2.1 of the

View File

@@ -25,7 +25,10 @@ QtcProduct {
name: "Qt.test"
}
cpp.internalVersion: ""
Properties {
condition: qbs.targetOS.contains("unix")
cpp.internalVersion: ""
}
cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"])
cpp.sonamePrefix: qbs.targetOS.contains("macos")
? "@rpath"

View File

@@ -21,12 +21,6 @@ Product {
cpp.cxxLanguageVersion: "c++11"
cpp.defines: qtc.generalDefines
cpp.linkerFlags: {
var flags = [];
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
flags.push("-Wl,-s");
return flags;
}
cpp.minimumOsxVersion: "10.7"
cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2"
cpp.useCxxPrecompiledHeader: useNonGuiPchFile || useGuiPchFile

View File

@@ -6,9 +6,6 @@ QTCREATOR_COMPAT_VERSION = 4.1.82
VERSION = $$QTCREATOR_VERSION
BINARY_ARTIFACTS_BRANCH = master
# enable c++11
CONFIG += c++11
defineReplace(qtLibraryTargetName) {
unset(LIBRARY_NAME)
LIBRARY_NAME = $$1

View File

@@ -1301,8 +1301,12 @@ class DumperBase:
return p > 100000 and (p & 0x7 == 0) and (p < 0x7fffffffffff)
def couldBeQObject():
(vtablePtr, dd) \
= self.extractStruct('PP', objectPtr, 2 * ptrSize)
try:
(vtablePtr, dd) \
= self.extractStruct('PP', objectPtr, 2 * ptrSize)
except:
self.bump("nostruct-1")
return False
if not canBePointer(vtablePtr):
self.bump("vtable")
return False
@@ -1310,8 +1314,12 @@ class DumperBase:
self.bump("d_d_ptr")
return False
(dvtablePtr, qptr, parentPtr, childrenDPtr, flags) \
= self.extractStruct('PPPPI', dd, 4 * ptrSize + 4)
try:
(dvtablePtr, qptr, parentPtr, childrenDPtr, flags) \
= self.extractStruct('PPPPI', dd, 4 * ptrSize + 4)
except:
self.bump("nostruct-2")
return False
#warn("STRUCT DD: %s %s" % (self.currentIName, x))
if not canBePointer(dvtablePtr):
self.bump("dvtable")
@@ -1343,6 +1351,11 @@ class DumperBase:
return True
def extractMetaObjectPtrFromAddress():
return 0
# FIXME: Calling "works" but seems to impact memory contents(!)
# in relevant places. One symptom is that object name
# contents "vanishes" as the reported size of the string
# gets zeroed out(?).
# Try vtable, metaObject() is the first entry.
vtablePtr = self.extractPointer(objectPtr)
metaObjectFunc = self.extractPointer(vtablePtr)
@@ -1493,6 +1506,23 @@ class DumperBase:
for i in range(size):
yield self.createValue(data + i * innerSize, innerType)
def putTypedPointer(self, name, addr, typeName):
""" Prints a typed pointer, expandable if the type can be resolved,
and without children otherwise """
with SubItem(self, name):
self.putAddress(addr)
self.putValue("@0x%x" % addr)
typeObj = self.lookupType(typeName)
if typeObj:
self.putType(typeObj)
self.putNumChild(1)
if self.isExpanded():
with Children(self):
self.putFields(self.createValue(addr, typeObj))
else:
self.putType(typeName)
self.putNumChild(0)
def putStructGuts(self, value):
self.putEmptyValue()
#metaObjectPtr = self.extractMetaObjectPtr(self.addressOf(value), value.type)
@@ -1600,11 +1630,18 @@ class DumperBase:
extraData = 0
if qobjectPtr:
isQt5 = self.qtVersion() >= 0x50000
extraDataOffset = 5 * ptrSize + 8 if isQt5 else 6 * ptrSize + 8
# dd = value["d_ptr"]["d"] is just behind the vtable.
#isQt5 = self.qtVersion() >= 0x50000
#extraDataOffset = 5 * ptrSize + 8 if isQt5 else 6 * ptrSize + 8
# (QObjectData/QObjectPrivate) dd = value["d_ptr"]["d"] is just behind the vtable.
dd = self.extractPointer(qobjectPtr + ptrSize)
extraData = self.extractPointer(dd + extraDataOffset)
if self.qtVersion() >= 0x50000:
(dvtablePtr, qptr, parentPtr, childrenDPtr, flags, postedEvents, dynMetaObjectPtr,
extraData, threadDataPtr, connectionListsPtr, sendersPtr, currentSenderPtr) \
= self.extractStruct('PPPPIIPPPPPP', dd, 10 * ptrSize + 8)
else:
(dvtablePtr, qptr, parentPtr, childrenDPtr, flags, postedEvents, dynMetaObjectPtr,
extraData, threadDataPtr, connectionListsPtr, sendersPtr, currentSenderPtr) \
= (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
if qobjectPtr:
qobjectType = self.lookupQtType("QObject")
@@ -1684,14 +1721,35 @@ class DumperBase:
t = self.extractStruct('IIIII', dataPtr + 56 + i * 20, 20)
putt("method %d" % i, "%s %s %s %s %s" % t)
putt("[extraData]", "0x%x" % toInteger(extraData), "void *")
if isQObject:
with SubItem(self, "[extra]"):
self.put('sortgroup="1"')
self.putEmptyValue()
self.putNumChild(1)
if self.isExpanded():
with Children(self):
if extraData:
self.putTypedPointer("[extraData]", extraData,
self.qtNamespace() + "QObjectPrivate::ExtraData")
if connectionListsPtr:
self.putTypedPointer("[connectionLists]", connectionListsPtr,
self.qtNamespace() + "QObjectConnectionListVector")
with SubItem(self, "[metaObject]"):
self.putAddress(metaObjectPtr)
self.putNumChild(1)
if self.isExpanded():
with Children(self):
self.putQObjectGutsHelper(0, 0, -1, metaObjectPtr, "QMetaObject")
if isQMetaObject or isQObject:
with SubItem(self, "[properties]"):
self.put('sortgroup="5"')
self.putItemCount(propertyCount)
if self.isExpanded():
usesVector = self.qtVersion() >= 0x50700
dynamicPropertyCount = 0
with Children(self):
# Static properties.
for i in range(propertyCount):
@@ -1712,11 +1770,12 @@ class DumperBase:
else:
values = self.listChildrenGenerator(extraData + 2 * ptrSize, variantType)
for (k, v) in zip(names, values):
with SubItem(self, propertyCount):
with SubItem(self, propertyCount + dynamicPropertyCount):
self.put('key="%s",' % self.encodeByteArray(k))
self.put('keyencoded="latin1",')
self.putItem(v)
propertyCount += 1
dynamicPropertyCount += 1
self.putItemCount(propertyCount + dynamicPropertyCount)
else:
# We need a handle to [x] for the user to expand the item
# before we know whether there are actual children. Counting
@@ -1768,21 +1827,18 @@ class DumperBase:
putt("[globalindex]", str(globalOffset + i))
if isQObject:
with SubItem(self, "[metaObject]"):
self.putAddress(metaObjectPtr)
self.putNumChild(1)
if self.isExpanded():
with Children(self):
self.putQObjectGutsHelper(0, 0, -1, metaObjectPtr, "QMetaObject")
if isQObject:
with SubItem(self, "d"):
with SubItem(self, "[d]"):
self.put('sortgroup="15"')
try:
self.putItem(qobject["d_ptr"]["d"])
qobjectPrivateType = self.lookupQtType("QObjectPrivate")
self.putItem(qobject["d_ptr"]["d"].dereference().cast(qobjectPrivateType))
except:
self.putNumChild(0)
self.putSpecialValue("notaccessible")
try:
self.putItem(qobject["d_ptr"]["d"])
except:
self.putNumChild(0)
self.putType(self.qtNamespace() + "QObjectData *")
self.putSpecialValue("notaccessible")
if isQMetaObject:
with SubItem(self, "[superdata]"):

View File

@@ -2,12 +2,12 @@
<style-scheme version="1.0" name="Qt Creator Dark">
<style name="Text" foreground="#d6cf9a" background="#2e2f30"/>
<style name="Link" foreground="#d6c540"/>
<style name="Selection" background="#1d545c"/>
<style name="Selection" foreground="#bec0c2" background="#1d545c"/>
<style name="LineNumber" foreground="#bec0c2" background="#404244"/>
<style name="SearchResult" background="#8a7f2c"/>
<style name="SearchScope" background="#8a602c"/>
<style name="Parentheses" foreground="#bec0c2" background="#1d545c"/>
<style name="ParenthesesMismatch" background="#d64564"/>
<style name="ParenthesesMismatch" background="#ff6aad"/>
<style name="AutoComplete" foreground="#2c408a" background="#9aa7d6"/>
<style name="CurrentLine" background="#373737"/>
<style name="CurrentLineNumber" foreground="#d6c540" bold="true"/>
@@ -26,7 +26,7 @@
<style name="Keyword" foreground="#45c6d6" italic="true"/>
<style name="PrimitiveType" foreground="#d69aa7"/>
<style name="Operator" foreground="#d6bb9a"/>
<style name="Preprocessor" foreground="#d64564"/>
<style name="Preprocessor" foreground="#ff6aad"/>
<style name="Label" foreground="#d6c540"/>
<style name="Comment" foreground="#a8abb0" italic="true"/>
<style name="Doxygen.Comment" foreground="#65676a" bold="true" italic="true"/>
@@ -42,7 +42,7 @@
<style name="JsImportVar" foreground="#4564d6" italic="true"/>
<style name="JsGlobalVar" foreground="#4564d6" italic="true"/>
<style name="QmlStateName" foreground="#45c6d6" italic="true"/>
<style name="Binding" foreground="#d64564"/>
<style name="Binding" foreground="#ff6aad"/>
<style name="DisabledCode" foreground="#969696" background="#474747"/>
<style name="AddedLine" foreground="#45c6d6"/>
<style name="RemovedLine" foreground="#d65645"/>

View File

@@ -28,7 +28,9 @@ bool %{CN}::setHeaderData(int section, Qt::Orientation orientation, const QVaria
int %{CN}::rowCount(const QModelIndex &parent) const
{
if (!parent.isValid())
// For list models only the root node (an invalid parent) should return the list's size. For all
// other (valid) parents, rowCount() should return 0 so that it does not become a tree model.
if (parent.isValid())
return 0;
// FIXME: Implement me!

View File

@@ -97,7 +97,7 @@ MenuBarItemTextColorDisabled=textDisabled
MenuBarItemTextColorNormal=text
MenuItemTextColorDisabled=textDisabled
MenuItemTextColorNormal=text
MiniProjectTargetSelectorBackgroundColor=shadowBackground
MiniProjectTargetSelectorBackgroundColor=normalBackground
MiniProjectTargetSelectorBorderColor=shadowBackground
MiniProjectTargetSelectorSummaryBackgroundColor=shadowBackground
MiniProjectTargetSelectorTextColor=text
@@ -200,6 +200,7 @@ PaletteWindowTextDisabled=textDisabled
PaletteBaseDisabled=backgroundColorDisabled
PaletteTextDisabled=textDisabled
QmlDesigner_BackgroundColor=ff3c3e40
QmlDesigner_HighlightColor=ff46a2da
[Flags]

View File

@@ -171,6 +171,7 @@ ProjectExplorer_TaskWarn_TextMarkColor=ffffa500
ClangCodeModel_Error_TextMarkColor=ffff882f
ClangCodeModel_Warning_TextMarkColor=ffc6c132
QmlDesigner_BackgroundColor=ff4c4e50
QmlDesigner_HighlightColor=ff46a2da
[Flags]

View File

@@ -185,7 +185,8 @@ ProjectExplorer_TaskWarn_TextMarkColor=ffffff40
ClangCodeModel_Error_TextMarkColor=ffff882f
ClangCodeModel_Warning_TextMarkColor=ffceff40
QmlDesigner_HighlightColor=ff46a2da
QmlDesigner_BackgroundColor=ff4c4e50
QmlDesigner_HighlightColor=ff3f91c4
PaletteWindow=normalBackground
PaletteWindowText=text

View File

@@ -39,7 +39,7 @@ DockWidgetResizeHandleColor=splitter
DoubleTabWidget1stSeparatorColor=ffff0000
DoubleTabWidget1stTabActiveTextColor=ff000000
DoubleTabWidget1stTabBackgroundColor=ffff0000
DoubleTabWidget1stTabInactiveTextColor=ffffffff
DoubleTabWidget1stTabInactiveTextColor=ff555555
DoubleTabWidget2ndSeparatorColor=ffff0000
DoubleTabWidget2ndTabActiveTextColor=ffffffff
DoubleTabWidget2ndTabBackgroundColor=ffff0000
@@ -182,6 +182,7 @@ ProjectExplorer_TaskWarn_TextMarkColor=ffffa500
ClangCodeModel_Error_TextMarkColor=ffff882f
ClangCodeModel_Warning_TextMarkColor=ffc6c132
QmlDesigner_BackgroundColor=fff8f8f8
QmlDesigner_HighlightColor=ff46a2da
[Flags]

View File

@@ -181,6 +181,7 @@ ProjectExplorer_TaskWarn_TextMarkColor=ffffa500
ClangCodeModel_Error_TextMarkColor=ffff882f
ClangCodeModel_Warning_TextMarkColor=ffc6c132
QmlDesigner_BackgroundColor=ff4c4e50
QmlDesigner_HighlightColor=ff46a2da
[Flags]

View File

@@ -51,6 +51,7 @@
#include <utils/qtcassert.h>
#ifdef WITH_TESTS
#include <utils/hostosinfo.h>
#include <QTest>
#endif
@@ -1025,7 +1026,8 @@ static int executeTestPlan(const TestPlan &testPlan)
<< QLatin1String("-maxwarnings") << QLatin1String("0"); // unlimit output
qExecArguments << functions;
// avoid being stuck in QTBUG-24925
qExecArguments << "-nocrashhandler";
if (!Utils::HostOsInfo::isWindowsHost())
qExecArguments << "-nocrashhandler";
failedTests += QTest::qExec(testObject, qExecArguments);
}

View File

@@ -38,6 +38,7 @@
#include <QString>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cstring>

View File

@@ -282,6 +282,7 @@ public:
ClangCodeModel_Warning_TextMarkColor,
/* QmlDesigner */
QmlDesigner_BackgroundColor,
QmlDesigner_HighlightColor
};

View File

@@ -258,23 +258,6 @@ static int extractPid(const QString &exeName, const QByteArray &psOutput)
return extractPidFromChunk(psOutput, from);
}
QByteArray AndroidRunner::runPs()
{
if (QThread::currentThread() != thread()) {
QByteArray ret;
QMetaObject::invokeMethod(this, "runPs", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QByteArray, ret));
return ret;
} else {
QByteArray psLine("ps");
if (m_isBusyBox)
psLine += " -w";
psLine += '\n';
m_psProc.write(psLine);
m_psProc.waitForBytesWritten(psLine.size());
return m_psProc.readAllStandardOutput();
}
}
void AndroidRunner::launchAVDProcesses()
{
// Its assumed that the device or avd serial returned by selector() is online.
@@ -284,8 +267,13 @@ void AndroidRunner::launchAVDProcesses()
void AndroidRunner::checkPID()
{
QByteArray psOut = runPs();
m_processPID = extractPid(m_androidRunnable.packageName, psOut);
// Don't write to m_psProc from a different thread
QTC_ASSERT(QThread::currentThread() == thread(), return);
QByteArray psLine(m_isBusyBox ? "ps -w\n" : "ps\n");
m_psProc.write(psLine);
m_psProc.waitForBytesWritten(psLine.size());
m_processPID = extractPid(m_androidRunnable.packageName, m_psProc.readAllStandardOutput());
if (m_processPID == -1) {
if (m_wasStarted) {
@@ -320,11 +308,17 @@ void AndroidRunner::checkPID()
void AndroidRunner::forceStop()
{
// Don't run Utils::SynchronousProcess on the GUI thread
QTC_ASSERT(QThread::currentThread() != thread(), return);
runAdb(selector() << _("shell") << _("am") << _("force-stop") << m_androidRunnable.packageName,
nullptr, 30);
// try killing it via kill -9
const QByteArray out = runPs();
const QByteArray out = Utils::SynchronousProcess()
.runBlocking(m_adb, selector() << _("shell") << _(m_isBusyBox ? "ps -w" : "ps"))
.allRawOutput();
int from = 0;
while (1) {
const int to = out.indexOf('\n', from);
@@ -346,7 +340,7 @@ void AndroidRunner::start()
launchAVD();
}
Utils::runAsync(&AndroidRunner::asyncStart, this);
Utils::runAsync(&AndroidRunner::asyncStart, this).waitForFinished();
}
void AndroidRunner::asyncStart()
@@ -588,8 +582,6 @@ void AndroidRunner::handleRemoteDebuggerRunning()
void AndroidRunner::stop()
{
QMutexLocker locker(&m_mutex);
if (m_avdFutureInterface.isRunning()) {
m_avdFutureInterface.cancel();
m_avdFutureInterface.waitForFinished();
@@ -597,16 +589,21 @@ void AndroidRunner::stop()
}
m_checkPIDTimer.stop();
m_adbLogcatProcess.kill();
m_psProc.kill();
Utils::runAsync(&AndroidRunner::asyncStop, this).waitForFinished();
m_adbLogcatProcess.waitForFinished();
m_psProc.waitForFinished();
}
void AndroidRunner::asyncStop()
{
QMutexLocker locker(&m_mutex);
m_tries = 0;
if (m_processPID != -1) {
forceStop();
emit remoteProcessFinished(QLatin1String("\n\n") + tr("\"%1\" terminated.").arg(m_androidRunnable.packageName));
}
//QObject::disconnect(&m_adbLogcatProcess, 0, this, 0);
m_adbLogcatProcess.kill();
m_adbLogcatProcess.waitForFinished();
m_psProc.kill();
m_psProc.waitForFinished();
foreach (const QStringList &entry, m_androidRunnable.afterFinishADBCommands)
runAdb(selector() << entry);
}

View File

@@ -80,7 +80,7 @@ private:
void logcatReadStandardError();
void logcatReadStandardOutput();
void asyncStart();
Q_INVOKABLE QByteArray runPs();
void asyncStop();
Q_INVOKABLE void launchAVDProcesses();
void adbKill(qint64 pid);
QStringList selector() const { return m_selector; }

View File

@@ -318,8 +318,13 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
QStringList list;
if (isFullParse) {
list = ProjectExplorer::SessionManager::startupProject()->files(ProjectExplorer::Project::SourceFiles);
if (list.isEmpty())
if (list.isEmpty()) {
// at least project file should be there, but might happen if parsing current project
// takes too long, especially when opening sessions holding multiple projects
qCDebug(LOG) << "File list empty (FullParse) - trying again in a sec";
emitUpdateTestTree();
return;
}
qCDebug(LOG) << "setting state to FullParse (scanForTests)";
m_parserState = FullParse;
} else {

View File

@@ -288,6 +288,19 @@
</slots>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>toolTree</tabstop>
<tabstop>addButton</tabstop>
<tabstop>removeButton</tabstop>
<tabstop>revertButton</tabstop>
<tabstop>description</tabstop>
<tabstop>arguments</tabstop>
<tabstop>outputBehavior</tabstop>
<tabstop>errorOutputBehavior</tabstop>
<tabstop>environmentButton</tabstop>
<tabstop>modifiesDocumentCheckbox</tabstop>
<tabstop>inputText</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -128,25 +128,42 @@ IFindSupport::Result ItemViewFind::findStep(const QString &txt, FindFlags findFl
return result;
}
QFrame *ItemViewFind::createSearchableWrapper(QAbstractItemView *treeView, ColorOption lightColored, FetchOption option)
static QFrame *createHelper(QAbstractItemView *treeView,
ItemViewFind::ColorOption colorOption,
ItemViewFind *finder)
{
QFrame *widget = new QFrame;
auto widget = new QFrame;
widget->setFrameStyle(QFrame::NoFrame);
QVBoxLayout *vbox = new QVBoxLayout(widget);
auto placeHolder = new FindToolBarPlaceHolder(widget);
placeHolder->setLightColored(colorOption);
auto vbox = new QVBoxLayout(widget);
vbox->setMargin(0);
vbox->setSpacing(0);
vbox->addWidget(treeView);
auto placeHolder = new FindToolBarPlaceHolder(widget);
placeHolder->setLightColored(lightColored);
vbox->addWidget(placeHolder);
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
auto agg = new Aggregation::Aggregate;
agg->add(treeView);
agg->add(new ItemViewFind(treeView, Qt::DisplayRole, option));
agg->add(finder);
return widget;
}
QFrame *ItemViewFind::createSearchableWrapper(QAbstractItemView *treeView,
ColorOption colorOption,
FetchOption option)
{
return createHelper(treeView, colorOption, new ItemViewFind(treeView, Qt::DisplayRole, option));
}
QFrame *ItemViewFind::createSearchableWrapper(ItemViewFind *finder,
ItemViewFind::ColorOption colorOption)
{
return createHelper(finder->d->m_view, colorOption, finder);
}
IFindSupport::Result ItemViewFind::find(const QString &searchTxt,
FindFlags findFlags,
bool startFromCurrentIndex,

View File

@@ -65,8 +65,10 @@ public:
Result findIncremental(const QString &txt, FindFlags findFlags);
Result findStep(const QString &txt, FindFlags findFlags);
static QFrame *createSearchableWrapper(QAbstractItemView *treeView, ColorOption lightColored = DarkColored,
static QFrame *createSearchableWrapper(QAbstractItemView *treeView, ColorOption colorOption = DarkColored,
FetchOption option = DoNotFetchMoreWhileSearching);
static QFrame *createSearchableWrapper(ItemViewFind *finder, ColorOption colorOption = DarkColored);
private:
Result find(const QString &txt, FindFlags findFlags,
bool startFromCurrentIndex, bool *wrapped);

View File

@@ -155,6 +155,12 @@
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>colorButton</tabstop>
<tabstop>resetColorButton</tabstop>
<tabstop>languageBox</tabstop>
<tabstop>resetWarningsButton</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -238,6 +238,15 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>valueLineEdit</tabstop>
<tabstop>typeSelector</tabstop>
<tabstop>maskLineEdit</tabstop>
<tabstop>useRecommendedGroupBox</tabstop>
<tabstop>startRangeSpinBox</tabstop>
<tabstop>endRangeSpinBox</tabstop>
<tabstop>prioritySpinBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>

View File

@@ -169,6 +169,16 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>filterLineEdit</tabstop>
<tabstop>mimeTypesTreeView</tabstop>
<tabstop>resetButton</tabstop>
<tabstop>patternsLineEdit</tabstop>
<tabstop>magicHeadersTreeWidget</tabstop>
<tabstop>addMagicButton</tabstop>
<tabstop>editMagicButton</tabstop>
<tabstop>removeMagicButton</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -374,6 +374,21 @@
</slots>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>terminalComboBox</tabstop>
<tabstop>resetTerminalButton</tabstop>
<tabstop>externalFileBrowserEdit</tabstop>
<tabstop>resetFileBrowserButton</tabstop>
<tabstop>helpExternalFileBrowserButton</tabstop>
<tabstop>fileSystemCaseSensitivityChooser</tabstop>
<tabstop>reloadBehavior</tabstop>
<tabstop>autoSaveCheckBox</tabstop>
<tabstop>autoSaveInterval</tabstop>
<tabstop>autoSuspendCheckBox</tabstop>
<tabstop>autoSuspendMinDocumentCount</tabstop>
<tabstop>warnBeforeOpeningBigFiles</tabstop>
<tabstop>bigFilesLimitSpinBox</tabstop>
</tabstops>
<resources>
<include location="core.qrc"/>
</resources>

View File

@@ -371,7 +371,7 @@ void CppEditorPlugin::test_autoBackspace_data()
QTest::newRow((QLatin1String("Inside ") + charGroupTestName(c)).toLatin1().data())
<< fileContent(InBetween, c)
<< QString("([").contains(c);
<< QString("(['\"").contains(c);
}
}

View File

@@ -18,9 +18,6 @@ HEADERS += \
cpphighlighter.h \
cpphoverhandler.h \
cppincludehierarchy.h \
cppincludehierarchyitem.h \
cppincludehierarchymodel.h \
cppincludehierarchytreeview.h \
cppinsertvirtualmethods.h \
cpplocalrenaming.h \
cppoutline.h \
@@ -48,9 +45,6 @@ SOURCES += \
cpphighlighter.cpp \
cpphoverhandler.cpp \
cppincludehierarchy.cpp \
cppincludehierarchyitem.cpp \
cppincludehierarchymodel.cpp \
cppincludehierarchytreeview.cpp \
cppinsertvirtualmethods.cpp \
cpplocalrenaming.cpp \
cppoutline.cpp \

View File

@@ -37,9 +37,6 @@ QtcPlugin {
"cpphighlighter.cpp", "cpphighlighter.h",
"cpphoverhandler.cpp", "cpphoverhandler.h",
"cppincludehierarchy.cpp", "cppincludehierarchy.h",
"cppincludehierarchyitem.cpp", "cppincludehierarchyitem.h",
"cppincludehierarchymodel.cpp", "cppincludehierarchymodel.h",
"cppincludehierarchytreeview.cpp", "cppincludehierarchytreeview.h",
"cppinsertvirtualmethods.cpp",
"cppinsertvirtualmethods.h",
"cpplocalrenaming.cpp", "cpplocalrenaming.h",

View File

@@ -29,50 +29,341 @@
#include "cppeditorconstants.h"
#include "cppeditorplugin.h"
#include "cppelementevaluator.h"
#include "cppincludehierarchymodel.h"
#include "cppincludehierarchytreeview.h"
#include <texteditor/textdocument.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/find/itemviewfind.h>
#include <cpptools/baseeditordocumentprocessor.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpptoolsbridge.h>
#include <cpptools/editordocumenthandle.h>
#include <cplusplus/CppDocument.h>
#include <utils/annotateditemdelegate.h>
#include <utils/dropsupport.h>
#include <utils/fileutils.h>
#include <utils/navigationtreeview.h>
#include <utils/qtcassert.h>
#include <QDir>
#include <QCoreApplication>
#include <QKeyEvent>
#include <QLabel>
#include <QLatin1String>
#include <QModelIndex>
#include <QStandardItem>
#include <QStackedWidget>
#include <QVBoxLayout>
using namespace Core;
using namespace CPlusPlus;
using namespace CppTools;
using namespace TextEditor;
using namespace Utils;
namespace CppEditor {
namespace Internal {
// CppIncludeHierarchyWidget
CppIncludeHierarchyWidget::CppIncludeHierarchyWidget() :
QWidget(0),
m_treeView(0),
m_model(0),
m_delegate(0),
m_includeHierarchyInfoLabel(0),
m_editor(0)
enum {
AnnotationRole = Qt::UserRole + 1,
LinkRole
};
static Snapshot globalSnapshot()
{
return CppModelManager::instance()->snapshot();
}
struct FileAndLine
{
FileAndLine() {}
FileAndLine(const QString &f, int l) : file(f), line(l) {}
QString file;
int line = 0;
};
using FileAndLines = QList<FileAndLine>;
static FileAndLines findIncluders(const QString &filePath)
{
FileAndLines result;
const Snapshot snapshot = globalSnapshot();
for (auto cit = snapshot.begin(), citEnd = snapshot.end(); cit != citEnd; ++cit) {
const QString filePathFromSnapshot = cit.key().toString();
Document::Ptr doc = cit.value();
const QList<Document::Include> resolvedIncludes = doc->resolvedIncludes();
for (const auto &includeFile : resolvedIncludes) {
const QString includedFilePath = includeFile.resolvedFileName();
if (includedFilePath == filePath)
result.append(FileAndLine(filePathFromSnapshot, int(includeFile.line())));
}
}
return result;
}
static FileAndLines findIncludes(const QString &filePath, const Snapshot &snapshot)
{
FileAndLines result;
if (Document::Ptr doc = snapshot.document(filePath)) {
const QList<Document::Include> resolvedIncludes = doc->resolvedIncludes();
for (const auto &includeFile : resolvedIncludes)
result.append(FileAndLine(includeFile.resolvedFileName(), 0));
}
return result;
}
class CppIncludeHierarchyItem
: public TypedTreeItem<CppIncludeHierarchyItem, CppIncludeHierarchyItem>
{
public:
enum SubTree { RootItem, InIncludes, InIncludedBy };
CppIncludeHierarchyItem() {}
void createChild(const QString &filePath, SubTree subTree,
int line = 0, bool definitelyNoChildren = false)
{
auto item = new CppIncludeHierarchyItem;
item->m_fileName = filePath.mid(filePath.lastIndexOf('/') + 1);
item->m_filePath = filePath;
item->m_line = line;
item->m_subTree = subTree;
appendChild(item);
for (auto ancestor = this; ancestor; ancestor = ancestor->parent()) {
if (ancestor->filePath() == filePath) {
item->m_isCyclic = true;
break;
}
}
if (filePath == model()->editorFilePath() || definitelyNoChildren)
item->setChildrenChecked();
}
QString filePath() const
{
return isPhony() ? model()->editorFilePath() : m_filePath;
}
private:
bool isPhony() const { return !parent() || !parent()->parent(); }
void setChildrenChecked() { m_checkedForChildren = true; }
CppIncludeHierarchyModel *model() const
{
return static_cast<CppIncludeHierarchyModel *>(TreeItem::model());
}
QVariant data(int column, int role) const override;
Qt::ItemFlags flags(int) const override
{
TextEditorWidget::Link link(m_filePath, m_line);
if (link.hasValidTarget())
return Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
bool canFetchMore() const override;
void fetchMore() override;
QString m_fileName;
QString m_filePath;
int m_line = 0;
SubTree m_subTree = RootItem;
bool m_isCyclic = false;
bool m_checkedForChildren = false;
};
QVariant CppIncludeHierarchyItem::data(int column, int role) const
{
Q_UNUSED(column);
if (role == Qt::DisplayRole) {
if (isPhony() && childCount() == 0)
return QString(m_fileName + ' ' + CppIncludeHierarchyModel::tr("(none)"));
if (m_isCyclic)
return QString(m_fileName + ' ' + CppIncludeHierarchyModel::tr("(cyclic)"));
return m_fileName;
}
if (isPhony())
return QVariant();
switch (role) {
case Qt::ToolTipRole:
return m_filePath;
case Qt::DecorationRole:
return FileIconProvider::icon(QFileInfo(m_filePath));
case LinkRole:
return QVariant::fromValue(TextEditorWidget::Link(m_filePath, m_line));
}
return QVariant();
}
bool CppIncludeHierarchyItem::canFetchMore() const
{
if (m_isCyclic || m_checkedForChildren || !children().isEmpty())
return false;
return !model()->m_searching || !model()->m_seen.contains(m_filePath);
}
void CppIncludeHierarchyItem::fetchMore()
{
QTC_ASSERT(canFetchMore(), setChildrenChecked(); return);
QTC_ASSERT(model(), return);
QTC_ASSERT(m_subTree != RootItem, return); // Root should always be populated.
model()->m_seen.insert(m_filePath);
const QString editorFilePath = model()->editorFilePath();
setChildrenChecked();
if (m_subTree == InIncludes) {
auto processor = CppToolsBridge::baseEditorDocumentProcessor(editorFilePath);
QTC_ASSERT(processor, return);
const Snapshot snapshot = processor->snapshot();
const FileAndLines includes = findIncludes(filePath(), snapshot);
for (const FileAndLine &include : includes) {
const FileAndLines subIncludes = findIncludes(include.file, snapshot);
bool definitelyNoChildren = subIncludes.isEmpty();
createChild(include.file, InIncludes, include.line, definitelyNoChildren);
}
} else if (m_subTree == InIncludedBy) {
const FileAndLines includers = findIncluders(filePath());
for (const FileAndLine &includer : includers) {
const FileAndLines subIncluders = findIncluders(includer.file);
bool definitelyNoChildren = subIncluders.isEmpty();
createChild(includer.file, InIncludedBy, includer.line, definitelyNoChildren);
}
}
}
void CppIncludeHierarchyModel::buildHierarchy(const QString &document)
{
m_editorFilePath = document;
rootItem()->removeChildren();
rootItem()->createChild(tr("Includes"), CppIncludeHierarchyItem::InIncludes);
rootItem()->createChild(tr("Included by"), CppIncludeHierarchyItem::InIncludedBy);
}
void CppIncludeHierarchyModel::setSearching(bool on)
{
m_searching = on;
m_seen.clear();
}
// CppIncludeHierarchyModel
CppIncludeHierarchyModel::CppIncludeHierarchyModel()
{
setRootItem(new CppIncludeHierarchyItem); // FIXME: Remove in 4.2
}
Qt::DropActions CppIncludeHierarchyModel::supportedDragActions() const
{
return Qt::MoveAction;
}
QStringList CppIncludeHierarchyModel::mimeTypes() const
{
return DropSupport::mimeTypesForFilePaths();
}
QMimeData *CppIncludeHierarchyModel::mimeData(const QModelIndexList &indexes) const
{
auto data = new DropMimeData;
foreach (const QModelIndex &index, indexes) {
auto link = index.data(LinkRole).value<TextEditorWidget::Link>();
if (link.hasValidTarget())
data->addFile(link.targetFileName, link.targetLine, link.targetColumn);
}
return data;
}
// CppIncludeHierarchyTreeView
class CppIncludeHierarchyTreeView : public NavigationTreeView
{
public:
CppIncludeHierarchyTreeView()
{
setDragEnabled(true);
setDragDropMode(QAbstractItemView::DragOnly);
}
protected:
void keyPressEvent(QKeyEvent *event) override
{
if (event->key())
QAbstractItemView::keyPressEvent(event);
else
NavigationTreeView::keyPressEvent(event);
}
};
// IncludeFinder
class IncludeFinder : public ItemViewFind
{
public:
IncludeFinder(QAbstractItemView *view, CppIncludeHierarchyModel *model)
: ItemViewFind(view, Qt::DisplayRole, FetchMoreWhileSearching)
, m_model(model)
{}
private:
Result findIncremental(const QString &txt, FindFlags findFlags)
{
m_model->setSearching(true);
Result result = ItemViewFind::findIncremental(txt, findFlags);
m_model->setSearching(false);
return result;
}
CppIncludeHierarchyModel *m_model; // Not owned.
};
// CppIncludeHierarchyWidget
class CppIncludeHierarchyWidget : public QWidget
{
Q_DECLARE_TR_FUNCTIONS(CppEditor::CppIncludeHierarchy)
public:
CppIncludeHierarchyWidget();
~CppIncludeHierarchyWidget() { delete m_treeView; }
void perform();
private:
void onItemActivated(const QModelIndex &index);
void editorsClosed(QList<IEditor *> editors);
void showNoIncludeHierarchyLabel();
void showIncludeHierarchy();
CppIncludeHierarchyTreeView *m_treeView = nullptr;
CppIncludeHierarchyModel m_model;
AnnotatedItemDelegate m_delegate;
TextEditorLinkLabel *m_inspectedFile = nullptr;
QLabel *m_includeHierarchyInfoLabel = nullptr;
BaseTextEditor *m_editor = nullptr;
};
CppIncludeHierarchyWidget::CppIncludeHierarchyWidget()
{
m_delegate.setDelimiter(" ");
m_delegate.setAnnotationRole(AnnotationRole);
m_inspectedFile = new TextEditorLinkLabel(this);
m_inspectedFile->setMargin(5);
m_model = new CppIncludeHierarchyModel(this);
m_treeView = new CppIncludeHierarchyTreeView(this);
m_delegate = new AnnotatedItemDelegate(this);
m_delegate->setDelimiter(QLatin1String(" "));
m_delegate->setAnnotationRole(AnnotationRole);
m_treeView->setModel(m_model);
m_treeView = new CppIncludeHierarchyTreeView;
m_treeView->setModel(&m_model);
m_treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_treeView->setItemDelegate(m_delegate);
m_treeView->setItemDelegate(&m_delegate);
connect(m_treeView, &QAbstractItemView::activated, this, &CppIncludeHierarchyWidget::onItemActivated);
m_includeHierarchyInfoLabel = new QLabel(tr("No include hierarchy available"), this);
@@ -81,69 +372,53 @@ CppIncludeHierarchyWidget::CppIncludeHierarchyWidget() :
m_includeHierarchyInfoLabel->setBackgroundRole(QPalette::Base);
m_includeHierarchyInfoLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
QVBoxLayout *layout = new QVBoxLayout;
auto layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(m_inspectedFile);
layout->addWidget(Core::ItemViewFind::createSearchableWrapper(
m_treeView,
Core::ItemViewFind::DarkColored,
Core::ItemViewFind::FetchMoreWhileSearching));
layout->addWidget(ItemViewFind::createSearchableWrapper(new IncludeFinder(m_treeView, &m_model)));
layout->addWidget(m_includeHierarchyInfoLabel);
setLayout(layout);
connect(CppEditorPlugin::instance(), &CppEditorPlugin::includeHierarchyRequested,
this, &CppIncludeHierarchyWidget::perform);
connect(Core::EditorManager::instance(), &Core::EditorManager::editorsClosed,
connect(EditorManager::instance(), &EditorManager::editorsClosed,
this, &CppIncludeHierarchyWidget::editorsClosed);
}
CppIncludeHierarchyWidget::~CppIncludeHierarchyWidget()
{
}
void CppIncludeHierarchyWidget::perform()
{
showNoIncludeHierarchyLabel();
m_editor = qobject_cast<CppEditor *>(Core::EditorManager::currentEditor());
m_editor = qobject_cast<CppEditor *>(EditorManager::currentEditor());
if (!m_editor)
return;
CppEditorWidget *widget = qobject_cast<CppEditorWidget *>(m_editor->widget());
if (!widget)
return;
QString document = m_editor->textDocument()->filePath().toString();
m_model.buildHierarchy(document);
m_model->clear();
m_model->buildHierarchy(m_editor, widget->textDocument()->filePath().toString());
if (m_model->isEmpty())
return;
m_inspectedFile->setText(m_editor->textDocument()->displayName());
m_inspectedFile->setLink(TextEditorWidget::Link(document));
m_inspectedFile->setText(widget->textDocument()->displayName());
m_inspectedFile->setLink(TextEditorWidget::Link(widget->textDocument()->filePath().toString()));
//expand "Includes"
m_treeView->expand(m_model->index(0, 0));
//expand "Included by"
m_treeView->expand(m_model->index(1, 0));
// expand "Includes" adn "Included by"
m_treeView->expand(m_model.index(0, 0));
m_treeView->expand(m_model.index(1, 0));
showIncludeHierarchy();
}
void CppIncludeHierarchyWidget::onItemActivated(const QModelIndex &index)
{
const TextEditorWidget::Link link = index.data(LinkRole).value<TextEditorWidget::Link>();
const auto link = index.data(LinkRole).value<TextEditorWidget::Link>();
if (link.hasValidTarget())
Core::EditorManager::openEditorAt(link.targetFileName,
link.targetLine,
link.targetColumn,
Constants::CPPEDITOR_ID);
EditorManager::openEditorAt(link.targetFileName,
link.targetLine,
link.targetColumn,
Constants::CPPEDITOR_ID);
}
void CppIncludeHierarchyWidget::editorsClosed(QList<Core::IEditor *> editors)
void CppIncludeHierarchyWidget::editorsClosed(QList<IEditor *> editors)
{
foreach (Core::IEditor *editor, editors) {
foreach (IEditor *editor, editors) {
if (m_editor == editor)
perform();
}
@@ -163,20 +438,9 @@ void CppIncludeHierarchyWidget::showIncludeHierarchy()
m_includeHierarchyInfoLabel->hide();
}
// CppIncludeHierarchyStackedWidget
CppIncludeHierarchyStackedWidget::CppIncludeHierarchyStackedWidget(QWidget *parent) :
QStackedWidget(parent),
m_typeHiearchyWidgetInstance(new CppIncludeHierarchyWidget)
{
addWidget(m_typeHiearchyWidgetInstance);
}
CppIncludeHierarchyStackedWidget::~CppIncludeHierarchyStackedWidget()
{
delete m_typeHiearchyWidgetInstance;
}
// CppIncludeHierarchyFactory
CppIncludeHierarchyFactory::CppIncludeHierarchyFactory()
{
setDisplayName(tr("Include Hierarchy"));
@@ -184,12 +448,16 @@ CppIncludeHierarchyFactory::CppIncludeHierarchyFactory()
setId(Constants::INCLUDE_HIERARCHY_ID);
}
Core::NavigationView CppIncludeHierarchyFactory::createWidget()
NavigationView CppIncludeHierarchyFactory::createWidget()
{
CppIncludeHierarchyStackedWidget *w = new CppIncludeHierarchyStackedWidget;
static_cast<CppIncludeHierarchyWidget *>(w->currentWidget())->perform();
Core::NavigationView navigationView;
navigationView.widget = w;
auto hierarchyWidget = new CppIncludeHierarchyWidget;
hierarchyWidget->perform();
auto stack = new QStackedWidget;
stack->addWidget(hierarchyWidget);
NavigationView navigationView;
navigationView.widget = stack;
return navigationView;
}

View File

@@ -26,83 +26,52 @@
#pragma once
#include <coreplugin/inavigationwidgetfactory.h>
#include <utils/treemodel.h>
#include <QString>
#include <QStackedWidget>
#include <QWidget>
QT_BEGIN_NAMESPACE
class QStandardItemModel;
class QStandardItem;
class QModelIndex;
class QLabel;
QT_END_NAMESPACE
namespace Core { class IEditor; }
namespace TextEditor {
class BaseTextEditor;
class TextEditorLinkLabel;
}
namespace Utils {
class AnnotatedItemDelegate;
class FileName;
}
#include <QSet>
namespace CppEditor {
namespace Internal {
class CppEditor;
class CppEditorWidget;
class CppInclude;
class CppIncludeHierarchyModel;
class CppIncludeHierarchyTreeView;
class CppIncludeHierarchyItem;
class CppIncludeHierarchyWidget : public QWidget
class CppIncludeHierarchyModel : public Utils::TreeModel<CppIncludeHierarchyItem>
{
Q_OBJECT
public:
CppIncludeHierarchyWidget();
virtual ~CppIncludeHierarchyWidget();
typedef Utils::TreeModel<CppIncludeHierarchyItem> base_type;
void perform();
public:
CppIncludeHierarchyModel();
Qt::DropActions supportedDragActions() const override;
QStringList mimeTypes() const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override;
void buildHierarchy(const QString &filePath);
QString editorFilePath() const { return m_editorFilePath; }
void setSearching(bool on);
QString toString() const;
#if WITH_TESTS
using base_type::canFetchMore;
using base_type::fetchMore;
#endif
private:
void onItemActivated(const QModelIndex &index);
void editorsClosed(QList<Core::IEditor *> editors);
void showNoIncludeHierarchyLabel();
void showIncludeHierarchy();
CppEditorWidget *m_cppEditor;
CppIncludeHierarchyTreeView *m_treeView;
CppIncludeHierarchyModel *m_model;
Utils::AnnotatedItemDelegate *m_delegate;
TextEditor::TextEditorLinkLabel *m_inspectedFile;
QLabel *m_includeHierarchyInfoLabel;
TextEditor::BaseTextEditor *m_editor;
};
// @todo: Pretty much the same design as the OutlineWidgetStack. Maybe we can generalize the
// outline factory so that it works for different widgets that support the same editor.
class CppIncludeHierarchyStackedWidget : public QStackedWidget
{
Q_OBJECT
public:
CppIncludeHierarchyStackedWidget(QWidget *parent = 0);
virtual ~CppIncludeHierarchyStackedWidget();
private:
CppIncludeHierarchyWidget *m_typeHiearchyWidgetInstance;
friend class CppIncludeHierarchyItem;
QString m_editorFilePath;
QSet<QString> m_seen;
bool m_searching = false;
};
class CppIncludeHierarchyFactory : public Core::INavigationWidgetFactory
{
Q_OBJECT
public:
CppIncludeHierarchyFactory();
Core::NavigationView createWidget();
Core::NavigationView createWidget() override;
};
} // namespace Internal

View File

@@ -25,7 +25,7 @@
#include "cppeditorplugin.h"
#include "cppeditortestcase.h"
#include "cppincludehierarchymodel.h"
#include "cppincludehierarchy.h"
#include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cppmodelmanager.h>
@@ -61,6 +61,8 @@ QString toString(CppIncludeHierarchyModel &model, const QModelIndex &index, int
QString toString(CppIncludeHierarchyModel &model)
{
model.fetchMore(model.index(0, 0));
model.fetchMore(model.index(1, 0));
return toString(model, model.index(0, 0))
+ toString(model, model.index(1, 0));
}
@@ -98,8 +100,8 @@ public:
closeEditorAtEndOfTestCase(editor);
// Test model
CppIncludeHierarchyModel model(0);
model.buildHierarchy(editor, fileName);
CppIncludeHierarchyModel model;
model.buildHierarchy(editor->document()->filePath().toString());
const QString actualHierarchy = toString(model);
QCOMPARE(actualHierarchy, expectedHierarchy);
}

View File

@@ -1,123 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
** 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.
**
****************************************************************************/
#include "cppincludehierarchyitem.h"
namespace CppEditor {
namespace Internal {
CppIncludeHierarchyItem::CppIncludeHierarchyItem(const QString &filePath,
CppIncludeHierarchyItem *parent,
bool isCyclic)
: m_fileName(filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1))
, m_filePath(filePath)
, m_parentItem(parent)
, m_isCyclic(isCyclic)
, m_hasChildren(false)
, m_line(0)
{
}
CppIncludeHierarchyItem::~CppIncludeHierarchyItem()
{
removeChildren();
}
const QString &CppIncludeHierarchyItem::fileName() const
{
return m_fileName;
}
const QString &CppIncludeHierarchyItem::filePath() const
{
return m_filePath;
}
CppIncludeHierarchyItem *CppIncludeHierarchyItem::parent() const
{
return m_parentItem;
}
bool CppIncludeHierarchyItem::isCyclic() const
{
return m_isCyclic;
}
void CppIncludeHierarchyItem::appendChild(CppIncludeHierarchyItem *childItem)
{
m_childItems.append(childItem);
}
CppIncludeHierarchyItem *CppIncludeHierarchyItem::child(int row)
{
return m_childItems.at(row);
}
int CppIncludeHierarchyItem::row() const
{
if (m_parentItem)
return m_parentItem->m_childItems.indexOf(const_cast<CppIncludeHierarchyItem*>(this));
return 0;
}
int CppIncludeHierarchyItem::childCount() const
{
return m_childItems.size();
}
void CppIncludeHierarchyItem::removeChildren()
{
qDeleteAll(m_childItems);
m_childItems.clear();
}
bool CppIncludeHierarchyItem::needChildrenPopulate() const
{
return m_hasChildren && m_childItems.isEmpty();
}
bool CppIncludeHierarchyItem::hasChildren() const
{
return m_hasChildren;
}
void CppIncludeHierarchyItem::setHasChildren(bool hasChildren)
{
m_hasChildren = hasChildren;
}
int CppIncludeHierarchyItem::line() const
{
return m_line;
}
void CppIncludeHierarchyItem::setLine(int line)
{
m_line = line;
}
} // namespace Internal
} // namespace CppEditor

View File

@@ -1,68 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
** 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.
**
****************************************************************************/
#pragma once
#include <QList>
#include <QString>
namespace CppEditor {
namespace Internal {
class CppIncludeHierarchyItem
{
public:
CppIncludeHierarchyItem(const QString &filePath, CppIncludeHierarchyItem *parent = 0,
bool isCyclic = false);
virtual ~CppIncludeHierarchyItem();
CppIncludeHierarchyItem *parent() const;
CppIncludeHierarchyItem *child(int row);
int childCount() const;
void appendChild(CppIncludeHierarchyItem *childItem);
void removeChildren();
bool needChildrenPopulate() const;
int row() const;
bool isCyclic() const;
const QString &fileName() const;
const QString &filePath() const;
bool hasChildren() const;
void setHasChildren(bool hasChildren);
int line() const;
void setLine(int line);
private:
QString m_fileName;
QString m_filePath;
QList<CppIncludeHierarchyItem *> m_childItems;
CppIncludeHierarchyItem *m_parentItem;
bool m_isCyclic;
bool m_hasChildren;
int m_line;
};
} // namespace Internal
} // namespace CppEditor

View File

@@ -1,371 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
** 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.
**
****************************************************************************/
#include "cppincludehierarchymodel.h"
#include "cppincludehierarchyitem.h"
#include <coreplugin/fileiconprovider.h>
#include <cpptools/baseeditordocumentprocessor.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpptoolsbridge.h>
#include <cpptools/editordocumenthandle.h>
#include <texteditor/texteditor.h>
#include <cplusplus/CppDocument.h>
#include <utils/dropsupport.h>
#include <utils/qtcassert.h>
#include <QSet>
using namespace CPlusPlus;
using namespace CppTools;
namespace {
Snapshot globalSnapshot()
{
return CppModelManager::instance()->snapshot();
}
} // anonymous namespace
namespace CppEditor {
namespace Internal {
CppIncludeHierarchyModel::CppIncludeHierarchyModel(QObject *parent)
: QAbstractItemModel(parent)
, m_rootItem(new CppIncludeHierarchyItem(QString()))
, m_includesItem(new CppIncludeHierarchyItem(tr("Includes"), m_rootItem))
, m_includedByItem(new CppIncludeHierarchyItem(tr("Included by"), m_rootItem))
, m_editor(0)
{
m_rootItem->appendChild(m_includesItem);
m_rootItem->appendChild(m_includedByItem);
}
CppIncludeHierarchyModel::~CppIncludeHierarchyModel()
{
delete m_rootItem;
}
QModelIndex CppIncludeHierarchyModel::index(int row, int column, const QModelIndex &parent) const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
CppIncludeHierarchyItem *parentItem = parent.isValid()
? static_cast<CppIncludeHierarchyItem*>(parent.internalPointer())
: m_rootItem;
CppIncludeHierarchyItem *childItem = parentItem->child(row);
return childItem ? createIndex(row, column, childItem) : QModelIndex();
}
QModelIndex CppIncludeHierarchyModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
CppIncludeHierarchyItem *childItem
= static_cast<CppIncludeHierarchyItem*>(index.internalPointer());
CppIncludeHierarchyItem *parentItem = childItem->parent();
if (parentItem == m_rootItem)
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);
}
int CppIncludeHierarchyModel::rowCount(const QModelIndex &parent) const
{
CppIncludeHierarchyItem *parentItem;
if (!parent.isValid())
parentItem = m_rootItem;
else
parentItem = static_cast<CppIncludeHierarchyItem*>(parent.internalPointer());
return parentItem->childCount();
}
int CppIncludeHierarchyModel::columnCount(const QModelIndex &) const
{
return 1;
}
QVariant CppIncludeHierarchyModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
CppIncludeHierarchyItem *item = static_cast<CppIncludeHierarchyItem*>(index.internalPointer());
if (!item)
return QVariant();
if (role == Qt::DisplayRole) {
if ((item == m_includesItem && m_includesItem->childCount() == 0)
|| (item == m_includedByItem && m_includedByItem->childCount() == 0)) {
return QString(item->fileName() + QLatin1Char(' ') + tr("(none)"));
}
if (item->isCyclic())
return QString(item->fileName() + QLatin1Char(' ') + tr("(cyclic)"));
return item->fileName();
}
if (item == m_rootItem || item == m_includesItem || item == m_includedByItem)
return QVariant();
switch (role) {
case Qt::ToolTipRole:
return item->filePath();
case Qt::DecorationRole:
return Core::FileIconProvider::icon(QFileInfo(item->filePath()));
case LinkRole: {
QVariant itemLink;
TextEditor::TextEditorWidget::Link link(item->filePath(), item->line());
itemLink.setValue(link);
return itemLink;
}
}
return QVariant();
}
void CppIncludeHierarchyModel::fetchMore(const QModelIndex &parent)
{
if (!parent.isValid())
return;
CppIncludeHierarchyItem *parentItem
= static_cast<CppIncludeHierarchyItem*>(parent.internalPointer());
Q_ASSERT(parentItem);
if (parentItem == m_rootItem || parentItem == m_includesItem || parentItem == m_includedByItem)
return;
if (parentItem->needChildrenPopulate()) {
const QString editorFilePath = m_editor->document()->filePath().toString();
QSet<QString> cyclic;
cyclic << editorFilePath;
CppIncludeHierarchyItem *item = parentItem->parent();
while (!(item == m_includesItem || item == m_includedByItem)) {
cyclic << item->filePath();
item = item->parent();
}
if (item == m_includesItem) {
auto *processor = CppToolsBridge::baseEditorDocumentProcessor(editorFilePath);
QTC_ASSERT(processor, return);
const Snapshot editorDocumentSnapshot = processor->snapshot();
buildHierarchyIncludes_helper(parentItem->filePath(), parentItem,
editorDocumentSnapshot, &cyclic);
} else {
buildHierarchyIncludedBy_helper(parentItem->filePath(), parentItem,
globalSnapshot(), &cyclic);
}
}
}
bool CppIncludeHierarchyModel::canFetchMore(const QModelIndex &parent) const
{
if (!parent.isValid())
return false;
CppIncludeHierarchyItem *parentItem
= static_cast<CppIncludeHierarchyItem*>(parent.internalPointer());
Q_ASSERT(parentItem);
if (parentItem == m_includesItem || parentItem == m_includedByItem)
return false;
if (parentItem->needChildrenPopulate())
return true;
return false;
}
void CppIncludeHierarchyModel::clear()
{
beginResetModel();
m_includesItem->removeChildren();
m_includedByItem->removeChildren();
endResetModel();
}
void CppIncludeHierarchyModel::buildHierarchy(TextEditor::BaseTextEditor *editor,
const QString &filePath)
{
m_editor = editor;
beginResetModel();
buildHierarchyIncludes(filePath);
buildHierarchyIncludedBy(filePath);
endResetModel();
}
bool CppIncludeHierarchyModel::hasChildren(const QModelIndex &parent) const
{
if (!parent.isValid())
return true;
CppIncludeHierarchyItem *parentItem
= static_cast<CppIncludeHierarchyItem*>(parent.internalPointer());
Q_ASSERT(parentItem);
return parentItem->hasChildren();
}
Qt::ItemFlags CppIncludeHierarchyModel::flags(const QModelIndex &index) const
{
const TextEditor::TextEditorWidget::Link link
= index.data(LinkRole).value<TextEditor::TextEditorWidget::Link>();
if (link.hasValidTarget())
return Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
Qt::DropActions CppIncludeHierarchyModel::supportedDragActions() const
{
return Qt::MoveAction;
}
QStringList CppIncludeHierarchyModel::mimeTypes() const
{
return Utils::DropSupport::mimeTypesForFilePaths();
}
QMimeData *CppIncludeHierarchyModel::mimeData(const QModelIndexList &indexes) const
{
auto data = new Utils::DropMimeData;
foreach (const QModelIndex &index, indexes) {
const TextEditor::TextEditorWidget::Link link
= index.data(LinkRole).value<TextEditor::TextEditorWidget::Link>();
if (link.hasValidTarget())
data->addFile(link.targetFileName, link.targetLine, link.targetColumn);
}
return data;
}
bool CppIncludeHierarchyModel::isEmpty() const
{
return !m_includesItem->hasChildren() && !m_includedByItem->hasChildren();
}
void CppIncludeHierarchyModel::buildHierarchyIncludes(const QString &currentFilePath)
{
if (!m_editor)
return;
const QString editorFilePath = m_editor->document()->filePath().toString();
auto *documentProcessor = CppToolsBridge::baseEditorDocumentProcessor(editorFilePath);
QTC_ASSERT(documentProcessor, return);
const Snapshot editorDocumentSnapshot = documentProcessor->snapshot();
QSet<QString> cyclic;
buildHierarchyIncludes_helper(currentFilePath, m_includesItem, editorDocumentSnapshot, &cyclic);
}
void CppIncludeHierarchyModel::buildHierarchyIncludes_helper(const QString &filePath,
CppIncludeHierarchyItem *parent,
Snapshot snapshot,
QSet<QString> *cyclic,
bool recursive)
{
Document::Ptr doc = snapshot.document(filePath);
if (!doc)
return;
parent->setHasChildren(doc->resolvedIncludes().size() > 0);
if (!recursive)
return;
cyclic->insert(filePath);
foreach (const Document::Include &includeFile, doc->resolvedIncludes()) {
const QString includedFilePath = includeFile.resolvedFileName();
CppIncludeHierarchyItem *item = 0;
if (cyclic->contains(includedFilePath)) {
item = new CppIncludeHierarchyItem(includedFilePath, parent, true);
parent->appendChild(item);
continue;
}
item = new CppIncludeHierarchyItem(includedFilePath, parent);
parent->appendChild(item);
buildHierarchyIncludes_helper(includedFilePath, item, snapshot, cyclic, false);
}
cyclic->remove(filePath);
}
void CppIncludeHierarchyModel::buildHierarchyIncludedBy(const QString &currentFilePath)
{
QSet<QString> cyclic;
buildHierarchyIncludedBy_helper(currentFilePath, m_includedByItem, globalSnapshot(), &cyclic);
}
void CppIncludeHierarchyModel::buildHierarchyIncludedBy_helper(const QString &filePath,
CppIncludeHierarchyItem *parent,
Snapshot snapshot,
QSet<QString> *cyclic,
bool recursive)
{
cyclic->insert(filePath);
Snapshot::const_iterator citEnd = snapshot.end();
for (Snapshot::const_iterator cit = snapshot.begin(); cit != citEnd; ++cit) {
const QString filePathFromSnapshot = cit.key().toString();
Document::Ptr doc = cit.value();
foreach (const Document::Include &includeFile, doc->resolvedIncludes()) {
const QString includedFilePath = includeFile.resolvedFileName();
if (includedFilePath == filePath) {
parent->setHasChildren(true);
if (!recursive) {
cyclic->remove(filePath);
return;
}
const bool isCyclic = cyclic->contains(filePathFromSnapshot);
CppIncludeHierarchyItem *item = new CppIncludeHierarchyItem(filePathFromSnapshot,
parent,
isCyclic);
item->setLine(includeFile.line());
parent->appendChild(item);
if (isCyclic)
continue;
buildHierarchyIncludedBy_helper(filePathFromSnapshot, item, snapshot, cyclic,
false);
}
}
}
cyclic->remove(filePath);
}
} // namespace Internal
} // namespace CppEditor

View File

@@ -1,90 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
** 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.
**
****************************************************************************/
#pragma once
#include <QAbstractItemModel>
namespace {
enum ItemRole {
AnnotationRole = Qt::UserRole + 1,
LinkRole
};
} // Anonymous
namespace CPlusPlus { class Snapshot; }
namespace TextEditor { class BaseTextEditor; }
namespace CppEditor {
namespace Internal {
class CppEditor;
class CppIncludeHierarchyItem;
class CppIncludeHierarchyModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit CppIncludeHierarchyModel(QObject *parent);
~CppIncludeHierarchyModel();
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
void fetchMore(const QModelIndex &parent);
bool canFetchMore(const QModelIndex &parent) const;
bool hasChildren(const QModelIndex &parent) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
Qt::DropActions supportedDragActions() const;
QStringList mimeTypes() const;
QMimeData *mimeData(const QModelIndexList &indexes) const;
void clear();
void buildHierarchy(TextEditor::BaseTextEditor *editor, const QString &filePath);
bool isEmpty() const;
private:
void buildHierarchyIncludes(const QString &currentFilePath);
void buildHierarchyIncludes_helper(const QString &filePath, CppIncludeHierarchyItem *parent,
CPlusPlus::Snapshot snapshot,
QSet<QString> *cyclic, bool recursive = true);
void buildHierarchyIncludedBy(const QString &currentFilePath);
void buildHierarchyIncludedBy_helper(const QString &filePath, CppIncludeHierarchyItem *parent,
CPlusPlus::Snapshot snapshot, QSet<QString> *cyclic,
bool recursive = true);
CppIncludeHierarchyItem *m_rootItem;
CppIncludeHierarchyItem *m_includesItem;
CppIncludeHierarchyItem *m_includedByItem;
TextEditor::BaseTextEditor *m_editor;
};
} // namespace Internal
} // namespace CppEditor

View File

@@ -1,52 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
** 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.
**
****************************************************************************/
#include "cppincludehierarchytreeview.h"
#include <QKeyEvent>
namespace CppEditor {
namespace Internal {
CppIncludeHierarchyTreeView::CppIncludeHierarchyTreeView(QWidget *parent/* = 0*/)
: NavigationTreeView(parent)
{
setDragEnabled(true);
setDragDropMode(QAbstractItemView::DragOnly);
}
void CppIncludeHierarchyTreeView::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Asterisk:
QAbstractItemView::keyPressEvent(event);
return;
}
NavigationTreeView::keyPressEvent(event);
}
} // namespace Internal
} // namespace CppEditor

View File

@@ -1,42 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
** 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.
**
****************************************************************************/
#pragma once
#include <utils/navigationtreeview.h>
namespace CppEditor {
namespace Internal {
class CppIncludeHierarchyTreeView : public Utils::NavigationTreeView
{
public:
CppIncludeHierarchyTreeView(QWidget *parent = 0);
protected:
void keyPressEvent(QKeyEvent *event);
};
} // namespace Internal
} // namespace CppEditor

View File

@@ -1516,12 +1516,15 @@ void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie)
str << cookie.address << ' ' << cookie.length;
cmd.args = args;
cmd.callback = [this, cookie](const DebuggerResponse &response) {
if (response.resultClass == ResultDone && cookie.agent) {
if (!cookie.agent)
return;
if (response.resultClass == ResultDone) {
const QByteArray data = QByteArray::fromHex(response.data.data().toUtf8());
if (unsigned(data.size()) == cookie.length)
cookie.agent->addData(cookie.address, data);
} else {
showMessage(response.data["msg"].data(), LogWarning);
cookie.agent->addData(cookie.address, QByteArray(int(cookie.length), char()));
}
};
runCommand(cmd);

View File

@@ -142,16 +142,6 @@ void DebuggerKitConfigWidget::currentDebuggerChanged(int)
m_kit->setValue(DebuggerKitInformation::id(), id);
}
int DebuggerKitConfigWidget::indexOf(const QVariant &id)
{
QTC_ASSERT(id.isValid(), return -1);
for (int i = 0; i < m_comboBox->count(); ++i) {
if (id == m_comboBox->itemData(i))
return i;
}
return -1;
}
QVariant DebuggerKitConfigWidget::currentId() const
{
return m_comboBox->itemData(m_comboBox->currentIndex());

View File

@@ -68,7 +68,6 @@ private:
void manageDebuggers();
void currentDebuggerChanged(int idx);
int indexOf(const QVariant &id);
QVariant currentId() const;
void updateComboBox(const QVariant &id);

View File

@@ -1650,8 +1650,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd);
cmd = ActionManager::registerAction(m_stepOutAction,
Constants::STEPOUT, cppDebuggercontext);
cmd = ActionManager::registerAction(m_stepOutAction, Constants::STEPOUT);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+T") : tr("Shift+F11")));
cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd);

View File

@@ -441,17 +441,19 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration *
if (rp.languages & QmlLanguage) {
if (rp.device && rp.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
QTcpServer server;
const bool canListen = server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6);
if (!canListen) {
errors->append(DebuggerPlugin::tr("Not enough free ports for QML debugging.") + ' ');
return 0;
if (rp.qmlServer.host.isEmpty() || !rp.qmlServer.port.isValid()) {
QTcpServer server;
const bool canListen = server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6);
if (!canListen) {
errors->append(DebuggerPlugin::tr("Not enough free ports for QML debugging.") + ' ');
return 0;
}
TcpServerConnection conn;
conn.host = server.serverAddress().toString();
conn.port = Utils::Port(server.serverPort());
rp.qmlServer = conn;
}
TcpServerConnection conn;
conn.host = server.serverAddress().toString();
conn.port = Utils::Port(server.serverPort());
rp.qmlServer = conn;
// Makes sure that all bindings go through the JavaScript engine, so that
// breakpoints are actually hit!

View File

@@ -49,7 +49,8 @@ using namespace Utils;
static const char* qtBuildPaths[] = {
"Q:/qt5_workdir/w/s",
"C:/work/build/qt5_workdir/w/s",
"c:/users/qt/work/qt"
"c:/users/qt/work/qt",
"c:/Users/qt/work/install"
};
#elif defined(Q_OS_MAC)
static const char* qtBuildPaths[] = {};

View File

@@ -91,6 +91,10 @@ void PdbEngine::postDirectCommand(const QString &command)
void PdbEngine::runCommand(const DebuggerCommand &cmd)
{
if (state() == EngineSetupRequested) { // cmd has been triggered too early
showMessage("IGNORED COMMAND: " + cmd.function);
return;
}
QTC_ASSERT(m_proc.state() == QProcess::Running, notifyEngineIll());
QString command = "qdebug('" + cmd.function + "'," + cmd.argsToPython() + ")";
showMessage(command, LogInput);

View File

@@ -1084,7 +1084,7 @@ void QmlEngine::quitDebugger()
d->noDebugOutputTimer.stop();
d->automaticConnect = false;
d->retryOnConnectFail = false;
DebuggerEngine::quitDebugger();
shutdownInferior();
}
void QmlEngine::disconnected()
@@ -2150,7 +2150,7 @@ void QmlEnginePrivate::handleFrame(const QVariantMap &response)
StackHandler *stackHandler = engine->stackHandler();
WatchHandler * watchHandler = engine->watchHandler();
watchHandler->notifyUpdateStarted();
watchHandler->notifyUpdateStarted({"local"});
const int frameIndex = stackHandler->currentIndex();
if (frameIndex < 0)

View File

@@ -2042,6 +2042,13 @@ void WatchHandler::notifyUpdateFinished()
foreach (auto item, toRemove)
m_model->destroyItem(item);
m_model->forAllItems([this](WatchItem *item) {
if (item->wantsChildren && isExpandedIName(item->iname)) {
m_model->m_engine->showMessage(QString("ADJUSTING CHILD EXPECTATION FOR " + item->iname));
item->wantsChildren = false;
}
});
m_model->m_contentsValid = true;
updateWatchersWindow();
m_model->reexpandItems();

View File

@@ -81,7 +81,7 @@ static QString defaultFallbackFontFamily()
if (Utils::HostOsInfo::isMacHost())
return QString("Helvetica");
if (Utils::HostOsInfo::isAnyUnixHost())
return QString("sans-serif");
return QString("Sans Serif");
return QString("Arial");
}

View File

@@ -106,14 +106,12 @@ bool NimBuildConfiguration::canRestore(const QVariantMap &map)
bool NimBuildConfiguration::hasNimCompilerBuildStep() const
{
BuildStepList *steps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
QTC_ASSERT(steps, return false);
return steps->contains(Constants::C_NIMCOMPILERBUILDSTEP_ID);
return steps ? steps->contains(Constants::C_NIMCOMPILERBUILDSTEP_ID) : false;
}
bool NimBuildConfiguration::hasNimCompilerCleanStep() const
{
BuildStepList *steps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
QTC_ASSERT(steps, return false);
return steps ? steps->contains(Constants::C_NIMCOMPILERCLEANSTEP_ID) : false;
}

View File

@@ -80,6 +80,7 @@ Runnable NimRunConfiguration::runnable() const
result.executable = m_executable;
result.commandLineArguments = m_argumentAspect->arguments();
result.workingDirectory = m_workingDirectoryAspect->workingDirectory().toString();
result.environment = m_localEnvironmentAspect->environment();
return result;
}

View File

@@ -110,7 +110,6 @@ private:
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const;
mutable QImage selectionGradient;
ListWidget *m_listWidget;
};
@@ -128,9 +127,6 @@ void TargetSelectorDelegate::paint(QPainter *painter,
painter->save();
painter->setClipping(false);
if (selectionGradient.isNull())
selectionGradient.load(QLatin1String(":/projectexplorer/images/targetpanel_gradient.png"));
if (option.state & QStyle::State_Selected) {
const QColor color = (option.state & QStyle::State_HasFocus) ?
option.palette.highlight().color() :
@@ -139,6 +135,7 @@ void TargetSelectorDelegate::paint(QPainter *painter,
painter->fillRect(option.rect, color);
} else {
painter->fillRect(option.rect, color.darker(140));
static const QImage selectionGradient(":/projectexplorer/images/targetpanel_gradient.png");
StyleHelper::drawCornerImage(selectionGradient, painter, option.rect.adjusted(0, 0, 0, -1), 5, 5, 5, 5);
const QRectF borderRect = QRectF(option.rect).adjusted(0.5, 0.5, -0.5, -0.5);
painter->setPen(QColor(255, 255, 255, 60));
@@ -1596,7 +1593,7 @@ void MiniProjectTargetSelector::paintEvent(QPaintEvent *)
if (creatorTheme()->flag(Theme::DrawTargetSelectorBottom)) {
// draw thicker border on the bottom
QRect bottomRect(0, rect().height() - 8, rect().width(), 8);
static QImage image(QLatin1String(":/projectexplorer/images/targetpanel_bottom.png"));
static const QImage image(":/projectexplorer/images/targetpanel_bottom.png");
StyleHelper::drawCornerImage(image, &painter, bottomRect, 1, 1, 1, 1);
}
}

View File

@@ -1229,7 +1229,7 @@ QPair<ProFile *, QStringList> QmakePriFileNode::readProFile(const QString &file)
QMakeVfs vfs;
QtSupport::ProMessageHandler handler;
QMakeParser parser(0, &vfs, &handler);
includeFile = parser.parsedProBlock(contents, file, 1);
includeFile = parser.parsedProBlock(QStringRef(&contents), file, 1);
}
return qMakePair(includeFile, lines);
}
@@ -1264,7 +1264,8 @@ bool QmakePriFileNode::renameFile(const QString &oldName,
// We need to re-parse here: The file has changed.
QMakeParser parser(0, 0, 0);
includeFile = parser.parsedProBlock(lines.join(QLatin1Char('\n')),
QString contents = lines.join(QLatin1Char('\n'));
includeFile = parser.parsedProBlock(QStringRef(&contents),
m_projectFilePath.toString(), 1, QMakeParser::FullGrammar);
QTC_ASSERT(includeFile, return false); // The file should still be valid after what we did.

View File

@@ -33,13 +33,6 @@
namespace QmlDesigner {
QColor midtone(const QColor &a, const QColor &b)
{
QColor alphaB = b;
alphaB.setAlpha(128);
return Utils::StyleHelper::alphaBlendedColors(a ,alphaB);
}
void Theming::insertTheme(QQmlPropertyMap *map)
{
const QVariantHash creatorTheme = Utils::creatorTheme()->values();
@@ -47,6 +40,7 @@ void Theming::insertTheme(QQmlPropertyMap *map)
map->insert(it.key(), it.value());
/* Define QmlDesigner colors and remove alpha channels */
const QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColor);
const QColor panelStatusBarBackgroundColor = Utils::creatorTheme()->color(Utils::Theme::PanelStatusBarBackgroundColor);
const QColor fancyToolButtonSelectedColor = Utils::creatorTheme()->color(Utils::Theme::FancyToolButtonSelectedColor);
const QColor darkerBackground = Utils::StyleHelper::alphaBlendedColors(panelStatusBarBackgroundColor, fancyToolButtonSelectedColor);
@@ -65,7 +59,7 @@ void Theming::insertTheme(QQmlPropertyMap *map)
}
map->insert("QmlDesignerBackgroundColorDarker", darkerBackground);
map->insert("QmlDesignerBackgroundColorDarkAlternate", midtone(panelStatusBarBackgroundColor, buttonColor));
map->insert("QmlDesignerBackgroundColorDarkAlternate", backgroundColor);
map->insert("QmlDesignerTabLight", tabLight);
map->insert("QmlDesignerTabDark", tabDark);
map->insert("QmlDesignerButtonColor", buttonColor);

View File

@@ -320,13 +320,13 @@ void DesignModeWidget::setup()
connect(m_warningWidget.data(), &DocumentWarningWidget::gotoCodeClicked, [=]
(const QString &filePath, int codeLine, int codeColumn) {
Q_UNUSED(filePath);
QTC_ASSERT(textEditor(), return;);
QTC_ASSERT(textEditor()->textDocument()->filePath().toString() == filePath,
qDebug() << Q_FUNC_INFO << textEditor()->textDocument()->filePath().toString() <<
filePath; );
textEditor()->gotoLine(codeLine, codeColumn);
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
}
);
qDebug() << Q_FUNC_INFO << textEditor()->textDocument()->filePath().toString() << filePath; );
textEditor()->gotoLine(codeLine, codeColumn);
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
});
QList<Core::SideBarItem*> sideBarItems;
QList<Core::SideBarItem*> leftSideBarItems;

Some files were not shown because too many files have changed in this diff Show More