Merge remote-tracking branch 'origin/4.7'

Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: I29916313f12e25f3942ac926f8e4d4490074978e
This commit is contained in:
Eike Ziller
2018-07-05 11:14:33 +02:00
108 changed files with 6218 additions and 3040 deletions

View File

@@ -54,8 +54,8 @@ include(qt-defines.qdocconf)
sources.fileextensions = "*.qdoc"
qhp.projects = QtCreator
qhp.QtCreator.file = $IDE_ID.qhp
qhp.QtCreator.namespace = org.qt-project.$IDE_ID.$QTC_VERSION_TAG
qhp.QtCreator.file = qtcreator.qhp
qhp.QtCreator.namespace = org.qt-project.qtcreator.$QTC_VERSION_TAG
qhp.QtCreator.virtualFolder = doc
qhp.QtCreator.indexTitle = $IDE_DISPLAY_NAME Manual $QTC_VERSION
qhp.QtCreator.filterAttributes = $IDE_ID $QTC_VERSION

View File

@@ -570,44 +570,45 @@
\row
\li M203
\li Warning
\li Imperative code is not supported in the Qt Quick Designer
\li Imperative code is not supported in the Design mode
\li
\row
\li M204
\li Warning
\li This QML type is not supported in the Qt Quick Designer
\li This QML type is not supported in the Design mode
\li
\row
\li M205
\li Warning
\li Reference to parent QML type cannot be resolved correctly by the Qt
Quick Designer
\li Reference to parent QML type cannot be resolved correctly by the
Design mode
\li
\row
\li M206
\li Warning
\li This visual property binding cannot be evaluated in the local
context and might not show up in Qt Quick Designer as expected
context and might not show up in Design mode as expected
\li
\row
\li M207
\li Warning
\li Qt Quick Designer only supports states in the root QML type
\li Design mode only supports states in the root QML type
\li
\row
\li M208
\li Error
\li This id might be ambiguous and is not supported in the \QMLD.
\li This id might be ambiguous and is not supported in the Design mode.
\li
\row
\li M209
\li Error
\li This type (type name) is not supported as a root element by \QMLD.
\li This type (type name) is not supported as a root element in the
Design mode.
\li
\row
@@ -813,15 +814,15 @@
instead of Qt Quick 2}.
You can see the error message when you move the mouse pointer over code that
\QC underlines in the code editor or when you open a QML file in the
\uicontrol Design mode.
\QC underlines in the code editor or when you open a QML file in the Design
mode.
To reset the code model, select \uicontrol Tools > \uicontrol {QML/JS} >
\uicontrol {Reset Code Model}.
If this does not help, try changing the QML emulation layer to the one that
was built with the same Qt version as the one selected in the build and run
kit. For more information, see \l{Running QML Modules in Qt Quick Designer}.
kit. For more information, see \l{Running QML Modules in Design Mode}.
\section1 Inspecting QML and JavaScript
@@ -2729,7 +2730,7 @@
\image qtcreator-move-component-into-separate-file.png
\li QML type name. This action is also available in the
\uicontrol {Form Editor} in \QMLD.
\uicontrol {Form Editor} in the Design mode.
\row
\li Split Initializer
\li Reformats a one-line type into a multi-line type. For example,

View File

@@ -235,7 +235,7 @@
select \uicontrol {GTest Filter} and specify the filter to use in the
\uicontrol {Active filter} field. For more information about GTest
filters, see
\l{https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#running-a-subset-of-the-tests}
\l{https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#running-a-subset-of-the-tests}
{Running a Subset of the Tests}.
\image qtcreator-autotests-options.png

View File

@@ -539,7 +539,10 @@
\li Ctrl+0
\endtable
\section2 Qt Quick Designer Keyboard Shortcuts
\section2 Design Mode Keyboard Shortcuts
You can use the following keyboard shortcuts when editing QML files in the
Design mode.
\table
\header

View File

@@ -152,8 +152,9 @@
\endlist
For more information about the sidebar views that are only available in
\QMLD, see \l{Using Qt Quick Designer}.
For more information about the sidebar views that are only
available when editing QML files in the Design mode, see
\l{Editing QML Files in Design Mode}.
You can change the view of the sidebars in the following ways:

View File

@@ -104,7 +104,7 @@
\b {What should I do when \QC complains about missing OpenGL support?}
Some parts of \QC, such as \QMLD and QML Profiler, use Qt Quick 2, which
Some parts of \QC, such as the Design mode and QML Profiler, use Qt Quick 2, which
relies on OpenGL API for drawing. Unfortunately, the use of OpenGL can cause
problems, especially in remote setups and with outdated drivers. In these
cases, \QC displays OpenGL-related error messages on the console or records

View File

@@ -36,6 +36,12 @@
\title Acknowledgements
\section1 Credits
We would like to thank our contributors, who are listed in the \QC
\l{https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/dist}{change logs}
for each release.
\section1 Third-party Components
\QC contains the following third-party components:

View File

@@ -42,7 +42,7 @@
\list
\li \l{Analyzing CPU Usage}{Performance Analyzer}
\li \l{Browsing ISO 7000 Icons} in \QMLD
\li \l{Browsing ISO 7000 Icons} in the Design mode
\li \l{http://doc.qt.io/QtForDeviceCreation/index.html}{Developing for
embedded devices}
\li \l{http://doc.qt.io/qtcreator/creator-overview-qtasam.html}

View File

@@ -39,16 +39,16 @@
\image creator_designinguserinterface.png
\QC provides two integrated visual editors, \QMLD and \QD. The integration
\QC provides integrated visual editors for designing Qt Quick and
widget-based applications in the Design mode. The integration
includes project management and code completion.
\list
\li \l{Developing Qt Quick Applications}
You can use wizards to create Qt Quick projects that contain
boiler-plate code. You can use \QMLD to develop Qt Quick
applications in the \uicontrol Design mode.
You can use wizards to create Qt Quick projects containing
boiler-plate code that you can edit in the Design mode.
\li \l{Developing Widget Based Applications}

View File

@@ -149,11 +149,11 @@
\endlist
\section1 Qt Quick Designer Issues
\section1 Design Mode Issues
\list
\li \QMLD uses a QML emulation layer (QML Puppet) to render and preview
\li The Design mode uses a QML emulation layer (QML Puppet) to render and preview
images and to collect data. Executing C++ code might cause the QML
emulation layer to crash. If it crashes, an error message is displayed and
you can continue editing the QML file in the code editor.

View File

@@ -64,7 +64,8 @@
\l{Managing Projects}.
\li \b {\l{Designing User Interfaces}}
\QC provides two integrated visual editors, \QMLD and \QD.
\QC provides integrated visual editors for creating Qt Quick and
widget-based applications in the Design mode.
To create intuitive, modern-looking, fluid user interfaces, you
can use \l{Qt Quick}.
If you need a traditional user interface that is clearly

View File

@@ -47,7 +47,7 @@
\li \l{Creating a Qt Quick Application}
Learn how to use \QMLD to create a Qt Quick application.
Learn how to use the Design mode to create a Qt Quick application.
\li \l{Creating a Qt Widget Based Application}

View File

@@ -90,7 +90,7 @@
files, as defined by the wizard.
For example, if you choose to create a Qt Quick application, \QC generates a
QML file that you can modify with the integrated \QMLD.
QML file that you can modify in the Design mode.
\section1 Selecting Project Type

View File

@@ -39,9 +39,9 @@
\image creator_managingprojects.png
One of the major advantages of \QC is that it allows a team of developers
to share a project across different development platforms with a common tool
for development and debugging.
One of the major advantages of \QC is that it allows a team of designers and
developers to share a project across different development platforms with a
common tool for design, development, and debugging.
\list
@@ -55,21 +55,14 @@
\li \l{Using Version Control Systems}
The recommended way to set up a project is to use a version control
system. Store and edit only project source files and build system
configuration files (for example, .pro and .pri files for qmake).
Do not store files generated by the build system or \QC, such as
makefiles, .pro.user, and object files.
system. Store and edit only project source files and configuration
files. Do not store generated files.
\li \l{Configuring Projects}
\QC allows you to specify separate build settings for each
development platform. By default, \l{glossary-shadow-build}
{shadow builds} are used to keep the build specific files separate
from the source. You can create separate versions of project files
to keep platform-dependent code separate. You can use qmake
\l{Adding Platform Specific Source Files}
{scopes} to select the file to process depending on which platform
qmake is run on.
Installation programs and project wizards create default
configurations for \QC and your projects. You can modify
the settings in the Projects mode.
\li \l{Managing Sessions}

View File

@@ -75,6 +75,11 @@
\uicontrol General, and enter a period (.) in the
\uicontrol {Default build directory} field.
You can create separate versions of project files to keep platform-dependent
code separate. You can use qmake \l{Adding Platform Specific Source Files}
{scopes} to select the file to process depending on which platform qmake is
run on.
\include creator-projects-cmake-building.qdocinc cmake build configuration
\section1 Starting External Processes

View File

@@ -87,9 +87,16 @@
\list
\li \l {Creating Qt Quick Projects}
\li \l {Qt Quick UI Forms}
\li \l {Using Qt Quick Designer}
\li \l {Editing QML Files in Design Mode}
\li \l {Editing PathView Properties}
\li \l {Adding Connections}
\list
\li \l{Connecting Objects to Signals}
\li \l{Specifying Dynamic Properties}
\li \l{Adding Bindings Between Properties}
\li \l{Managing C++ Backend Objects}
\endlist
\li \l {Adding States}
\li \l {Creating Components}
\li \l {Creating Buttons}
\li \l {Creating Scalable Buttons and Borders}

View File

@@ -133,5 +133,8 @@
You can also join the \QC mailing list at:
\l{http://lists.qt-project.org/mailman/listinfo/}
{lists.qt-project.org Mailing Lists}.
For credits and a list of third-party libraries, see
\l {Acknowledgements}.
\endtable
*/

View File

@@ -78,12 +78,12 @@
The image appears in \uicontrol Resources. You can also use any other
image or a QML type, instead.
To create the UI in the \uicontrol Design mode:
To create the UI in the Design mode:
\list 1
\li In the \uicontrol Projects view, double-click the \e Page1Form.ui.qml
file to open it in \QMLD.
file to open it in the Design mode.
\li In the \uicontrol Navigator, select \uicontrol Label and press
\key Delete to delete it.
@@ -119,7 +119,8 @@
\endlist
We want to modify the properties of the bubble in ways that are not
supported by \QMLD, and therefore we create a custom QML type for it:
supported in the Design mode, and therefore we create a custom QML
type for it:
\list 1

View File

@@ -50,10 +50,10 @@
(.ui.qml files). The forms use a purely declarative subset of the
QML language and you can edit them in the Design mode.
\li \l {Using Qt Quick Designer}
\li \l {Editing QML Files in Design Mode}
You can use the \uicontrol {Form Editor} or the
\uicontrol {Text Editor} of \QMLD in the \uicontrol Design mode to
\uicontrol {Text Editor} in the Design mode to
develop Qt Quick applications.
\li \l {Editing PathView Properties}

View File

@@ -48,8 +48,8 @@
\image qmldesigner-tutorial.png "States and transitions example"
For more information about using \QMLD, see
\l{Developing Qt Quick Applications}.
For more information about developing Qt Quick applications in the Design
mode, see \l{Developing Qt Quick Applications}.
For examples of using Qt Quick Controls 2, see
\l{Qt Quick Controls 2 Examples}.
@@ -69,7 +69,7 @@
\list 1
\li In the \uicontrol Projects view, double-click the \e Page1Form.ui.qml
file to open it in \QMLD.
file to open it in the Design mode.
\image qmldesigner-tutorial-design-mode.png "Transitions project in Design Mode"

View File

@@ -32,7 +32,7 @@
/*!
\contentspage {Qt Creator Manual}
\previouspage qmldesigner-connections.html
\previouspage quick-states.html
\page quick-components.html
\nextpage quick-buttons.html
@@ -92,13 +92,13 @@
Qt Quick Controls 2 achieve improved efficiency by employing a simplified
\l {Styling Qt Quick Controls 2}{styling architecture} when compared to
Qt Quick Controls, on which the module is based. \QMLD reads the
Qt Quick Controls, on which the module is based. The visual editor reads the
\c qtquickcontrols2.conf file that specifies the preferred style and some
style-specific arguments. To change the style, select another style from
the list on the toolbar. This enables you to check how your UI looks when
using the available styles.
For an example of defining your own style and using it in \QMLD, see
For an example of defining your own style and using it in the Design mode, see
\l {Qt Quick Controls 2 - Flat Style}.
Qt Quick Controls 2 work in conjunction with Qt Quick and Qt Quick Layouts.
@@ -112,7 +112,7 @@
Some ready-made controls, such as a gauge, dial, status indicator, and
tumbler, are provided by the \l {Qt Quick Extras} module.
\section1 Creating Components in Qt Quick Designer
\section1 Creating Components in Design Mode
\list 1
@@ -125,7 +125,7 @@
the \uicontrol Library only if the filename begins with a capital
letter.
\li Click \uicontrol Design to open the .qml file in \QMLD.
\li Click \uicontrol Design to open the .qml file in the Design mode.
\li Drag and drop a QML type from the \uicontrol Library to the
\uicontrol Navigator or \uicontrol {Form Editor}.

View File

@@ -0,0 +1,74 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\contentspage {Qt Creator Manual}
\previouspage quick-property-bindings.html
\page quick-connections-backend.html
\nextpage quick-states.html
\title Managing C++ Backend Objects
Many applications provide QObject objects implemented in C++ that work as a
bridge between QML and C++. Such objects are typically registered with
\c qmlRegisterType or \c qmlRegisterSingletonType and then used by QML to
communicate with the C++ backend. Another example of such objects are the
state machines created by the \l {Using the Qt SCXML Compiler (qscxmlc)}
{Qt SCXML Compiler}.
Backend objects in a QML file are accessible if the QML file contains the
required imports. In addition, for a non-singleton QObject, a dynamic
property that contains the QObject must be specified.
A \e local QObject is instantiated in the current \e .qml file, as follows:
\badcode
property MyType myType: MyType {}.
\endcode
Otherwise the property is just defined, as follows:
\badcode
property MyType myType
\endcode
To manage backend objects:
\list 1
\li In the \uicontrol {Connections} view, select the
\uicontrol Backends tab to view accessible backend objects.
\image qmldesigner-backends.png
\li Select the \inlineimage plus.png
(\uicontrol Add) button to add a backend object in the
\uicontrol {Add New C++ Backend} dialog.
\li In the \uicontrol Type field, select the type of the backend QObject
to add.
\li Select the \uicontrol {Define object locally} check box if the
QObject is not registered as a singleton.
\li Select \uicontrol OK to add the required import and to create the
property for a non-singleton object.
\endlist
*/

View File

@@ -0,0 +1,65 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\contentspage {Qt Creator Manual}
\previouspage quick-dynamic-properties.html
\page quick-property-bindings.html
\nextpage quick-connections-backend.html
\title Adding Bindings Between Properties
To dynamically change the behavior of an object, you can create a \e binding
between the properties of two objects. To create a property binding, a
property is assigned a JavaScript expression that evaluates to the desired
value. At its simplest, a binding may be a reference to another property.
For example, the height of an object can be bound to the height of its
parent, so that when the parent height changes, the object height is
adjusted automatically.
For more information about the use of property bindings, see
\l{Property Binding}.
You can create bindings between objects in the \uicontrol Connections view.
\image qmldesigner-bindings.png
To bind a property of an object to the property of another object:
\list 1
\li In the \uicontrol {Connections} view, select the
\uicontrol {Bindings} tab.
\li Select the \inlineimage plus.png
(\uicontrol Add) button to add a binding.
\li Select \uicontrol Item to select the target object whose property
you want to change dynamically.
\li Select \uicontrol Property to select the property to bind to a
source property.
\li Select \uicontrol {Source Item} to select the object whose property
you want to use to determine the behavior of the target object.
\li Select \uicontrol {Source Property} to select the property to bind
the target property to.
\endlist
*/

View File

@@ -0,0 +1,58 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\contentspage {Qt Creator Manual}
\previouspage qmldesigner-connections.html
\page quick-dynamic-properties.html
\nextpage quick-property-bindings.html
\title Specifying Dynamic Properties
You can bind object properties to dynamic expressions to define global
properties for an object that can be read by other objects. For example,
you can specify global properties for the root object that you can use in
the child objects.
You can specify dynamic properties for objects in the
\uicontrol Connections view.
\image qmldesigner-dynamicprops.png
To specify dynamic properties for an object:
\list 1
\li In the \uicontrol {Connections} view, select the
\uicontrol {Properties} tab.
\li Select \uicontrol Item to select the object to specify the property
for.
\li Select \uicontrol Property to give a name to the property.
\li Select \uicontrol {Property Type} to specify the type of the
property.
\li Select \uicontrol {Property Value} to specify the value of the
property.
\endlist
*/

View File

@@ -0,0 +1,71 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\contentspage {Qt Creator Manual}
\previouspage qmldesigner-connections.html
\page quick-signals.html
\nextpage quick-dynamic-properties.html
\title Connecting Objects to Signals
To receive a notification when a particular signal is emitted for a
particular object, the object definition should declare a signal handler
named \e {on<Signal>} where \e {<Signal>} is the name of the signal, with
the first letter capitalized. The signal handler should contain the
JavaScript code to be executed when the signal handler is invoked.
QML types have predefined signals that are emitted when users interact with
the application. For example, the \l MouseArea type from the \l QtQuick
module has a \c clicked signal that is emitted whenever the mouse is
clicked within the area. Since the signal name is \c clicked, the signal
handler for receiving this signal is named \c onClicked.
For more information about signals and signal handlers, see
\l{Signal and Handler Event System}.
To access a signal outside of the object that emits it, you can use the
\l Connections type for connecting to signals of arbitrary objects. A
connections object can receive any signal from its specified target.
You can connect objects to signals that are available to them in the
\uicontrol Connections view.
\image qmldesigner-connections.png
To connect objects to signals:
\list 1
\li In the \uicontrol {Connections} view, select the
\uicontrol {Connections} tab.
\li Select the \inlineimage plus.png
(\uicontrol Add) button to add a connection.
\li Select \uicontrol Target to add the object to connect to a signal.
\li Select \uicontrol {Signal Handler} to select the signal that the
connection will listen to from a list of all signals available for
the object.
\li Select \uicontrol Actions to specify the action to perform when
the signal is emitted. You use JavaScript to specify the actions.
\endlist
*/

View File

@@ -27,153 +27,45 @@
\contentspage {Qt Creator Manual}
\previouspage qmldesigner-pathview-editor.html
\page qmldesigner-connections.html
\nextpage quick-components.html
\nextpage quick-signals.html
\title Adding Connections
You can use the \uicontrol {Connections} view to:
The user interface components and the application need to communicate with
each other. For example, a button needs to know that the user has clicked
on it. The button may then change color to indicate its state or perform an
action. Further, the application needs to know whether the user is clicking
the button, because it may need to relay this clicking event to other
applications.
QML has a signal and handler mechanism, that enables components to respond
to application events. Events are represented by \e signals. When a signal
is emitted, the corresponding \e {signal handler} is invoked to respond to
the event by using scripts or other operations placed in the handler.
To access a signal outside of the object that emits it, you can use the
\l Connections type for connecting to signals of arbitrary objects. A
Connections object can receive any signal from its specified target.
A component's property can be assigned a static value which stays constant
until it is explicitly assigned a new value. However, to make the fullest
use of QML and its built-in support for dynamic object behaviors, most QML
types use property bindings. This means that you can specify relationships
between different object properties so that when a property's sependencies
change in value, the property's value is automatically updated accordingly.
Behind the scenes, the QML engine monitors the property's dependencies (that
is, the variables in the binding expression). When a change is detected, the
QML engine re-evaluates the binding expression and applies the new result to
the property.
The following sections describe how to use the \uicontrol {Connections} view
to perform the following tasks:
\list
\li Connect objects to signals.
\li Specify dynamic properties for objects.
\li Create bindings between the properties of two objects.
\li Manage backend QObjects.
\li \l{Connecting Objects to Signals}
\li \l{Specifying Dynamic Properties}
\li \l{Adding Bindings Between Properties}
\li \l{Managing C++ Backend Objects}
\endlist
For examples of adding connections, see
\l{Creating Scalable Buttons and Borders}.
\section1 Connecting Objects to Signals
To connect objects to signals in QML, create \l{Connections} objects.
\image qmldesigner-connections.png
To create the connections:
\list 1
\li Select the \uicontrol {Connections} tab.
\li Select the \inlineimage plus.png
(\uicontrol Add) button to add a connection.
\li Select \uicontrol Target to add the object to connect to a signal.
\li Select \uicontrol {Signal Handler} to select the signal that the connection
will listen to from a list of all signals available for the object.
\li Select \uicontrol Actions to specify the action to perform when
the signal is emitted. You use JavaScript to specify the actions.
\endlist
\section1 Specifying Dynamic Properties
You can bind \l{Properties} to dynamic expressions to define global properties for an
object that can be read by other objects. For example, you can specify
global properties for the root object that you can use in the child objects.
\image qmldesigner-dynamicprops.png
To specify dynamic properties for an object:
\list 1
\li Select the \uicontrol {Properties} tab.
\li Select \uicontrol Item to select the object to specify the property for.
\li Select \uicontrol Property to give a name to the property.
\li Select \uicontrol {Property Type} to specify the type of the property.
\li Select \uicontrol {Property Value} to specify the value of the property.
\endlist
\section1 Adding Bindings Between Properties
To dynamically change the behavior of an object, you can create a
\l{Property Binding} between the properties of two objects.
\image qmldesigner-bindings.png
To bind a property of an object to the property of another object:
\list 1
\li Select the \uicontrol {Bindings} tab.
\li Select the \inlineimage plus.png
(\uicontrol Add) button to add a binding.
\li Select \uicontrol Item to select the target object whose property you want
to change dynamically.
\li Select \uicontrol Property to select the property to bind to a source
property.
\li Select \uicontrol {Source Item} to select the object whose property you
want to use to determine the behavior of the target object.
\li Select \uicontrol {Source Property} to select the property to bind the
target property to.
\endlist
\section1 Managing C++ Backend Objects
Many applications provide QObject objects implemented in C++ that work as a
bridge between QML and C++. Such objects are typically registered with
qmlRegisterType or qmlRegisterSingletonType and then used by QML to
communicate with the C++ backend. Another example of such objects are the
state machines created by the \l {Using the Qt SCXML Compiler (qscxmlc)}
{Qt SCXML Compiler}.
Backend objects in a QML file are accessible if the QML file contains the
required imports. In addition, for a non-singleton QObject, a dynamic
property that contains the QObject must be specified.
A \e local QObject is instantiated in the current \e .qml file, as follows:
\badcode
property MyType myType: MyType {}.
\endcode
Otherwise the property is just defined, as follows:
\badcode
property MyType myType
\endcode
To manage backend objects:
\list 1
\li Select the \uicontrol Backends tab to view accessible backend
objects.
\image qmldesigner-backends.png
\li Select the \inlineimage plus.png
(\uicontrol Add) button to add a backend object in the
\uicontrol {Add New C++ Backend} dialog.
\li In the \uicontrol Type field, select the type of the backend QObject
to add.
\li Select the \uicontrol {Define object locally} check box if the
QObject is not registered as a singleton.
\li Select \uicontrol OK to add the required import and to create the
property for a non-singleton object.
\endlist
*/

View File

@@ -137,7 +137,8 @@
\endlist
\QC generates a QML file, \e main.qml, that you can modify in \QMLD.
\QC generates a QML file, \e main.qml, that you can modify in the Design
mode.
\section1 Creating Qt Quick Controls 2 Applications
@@ -184,11 +185,11 @@
\endlist
For the Scroll application, \QC creates a QML file, \e main.qml, that you
can modify in \QMLD.
can modify in the Design mode.
For the Stack and Swipe applications, \QC generates two UI files,
\e Page1Form.ui.qml and \e Page2Form.ui.qml, that you can modify in the
\QMLD \uicontrol {Form Editor} and a QML file, \e main.qml, that you can
\uicontrol {Form Editor} and a QML file, \e main.qml, that you can
modify in the \uicontrol {Text Editor} to add the application logic.
\section1 Creating Qt Quick UI Projects

View File

@@ -35,16 +35,16 @@
\page creator-using-qt-quick-designer.html
\nextpage qmldesigner-pathview-editor.html
\title Using Qt Quick Designer
\title Editing QML Files in Design Mode
You can edit \l{Qt Quick UI Forms} (ui.qml files) in \QMLD. \QC opens the
UI forms in the \uicontrol {Form Editor} tab in the \uicontrol Design mode.
It is recommended that you use UI forms for components that you want to
design in \QMLD.
\QC opens \l{Qt Quick UI Forms}{UI forms} (ui.qml files) in the
\uicontrol {Form Editor} tab in the Design mode. It is
recommended that you use UI forms for components that you want to
edit in the Design mode.
\image qmldesigner-visual-editor.png "Visual editor"
Use \QMLD to manage your project:
To manage your project in the Design mode:
\list
@@ -93,7 +93,7 @@
\li \uicontrol {State} pane (6) displays the different states of the item.
QML states typically describe user interface configurations, such as
the UI controls, their properties and behavior and the available
actions.
actions. For more information, see \l{Adding States}.
\endlist
@@ -170,9 +170,9 @@
\section2 Switching Parent Items
When you drag and drop instances of QML types to the canvas, Qt Quick Designer
adds the new item as a child of the item beneath it.
When you move items on the canvas, Qt Quick Designer cannot determine
When you drag and drop instances of QML types to the canvas, the new item
is added as a child of the item beneath it. When you move items on the
canvas, it is not possible to determine
whether you want to adjust their position or attach them to a new
parent item. Therefore, the parent item is not automatically
changed. To change the parent of the item, press down the \key Shift
@@ -307,7 +307,7 @@
If you use text IDs instead of plain text, change the default call to
\c qsTrId(). Select \uicontrol Tools > \uicontrol Options >
\uicontrol {Qt Quick} > \uicontrol {Qt Quick Designer}, and then select the
\uicontrol {Qt Quick} > \uicontrol {\QMLD}, and then select the
\uicontrol {qsTrId()} radio button in the \uicontrol Internationalization
group. For more information about text ID based translations, see
\l {Qt Linguist Manual: Text ID Based Translations}.
@@ -321,19 +321,20 @@
\section2 Loading Placeholder Data
\QMLD supports views, models, and delegates, so that when you add a Grid
View, List View, or Path View item, the ListModel and the delegate
The Design mode supports views, models, and delegates, so that when you add
a Grid View, List View, or Path View item, the ListModel and the delegate
item are added automatically.
However, the missing context of the application presents a challenge for
\QMLD. Specific models defined in C++ are the most obvious case. Often,
However, the missing context of the application presents a challenge.
Specific models defined in C++ are the most obvious case. Often,
the context is missing simple properties, which are either defined in C++,
or in other QML files. A typical example is an item that uses the
properties of its parent, such as \c parent.width.
\section3 Using Dummy Models
If you open a file in \QMLD that references a C++ model, you see nothing on
If you open a file in the Design mode that references a C++ model, you see
nothing on
the canvas. If the data in the model is fetched from the internet, you have
no control over it. To get reliable data, \e {dummy data} was introduced.
@@ -387,8 +388,8 @@
}
\endqml
This works nicely for applications but \QMLD displays a zero-sized item.
A parent for the opened file does not exist, because the context is
This works nicely for applications but the Design mode displays a zero-sized
item. A parent for the opened file does not exist, because the context is
missing. To get around the missing context, the idea of a \e {dummy
context} is introduced. If you place a file with the same name as the
application (here, example.qml) in the \c {dummydata/context} directory,
@@ -425,70 +426,6 @@
\image qmldesigner-inline-editing.png
\section1 Adding States
User interfaces are designed to present different interface configurations
in different scenarios, or to modify their appearances in response to user
interaction. Often, there are a set of changes that are made concurrently,
such that the interface could be seen to be internally changing from one
\e state to another.
This applies generally to interfaces regardless of their complexity.
A photo viewer may initially present images in a grid, and when an image is
clicked, change to a detailed state where the individual image is expanded
and the interface is changed to present new options for image editing.
On the other end of the scale, when a simple button is pressed, it may change
to a \e pressed state in which its color and position is modified to give a
pressed appearance.
In QML, any item can change between different states to apply sets of
changes that modify the properties of relevant items. Each state can present
a different configuration that can, for example:
\list
\li Show some UI items and hide others.
\li Present different available actions to the user.
\li Start, stop or pause animations.
\li Execute some script required in the new state.
\li Change a property value for a particular item.
\li Show a different view or screen.
\endlist
The \uicontrol State pane displays the different \l{State}{states}
of the component in the Qt Quick Designer. The \uicontrol State pane is
collapsed by default to save space. Select \uicontrol Expand in the context
menu to view the whole pane.
\image qmldesigner-transitions.png "State pane"
To add states, click the \inlineimage plus.png
button. Then modify the new state in the editor.
For example, to change the appearance of a button, you can hide the button
image and show another image in its place. Or, to add movement to the screen,
you can change the position of an object on the canvas and then add animation
to the change between the states.
To determine when the state should be applied, select
\uicontrol {Set when Condition} in the menu and specify a
\l [QtQuick]{State::when}{when} property for the state.
You can preview the states in the \uicontrol State pane and click them to switch
between states on the canvas.
For more information on using states, see \l{Creating Screens}.
If you add animation to the states, you can run the application to test the
animation.
For more information on adding animation, see \l{Animating Screens}.
\section1 Working with QML Types on Canvas
You design applications on the canvas by placing items on it.
@@ -502,8 +439,9 @@
Click the \inlineimage snapping_and_anchoring.png
button to anchor the item to the items that you snap to.
Choose \uicontrol {Tools > Options > Qt Quick > Qt Quick Designer} to specify
settings for snapping. In the \uicontrol {Parent item padding} field, specify the
Choose \uicontrol Tools > \uicontrol Options > \uicontrol {Qt Quick} >
\uicontrol {\QMLD} to specify settings for snapping. In the
\uicontrol {Parent item padding} field, specify the
distance in pixels between the parent item and the snapping lines. In the
\uicontrol {Sibling item spacing} field, specify the distance in pixels between
sibling items and the snapping lines.
@@ -515,7 +453,7 @@
\section2 Hiding Item Boundaries
\QMLD displays the boundaries of items on the canvas. To hide
The Design mode displays the boundaries of items on the canvas. To hide
the boundaries, click the \inlineimage boundingrect.png
button.
@@ -549,14 +487,14 @@
\section2 Specifying Canvas Size
To change the canvas size, select \uicontrol {Tools > Options > Qt Quick
> Qt Quick Designer} and
To change the canvas size, select \uicontrol Tools > \uicontrol Options >
\uicontrol {Qt Quick} > \uicontrol {\QMLD} and
specify the canvas width and height in the \uicontrol Canvas group.
\section2 Refreshing the Canvas
When you open QML files in \QMLD, the items in the file are drawn on
the canvas. When you edit the item properties in \QMLD, the QML file and
When you open QML files in the Design mode, the items in the file are drawn
on the canvas. When you edit the item properties, the QML file and
the image on the canvas might get out of sync. For example, when you change
the position of an item within a column or a row, the new position might
not be displayed correctly on the canvas.

View File

@@ -66,7 +66,7 @@
development PC. Each layer is exported as an item.
You can open the QML file in \QC for editing. By default, the export scripts
generate Qt Quick 1 files. To edit the files in \QMLD, change the import
generate Qt Quick 1 files. To edit the files in the Design mode, change the import
statements in the export scripts to import Qt Quick 2. Or, you can change
the import statement in each file after generating the files.
@@ -146,8 +146,8 @@
On Linux, run the following command: \c {chmod u+rx}
\li To generate QML files that you can edit in \QMLD, edit the import
statement in \e qmlexporter.py. For example:
\li To generate QML files that you can edit in the Design mode, edit the
import statement in \e qmlexporter.py. For example:
\code
f.write('import QtQuick 2.5\n')

View File

@@ -43,7 +43,7 @@
information for code completion and the semantic checks to work correctly.
To create a QML module and make it appear in the \uicontrol Library in
\QMLD:
the Design mode:
\list 1
@@ -69,15 +69,15 @@
.pro file: \c {QML_IMPORT_PATH += path/to/module}.
For more information, see \l {Importing QML Modules}.
\li Make sure that the QML emulation layer of \QMLD is built with
\li Make sure that the QML emulation layer used in the Design mode is built with
the same Qt version as your QML modules. For more information, see
\l {Running QML Modules in Qt Quick Designer}. You can also try
\l {Running QML Modules in Design Mode}. You can also try
skipping this step and take it later, if necessary.
\endlist
Your module should now appear in the \uicontrol Imports tab in the
\uicontrol Library in \QMLD. Your components should appear in the
\uicontrol Library in the Design mode. Your components should appear in the
\uicontrol {QML Types} tab if a valid \c .metainfo file is in place.
\section1 Registering QML Types
@@ -93,7 +93,7 @@
for QML modules with plugins before distributing them.
Classes registered with \c qmlRegisterType() can be used as backend objects
in the \QMLD. For more information, see \l {Adding Connections}.
in the Design mode. For more information, see \l {Adding Connections}.
\section1 Generating qmltypes Files
@@ -150,10 +150,10 @@
The import path affects all the targets built by the CMake project.
\section1 Running QML Modules in Qt Quick Designer
\section1 Running QML Modules in Design Mode
\QMLD uses a QML emulation layer (also called QML Puppet) to render and
preview images and to collect data. To be able to render custom types
A QML emulation layer (also called QML Puppet) is used in the Design mode to
render and preview images and to collect data. To be able to render custom types
correctly from QML modules, the emulation layer must be built with the same
Qt version as the QML modules.
@@ -163,20 +163,21 @@
To use an emulation layer that is built with the Qt
configured in the build and run kit for the project, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Qt Quick} > \uicontrol {Qt Quick Designer} >
\uicontrol Options > \uicontrol {Qt Quick} > \uicontrol {\QMLD} >
\uicontrol {Use QML emulation layer which is built by the selected Qt} radio button.
\QC builds the emulation layer when you select the \uicontrol Design mode.
\QC builds the emulation layer when you select the Design mode.
A plugin should behave differently depending on whether it is run by the
emulation layer or an application. For example, animations should not be run
in the \uicontrol Design mode. You can use the value of the QML_PUPPET_MODE
in the Design mode. You can use the value of the QML_PUPPET_MODE
environment variable to check whether the plugin is currently being run
by an application or edited in the \uicontrol Design mode.
by an application or edited in the Design mode.
If you want to use a different module in \QMLD than in your actual
If you want to use a different module in the Design mode than in your actual
application for example to mockup C++ items, then you can use \c{QML_DESIGNER_IMPORT_PATH}
in the \c{.pro} file.
Modules in the import paths defined in \c{QML_DESIGNER_IMPORT_PATH} will be used only in \QMLD.
Modules in the import paths defined in \c{QML_DESIGNER_IMPORT_PATH} will be
used only in the Design mode.
For an example, see \l {Qt Quick Controls 2 - Contact List}.
*/

View File

@@ -120,8 +120,8 @@
Property bindings are created implicitly in QML whenever a property is
assigned a JavaScript expression. To set JavaScript expressions as values of
properties in \QMLD, click the circle icon next to a property to open a
context menu, and select \uicontrol {Set Binding}.
properties in the Design mode, click the circle icon next to a property to
open a context menu, and select \uicontrol {Set Binding}.
\image qmldesigner-set-expression.png "Type properties context menu"
@@ -141,7 +141,8 @@
For more information on the JavaScript environment provided by QML, see
\l{Integrating QML and JavaScript}.
Bindings are a black box for \QMLD and using them might have a negative impact on
Bindings are a black box for the Design mode and using them might have a
negative impact on
performance, so consider setting anchors and margins for items, instead.
For example, instead of setting \c {parent.width} for an item, you could
anchor the item to its sibling items on the left and the right.
@@ -167,8 +168,8 @@
(\uicontrol {Reset Anchors}) button to reset the anchors to their saved
state.
Specifying the baseline anchor in \QMLD is not supported. You can specify it
in the \uicontrol {Text Editor}.
You can specify the baseline anchor in the \uicontrol {Text Editor} in the
Design mode.
For performance reasons, you can only anchor an item to its siblings and
direct parent. By default, an item is anchored to its parent when you
@@ -393,9 +394,9 @@
\section2 Using SCXML State Machines
To use QML and \QMLD together with an SCXML state machine, add states and
bind them to the state machine in the \uicontrol Backends tab, as described
in \l {Managing C++ Backend Objects}.
To use QML together with an SCXML state machine, add states and bind them to
the state machine in the \uicontrol Backends tab in the Design mode, as
described in \l {Managing C++ Backend Objects}.
In the \uicontrol States pane, you can edit the \c when condition of states
to map QML states to the states of the SCXML state machine. For an example,

View File

@@ -0,0 +1,88 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\contentspage {Qt Creator Manual}
\previouspage quick-connections-backend.html
\page quick-states.html
\nextpage quick-components.html
\title Adding States
User interfaces are designed to present different interface configurations
in different scenarios, or to modify their appearances in response to user
interaction. Often, there are a set of changes that are made concurrently,
such that the interface could be seen to be internally changing from one
\e state to another.
This applies generally to interfaces regardless of their complexity. A photo
viewer may initially present images in a grid, and when an image is clicked,
change to a detailed state where the individual image is expanded and the
interface is changed to present new options for image editing. At the other
end of the scale, when a button is pressed, it may change to a
\e pressed state in which its color and position are modified so that it
appears to be pressed down.
In QML, any item can change between different states to apply sets of
changes that modify the properties of relevant items. Each state can
present a different configuration that can, for example:
\list
\li Show some UI items and hide others.
\li Present different available actions to the user.
\li Start, stop or pause animations.
\li Execute some script required in the new state.
\li Change a property value for a particular item.
\li Show a different view or screen.
\endlist
The \uicontrol State pane displays the different \l{State}{states}
of the component in the Design mode. The \uicontrol State pane is
collapsed by default to save space. Select \uicontrol Expand in
the context menu to view the whole pane.
\image qmldesigner-transitions.png "State pane"
To add states, click the \inlineimage plus.png
button. Then modify the new state in the editor. For example, to change the
appearance of a button, you can hide the button image and show another image
in its place. Or, to add movement to the screen, you can change the position
of an object on the canvas and then add animation to the change between the
states.
To determine when the state should be applied, select
\uicontrol {Set when Condition} in the menu and specify a
\l [QtQuick]{State::when}{when} property for the state.
You can preview the states in the \uicontrol State pane and click them to
switch between states on the canvas.
For more information about using states, see \l{Creating Screens}.
If you add animation to the states, you can run the application to test the
animation.
For more information about adding animation, see \l{Animating Screens}.
*/

View File

@@ -990,7 +990,7 @@ class Dumper(DumperBase):
if self.isWindowsTarget():
qtCoreMatch = re.match('.*Qt5?Core[^/.]*d?\.dll', name)
else:
qtCoreMatch = re.match('.*/libQt5?Core[^/.]\.so', name)
qtCoreMatch = re.match('.*/libQt5?Core[^/.]*\.so', name)
if qtCoreMatch is not None:
self.handleQtCoreLoaded(objfile)

View File

@@ -131,6 +131,14 @@
"QtQuick 2.8",
"QtQuick 2.9",
"QtTest 1.0",
"QtWebEngine 1.0",
"QtWebEngine 1.1",
"QtWebEngine 1.2",
"QtWebEngine 1.3",
"QtWebEngine 1.4",
"QtWebEngine 1.5",
"QtWebEngine 1.6",
"QtWebEngine 1.7",
"QtWebKit 3.0",
"Enginio 1.0"
]

File diff suppressed because it is too large Load Diff

View File

@@ -70,7 +70,7 @@ public:
_message = Message(type, _location);
}
virtual void visit(const NumberValue *value)
void visit(const NumberValue *value) override
{
if (const QmlEnumValue *enumValue = value_cast<QmlEnumValue>(value)) {
if (StringLiteral *stringLiteral = cast<StringLiteral *>(_ast)) {
@@ -90,7 +90,7 @@ public:
}
}
virtual void visit(const BooleanValue *)
void visit(const BooleanValue *) override
{
UnaryMinusExpression *unaryMinus = cast<UnaryMinusExpression *>(_ast);
@@ -101,7 +101,7 @@ public:
}
}
virtual void visit(const StringValue *value)
void visit(const StringValue *value) override
{
UnaryMinusExpression *unaryMinus = cast<UnaryMinusExpression *>(_ast);
@@ -132,7 +132,7 @@ public:
}
}
virtual void visit(const ColorValue *)
void visit(const ColorValue *) override
{
if (StringLiteral *stringLiteral = cast<StringLiteral *>(_ast)) {
if (!toQColor(stringLiteral->value.toString()).isValid())
@@ -142,7 +142,7 @@ public:
}
}
virtual void visit(const AnchorLineValue *)
void visit(const AnchorLineValue *) override
{
if (! (_rhsValue->asAnchorLineValue() || _rhsValue->asUnknownValue()))
setMessage(ErrAnchorLineExpected);
@@ -189,7 +189,7 @@ protected:
return _state;
}
virtual bool preVisit(Node *ast)
bool preVisit(Node *ast) override
{
if (ast->expressionCast())
return false;
@@ -204,7 +204,7 @@ protected:
return false;
}
virtual bool visit(LabelledStatement *ast)
bool visit(LabelledStatement *ast) override
{
// get the target statement
Statement *end = ast->statement;
@@ -219,7 +219,7 @@ protected:
return true;
}
virtual bool visit(BreakStatement *ast)
bool visit(BreakStatement *ast) override
{
_state = Break;
if (!ast->label.isEmpty()) {
@@ -232,12 +232,12 @@ protected:
}
// labelled continues don't change control flow...
virtual bool visit(ContinueStatement *) { _state = Continue; return false; }
bool visit(ContinueStatement *) override { _state = Continue; return false; }
virtual bool visit(ReturnStatement *) { _state = ReturnOrThrow; return false; }
virtual bool visit(ThrowStatement *) { _state = ReturnOrThrow; return false; }
bool visit(ReturnStatement *) override { _state = ReturnOrThrow; return false; }
bool visit(ThrowStatement *) override { _state = ReturnOrThrow; return false; }
virtual bool visit(IfStatement *ast)
bool visit(IfStatement *ast) override
{
State ok = check(ast->ok);
State ko = check(ast->ko);
@@ -256,7 +256,7 @@ protected:
}
}
virtual bool visit(SwitchStatement *ast)
bool visit(SwitchStatement *ast) override
{
if (!ast->block)
return false;
@@ -282,7 +282,7 @@ protected:
return false;
}
virtual bool visit(TryStatement *ast)
bool visit(TryStatement *ast) override
{
State tryBody = check(ast->statement);
State catchBody = ReturnOrThrow;
@@ -303,13 +303,13 @@ protected:
return false;
}
virtual bool visit(WhileStatement *ast) { return preconditionLoopStatement(ast, ast->statement); }
virtual bool visit(ForStatement *ast) { return preconditionLoopStatement(ast, ast->statement); }
virtual bool visit(ForEachStatement *ast) { return preconditionLoopStatement(ast, ast->statement); }
virtual bool visit(LocalForStatement *ast) { return preconditionLoopStatement(ast, ast->statement); }
virtual bool visit(LocalForEachStatement *ast) { return preconditionLoopStatement(ast, ast->statement); }
bool visit(WhileStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); }
bool visit(ForStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); }
bool visit(ForEachStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); }
bool visit(LocalForStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); }
bool visit(LocalForEachStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); }
virtual bool visit(DoWhileStatement *ast)
bool visit(DoWhileStatement *ast) override
{
check(ast->statement);
// not necessarily an infinite loop due to labelled breaks
@@ -335,7 +335,7 @@ public:
}
protected:
virtual State check(Node *node)
State check(Node *node) override
{
bool oldwarning = _emittedWarning;
_emittedWarning = false;
@@ -344,7 +344,7 @@ protected:
return s;
}
virtual void onUnreachable(Node *node)
void onUnreachable(Node *node) override
{
if (_emittedWarning)
return;

View File

@@ -119,7 +119,7 @@ public:
}
protected:
virtual bool visit(CompoundStatementAST *ast)
bool visit(CompoundStatementAST *ast) override
{
CompoundStatementAST *old = _compound;
_compound = ast;
@@ -128,7 +128,7 @@ protected:
return false;
}
virtual bool visit(CallAST *ast)
bool visit(CallAST *ast) override
{
if (checkForQmlRegisterType(ast))
return false;

View File

@@ -103,27 +103,27 @@ public:
const Value *value() const { return m_value; }
virtual bool processProperty(const QString &name, const Value *value, const PropertyInfo &)
bool processProperty(const QString &name, const Value *value, const PropertyInfo &) override
{
return process(name, value);
}
virtual bool processEnumerator(const QString &name, const Value *value)
bool processEnumerator(const QString &name, const Value *value) override
{
return process(name, value);
}
virtual bool processSignal(const QString &name, const Value *value)
bool processSignal(const QString &name, const Value *value) override
{
return process(name, value);
}
virtual bool processSlot(const QString &name, const Value *value)
bool processSlot(const QString &name, const Value *value) override
{
return process(name, value);
}
virtual bool processGeneratedSlot(const QString &name, const Value *value)
bool processGeneratedSlot(const QString &name, const Value *value) override
{
return process(name, value);
}
@@ -2574,31 +2574,31 @@ class MemberDumper: public MemberProcessor
public:
MemberDumper() {}
virtual bool processProperty(const QString &name, const Value *, const PropertyInfo &pInfo)
bool processProperty(const QString &name, const Value *, const PropertyInfo &pInfo) override
{
qCDebug(qmljsLog) << "property: " << name << " flags:" << pInfo.toString();
return true;
}
virtual bool processEnumerator(const QString &name, const Value *)
bool processEnumerator(const QString &name, const Value *) override
{
qCDebug(qmljsLog) << "enumerator: " << name;
return true;
}
virtual bool processSignal(const QString &name, const Value *)
bool processSignal(const QString &name, const Value *) override
{
qCDebug(qmljsLog) << "signal: " << name;
return true;
}
virtual bool processSlot(const QString &name, const Value *)
bool processSlot(const QString &name, const Value *) override
{
qCDebug(qmljsLog) << "slot: " << name;
return true;
}
virtual bool processGeneratedSlot(const QString &name, const Value *)
bool processGeneratedSlot(const QString &name, const Value *) override
{
qCDebug(qmljsLog) << "generated slot: " << name;
return true;

View File

@@ -53,12 +53,12 @@ protected:
BlockData data;
};
virtual void saveBlockData(QTextBlock *block, const BlockData &data) const
void saveBlockData(QTextBlock *block, const BlockData &data) const override
{
block->setUserData(new FormatterData(data));
}
virtual bool loadBlockData(const QTextBlock &block, BlockData *data) const
bool loadBlockData(const QTextBlock &block, BlockData *data) const override
{
if (!block.userData())
return false;
@@ -67,12 +67,12 @@ protected:
return true;
}
virtual void saveLexerState(QTextBlock *block, int state) const
void saveLexerState(QTextBlock *block, int state) const override
{
block->setUserState(state);
}
virtual int loadLexerState(const QTextBlock &block) const
int loadLexerState(const QTextBlock &block) const override
{
return block.userState();
}
@@ -464,7 +464,7 @@ protected:
loc.length += 2;
}
virtual bool preVisit(Node *ast)
bool preVisit(Node *ast) override
{
SourceLocation firstLoc;
if (ExpressionNode *expr = ast->expressionCast())
@@ -486,7 +486,7 @@ protected:
return true;
}
virtual void postVisit(Node *ast)
void postVisit(Node *ast) override
{
SourceLocation lastLoc;
if (ExpressionNode *expr = ast->expressionCast())
@@ -525,14 +525,14 @@ protected:
}
}
virtual bool visit(UiPragma *ast)
bool visit(UiPragma *ast) override
{
out("pragma ", ast->pragmaToken);
accept(ast->pragmaType);
return false;
}
virtual bool visit(UiImport *ast)
bool visit(UiImport *ast) override
{
out("import ", ast->importToken);
if (!ast->fileName.isNull())
@@ -550,7 +550,7 @@ protected:
return false;
}
virtual bool visit(UiObjectDefinition *ast)
bool visit(UiObjectDefinition *ast) override
{
accept(ast->qualifiedTypeNameId);
out(" ");
@@ -558,7 +558,7 @@ protected:
return false;
}
virtual bool visit(UiObjectInitializer *ast)
bool visit(UiObjectInitializer *ast) override
{
out(ast->lbraceToken);
if (ast->members)
@@ -568,7 +568,7 @@ protected:
return false;
}
virtual bool visit(UiParameterList *list)
bool visit(UiParameterList *list) override
{
for (UiParameterList *it = list; it; it = it->next) {
out(it->propertyTypeToken);
@@ -580,7 +580,7 @@ protected:
return false;
}
virtual bool visit(UiPublicMember *ast)
bool visit(UiPublicMember *ast) override
{
if (ast->type == UiPublicMember::Property) {
if (ast->isDefaultMember)
@@ -618,7 +618,7 @@ protected:
return false;
}
virtual bool visit(UiObjectBinding *ast)
bool visit(UiObjectBinding *ast) override
{
if (ast->hasOnToken) {
accept(ast->qualifiedTypeNameId);
@@ -634,7 +634,7 @@ protected:
return false;
}
virtual bool visit(UiScriptBinding *ast)
bool visit(UiScriptBinding *ast) override
{
accept(ast->qualifiedId);
out(": ", ast->colonToken);
@@ -642,7 +642,7 @@ protected:
return false;
}
virtual bool visit(UiArrayBinding *ast)
bool visit(UiArrayBinding *ast) override
{
accept(ast->qualifiedId);
out(ast->colonToken);
@@ -654,16 +654,16 @@ protected:
return false;
}
virtual bool visit(ThisExpression *ast) { out(ast->thisToken); return true; }
virtual bool visit(NullExpression *ast) { out(ast->nullToken); return true; }
virtual bool visit(TrueLiteral *ast) { out(ast->trueToken); return true; }
virtual bool visit(FalseLiteral *ast) { out(ast->falseToken); return true; }
virtual bool visit(IdentifierExpression *ast) { out(ast->identifierToken); return true; }
virtual bool visit(StringLiteral *ast) { out(ast->literalToken); return true; }
virtual bool visit(NumericLiteral *ast) { out(ast->literalToken); return true; }
virtual bool visit(RegExpLiteral *ast) { out(ast->literalToken); return true; }
bool visit(ThisExpression *ast) override { out(ast->thisToken); return true; }
bool visit(NullExpression *ast) override { out(ast->nullToken); return true; }
bool visit(TrueLiteral *ast) override { out(ast->trueToken); return true; }
bool visit(FalseLiteral *ast) override { out(ast->falseToken); return true; }
bool visit(IdentifierExpression *ast) override { out(ast->identifierToken); return true; }
bool visit(StringLiteral *ast) override { out(ast->literalToken); return true; }
bool visit(NumericLiteral *ast) override { out(ast->literalToken); return true; }
bool visit(RegExpLiteral *ast) override { out(ast->literalToken); return true; }
virtual bool visit(ArrayLiteral *ast)
bool visit(ArrayLiteral *ast) override
{
out(ast->lbracketToken);
if (ast->elements)
@@ -676,7 +676,7 @@ protected:
return false;
}
virtual bool visit(ObjectLiteral *ast)
bool visit(ObjectLiteral *ast) override
{
out(ast->lbraceToken);
lnAcceptIndented(ast->properties);
@@ -685,7 +685,7 @@ protected:
return false;
}
virtual bool visit(ElementList *ast)
bool visit(ElementList *ast) override
{
for (ElementList *it = ast; it; it = it->next) {
if (it->elision)
@@ -700,7 +700,7 @@ protected:
return false;
}
virtual bool visit(PropertyAssignmentList *ast)
bool visit(PropertyAssignmentList *ast) override
{
for (PropertyAssignmentList *it = ast; it; it = it->next) {
PropertyNameAndValue *assignment = AST::cast<PropertyNameAndValue *>(it->assignment);
@@ -739,7 +739,7 @@ protected:
return false;
}
virtual bool visit(NestedExpression *ast)
bool visit(NestedExpression *ast) override
{
out(ast->lparenToken);
accept(ast->expression);
@@ -747,11 +747,11 @@ protected:
return false;
}
virtual bool visit(IdentifierPropertyName *ast) { out(ast->id.toString()); return true; }
virtual bool visit(StringLiteralPropertyName *ast) { out(ast->id.toString()); return true; }
virtual bool visit(NumericLiteralPropertyName *ast) { out(QString::number(ast->id)); return true; }
bool visit(IdentifierPropertyName *ast) override { out(ast->id.toString()); return true; }
bool visit(StringLiteralPropertyName *ast) override { out(ast->id.toString()); return true; }
bool visit(NumericLiteralPropertyName *ast) override { out(QString::number(ast->id)); return true; }
virtual bool visit(ArrayMemberExpression *ast)
bool visit(ArrayMemberExpression *ast) override
{
accept(ast->base);
out(ast->lbracketToken);
@@ -760,7 +760,7 @@ protected:
return false;
}
virtual bool visit(FieldMemberExpression *ast)
bool visit(FieldMemberExpression *ast) override
{
accept(ast->base);
out(ast->dotToken);
@@ -768,7 +768,7 @@ protected:
return false;
}
virtual bool visit(NewMemberExpression *ast)
bool visit(NewMemberExpression *ast) override
{
out("new ", ast->newToken);
accept(ast->base);
@@ -778,14 +778,14 @@ protected:
return false;
}
virtual bool visit(NewExpression *ast)
bool visit(NewExpression *ast) override
{
out("new ", ast->newToken);
accept(ast->expression);
return false;
}
virtual bool visit(CallExpression *ast)
bool visit(CallExpression *ast) override
{
accept(ast->base);
out(ast->lparenToken);
@@ -795,84 +795,84 @@ protected:
return false;
}
virtual bool visit(PostIncrementExpression *ast)
bool visit(PostIncrementExpression *ast) override
{
accept(ast->base);
out(ast->incrementToken);
return false;
}
virtual bool visit(PostDecrementExpression *ast)
bool visit(PostDecrementExpression *ast) override
{
accept(ast->base);
out(ast->decrementToken);
return false;
}
virtual bool visit(PreIncrementExpression *ast)
bool visit(PreIncrementExpression *ast) override
{
out(ast->incrementToken);
accept(ast->expression);
return false;
}
virtual bool visit(PreDecrementExpression *ast)
bool visit(PreDecrementExpression *ast) override
{
out(ast->decrementToken);
accept(ast->expression);
return false;
}
virtual bool visit(DeleteExpression *ast)
bool visit(DeleteExpression *ast) override
{
out("delete ", ast->deleteToken);
accept(ast->expression);
return false;
}
virtual bool visit(VoidExpression *ast)
bool visit(VoidExpression *ast) override
{
out("void ", ast->voidToken);
accept(ast->expression);
return false;
}
virtual bool visit(TypeOfExpression *ast)
bool visit(TypeOfExpression *ast) override
{
out("typeof ", ast->typeofToken);
accept(ast->expression);
return false;
}
virtual bool visit(UnaryPlusExpression *ast)
bool visit(UnaryPlusExpression *ast) override
{
out(ast->plusToken);
accept(ast->expression);
return false;
}
virtual bool visit(UnaryMinusExpression *ast)
bool visit(UnaryMinusExpression *ast) override
{
out(ast->minusToken);
accept(ast->expression);
return false;
}
virtual bool visit(TildeExpression *ast)
bool visit(TildeExpression *ast) override
{
out(ast->tildeToken);
accept(ast->expression);
return false;
}
virtual bool visit(NotExpression *ast)
bool visit(NotExpression *ast) override
{
out(ast->notToken);
accept(ast->expression);
return false;
}
virtual bool visit(BinaryExpression *ast)
bool visit(BinaryExpression *ast) override
{
++_binaryExpDepth;
accept(ast->left);
@@ -893,7 +893,7 @@ protected:
return false;
}
virtual bool visit(ConditionalExpression *ast)
bool visit(ConditionalExpression *ast) override
{
accept(ast->expression);
out(" ? ", ast->questionToken);
@@ -903,7 +903,7 @@ protected:
return false;
}
virtual bool visit(Block *ast)
bool visit(Block *ast) override
{
out(ast->lbraceToken);
lnAcceptIndented(ast->statements);
@@ -912,14 +912,14 @@ protected:
return false;
}
virtual bool visit(VariableStatement *ast)
bool visit(VariableStatement *ast) override
{
out("var ", ast->declarationKindToken);
accept(ast->declarations);
return false;
}
virtual bool visit(VariableDeclaration *ast)
bool visit(VariableDeclaration *ast) override
{
out(ast->identifierToken);
if (ast->expression) {
@@ -929,13 +929,13 @@ protected:
return false;
}
virtual bool visit(EmptyStatement *ast)
bool visit(EmptyStatement *ast) override
{
out(ast->semicolonToken);
return false;
}
virtual bool visit(IfStatement *ast)
bool visit(IfStatement *ast) override
{
out(ast->ifToken);
out(" ");
@@ -955,7 +955,7 @@ protected:
return false;
}
virtual bool visit(DoWhileStatement *ast)
bool visit(DoWhileStatement *ast) override
{
out(ast->doToken);
acceptBlockOrIndented(ast->statement, true);
@@ -967,7 +967,7 @@ protected:
return false;
}
virtual bool visit(WhileStatement *ast)
bool visit(WhileStatement *ast) override
{
out(ast->whileToken);
out(" ");
@@ -978,7 +978,7 @@ protected:
return false;
}
virtual bool visit(ForStatement *ast)
bool visit(ForStatement *ast) override
{
out(ast->forToken);
out(" ");
@@ -993,7 +993,7 @@ protected:
return false;
}
virtual bool visit(LocalForStatement *ast)
bool visit(LocalForStatement *ast) override
{
out(ast->forToken);
out(" ");
@@ -1010,7 +1010,7 @@ protected:
return false;
}
virtual bool visit(ForEachStatement *ast)
bool visit(ForEachStatement *ast) override
{
out(ast->forToken);
out(" ");
@@ -1023,7 +1023,7 @@ protected:
return false;
}
virtual bool visit(LocalForEachStatement *ast)
bool visit(LocalForEachStatement *ast) override
{
out(ast->forToken);
out(" ");
@@ -1038,7 +1038,7 @@ protected:
return false;
}
virtual bool visit(ContinueStatement *ast)
bool visit(ContinueStatement *ast) override
{
out(ast->continueToken);
if (!ast->label.isNull()) {
@@ -1048,7 +1048,7 @@ protected:
return false;
}
virtual bool visit(BreakStatement *ast)
bool visit(BreakStatement *ast) override
{
out(ast->breakToken);
if (!ast->label.isNull()) {
@@ -1058,7 +1058,7 @@ protected:
return false;
}
virtual bool visit(ReturnStatement *ast)
bool visit(ReturnStatement *ast) override
{
out(ast->returnToken);
if (ast->expression) {
@@ -1068,7 +1068,7 @@ protected:
return false;
}
virtual bool visit(ThrowStatement *ast)
bool visit(ThrowStatement *ast) override
{
out(ast->throwToken);
if (ast->expression) {
@@ -1078,7 +1078,7 @@ protected:
return false;
}
virtual bool visit(WithStatement *ast)
bool visit(WithStatement *ast) override
{
out(ast->withToken);
out(" ");
@@ -1089,7 +1089,7 @@ protected:
return false;
}
virtual bool visit(SwitchStatement *ast)
bool visit(SwitchStatement *ast) override
{
out(ast->switchToken);
out(" ");
@@ -1101,7 +1101,7 @@ protected:
return false;
}
virtual bool visit(CaseBlock *ast)
bool visit(CaseBlock *ast) override
{
out(ast->lbraceToken);
newLine();
@@ -1117,7 +1117,7 @@ protected:
return false;
}
virtual bool visit(CaseClause *ast)
bool visit(CaseClause *ast) override
{
out("case ", ast->caseToken);
accept(ast->expression);
@@ -1127,7 +1127,7 @@ protected:
return false;
}
virtual bool visit(DefaultClause *ast)
bool visit(DefaultClause *ast) override
{
out(ast->defaultToken);
out(ast->colonToken);
@@ -1135,7 +1135,7 @@ protected:
return false;
}
virtual bool visit(LabelledStatement *ast)
bool visit(LabelledStatement *ast) override
{
out(ast->identifierToken);
out(": ", ast->colonToken);
@@ -1143,7 +1143,7 @@ protected:
return false;
}
virtual bool visit(TryStatement *ast)
bool visit(TryStatement *ast) override
{
out("try ", ast->tryToken);
accept(ast->statement);
@@ -1158,7 +1158,7 @@ protected:
return false;
}
virtual bool visit(Catch *ast)
bool visit(Catch *ast) override
{
out(ast->catchToken);
out(" ");
@@ -1169,19 +1169,19 @@ protected:
return false;
}
virtual bool visit(Finally *ast)
bool visit(Finally *ast) override
{
out("finally ", ast->finallyToken);
accept(ast->statement);
return false;
}
virtual bool visit(FunctionDeclaration *ast)
bool visit(FunctionDeclaration *ast) override
{
return visit(static_cast<FunctionExpression *>(ast));
}
virtual bool visit(FunctionExpression *ast)
bool visit(FunctionExpression *ast) override
{
out("function ", ast->functionToken);
if (!ast->name.isNull())
@@ -1200,7 +1200,7 @@ protected:
}
virtual bool visit(UiHeaderItemList *ast)
bool visit(UiHeaderItemList *ast) override
{
for (UiHeaderItemList *it = ast; it; it = it->next) {
accept(it->headerItem);
@@ -1210,7 +1210,7 @@ protected:
return false;
}
virtual bool visit(UiObjectMemberList *ast)
bool visit(UiObjectMemberList *ast) override
{
for (UiObjectMemberList *it = ast; it; it = it->next) {
accept(it->member);
@@ -1220,7 +1220,7 @@ protected:
return false;
}
virtual bool visit(UiArrayMemberList *ast)
bool visit(UiArrayMemberList *ast) override
{
for (UiArrayMemberList *it = ast; it; it = it->next) {
accept(it->member);
@@ -1232,7 +1232,7 @@ protected:
return false;
}
virtual bool visit(UiQualifiedId *ast)
bool visit(UiQualifiedId *ast) override
{
for (UiQualifiedId *it = ast; it; it = it->next) {
out(it->identifierToken);
@@ -1242,13 +1242,13 @@ protected:
return false;
}
virtual bool visit(UiQualifiedPragmaId *ast)
bool visit(UiQualifiedPragmaId *ast) override
{
out(ast->identifierToken);
return false;
}
virtual bool visit(Elision *ast)
bool visit(Elision *ast) override
{
for (Elision *it = ast; it; it = it->next) {
if (it->next)
@@ -1257,7 +1257,7 @@ protected:
return false;
}
virtual bool visit(ArgumentList *ast)
bool visit(ArgumentList *ast) override
{
for (ArgumentList *it = ast; it; it = it->next) {
accept(it->expression);
@@ -1269,7 +1269,7 @@ protected:
return false;
}
virtual bool visit(StatementList *ast)
bool visit(StatementList *ast) override
{
for (StatementList *it = ast; it; it = it->next) {
// ### work around parser bug: skip empty statements with wrong tokens
@@ -1285,7 +1285,7 @@ protected:
return false;
}
virtual bool visit(SourceElements *ast)
bool visit(SourceElements *ast) override
{
for (SourceElements *it = ast; it; it = it->next) {
accept(it->element);
@@ -1295,7 +1295,7 @@ protected:
return false;
}
virtual bool visit(VariableDeclarationList *ast)
bool visit(VariableDeclarationList *ast) override
{
for (VariableDeclarationList *it = ast; it; it = it->next) {
accept(it->declaration);
@@ -1305,7 +1305,7 @@ protected:
return false;
}
virtual bool visit(CaseClauses *ast)
bool visit(CaseClauses *ast) override
{
for (CaseClauses *it = ast; it; it = it->next) {
accept(it->clause);
@@ -1315,7 +1315,7 @@ protected:
return false;
}
virtual bool visit(FormalParameterList *ast)
bool visit(FormalParameterList *ast) override
{
for (FormalParameterList *it = ast; it; it = it->next) {
if (it->commaToken.isValid())

View File

@@ -342,7 +342,7 @@ void TimelineItemsGeometry::updateCurrentNode(float itemRight, float itemTop)
class TimelineExpandedRowNode : public QSGNode {
public:
TimelineItemsMaterial material;
virtual ~TimelineExpandedRowNode() {}
~TimelineExpandedRowNode() override {}
};
static qint64 startTime(const TimelineModel *model, const TimelineRenderState *parentState, int i)
@@ -436,12 +436,12 @@ class TimelineItemsMaterialShader : public QSGMaterialShader
public:
TimelineItemsMaterialShader();
virtual void updateState(const RenderState &state, QSGMaterial *newEffect,
QSGMaterial *oldEffect);
virtual char const *const *attributeNames() const;
void updateState(const RenderState &state, QSGMaterial *newEffect,
QSGMaterial *oldEffect) override;
char const *const *attributeNames() const override;
private:
virtual void initialize();
void initialize() override;
int m_matrix_id;
int m_scale_id;

View File

@@ -220,12 +220,12 @@ class NotesMaterialShader : public QSGMaterialShader
public:
NotesMaterialShader();
virtual void updateState(const RenderState &state, QSGMaterial *newEffect,
QSGMaterial *oldEffect);
virtual char const *const *attributeNames() const;
void updateState(const RenderState &state, QSGMaterial *newEffect,
QSGMaterial *oldEffect) override;
char const *const *attributeNames() const override;
private:
virtual void initialize();
void initialize() override;
int m_matrix_id;
int m_z_range_id;

View File

@@ -85,7 +85,7 @@ class FancyLineEditPrivate : public QObject
public:
explicit FancyLineEditPrivate(FancyLineEdit *parent);
virtual bool eventFilter(QObject *obj, QEvent *event);
bool eventFilter(QObject *obj, QEvent *event) override;
FancyLineEdit *m_lineEdit;
IconButton *m_iconbutton[2];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

View File

@@ -147,7 +147,7 @@ public:
BinaryVersionToolTipEventFilter(pe->lineEdit()), m_pathChooser(pe) {}
private:
virtual QString defaultToolTip() const
QString defaultToolTip() const override
{ return m_pathChooser->errorMessage(); }
const PathChooser *m_pathChooser = nullptr;

View File

@@ -70,7 +70,7 @@ class PathListPlainTextEdit : public QPlainTextEdit {
public:
explicit PathListPlainTextEdit(QWidget *parent = 0);
protected:
virtual void insertFromMimeData (const QMimeData *source);
void insertFromMimeData (const QMimeData *source) override;
};
PathListPlainTextEdit::PathListPlainTextEdit(QWidget *parent) :

View File

@@ -126,7 +126,7 @@ bool SaveFile::commit()
m_tempFile.reset();
bool result = ReplaceFile(finalFileName.toStdWString().data(),
fileName().toStdWString().data(),
nullptr, 0, nullptr, nullptr);
nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS, nullptr, nullptr);
if (!result) {
const DWORD replaceErrorCode = GetLastError();
QString errorStr;

View File

@@ -276,6 +276,7 @@ void ShellCommand::run(QFutureInterface<void> &future)
QString stdOut;
QString stdErr;
emit started();
if (d->m_progressParser)
d->m_progressParser->setFuture(&future);
else

View File

@@ -154,6 +154,7 @@ public:
signals:
void stdOutText(const QString &);
void stdErrText(const QString &);
void started();
void finished(bool ok, int exitCode, const QVariant &cookie);
void success(const QVariant &cookie);

View File

@@ -90,7 +90,7 @@ public:
void setFlags(unsigned tc) { m_flags = tc; }
protected:
virtual void setupChildProcess();
void setupChildProcess() override;
private:
unsigned m_flags;

View File

@@ -207,5 +207,7 @@
<file>images/lightbulb@2x.png</file>
<file>images/lightbulbcap.png</file>
<file>images/lightbulbcap@2x.png</file>
<file>images/toolbuttonexpandarrow.png</file>
<file>images/toolbuttonexpandarrow@2x.png</file>
</qresource>
</RCC>

View File

@@ -176,7 +176,8 @@ const Icon CLOSE_SPLIT_LEFT({
const Icon CLOSE_SPLIT_RIGHT({
{QLatin1String(":/utils/images/splitbutton_closeright.png"), Theme::IconsBaseColor}});
const Icon FILTER({
{QLatin1String(":/utils/images/filtericon.png"), Theme::IconsBaseColor}});
{QLatin1String(":/utils/images/filtericon.png"), Theme::IconsBaseColor},
{QLatin1String(":/utils/images/toolbuttonexpandarrow.png"), Theme::IconsBaseColor}});
const Icon LINK({
{QLatin1String(":/utils/images/linkicon.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon LINK_TOOLBAR({

View File

@@ -33,8 +33,9 @@
#include <cpptools/cppmodelmanager.h>
#include <projectexplorer/session.h>
#include <utils/algorithm.h>
#include <utils/icon.h>
#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
#include <utils/theme/theme.h>
#include <QRegExp>
@@ -112,7 +113,9 @@ QVariant GTestTreeItem::data(int column, int role) const
case Qt::DecorationRole:
if (type() == GroupNode
&& GTestFramework::groupMode() == GTest::Constants::GTestFilter) {
return Utils::Icons::FILTER.icon(); // TODO replace by an 'inked' filter w/o arrow
static const QIcon filterIcon = Utils::Icon({{":/utils/images/filtericon.png",
Utils::Theme::PanelTextColorMid}}).icon();
return filterIcon;
}
break;
case Qt::ToolTipRole:

View File

@@ -205,7 +205,8 @@ bool QtTestResult::matchesTestFunction(const TestTreeItem *item) const
}
if (type == TestTreeItem::TestDataTag) {
TestTreeItem *grandParentItem = parentItem->parentItem();
return parentItem->name() == m_function && grandParentItem->name() == name();
return parentItem->name() == m_function && grandParentItem->name() == name()
&& item->name() == m_dataTag;
}
return item->name() == m_function && parentItem->name() == name();
}

View File

@@ -87,6 +87,8 @@ bool Uncrustify::initialize()
connect(m_settings, &UncrustifySettings::supportedMimeTypesChanged,
[this] { updateActions(Core::EditorManager::currentEditor()); });
new UncrustifyOptionsPage(m_settings, this);
return true;
}

View File

@@ -36,12 +36,24 @@ namespace Internal {
class FileInfo
{
public:
FileInfo() = default;
FileInfo(Utils::FileName file,
CppTools::ProjectFile::Kind kind,
CppTools::ProjectPart::Ptr projectPart)
: file(std::move(file))
, kind(kind)
, projectPart(projectPart)
{}
Utils::FileName file;
CppTools::ProjectFile::Kind kind;
CppTools::ProjectPart::Ptr projectPart;
};
using FileInfos = QVector<FileInfo>;
inline bool operator==(const FileInfo &lhs, const FileInfo &rhs) {
return lhs.file == rhs.file;
}
using FileInfos = std::vector<FileInfo>;
} // namespace Internal
} // namespace ClangTools

View File

@@ -42,11 +42,11 @@ using namespace Utils;
namespace ClangTools {
namespace Internal {
int FixitsRefactoringFile::position(unsigned line, unsigned column) const
int FixitsRefactoringFile::position(const QString &filePath, unsigned line, unsigned column) const
{
QTC_ASSERT(line != 0, return -1);
QTC_ASSERT(column != 0, return -1);
return document()->findBlockByNumber(line - 1).position() + column - 1;
return document(filePath)->findBlockByNumber(line - 1).position() + column - 1;
}
static QDebug operator<<(QDebug debug, const ReplacementOperation &op)
@@ -71,23 +71,22 @@ bool FixitsRefactoringFile::apply()
QTC_ASSERT(!m_filePath.isEmpty(), return false);
// Check for permissions
if (!QFileInfo(m_filePath).isWritable())
return false; // Error file not writable
// Apply changes
QTextDocument *doc = document();
QTextCursor cursor(doc);
for (int i=0; i < m_replacementOperations.size(); ++i) {
ReplacementOperation &op = *m_replacementOperations[i];
if (op.apply) {
// Check for permissions
if (!QFileInfo(op.fileName).isWritable())
return false; // Error file not writable
qCDebug(fixitsLog) << " " << i << "Applying" << op;
// Shift subsequent operations that are affected
shiftAffectedReplacements(op, i + 1);
// Apply
QTextDocument *doc = document(op.fileName);
QTextCursor cursor(doc);
cursor.setPosition(op.pos);
cursor.setPosition(op.pos + op.length, QTextCursor::KeepAnchor);
cursor.insertText(op.text);
@@ -99,40 +98,45 @@ bool FixitsRefactoringFile::apply()
return false; // Error reading file
QString error;
if (!m_textFileFormat.writeFile(m_filePath, doc->toPlainText(), &error)) {
qCDebug(fixitsLog) << "ERROR: Could not write file" << m_filePath << ":" << error;
return false; // Error writing file
for (auto it = m_documents.begin(); it != m_documents.end(); ++it) {
if (!m_textFileFormat.writeFile(it.key(), it.value()->toPlainText(), &error)) {
qCDebug(fixitsLog) << "ERROR: Could not write file" << it.key() << ":" << error;
return false; // Error writing file
}
}
return true;
}
QTextDocument *FixitsRefactoringFile::document() const
QTextDocument *FixitsRefactoringFile::document(const QString &filePath) const
{
if (!m_document) {
if (m_documents.find(filePath) == m_documents.end()) {
QString fileContents;
if (!m_filePath.isEmpty()) {
if (!filePath.isEmpty()) {
QString error;
QTextCodec *defaultCodec = Core::EditorManager::defaultTextCodec();
TextFileFormat::ReadResult result = TextFileFormat::readFile(
m_filePath, defaultCodec,
filePath, defaultCodec,
&fileContents, &m_textFileFormat,
&error);
if (result != TextFileFormat::ReadSuccess) {
qCDebug(fixitsLog) << "ERROR: Could not read " << m_filePath << ":" << error;
qCDebug(fixitsLog) << "ERROR: Could not read " << filePath << ":" << error;
m_textFileFormat.codec = nullptr;
}
}
// always make a QTextDocument to avoid excessive null checks
m_document = new QTextDocument(fileContents);
m_documents[filePath] = new QTextDocument(fileContents);
}
return m_document;
return m_documents[filePath];
}
void FixitsRefactoringFile::shiftAffectedReplacements(const ReplacementOperation &op, int startIndex)
{
for (int i = startIndex; i < m_replacementOperations.size(); ++i) {
ReplacementOperation &current = *m_replacementOperations[i];
if (op.fileName != current.fileName)
continue;
ReplacementOperation before = current;
if (op.pos <= current.pos)

View File

@@ -41,6 +41,7 @@ public:
int pos = -1;
int length = -1;
QString text;
QString fileName;
bool apply = false;
};
using ReplacementOperations = QVector<ReplacementOperation *>;
@@ -52,20 +53,21 @@ class FixitsRefactoringFile
public:
FixitsRefactoringFile() = default;
FixitsRefactoringFile(const QString &filePath) : m_filePath(filePath) {}
~FixitsRefactoringFile() { qDeleteAll(m_documents); }
bool isValid() const { return !m_filePath.isEmpty(); }
int position(unsigned line, unsigned column) const;
int position(const QString &filePath, unsigned line, unsigned column) const;
void setReplacements(const ReplacementOperations &ops) { m_replacementOperations = ops; }
bool apply();
private:
QTextDocument *document() const;
QTextDocument *document(const QString &filePath) const;
void shiftAffectedReplacements(const ReplacementOperation &op, int startIndex);
QString m_filePath;
mutable Utils::TextFileFormat m_textFileFormat;
mutable QTextDocument *m_document = nullptr;
mutable QHash<QString, QTextDocument *> m_documents;
ReplacementOperations m_replacementOperations; // Not owned.
};

View File

@@ -155,7 +155,7 @@ public:
return false;
if (!node->isDir)
result += static_cast<TreeWithFileInfo *>(node)->info;
result.push_back(static_cast<TreeWithFileInfo *>(node)->info);
return true;
});
@@ -194,7 +194,7 @@ private:
Tree *projectDirTree = buildProjectDirTree(project->projectDirectory(),
fileInfos,
outOfBaseDirFiles);
if (outOfBaseDirFiles.isEmpty()) {
if (outOfBaseDirFiles.empty()) {
// Showing the project file and beneath the project dir is pointless in this case,
// so get rid of the root node and modify the project dir node as the new root node.
projectDirTree->name = m_root->name;
@@ -229,7 +229,7 @@ private:
for (const FileInfo &fileInfo : fileInfos) {
if (!fileInfo.file.isChildOf(projectDirNode->fullPath)) {
outOfBaseDirFiles += fileInfo;
outOfBaseDirFiles.push_back(fileInfo);
continue; // Handle these separately.
}

View File

@@ -119,13 +119,14 @@ public:
const Debugger::DiagnosticLocation start = step.ranges.first();
const Debugger::DiagnosticLocation end = step.ranges.last();
const int startPos = file.position(start.line, start.column);
const int endPos = file.position(end.line, end.column);
const int startPos = file.position(start.filePath, start.line, start.column);
const int endPos = file.position(start.filePath, end.line, end.column);
auto op = new ReplacementOperation;
op->pos = startPos;
op->length = endPos - startPos;
op->text = step.message;
op->fileName = start.filePath;
op->apply = apply;
replacements += op;
@@ -332,7 +333,7 @@ void ClangTidyClazyTool::startTool(bool askUserForFileSelection)
QTC_ASSERT(project, return);
const FileInfos fileInfos = collectFileInfos(project, askUserForFileSelection);
if (fileInfos.isEmpty())
if (fileInfos.empty())
return;
auto clangTool = new ClangTidyClazyRunControl(runControl,

View File

@@ -78,13 +78,13 @@ static FileInfos sortedFileInfos(const QVector<CppTools::ProjectPart::Ptr> &proj
continue;
if (CppTools::ProjectFile::isSource(file.kind)) {
const FileInfo info{Utils::FileName::fromString(file.path), file.kind, projectPart};
fileInfos.append(info);
fileInfos.emplace_back(Utils::FileName::fromString(file.path), file.kind, projectPart);
}
}
}
Utils::sort(fileInfos, &FileInfo::file);
fileInfos.erase(std::unique(fileInfos.begin(), fileInfos.end()), fileInfos.end());
return fileInfos;
}

View File

@@ -157,6 +157,7 @@ public:
QFileSystemWatcher *m_fileWatcher = nullptr; // Delayed creation.
QFileSystemWatcher *m_linkWatcher = nullptr; // Delayed creation (only UNIX/if a link is seen).
bool m_postponeAutoReload = false;
bool m_blockActivated = false;
bool m_checkOnFocusChange = false;
QString m_lastVisitedDirectory = QDir::currentPath();
@@ -597,6 +598,13 @@ void DocumentManager::unexpectFileChange(const QString &fileName)
updateExpectedState(filePathKey(fileName, ResolveLinks));
}
void DocumentManager::setAutoReloadPostponed(bool postponed)
{
d->m_postponeAutoReload = postponed;
if (!postponed)
QTimer::singleShot(500, m_instance, &DocumentManager::checkForReload);
}
static bool saveModifiedFilesHelper(const QList<IDocument *> &documents,
const QString &message, bool *cancelled, bool silently,
const QString &alwaysSaveMessage, bool *alwaysSave,
@@ -990,7 +998,7 @@ void DocumentManager::changedFile(const QString &fileName)
void DocumentManager::checkForReload()
{
if (d->m_changedFiles.isEmpty())
if (d->m_postponeAutoReload || d->m_changedFiles.isEmpty())
return;
if (QApplication::applicationState() != Qt::ApplicationActive)
return;

View File

@@ -69,6 +69,8 @@ public:
static void expectFileChange(const QString &fileName);
static void unexpectFileChange(const QString &fileName);
static void setAutoReloadPostponed(bool enabled);
// recent files
static void addToRecentFiles(const QString &fileName, Id editorId = Id());
Q_SLOT void clearRecentFiles();

View File

@@ -29,6 +29,7 @@
#include "fancyactionbar.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/styledbar.h>
#include <utils/stylehelper.h>
#include <utils/theme/theme.h>
@@ -599,6 +600,12 @@ void FancyTabWidget::showWidget(int index)
{
emit currentAboutToShow(index);
m_modesStack->setCurrentIndex(index);
QWidget *w = m_modesStack->currentWidget();
if (QTC_GUARD(w)) {
if (QWidget *focusWidget = w->focusWidget())
w = focusWidget;
w->setFocus();
}
emit currentChanged(index);
}

View File

@@ -1882,8 +1882,8 @@ bool matchName(const Name *name, QList<Core::LocatorFilterEntry> *matches, QStri
if (!name)
return false;
if (CppClassesFilter *classesFilter
= ExtensionSystem::PluginManager::getObject<CppClassesFilter>()) {
if (Core::ILocatorFilter *classesFilter
= CppTools::CppModelManager::instance()->classesFilter()) {
QFutureInterface<Core::LocatorFilterEntry> dummy;
const Overview oo;

View File

@@ -129,28 +129,10 @@ void CompilerOptionsBuilder::enableExceptions()
add(QLatin1String("-fexceptions"));
}
static Utils::FileName absoluteDirectory(const QString &filePath)
{
return Utils::FileName::fromString(QFileInfo(filePath + '/').absolutePath());
}
static Utils::FileName projectTopLevelDirectory(const ProjectPart &projectPart)
{
if (!projectPart.project)
return Utils::FileName();
const Utils::FileName result = projectPart.project->projectDirectory();
const Utils::FileName vcsTopLevel = Utils::FileName::fromString(
Core::VcsManager::findTopLevelForDirectory(result.toString()));
if (result.isChildOf(vcsTopLevel))
return vcsTopLevel;
return result;
}
void CompilerOptionsBuilder::addHeaderPathOptions()
{
typedef ProjectPartHeaderPath HeaderPath;
const QString defaultPrefix = includeDirOption();
const Utils::FileName projectDirectory = projectTopLevelDirectory(m_projectPart);
QStringList result;
@@ -170,14 +152,7 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
default: // This shouldn't happen, but let's be nice..:
// intentional fall-through:
case HeaderPath::IncludePath:
path = absoluteDirectory(headerPath.path);
if (projectDirectory.isEmpty()
|| path == projectDirectory
|| path.isChildOf(projectDirectory)) {
prefix = defaultPrefix;
} else {
prefix = SYSTEM_INCLUDE_PREFIX;
}
prefix = defaultPrefix;
break;
}

View File

@@ -96,7 +96,7 @@ class CppCurrentDocumentFilterTestCase
public:
CppCurrentDocumentFilterTestCase(const QString &fileName,
const ResultDataList &expectedResults)
: BasicLocatorFilterTest(PluginManager::getObject<CppCurrentDocumentFilter>())
: BasicLocatorFilterTest(CppTools::CppModelManager::instance()->currentDocumentFilter())
, m_editor(0)
, m_fileName(fileName)
{
@@ -158,9 +158,11 @@ void CppToolsPlugin::test_cpplocatorfilters_CppLocatorFilter_data()
QTest::addColumn<QString>("searchText");
QTest::addColumn<ResultDataList>("expectedResults");
ILocatorFilter *cppFunctionsFilter = PluginManager::getObject<CppFunctionsFilter>();
ILocatorFilter *cppClassesFilter = PluginManager::getObject<CppClassesFilter>();
ILocatorFilter *cppLocatorFilter = PluginManager::getObject<CppLocatorFilter>();
CppModelManager *cppModelManager = CppModelManager::instance();
ILocatorFilter *cppFunctionsFilter = cppModelManager->functionsFilter();
ILocatorFilter *cppClassesFilter = cppModelManager->classesFilter();
ILocatorFilter *cppLocatorFilter = cppModelManager->locatorFilter();
MyTestDataDir testDirectory("testdata_basic");
const QString testFile = testDirectory.file("file1.cpp");

View File

@@ -390,6 +390,36 @@ void CppModelManager::setCurrentDocumentFilter(std::unique_ptr<Core::ILocatorFil
setFilter(d->m_currentDocumentFilter, std::move(filter));
}
Core::ILocatorFilter *CppModelManager::locatorFilter() const
{
return d->m_locatorFilter.get();
}
Core::ILocatorFilter *CppModelManager::classesFilter() const
{
return d->m_classesFilter.get();
}
Core::ILocatorFilter *CppModelManager::includesFilter() const
{
return d->m_includesFilter.get();
}
Core::ILocatorFilter *CppModelManager::functionsFilter() const
{
return d->m_functionsFilter.get();
}
Core::IFindFilter *CppModelManager::symbolsFindFilter() const
{
return d->m_symbolsFindFilter.get();
}
Core::ILocatorFilter *CppModelManager::currentDocumentFilter() const
{
return d->m_currentDocumentFilter.get();
}
FollowSymbolInterface &CppModelManager::followSymbolInterface() const
{
return d->m_activeModelManagerSupport->followSymbolInterface();

View File

@@ -219,6 +219,13 @@ public:
void setSymbolsFindFilter(std::unique_ptr<Core::IFindFilter> &&filter);
void setCurrentDocumentFilter(std::unique_ptr<Core::ILocatorFilter> &&filter);
Core::ILocatorFilter *locatorFilter() const;
Core::ILocatorFilter *classesFilter() const;
Core::ILocatorFilter *includesFilter() const;
Core::ILocatorFilter *functionsFilter() const;
Core::IFindFilter *symbolsFindFilter() const;
Core::ILocatorFilter *currentDocumentFilter() const;
void renameIncludes(const QString &oldFileName, const QString &newFileName);
signals:

View File

@@ -486,6 +486,7 @@ void DebuggerEngine::start()
d->m_runTool->runControl()->setApplicationProcessHandle(d->m_inferiorPid);
action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability));
action(OperateByInstruction)->setChecked(boolSetting(OperateByInstruction));
QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished,
qDebug() << state());
@@ -534,8 +535,10 @@ void DebuggerEngine::gotoLocation(const Location &loc)
const QString file = QDir::cleanPath(loc.fileName());
const int line = loc.lineNumber();
bool newEditor = false;
IEditor *editor = EditorManager::openEditor(file, Id(),
EditorManager::IgnoreNavigationHistory, &newEditor);
IEditor *editor = EditorManager::openEditor(
file, Id(),
EditorManager::IgnoreNavigationHistory | EditorManager::DoNotSwitchToDesignMode,
&newEditor);
QTC_ASSERT(editor, return); // Unreadable file?
editor->gotoLine(line, 0, !boolSetting(StationaryEditorWhileStepping));

View File

@@ -108,7 +108,8 @@ bool ElementTasks::hasClassDefinition(const qmt::MElement *element) const
? klass->name()
: klass->umlNamespace() + "::" + klass->name();
CppTools::CppClassesFilter *classesFilter = ExtensionSystem::PluginManager::getObject<CppTools::CppClassesFilter>();
Core::ILocatorFilter *classesFilter
= CppTools::CppModelManager::instance()->classesFilter();
if (!classesFilter)
return false;
@@ -144,7 +145,8 @@ void ElementTasks::openClassDefinition(const qmt::MElement *element)
? klass->name()
: klass->umlNamespace() + "::" + klass->name();
CppTools::CppClassesFilter *classesFilter = ExtensionSystem::PluginManager::getObject<CppTools::CppClassesFilter>();
Core::ILocatorFilter *classesFilter
= CppTools::CppModelManager::instance()->classesFilter();
if (!classesFilter)
return;

View File

@@ -160,7 +160,7 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *pare
connect(WinDebugInterface::instance(), &WinDebugInterface::cannotRetrieveDebugOutput,
this, &ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput);
connect(WinDebugInterface::instance(), &WinDebugInterface::debugOutput,
this, &ApplicationLauncherPrivate::checkLocalDebugOutput, Qt::BlockingQueuedConnection);
this, &ApplicationLauncherPrivate::checkLocalDebugOutput);
#endif
}

View File

@@ -604,6 +604,7 @@ bool FolderNode::isAncesterOf(Node *n)
bool FolderNode::replaceSubtree(Node *oldNode, std::unique_ptr<Node> &&newNode)
{
std::unique_ptr<Node> keepAlive;
if (!oldNode) {
addNode(std::move(newNode)); // Happens e.g. when a project is registered
} else {
@@ -614,9 +615,10 @@ bool FolderNode::replaceSubtree(Node *oldNode, std::unique_ptr<Node> &&newNode)
QTC_ASSERT(it != m_nodes.end(), return false);
if (newNode) {
newNode->setParentFolderNode(this);
keepAlive = std::move(*it);
*it = std::move(newNode);
} else {
takeNode(oldNode); // Happens e.g. when project is shutting down
keepAlive = takeNode(oldNode); // Happens e.g. when project is shutting down
}
}
handleSubTreeChanged(this);

View File

@@ -331,10 +331,18 @@ TaskFilterModel::TaskFilterModel(TaskModel *sourceModel, QObject *parent) : QAbs
connect(m_sourceModel, &QAbstractItemModel::rowsInserted,
this, &TaskFilterModel::handleNewRows);
connect(m_sourceModel, &QAbstractItemModel::rowsAboutToBeRemoved,
this, &TaskFilterModel::handleRowsAboutToBeRemoved);
connect(m_sourceModel, &QAbstractItemModel::rowsRemoved,
this, [this](const QModelIndex &parent, int, int) {
QTC_ASSERT(!parent.isValid(), return);
endRemoveRows();
});
connect(m_sourceModel, &QAbstractItemModel::modelReset,
this, &TaskFilterModel::handleReset);
this, &TaskFilterModel::invalidateFilter);
connect(m_sourceModel, &QAbstractItemModel::dataChanged,
this, &TaskFilterModel::handleDataChanged);
@@ -383,8 +391,9 @@ static QPair<int, int> findFilteredRange(int first, int last, const QList<int> &
void TaskFilterModel::handleNewRows(const QModelIndex &index, int first, int last)
{
if (index.isValid())
return;
QTC_ASSERT(!index.isValid(), return);
const int newItemCount = last - first + 1;
QList<int> newMapping;
for (int i = first; i <= last; ++i) {
@@ -393,8 +402,8 @@ void TaskFilterModel::handleNewRows(const QModelIndex &index, int first, int las
newMapping.append(i);
}
const int newItems = newMapping.count();
if (!newItems)
const int newMappingCount = newMapping.count();
if (!newMappingCount)
return;
int filteredFirst = -1;
@@ -403,36 +412,35 @@ void TaskFilterModel::handleNewRows(const QModelIndex &index, int first, int las
else
filteredFirst = std::lower_bound(m_mapping.constBegin(), m_mapping.constEnd(), first) - m_mapping.constBegin();
const int filteredLast = filteredFirst + newItems - 1;
const int filteredLast = filteredFirst + newMappingCount - 1;
beginInsertRows(QModelIndex(), filteredFirst, filteredLast);
if (filteredFirst == m_mapping.count()) {
m_mapping.append(newMapping);
} else {
QList<int> rest = m_mapping.mid(filteredFirst);
const QList<int> rest = m_mapping.mid(filteredFirst);
m_mapping.reserve(m_mapping.count() + newItems);
m_mapping.reserve(m_mapping.count() + newMappingCount);
m_mapping.erase(m_mapping.begin() + filteredFirst, m_mapping.end());
m_mapping.append(newMapping);
foreach (int pos, rest)
m_mapping.append(pos + newItems);
for (int pos : rest)
m_mapping.append(pos + newItemCount);
}
endInsertRows();
}
void TaskFilterModel::handleRowsAboutToBeRemoved(const QModelIndex &index, int first, int last)
{
if (index.isValid())
return;
QTC_ASSERT(!index.isValid(), return);
const QPair<int, int> range = findFilteredRange(first, last, m_mapping);
if (range.first > range.second)
if (range.first > range.second) // rows to be removed are filtered out
return;
beginRemoveRows(QModelIndex(), range.first, range.second);
m_mapping.erase(m_mapping.begin() + range.first, m_mapping.begin() + range.second + 1);
const int sourceRemovedCount = (last - first) + 1;
for (int i = range.first; i < m_mapping.count(); ++i)
m_mapping[i] = m_mapping.at(i) - (last - first) - 1;
endRemoveRows();
m_mapping[i] = m_mapping.at(i) - sourceRemovedCount;
}
void TaskFilterModel::handleDataChanged(const QModelIndex &top, const QModelIndex &bottom)
@@ -444,24 +452,21 @@ void TaskFilterModel::handleDataChanged(const QModelIndex &top, const QModelInde
emit dataChanged(index(range.first, top.column()), index(range.second, bottom.column()));
}
void TaskFilterModel::handleReset()
{
invalidateFilter();
}
QModelIndex TaskFilterModel::mapFromSource(const QModelIndex &idx) const
{
auto it = std::lower_bound(m_mapping.constBegin(), m_mapping.constEnd(), idx.row());
if (it == m_mapping.constEnd() || idx.row() != *it)
if (!idx.isValid())
return QModelIndex();
auto it = std::lower_bound(m_mapping.constBegin(), m_mapping.constEnd(), idx.row());
QTC_ASSERT(it != m_mapping.constEnd() && idx.row() == *it, return QModelIndex());
return index(it - m_mapping.constBegin(), 0);
}
QModelIndex TaskFilterModel::mapToSource(const QModelIndex &index) const
{
int row = index.row();
if (row >= m_mapping.count())
if (!index.isValid())
return QModelIndex();
int row = index.row();
QTC_ASSERT(row >= 0 && row < m_mapping.count(), return QModelIndex());
return m_sourceModel->index(m_mapping.at(row), index.column(), index.parent());
}

View File

@@ -159,7 +159,6 @@ private:
void handleNewRows(const QModelIndex &index, int first, int last);
void handleRowsAboutToBeRemoved(const QModelIndex &index, int first, int last);
void handleDataChanged(const QModelIndex &top, const QModelIndex &bottom);
void handleReset();
QModelIndex mapToSource(const QModelIndex &index) const;
void invalidateFilter();

View File

@@ -27,10 +27,11 @@
#ifdef Q_OS_WIN
#include <windows.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QMap>
#include <QTime>
#include <qt_windows.h>
#include <algorithm>
/*!
\class ProjectExplorer::Internal::WinDebugInterface
@@ -67,6 +68,8 @@ WinDebugInterface::WinDebugInterface(QObject *parent) :
m_instance = this;
m_creatorPid = QCoreApplication::applicationPid();
setObjectName(QLatin1String("WinDebugInterfaceThread"));
connect(this, &WinDebugInterface::_q_debugOutputReady,
this, &WinDebugInterface::dispatchDebugOutput, Qt::QueuedConnection);
}
WinDebugInterface::~WinDebugInterface()
@@ -131,41 +134,18 @@ bool WinDebugInterface::runLoop()
SetEvent(m_bufferReadyEvent);
QTime timer; // time since last signal sent
timer.start();
QMap<qint64, QString> delayedMessages;
auto flushMessages = [this, &delayedMessages, &timer](){
auto it = delayedMessages.constBegin();
auto end = delayedMessages.constEnd();
for (; it != end; ++it)
emit debugOutput(it.key(), it.value());
delayedMessages.clear();
timer.start();
};
while (true) {
DWORD timeout = INFINITE;
if (!delayedMessages.isEmpty()) // if we have delayed message, don't wait forever
timeout = qMax(60 - timer.elapsed(), 1);
const DWORD ret = WaitForMultipleObjects(HandleCount, m_waitHandles, FALSE, timeout);
const DWORD ret = WaitForMultipleObjects(HandleCount, m_waitHandles, FALSE, INFINITE);
if (ret == WAIT_FAILED || ret - WAIT_OBJECT_0 == TerminateEventHandle) {
flushMessages();
std::lock_guard<std::mutex> guard(m_outputMutex);
emitReadySignal();
break;
}
if (ret == WAIT_TIMEOUT) {
flushMessages();
SetEvent(m_bufferReadyEvent);
} else if (ret - WAIT_OBJECT_0 == DataReadyEventHandle) {
if (ret - WAIT_OBJECT_0 == DataReadyEventHandle) {
if (*processId != m_creatorPid) {
if (timer.elapsed() < 60) {
delayedMessages[*processId].append(QString::fromLocal8Bit(message));
} else {
delayedMessages[*processId] += QString::fromLocal8Bit(message);
flushMessages();
}
std::lock_guard<std::mutex> guard(m_outputMutex);
m_debugOutput[*processId].push_back(QString::fromLocal8Bit(message));
emitReadySignal();
}
SetEvent(m_bufferReadyEvent);
}
@@ -173,6 +153,49 @@ bool WinDebugInterface::runLoop()
return true;
}
void WinDebugInterface::emitReadySignal()
{
// This function must be called from the WinDebugInterface thread only.
QTC_ASSERT(QThread::currentThread() == this, return);
if (m_debugOutput.empty() || m_readySignalEmitted)
return;
m_readySignalEmitted = true;
emit _q_debugOutputReady();
}
void WinDebugInterface::dispatchDebugOutput()
{
// Called in the thread this object was created in, not in the WinDebugInterfaceThread.
QTC_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread(), return);
static size_t maxMessagesToSend = 100;
std::vector<std::pair<qint64, QString>> output;
bool hasMoreOutput = false;
m_outputMutex.lock();
for (auto &entry : m_debugOutput) {
std::vector<QString> &src = entry.second;
QString dst;
size_t n = std::min(maxMessagesToSend, src.size());
for (size_t i = 0; i < n; ++i)
dst += src.at(i);
src.erase(src.begin(), std::next(src.begin(), n));
if (!src.empty())
hasMoreOutput = true;
output.emplace_back(entry.first, std::move(dst));
}
if (!hasMoreOutput)
m_readySignalEmitted = false;
m_outputMutex.unlock();
for (auto p : output)
emit debugOutput(p.first, p.second);
if (hasMoreOutput)
emit _q_debugOutputReady();
}
} // namespace Internal
} // namespace ProjectExplorer
@@ -193,6 +216,10 @@ void WinDebugInterface::run() { }
bool WinDebugInterface::runLoop() { return false; }
void WinDebugInterface::emitReadySignal() { }
void WinDebugInterface::dispatchDebugOutput() { }
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -25,8 +25,13 @@
#pragma once
#include <QMap>
#include <QThread>
#include <map>
#include <mutex>
#include <vector>
namespace ProjectExplorer {
namespace Internal {
@@ -45,12 +50,15 @@ public:
signals:
void debugOutput(qint64 pid, const QString &message);
void cannotRetrieveDebugOutput();
void _q_debugOutputReady();
private:
enum Handles { DataReadyEventHandle, TerminateEventHandle, HandleCount };
void run() override;
bool runLoop();
void emitReadySignal();
void dispatchDebugOutput();
static WinDebugInterface *m_instance;
@@ -59,6 +67,9 @@ private:
Qt::HANDLE m_bufferReadyEvent = nullptr;
Qt::HANDLE m_sharedFile = nullptr;
void *m_sharedMem = nullptr;
std::mutex m_outputMutex;
bool m_readySignalEmitted = false;
std::map<qint64, std::vector<QString>> m_debugOutput;
};
} // namespace Internal

View File

@@ -45,6 +45,7 @@
#include <utils/qtcprocess.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/stringutils.h>
#include <utils/temporarydirectory.h>
#include <utils/QtConcurrentTools>
#include <QLoggingCategory>
@@ -1870,9 +1871,11 @@ FileName QmakeProFile::buildDir(QmakeBuildConfiguration *bc) const
const QString relativeDir = srcDirRoot.relativeFilePath(directoryPath().toString());
if (!bc && m_project->activeTarget())
bc = static_cast<QmakeBuildConfiguration *>(m_project->activeTarget()->activeBuildConfiguration());
if (!bc)
return { };
return FileName::fromString(QDir::cleanPath(QDir(bc->buildDirectory().toString()).absoluteFilePath(relativeDir)));
const QString buildConfigBuildDir = bc ? bc->buildDirectory().toString() : QString();
const QString buildDir = buildConfigBuildDir.isEmpty()
? m_project->projectDirectory().toString()
: buildConfigBuildDir;
return FileName::fromString(QDir::cleanPath(QDir(buildDir).absoluteFilePath(relativeDir)));
}
FileNameList QmakeProFile::generatedFiles(const FileName &buildDir,

View File

@@ -107,6 +107,7 @@ void MoveTool::mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
FormEditorItem *containerItem = containerFormEditorItem(itemList, m_movingItems);
if (containerItem && view()->currentState().isBaseState()) {
if (containerItem != m_movingItems.constFirst()->parentItem()
&& event->modifiers().testFlag(Qt::ControlModifier)
&& event->modifiers().testFlag(Qt::ShiftModifier)) {
const FormEditorItem *movingItem = m_movingItems.constFirst();

View File

@@ -49,6 +49,7 @@
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/qmljssimplereader.h>
#include <utils/algorithm.h>
#include <utils/changeset.h>
#include <utils/qtcassert.h>
@@ -483,14 +484,20 @@ QString RewriterView::auxiliaryDataAsQML() const
str += QString::number(node.internalId());
str += ";";
for (auto i = data.begin(); i != data.end(); ++i) {
const QVariant value = i.value();
QStringList keys = Utils::transform(data.keys(), [](const PropertyName &name) {
return QString::fromUtf8(name);
});
keys.sort();
for (const QString &key : keys) {
const QVariant value = data.value(key.toUtf8());
QString strValue = value.toString();
if (static_cast<QMetaType::Type>(value.type()) == QMetaType::QString)
strValue = "\"" + strValue + "\"";
if (!strValue.isEmpty()) {
str += replaceIllegalPropertyNameChars(QString::fromUtf8(i.key())) + ":";
str += replaceIllegalPropertyNameChars(key) + ":";
str += strValue;
str += ";";
}

View File

@@ -27,6 +27,7 @@
#include <formeditorscene.h>
#include <nodemetainfo.h>
#include <rewritingexception.h>
#include <QLineEdit>
#include <QTextEdit>
@@ -48,12 +49,17 @@ TextEditItem::~TextEditItem()
void TextEditItem::writeTextToProperty()
{
if (m_formEditorItem) {
if (text().isEmpty())
m_formEditorItem->qmlItemNode().removeProperty("text");
else if (m_formEditorItem->qmlItemNode().isTranslatableText("text"))
m_formEditorItem->qmlItemNode().setBindingProperty("text", QmlObjectNode::generateTranslatableText(text()));
else
m_formEditorItem->qmlItemNode().setVariantProperty("text", text());
try {
if (text().isEmpty())
m_formEditorItem->qmlItemNode().removeProperty("text");
else if (m_formEditorItem->qmlItemNode().isTranslatableText("text"))
m_formEditorItem->qmlItemNode().setBindingProperty("text", QmlObjectNode::generateTranslatableText(text()));
else
m_formEditorItem->qmlItemNode().setVariantProperty("text", text());
}
catch (const RewritingException &e) {
e.showException();
}
}
}

View File

@@ -85,6 +85,7 @@ namespace {
static const QLatin1String kDetect2Chars("Detect2Chars");
static const QLatin1String kAnyChar("AnyChar");
static const QLatin1String kStringDetect("StringDetect");
static const QLatin1String kWordDetect("WordDetect");
static const QLatin1String kRegExpr("RegExpr");
static const QLatin1String kKeyword("keyword");
static const QLatin1String kInt("Int");
@@ -153,6 +154,8 @@ bool HighlightDefinitionHandler::startElement(const QString &,
anyCharStarted(atts);
else if (qName == kStringDetect)
stringDetectedStarted(atts);
else if (qName == kWordDetect)
wordDetectStarted(atts);
else if (qName == kRegExpr)
regExprStarted(atts);
else if (qName == kKeyword)
@@ -189,7 +192,8 @@ bool HighlightDefinitionHandler::endElement(const QString &, const QString &, co
m_currentList->addKeyword(m_currentKeyword.trimmed());
m_processingKeyword = false;
} else if (qName == kDetectChar || qName == kDetect2Chars || qName == kAnyChar ||
qName == kStringDetect || qName == kRegExpr || qName == kKeyword || qName == kInt ||
qName == kStringDetect || qName == kWordDetect || qName == kRegExpr ||
qName == kKeyword || qName == kInt ||
qName == kFloat || qName == kHlCOct || qName == kHlCHex || qName == kHlCStringChar ||
qName == kHlCChar || qName == kRangeDetect || qName == kLineContinue ||
qName == kDetectSpaces || qName == kDetectIdentifier) {
@@ -333,6 +337,15 @@ void HighlightDefinitionHandler::stringDetectedStarted(const QXmlAttributes &att
ruleElementStarted(atts, QSharedPointer<Rule>(rule));
}
void HighlightDefinitionHandler::wordDetectStarted(const QXmlAttributes &atts)
{
WordDetectRule *rule = new WordDetectRule;
rule->setString(atts.value(kString));
rule->setInsensitive(atts.value(kInsensitive));
rule->setActive(atts.value(kDynamic));
ruleElementStarted(atts, QSharedPointer<Rule>(rule));
}
void HighlightDefinitionHandler::regExprStarted(const QXmlAttributes &atts)
{
RegExprRule *rule = new RegExprRule;

View File

@@ -67,6 +67,7 @@ private:
void detect2CharsStarted(const QXmlAttributes &atts);
void anyCharStarted(const QXmlAttributes &atts);
void stringDetectedStarted(const QXmlAttributes &atts);
void wordDetectStarted(const QXmlAttributes &atts);
void regExprStarted(const QXmlAttributes &atts);
void keywordStarted(const QXmlAttributes &atts);
void intStarted(const QXmlAttributes &atts);

View File

@@ -171,6 +171,21 @@ bool StringDetectRule::doMatchSucceed(const QString &text,
return false;
}
bool WordDetectRule::doMatchSucceed(const QString &text, const int length, ProgressData *progress)
{
const int offset = progress->offset();
if (length - offset < m_length)
return false;
if (offset > 0 && !definition()->isDelimiter(text.at(offset - 1)))
return false;
if (text.midRef(offset, m_string.size()).compare(m_string, m_caseSensitivity) != 0)
return false;
if (length > offset + m_string.size() && !definition()->isDelimiter(text.at(offset + m_string.size())))
return false;
progress->incrementOffset(m_length);
return true;
}
// RegExpr
RegExprRule::~RegExprRule()
{

View File

@@ -99,7 +99,7 @@ public:
void setString(const QString &s);
void setInsensitive(const QString &insensitive);
private:
protected:
virtual bool doMatchSucceed(const QString &text,
const int length,
ProgressData *progress);
@@ -111,6 +111,15 @@ private:
Qt::CaseSensitivity m_caseSensitivity = Qt::CaseSensitive;
};
class WordDetectRule : public StringDetectRule
{
private:
virtual bool doMatchSucceed(const QString &text,
const int length,
ProgressData *progress);
virtual WordDetectRule *doClone() const { return new WordDetectRule(*this); }
};
class RegExprRule : public DynamicRule
{
public:

View File

@@ -351,6 +351,8 @@ public:
void onHandlerFinished(int documentRevision, int position, int priority)
{
if (!m_widget)
return;
QTC_ASSERT(m_currentHandlerIndex < m_handlers.size(), return);
QTC_ASSERT(documentRevision == m_documentRevision, return);
QTC_ASSERT(position == m_position, return);
@@ -376,7 +378,7 @@ public:
}
private:
TextEditorWidget *m_widget = nullptr;
QPointer<TextEditorWidget> m_widget;
const QList<BaseHoverHandler *> &m_handlers;
struct LastHandlerInfo {

View File

@@ -1303,14 +1303,14 @@ int VcsBaseEditor::lineNumberOfCurrentEditor(const QString &currentFile)
const BaseTextEditor *eda = qobject_cast<const BaseTextEditor *>(ed);
if (!eda)
return -1;
const int cursorLine = eda->textCursor().blockNumber();
const int cursorLine = eda->textCursor().blockNumber() + 1;
auto const edw = qobject_cast<const TextEditorWidget *>(ed->widget());
if (edw) {
const int firstLine = edw->firstVisibleBlockNumber();
const int lastLine = edw->lastVisibleBlockNumber();
const int firstLine = edw->firstVisibleBlockNumber() + 1;
const int lastLine = edw->lastVisibleBlockNumber() + 1;
if (firstLine <= cursorLine && cursorLine < lastLine)
return cursorLine;
return edw->centerVisibleBlockNumber();
return edw->centerVisibleBlockNumber() + 1;
}
return cursorLine;
}

View File

@@ -27,6 +27,7 @@
#include "vcsbaseplugin.h"
#include "vcsoutputwindow.h"
#include <coreplugin/documentmanager.h>
#include <coreplugin/vcsmanager.h>
#include <utils/synchronousprocess.h>
@@ -56,6 +57,14 @@ VcsCommand::VcsCommand(const QString &workingDirectory,
return proxy;
});
connect(this, &VcsCommand::started, this, [this] {
if (flags() & ExpectRepoChanges)
Core::DocumentManager::setAutoReloadPostponed(true);
});
connect(this, &VcsCommand::finished, this, [this] {
if (flags() & ExpectRepoChanges)
Core::DocumentManager::setAutoReloadPostponed(false);
});
}
const QProcessEnvironment VcsCommand::processEnvironment() const

View File

@@ -87,6 +87,9 @@ WinRtDeployStepFactory::WinRtDeployStepFactory()
setDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployStepFactory", "Run windeployqt"));
setFlags(BuildStepInfo::Unclonable);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedDeviceTypes({Constants::WINRT_DEVICE_TYPE_LOCAL,
Constants::WINRT_DEVICE_TYPE_EMULATOR,
Constants::WINRT_DEVICE_TYPE_PHONE});
setRepeatable(false);
}

View File

@@ -8,7 +8,7 @@
<!ENTITY noword "(?![\w$+-])"> <!-- no word, $, + or - following -->
<!ENTITY pathpart "([\w_@.&#37;*?+-]|\\ )"> <!-- valid character in a file name -->
]>
<language name="Bash" version="6" kateversion="5.0" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;*.nix;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
<language name="Bash" version="8" kateversion="5.0" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;*.nix;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD;APKBUILD" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
<!-- (c) 2004 by Wilbert Berendsen (wilbert@kde.nl)
Changes by Matthew Woehlke (mw_triad@users.sourceforge.net)
@@ -540,7 +540,7 @@
<RegExpr attribute="Variable" context="AssignSubscr" String="\b&varname;(?=\[.+\]\+?=)" />
<!-- handle functions with function keyword before keywords -->
<StringDetect attribute="Function" context="#stay" String=":()" />
<RegExpr attribute="Keyword" context="FunctionDef" String="\bfunction\b" />
<WordDetect attribute="Keyword" context="FunctionDef" String="function" />
<!-- mark function definitions without function keyword -->
<RegExpr attribute="Function" context="#stay" String="&funcname;\s*\(\)" />
<!-- handle keywords -->
@@ -551,7 +551,7 @@
<!-- handle here-string -->
<RegExpr attribute="Redirection" context="#stay" String="\d*&lt;&lt;&lt;" />
<!-- handle here document -->
<StringDetect attribute="Redirection" context="HereDoc" String="&lt;&lt;" lookAhead="true" />
<Detect2Chars attribute="Redirection" context="HereDoc" char="&lt;" char1="&lt;" lookAhead="true" />
<!-- handle process subst -->
<RegExpr attribute="Redirection" context="ProcessSubst" String="[&lt;&gt;]\(" />
<!-- handle redirection -->
@@ -580,7 +580,7 @@
<!-- handle here-string -->
<RegExpr attribute="Redirection" context="#stay" String="\d*&lt;&lt;&lt;" />
<!-- handle here document -->
<StringDetect attribute="Redirection" context="HereDoc" String="&lt;&lt;" lookAhead="true" />
<Detect2Chars attribute="Redirection" context="HereDoc" char="&lt;" char1="&lt;" lookAhead="true" />
<!-- handle process subst -->
<RegExpr attribute="Redirection" context="ProcessSubst" String="[&lt;&gt;]\(" />
<!-- handle redirection -->
@@ -647,7 +647,7 @@
<RegExpr attribute="Variable" context="VarBrace" String="\$\{[*@#?$!_0-9-](?=[:#%/=?+-])" />
<StringDetect attribute="Variable" context="ExprDblParenSubst" String="$((" beginRegion="expression" />
<StringDetect attribute="Redirection" context="SubstFile" String="$(&lt;" />
<StringDetect attribute="Variable" context="SubstCommand" String="$(" />
<Detect2Chars attribute="Variable" context="SubstCommand" char="$" char1="(" />
<DetectChar attribute="Backquote" context="SubstBackq" char="`" />
<RegExpr attribute="Escape" context="#stay" String="\\[`$\\]" />
</context>
@@ -902,7 +902,7 @@
<RegExpr attribute="Redirection" context="HereDocQ" String="(&lt;&lt;\s*'(&word;)')" lookAhead="true" />
<RegExpr attribute="Redirection" context="HereDocQ" String="(&lt;&lt;\s*\\(&word;))" lookAhead="true" />
<RegExpr attribute="Redirection" context="HereDocNQ" String="(&lt;&lt;\s*(&word;))" lookAhead="true" />
<StringDetect attribute="Redirection" context="#pop" String="&lt;&lt;" /><!-- always met -->
<Detect2Chars attribute="Redirection" context="#pop" char="&lt;" char1="&lt;" /><!-- always met -->
</context>
<context attribute="Normal Text" lineEndContext="#pop" name="HereDocRemainder">

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="INI Files" section="Configuration" extensions="*.ini;*.pls;*.kcfgc" mimetype="" version="2" kateversion="2.4" author="Jan Janssen (medhefgo@web.de)" license="LGPL">
<language name="INI Files" section="Configuration" extensions="*.ini;*.pls;*.kcfgc" mimetype="" version="3" kateversion="2.4" author="Jan Janssen (medhefgo@web.de)" license="LGPL">
<highlighting>
<list name="keywords">
@@ -44,8 +44,6 @@
<Float attribute="Float" />
<Int attribute="Int" />
<keyword attribute="Keyword" String="keywords" />
<RegExpr attribute="Comment" context="#pop" String=";.*$" />
<RegExpr attribute="Comment" context="#pop" String="#.*$" />
</context>
<context name="Comment" attribute="Comment" lineEndContext="#pop">

View File

@@ -39,7 +39,7 @@
Enhance tr/// and y/// support.
-->
<language name="Perl" version="5" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2">
<language name="Perl" version="6" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm;*.pl6;*.PL6;*.p6;*.pm6;" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2">
<highlighting>
<list name="keywords">
<item>if</item>

View File

@@ -10,6 +10,17 @@ This code is released under the LGPL as part of kdelibs/kate.
== UPDATE HISTORY ==
2018-02-20 // Nibaldo González <nibgonz@gmail.com>
Fix '$' symbol, highlighted as 'dsError' by C++ (isocpp.xml).
Update syntax for Bison (3.0.4):
- Add declarations, directives in rules and the '@' variable.
- Allow a tag in '%union', declarations in multiple lines and
grammar declarations in the grammar rules section.
- The ';' char is not necessary to finish a rule. Allow '; |'
within rules.
Add mimetypes and extensions '*.ypp' & '*.y++'.
2007-10-01 // Sebastian Pipping <webmaster@hartwork.org>
Added: Extension "*.yy" for Bison
@@ -19,13 +30,9 @@ This code is released under the LGPL as part of kdelibs/kate.
YACC.XML 1.00 - First released.
== TODO ==
- Add a mime type (cannot find it !?)
========================================================================
-->
<language name="Yacc/Bison" version="3" kateversion="2.4" section="Sources" extensions="*.y;*.yy" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL">
<language name="Yacc/Bison" version="4" kateversion="2.4" section="Sources" extensions="*.y;*.yy;*.ypp;*.y++" mimetype="text/x-yacc;text/x-bison" priority="5" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL">
<highlighting>
<contexts>
@@ -44,16 +51,32 @@ This code is released under the LGPL as part of kdelibs/kate.
<context name="Declarations" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Comment" />
<StringDetect attribute="Directive" context="Union Start" String="%union" />
<Detect2Chars attribute="Content-Type Delimiter" context="Rules" char="%" char1="%" beginRegion="rules" endRegion="declarations" />
<!-- not sure that strict yacc allows that ... but it is commonly used -->
<!-- Prologue Declarations -->
<Detect2Chars attribute="Content-Type Delimiter" context="C Declarations" char="%" char1="{" beginRegion="cdeclarations" column="0" />
<IncludeRules context="Grammar Declarations" />
<WordDetect attribute="Directive" context="Code-Symbols Start" String="%initial-action" />
<WordDetect attribute="Directive" context="Code-Symbols Start" String="%param" />
<WordDetect attribute="Directive" context="Code-Symbols Start" String="%lex-param" />
<WordDetect attribute="Directive" context="Code-Symbols Start" String="%parse-param" />
<WordDetect attribute="Directive" context="Percent Command In" String="%&lt;flag&gt;" />
<!-- Any word followed by '%' (End with ';' or '%') -->
<DetectChar attribute="Directive" context="Percent Command" char="%" />
</context>
<context name="Grammar Declarations" attribute="Normal Text" lineEndContext="#stay">
<WordDetect attribute="Directive" context="Union Start" String="%union" />
<WordDetect attribute="Directive" context="Union Start" String="%code" />
<WordDetect attribute="Directive" context="Code-Symbols Start" String="%destructor" />
<WordDetect attribute="Directive" context="Code-Symbols Start" String="%printer" />
</context>
<context name="Union Start" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Comment" />
<DetectSpaces />
<DetectChar attribute="Normal Text" context="Union In" char="{" beginRegion="union" />
<RegExpr attribute="Normal Text" context="#pop!Union Tag" String="[^\s\{](?=(\s|$|//))" />
</context>
<context name="Union Tag" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Comment" />
<DetectSpaces />
<DetectChar attribute="Normal Text" context="Union In" char="{" beginRegion="union" />
@@ -70,39 +93,109 @@ This code is released under the LGPL as part of kdelibs/kate.
<IncludeRules context="##C++" />
</context>
<!-- '%'<decl> ('{' <Code-Symbols In> '}')+ <Percent Command In> [';'] -->
<context name="Code-Symbols Start" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Comment" />
<DetectSpaces />
<DetectChar attribute="Normal Text" context="Code-Symbols In" char="{" beginRegion="code-symbols" />
<RegExpr attribute="Alert" context="#pop" String="." />
</context>
<context name="Code-Symbols In" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="Normal Text" context="#pop#pop!Code-Symbols End" char="}" endRegion="code-symbols" />
<DetectChar attribute="Normal Text" context="Code-Symbols InIn" char="{" />
<IncludeRules context="Symbol-Variable" />
<IncludeRules context="##C++" />
</context>
<context name="Code-Symbols InIn" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="Normal Text" context="Code-Symbols InIn" char="{" />
<DetectChar attribute="Normal Text" context="#pop" char="}" />
<IncludeRules context="Symbol-Variable" />
<IncludeRules context="##C++" />
</context>
<context name="Code-Symbols End" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!Percent Command In">
<IncludeRules context="Comment" />
<DetectSpaces />
<DetectChar attribute="Normal Text" context="#pop" char=";" lookAhead="true" />
<DetectChar attribute="Normal Text" context="Code-Symbols In" char="{" beginRegion="code-symbols" />
</context>
<context name="Rules" attribute="Rule" lineEndContext="#stay">
<IncludeRules context="Comment" />
<Detect2Chars attribute="Content-Type Delimiter" context="User Code" char="%" char1="%" beginRegion="code" endRegion="rules" />
<DetectChar attribute="Normal Text" context="Rule In" char=":" beginRegion="rule" />
<DetectChar attribute="Rule" context="Grammar Declaration Start" char="%" lookAhead="true" />
</context>
<context name="Rule In" attribute="Definition" lineEndContext="#stay">
<IncludeRules context="Comment" />
<DetectChar attribute="Normal Text" context="#pop" char=";" endRegion="rule" />
<DetectChar attribute="Normal Text" context="Rule End" char=";" endRegion="rule" />
<DetectChar attribute="Normal Text" context="Normal C Bloc" char="{" beginRegion="bloc" />
<DetectChar attribute="Normal Text" context="#stay" char="|" />
<IncludeRules context="StringOrChar" />
<RegExpr attribute="Directive" context="#stay" String="%\?(?=\{)" />
<WordDetect attribute="Directive" context="#stay" String="%empty" />
<WordDetect attribute="Directive" context="#stay" String="%prec" />
<WordDetect attribute="Directive" context="#stay" String="%dprec" />
<WordDetect attribute="Directive" context="#stay" String="%merge" />
<!-- Finish rule without the ';' character (see the 'rhses.1' rule in the 'src/parse-gram.y' file, from the Bison source) -->
<RegExpr attribute="Open Rule" context="#pop" String="[\w\-\.](?=[\w\-\.]*:)" column="0" endRegion="rule" />
<Detect2Chars attribute="Content-Type Delimiter" context="#pop" char="%" char1="%" lookAhead="true" firstNonSpace="true" endRegion="rule" />
<RegExpr attribute="Directive" context="#pop" String="%(union|code|destructor|printer|start|(no\-)?default\-prec|nterm|token|type|left|right|nonassoc|precedence)\b" lookAhead="true" column="0" endRegion="rule" />
</context>
<!-- The Bison parser allows to have ';' followed by '|', without the rule ending.
The problem here is that the ';' char has endRegion="rule" (although it is not very relevant). -->
<context name="Rule End" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop">
<DetectSpaces />
<DetectChar attribute="Normal Text" context="#stay" char=";" />
<DetectChar attribute="Normal Text" context="#pop" char="|" />
<IncludeRules context="Comment" />
</context>
<context name="Grammar Declaration Start" attribute="Normal Text" lineEndContext="#stay">
<!-- In the rules section, only highlighting exact declarations -->
<IncludeRules context="Grammar Declarations" />
<WordDetect attribute="Directive" context="Percent Command In" String="%start" />
<WordDetect attribute="Directive" context="Percent Command In" String="%default-prec" />
<WordDetect attribute="Directive" context="Percent Command In" String="%no-default-prec" />
<WordDetect attribute="Directive" context="Percent Command In" String="%nterm" />
<WordDetect attribute="Directive" context="Percent Command In" String="%token" />
<WordDetect attribute="Directive" context="Percent Command In" String="%type" />
<WordDetect attribute="Directive" context="Percent Command In" String="%left" />
<WordDetect attribute="Directive" context="Percent Command In" String="%right" />
<WordDetect attribute="Directive" context="Percent Command In" String="%nonassoc" />
<WordDetect attribute="Directive" context="Percent Command In" String="%precedence" />
<DetectChar attribute="Rule" context="#pop" char="%" /> <!-- End when there is an invalid declaration -->
<DetectChar attribute="Normal Text" context="#pop" char=";" />
<IncludeRules context="Comment" />
<DetectSpaces />
<RegExpr attribute="Alert" context="#pop" String=".+" />
</context>
<context name="User Code" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="##C++" />
</context>
<context name="Percent Command" attribute="Directive" lineEndContext="#pop">
<context name="Percent Command" attribute="Directive" lineEndContext="#pop!Percent Command In">
<IncludeRules context="Comment" />
<RegExpr attribute="Normal Text" context="Percent Command In" String="\W" lookAhead="true" />
<RegExpr attribute="Normal Text" context="#pop!Percent Command In" String="[^\w\-]" lookAhead="true" />
</context>
<context name="Percent Command In" attribute="Normal Text" lineEndContext="#pop#pop">
<context name="Percent Command In" attribute="Normal Text" lineEndContext="#stay">
<!-- This can be applied to multiple lines -->
<DetectChar attribute="Normal Text" context="#pop" char=";" lookAhead="true" />
<DetectChar attribute="Normal Text" context="#pop" char="%" lookAhead="true" firstNonSpace="true" />
<Detect2Chars attribute="Normal Text" context="#pop" char="%" char1="%" lookAhead="true" />
<IncludeRules context="StringOrChar" />
<DetectChar attribute="Data Type" context="PC type" char="&lt;" />
<IncludeRules context="Comment" />
</context>
<context name="PC type" attribute="Data Type" lineEndContext="#pop#pop#pop">
<context name="PC type" attribute="Data Type" lineEndContext="#pop#pop">
<DetectChar attribute="Data Type" context="#pop" char="&gt;" />
</context>
<context name="Comment" attribute="Comment" lineEndContext="#stay">
<Detect2Chars attribute="Comment" context="CommentStar" char="/" char1="*" />
<!-- not sure that strict yacc allows that ... but I saw it in some sources ... -->
<Detect2Chars attribute="Comment" context="CommentSlash" char="/" char1="/" />
</context>
<context name="CommentStar" attribute="Comment" lineEndContext="#stay">
@@ -128,15 +221,20 @@ This code is released under the LGPL as part of kdelibs/kate.
<context name="Normal C Bloc" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="Normal Text" context="Normal C Bloc" char="{" beginRegion="bloc" />
<DetectChar attribute="Normal Text" context="#pop" char="}" endRegion="bloc" />
<IncludeRules context="Symbol-Variable" />
<IncludeRules context="##C++" />
</context>
<context name="Symbol-Variable" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="Directive" context="Dol" char="$" />
<RegExpr attribute="Directive" context="#stay" String="@(\$?)(\d+|[A-Za-z_]\w*)?" />
</context>
<context name="Dol" attribute="Normal Text" fallthrough="true" fallthroughContext="DolEnd" lineEndContext="#stay">
<RegExpr attribute="Data Type" context="DolEnd" String="&lt;[^&gt;]+&gt;" />
</context>
<context name="DolEnd" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Directive" context="#pop#pop" String="\d+" />
<context name="DolEnd" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop">
<RegExpr attribute="Directive" context="#pop#pop" String="@?\d+" />
<DetectChar attribute="Directive" context="#pop#pop" char="$" />
<DetectIdentifier attribute="Directive" context="#pop#pop" />
</context>
</contexts>
@@ -147,6 +245,7 @@ This code is released under the LGPL as part of kdelibs/kate.
<itemData name="Content-Type Delimiter" defStyleNum="dsBaseN" bold="1" />
<itemData name="Directive" defStyleNum="dsKeyword"/>
<itemData name="Rule" defStyleNum="dsString" />
<itemData name="Open Rule" defStyleNum="dsString" bold="1" />
<itemData name="Backslash Code" defStyleNum="dsString" bold="1" />
<itemData name="Alert" defStyleNum="dsAlert" />
<itemData name="String" defStyleNum="dsString"/>
@@ -158,6 +257,7 @@ This code is released under the LGPL as part of kdelibs/kate.
<general>
<comments>
<comment name="multiLine" start="/*" end="*/" />
<comment name="singleLine" start="//" />
</comments>
</general>
</language>

View File

@@ -51,4 +51,9 @@ enum class PreferredTranslationUnit
# define IS_LIMITSKIPFUNCTIONBODIESTOPREAMBLE_SUPPORTED
#endif
// CLANG-UPGRADE-CHECK: Remove IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED once we require clang >= 7.0
#if defined(CINDEX_VERSION_HAS_SKIPWARNINGSFROMINCLUDEDFILES_BACKPORTED) || CINDEX_VERSION_MINOR >= 46
# define IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED
#endif
} // namespace ClangBackEnd

View File

@@ -237,17 +237,6 @@ static bool isHeaderErrorDiagnostic(const Utf8String &mainFilePath, const Diagno
return isCritical && diagnostic.location().filePath() != mainFilePath;
}
static bool isIgnoredHeaderErrorDiagnostic(const Diagnostic &diagnostic)
{
// FIXME: This diagnostic can appear if e.g. a main file includes a -isystem header and then the
// header is opened in the editor - the provided unsaved file for the newly opened editor
// overrides the file from the preamble. In this case, clang uses the version from the preamble
// and changes in the header are not reflected in the main file. Typically that's not a problem
// because only non-project headers are opened as -isystem headers.
return diagnostic.text().endsWith(
Utf8StringLiteral("from the precompiled header has been overridden"));
}
void TranslationUnit::extractDiagnostics(DiagnosticContainer &firstHeaderErrorDiagnostic,
QVector<DiagnosticContainer> &mainFileDiagnostics) const
{
@@ -257,9 +246,7 @@ void TranslationUnit::extractDiagnostics(DiagnosticContainer &firstHeaderErrorDi
bool hasFirstHeaderErrorDiagnostic = false;
for (const Diagnostic &diagnostic : diagnostics()) {
if (!hasFirstHeaderErrorDiagnostic
&& isHeaderErrorDiagnostic(m_filePath, diagnostic)
&& !isIgnoredHeaderErrorDiagnostic(diagnostic)) {
if (!hasFirstHeaderErrorDiagnostic && isHeaderErrorDiagnostic(m_filePath, diagnostic)) {
hasFirstHeaderErrorDiagnostic = true;
firstHeaderErrorDiagnostic = diagnostic.toDiagnosticContainer();
}

View File

@@ -180,6 +180,9 @@ uint TranslationUnitUpdater::defaultParseOptions()
#ifdef IS_LIMITSKIPFUNCTIONBODIESTOPREAMBLE_SUPPORTED
| CXTranslationUnit_SkipFunctionBodies
| CXTranslationUnit_LimitSkipFunctionBodiesToPreamble
#endif
#ifdef IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED
| CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles
#endif
| CXTranslationUnit_IncludeBriefCommentsInCodeCompletion
| CXTranslationUnit_DetailedPreprocessingRecord

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