Merge remote-tracking branch 'origin/3.0'

This commit is contained in:
Eike Ziller
2013-11-27 12:18:12 +01:00
99 changed files with 6534 additions and 5559 deletions

View File

@@ -10,7 +10,20 @@ exampledirs = $SRCDIR/examples \
indexes += $QT_INSTALL_DOCS/qtwidgets/qtwidgets.index \ indexes += $QT_INSTALL_DOCS/qtwidgets/qtwidgets.index \
$QT_INSTALL_DOCS/qtcore/qtcore.index \ $QT_INSTALL_DOCS/qtcore/qtcore.index \
$QT_INSTALL_DOCS/qtqml/qtqml.index \ $QT_INSTALL_DOCS/qtqml/qtqml.index \
$QT_INSTALL_DOCS/qtquick/qtquick.index $QT_INSTALL_DOCS/qtquick/qtquick.index \
$QT_INSTALL_DOCS/qmake/qmake.index \
$QT_INSTALL_DOCS/qtdesigner/qtdesigner.index \
$QT_INSTALL_DOCS/qtdoc/qtdoc.index \
$QT_INSTALL_DOCS/qtgui/qtgui.index \
$QT_INSTALL_DOCS/qthelp/qthelp.index \
$QT_INSTALL_DOCS/qtquickcontrols/qtquickcontrols.index \
$QT_INSTALL_DOCS/qtquicklayouts/qtquicklayouts.index \
$QT_INSTALL_DOCS/qtlinguist/qtlinguist.index \
$QT_INSTALL_DOCS/qtscript/qtscript.index \
$QT_INSTALL_DOCS/qtsensors/qtsensors.index \
$QT_INSTALL_DOCS/qtuitools/qtuitools.index \
$QT_INSTALL_DOCS/qtwebkit/qtwebkit.index \
$QT_INSTALL_DOCS/qtxml/qtxml.index
include(macros.qdocconf) include(macros.qdocconf)
include(qt-cpp-ignore.qdocconf) include(qt-cpp-ignore.qdocconf)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -142,8 +142,7 @@
SDK to get the API and tools packages needed for development. In addition, SDK to get the API and tools packages needed for development. In addition,
you must install Qt for Android as part of Qt 5.2, or later. you must install Qt for Android as part of Qt 5.2, or later.
For more information, see For more information, see \l{Qt for Android}.
\l{http://qt-project.org/doc/qt-5/android-support.html}{Qt for Android}.
To configure connections between \QC and Android devices: To configure connections between \QC and Android devices:

View File

@@ -155,7 +155,7 @@
import QtSensors 5.0 import QtSensors 5.0
\endcode \endcode
\li Add the Accelerometer type with the necessary properties: \li Add the \l{Accelerometer} type with the necessary properties:
\quotefromfile accelbubble/main.qml \quotefromfile accelbubble/main.qml
\skipto Accelerometer \skipto Accelerometer

View File

@@ -154,8 +154,7 @@
For more information, see \l{Selecting Android Devices}. For more information, see \l{Selecting Android Devices}.
For more information about the \c androiddeployqt tool, see For more information about the \c androiddeployqt tool, see
\l{http://qt-project.org/doc/qt-5/deployment-android.html} \l{Deploying an Application on Android}.
{Deploying an Application on Android}.
\section2 Specifying Settings for Qt 5 Packages \section2 Specifying Settings for Qt 5 Packages
@@ -168,8 +167,7 @@
The anddroiddeployqt tool uses the information in the project .pro file to The anddroiddeployqt tool uses the information in the project .pro file to
create APKs. For more information about the qmake variables create APKs. For more information about the qmake variables
that you can set in the .pro file to tailor the APK, see that you can set in the .pro file to tailor the APK, see
\l{http://qt-project.org/doc/qt-5/deployment-android.html#qmake-variables} \l{Deploying an Application on Android#qmake-variables}{qmake Variables}.
{qmake Variables}.
You can view information about what the anddroiddeployqt tool is doing in You can view information about what the anddroiddeployqt tool is doing in
the \gui {Compile Output} pane. To view additional information, select the the \gui {Compile Output} pane. To view additional information, select the

View File

@@ -31,7 +31,7 @@
\title Debugging a Qt Quick Example Application \title Debugging a Qt Quick Example Application
This section uses the This section uses the
\l{http://qt-project.org/doc/qt-5.0/qtquick/qtquick2-qml-advtutorial.html}{Same Game} \l{QML Advanced Tutorial}{Same Game}
example application to illustrate how to debug Qt Quick applications in the example application to illustrate how to debug Qt Quick applications in the
\gui Debug mode. \gui Debug mode.

View File

@@ -161,11 +161,11 @@
\section1 Using Custom Styles \section1 Using Custom Styles
\QC is a \l{http://qt-project.org/doc/qt-5.0/qtwidgets/qapplication.html#QApplication} \QC is a \l{QApplication}
{Qt application}, and therefore, it accepts the command line options {Qt application}, and therefore, it accepts the command line options
that all Qt applications accept. For example, you can use the \c {-style} and that all Qt applications accept. For example, you can use the \c {-style} and
\c {-stylesheet} options to apply custom styles and \c {-stylesheet} options to apply custom styles and
\l{http://qt-project.org/doc/qt-5.0/qtwidgets/stylesheet.html}{stylesheets}. \l{QApplication#stylesheet}{stylesheets}.
The styling is only applied during the current session. The styling is only applied during the current session.
Exercise caution when applying styles, as overriding the existing styling Exercise caution when applying styles, as overriding the existing styling

View File

@@ -55,9 +55,7 @@
specify other command line arguments for the tools, select \gui {Tools > specify other command line arguments for the tools, select \gui {Tools >
External > Configure}. External > Configure}.
For more information about Qt Linguist, see For more information about Qt Linguist, see \l{Qt Linguist Manual}.
\l{http://qt-project.org/doc/qt-5.0/qtlinguist/qtlinguist-index.html}
{Qt Linguist Manual}.
\section1 Previewing QML Files \section1 Previewing QML Files
@@ -66,7 +64,8 @@
for viewing and testing while you are developing an application. for viewing and testing while you are developing an application.
To preview the currently active QML file, select \gui Tools > \gui External To preview the currently active QML file, select \gui Tools > \gui External
> \gui {Qt Quick} > \gui {Preview (qmlviewer)} or \gui {Preview (qmlscene)}. > \gui {Qt Quick} > \gui {Qt Quick 1 Preview (qmlviewer)} or
\gui {Qt Quick 2 Preview (qmlscene)}.
\section1 Using External Text Editors \section1 Using External Text Editors
@@ -127,6 +126,10 @@
\li In the \gui {Error output pane}, select how to handle error messages \li In the \gui {Error output pane}, select how to handle error messages
from the tool. from the tool.
\li Select the \gui {Modifies current document} check box to make sure
that if the current document is modified by the tool, it is saved
before the tool is run and reloaded after the tool finishes.
\li In the \gui Input field, specify text that is passed as standard \li In the \gui Input field, specify text that is passed as standard
input to the tool. input to the tool.

View File

@@ -177,9 +177,7 @@
\li Create a .qch file from your documentation. \li Create a .qch file from your documentation.
For information on how to prepare your documentation and create a For information on how to prepare your documentation and create a
.qch file, see .qch file, see \l{The Qt Help Framework}.
\l{http://qt-project.org/doc/qt-5.0/qthelp/qthelp-framework.html}
{The Qt Help Framework}.
\li To add the .qch file to \QC, select \gui Tools > \gui Options > \li To add the .qch file to \QC, select \gui Tools > \gui Options >
\gui Help > \gui Documentation > \gui Add. \gui Help > \gui Documentation > \gui Add.

View File

@@ -42,8 +42,7 @@
field displays the location of the file on the development PC. The field displays the location of the file on the development PC. The
\gui {Remote Directory} field displays the folder where the file is \gui {Remote Directory} field displays the folder where the file is
installed on the device. Text in red color indicates that the information is installed on the device. Text in red color indicates that the information is
missing. Edit the qmake missing. Edit the qmake \l{Variables#installs}
\l{http://qt-project.org/doc/qt-5.0/qtdoc/qmake-variable-reference.html#installs}
{INSTALLS variable} in the project .pro file to add the missing files. {INSTALLS variable} in the project .pro file to add the missing files.
When you run the application, \QC copies the necessary files to the device When you run the application, \QC copies the necessary files to the device

View File

@@ -67,9 +67,7 @@
contained in a .qml file. For instance, a Button component may contained in a .qml file. For instance, a Button component may
be defined in Button.qml. The QML runtime may instantiate this be defined in Button.qml. The QML runtime may instantiate this
Button component to create Button objects. Alternatively, a Button component to create Button objects. Alternatively, a
component may be defined inside a component may be defined inside a \l{Component} QML type.
\l{http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-component.html}
{Component} QML type.
\row \row
\li Deploy configuration \li Deploy configuration

View File

@@ -59,8 +59,7 @@
\QC provides two integrated visual editors, \QMLD and \QD. \QC provides two integrated visual editors, \QMLD and \QD.
To create intuitive, modern-looking, fluid user interfaces, you To create intuitive, modern-looking, fluid user interfaces, you
can use \l{http://qt-project.org/doc/qt-5.0/qtquick/qtquick-index.html} can use \l{Qt Quick}.
{Qt Quick}.
If you need a traditional user interface that is clearly If you need a traditional user interface that is clearly
structured and enforces a platform look and feel, you can use structured and enforces a platform look and feel, you can use
the integrated \QD. For more information, see the integrated \QD. For more information, see

View File

@@ -40,14 +40,32 @@
\list \list
\li Windows 7 \li Windows
\li Windows XP Service Pack 2 \list
\li Windows Vista \li Windows Vista
\li (K)Ubuntu Linux 10.04 (32-bit and 64-bit) or later, with the \li Windows 7
following:
\li Windows 8
\li Windows 8.1
\endlist
\note Some \QC plugins rely on Direct3D (part of DirectX). You might
have to manually enable support for it if you are running Windows in a
Virtual Machine. For more information, see
\l{http://www.virtualbox.org/manual/ch04.html#guestadd-3d}
{Hardware 3D acceleration (OpenGL and Direct3D 8/9)} and
\l{http://pubs.vmware.com/workstation-10/index.jsp?topic=%2Fcom.vmware.ws.using.doc%2FGUID-EA588485-718A-4FD8-81F5-B6E1F04C5788.html}
{Prepare the Host System to Use DirectX 9 Accelerated Graphics}.
\li (K)Ubuntu Linux 11.10 (32-bit and 64-bit) or later
To build Qt applications using \QC on Linux, you usually need the
following:
\list \list
@@ -79,11 +97,12 @@
\li libxrandr-dev \li libxrandr-dev
\li If you are using QtOpenGL, libgl-dev and libglu-dev \li libgl-dev and libglu-dev if you use Qt OpenGL (deprecated
in Qt 5) or Qt GUI OpenGL functions
\endlist \endlist
\li Mac OS 10.5 or later with the following: \li Mac OS 10.6 or later with the following:
\list \list

View File

@@ -55,8 +55,7 @@
process for development projects across different platforms. qmake process for development projects across different platforms. qmake
automates the generation of build configurations so that only a few lines automates the generation of build configurations so that only a few lines
of information are needed to create each configuration. For more of information are needed to create each configuration. For more
information about qmake, see the information about qmake, see the \l{qmake Manual}.
\l{http://qt-project.org/doc/qt-5.0/qtdoc/qmake-manual.html}{qmake Manual}.
You can modify the build and run settings for qmake projects in the You can modify the build and run settings for qmake projects in the
\gui Projects mode. \gui Projects mode.
@@ -199,6 +198,12 @@
Plain C or C++ project that uses CMake but does not use the Qt Plain C or C++ project that uses CMake but does not use the Qt
library library
\li Plain C or C++ Project (Qbs Build)
Plain C or C++ project that uses Qbs but does not use the Qt
library. This project type is listed if the experimental Qbs
plugin has been enabled in \gui Help > \gui {About Plugins}.
\endlist \endlist
\li Import Project \li Import Project
@@ -321,11 +326,12 @@
Qt provides support for integration with OpenGL implementations on all Qt provides support for integration with OpenGL implementations on all
platforms, which allows you to display hardware accelerated 3D graphics platforms, which allows you to display hardware accelerated 3D graphics
alongside a more conventional user interface. For more information, see alongside a more conventional user interface. For more information, see
\l{http://qt-project.org/doc/qt-5.0/qtopengl/qtopengl-index.html}{Qt OpenGL}. \l{Qt Gui#opengl-and-opengl-es-integration}{OpenGL and OpenGL ES integration}.
You can use the QGLShader class to compile OpenGL shaders written in the You can use the QOpenGLShader class to compile OpenGL shaders written in the
OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language
(GLSL/ES). QGLShader and QGLShaderProgram shelter you from the details of (GLSL/ES). QOpenGLShader and QOpenGLShaderProgram shelter you from the
details of
compiling and linking vertex and fragment shaders. compiling and linking vertex and fragment shaders.
You can use \QC code editor to write fragment and vertex shaders You can use \QC code editor to write fragment and vertex shaders
@@ -374,8 +380,7 @@
the root project and to add another project, such as a C++ library. the root project and to add another project, such as a C++ library.
The wizard creates a project file (.pro) that defines a \c subdirs template The wizard creates a project file (.pro) that defines a \c subdirs template
and the subproject that you add as a value of the and the subproject that you add as a value of the \l{Variables#subdirs}
\l{http://qt-project.org/doc/qt-5.0/qtdoc/qmake-variable-reference.html#subdirs}
{SUBDIRS variable}. It also adds all the necessary files for the subproject. {SUBDIRS variable}. It also adds all the necessary files for the subproject.
To add more subprojects, right-click the project name in the \gui Projects To add more subprojects, right-click the project name in the \gui Projects

View File

@@ -90,8 +90,7 @@
\endlist \endlist
For more information about the project file settings, see For more information about the project file settings, see
\l{http://qt-project.org/doc/qt-5.0/qtdoc/qmake-project-files.html#declaring-other-libraries} \l{Declaring Other Libraries}.
{Declaring Other Libraries}.
\section1 Example of Adding Internal Libraries \section1 Example of Adding Internal Libraries

View File

@@ -60,7 +60,7 @@
{shadow builds} are used to keep the build specific files separate {shadow builds} are used to keep the build specific files separate
from the source. You can create separate versions of project files from the source. You can create separate versions of project files
to keep platform-dependent code separate. You can use qmake to keep platform-dependent code separate. You can use qmake
\l{http://qt-project.org/doc/qt-5.0/qtdoc/qmake-tutorial.html#adding-platform-specific-source-files} \l{Adding Platform Specific Source Files}
{scopes} to select the file to process depending on which platform {scopes} to select the file to process depending on which platform
qmake is run on. qmake is run on.

View File

@@ -72,8 +72,7 @@
field displays the location of the file on the development PC. The field displays the location of the file on the development PC. The
\gui {Remote Directory} field displays the folder where the file is \gui {Remote Directory} field displays the folder where the file is
installed on the device. Text in red color indicates that the information is installed on the device. Text in red color indicates that the information is
missing. Edit the qmake missing. Edit the qmake \l{Variables#installs}
\l{http://qt-project.org/doc/qt-5.0/qtdoc/qmake-variable-reference.html#installs}
{INSTALLS variable} in the project .pro file to add the missing files. {INSTALLS variable} in the project .pro file to add the missing files.
When you run the application, \QC copies the necessary files to the device When you run the application, \QC copies the necessary files to the device

View File

@@ -31,10 +31,10 @@
\title Creating a Qt Quick Application \title Creating a Qt Quick Application
This tutorial uses built-in QML types and illustrates basic concepts of This tutorial uses built-in QML types and illustrates basic concepts of
\l {http://qt-project.org/doc/qt-5.0/qtquick/qtquick-index.html}{Qt Quick}. \l{Qt Quick}.
This tutorial describes how to use \QC to implement Qt states and transitions. We use This tutorial describes how to use \QC to implement Qt states and transitions. We use
\l{http://qt-project.org/doc/qt-5.0/qtquick/animation.html}{Qt example code} to \l{Animation}{Qt example code} to
create an application that displays a Qt logo that moves between three rectangles on the create an application that displays a Qt logo that moves between three rectangles on the
page when you click them. page when you click them.

View File

@@ -91,8 +91,7 @@
\endlist \endlist
To create a graphical button that scales beautifully without using vector To create a graphical button that scales beautifully without using vector
graphics, use the \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-borderimage.html} graphics, use the \l{BorderImage} type. For more information, see
{Border Image} type. For more information, see
\l{Creating Scalable Buttons and Borders}. \l{Creating Scalable Buttons and Borders}.
*/ */
@@ -108,8 +107,7 @@
\title Creating Scalable Buttons and Borders \title Creating Scalable Buttons and Borders
You can use the You can use the
\l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-borderimage.html} \l{BorderImage} type to display an image, such as a PNG file, as a border
{Border Image} type to display an image, such as a PNG file, as a border
and a background. and a background.
Use two Border Image items and suitable graphics to make it look like the Use two Border Image items and suitable graphics to make it look like the

View File

@@ -41,36 +41,32 @@
\list \list
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-borderimage.html} \li \l{BorderImage} uses an image as a border or background.
{Border Image}
uses an image as a border or background.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-image.html}{Image} \li \l{Image}
adds a bitmap to the scene. You can stretch and tile images. adds a bitmap to the scene. You can stretch and tile images.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-item.html}{Item} \li \l{Item}
is the most basic of all visual types in QML. Even though it has no is the most basic of all visual types in QML. Even though it has no
visual appearance, it defines all the properties that are common visual appearance, it defines all the properties that are common
across visual types, such as the x and y position, width and height, across visual types, such as the x and y position, width and height,
anchoring, and key handling. anchoring, and key handling.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-rectangle.html}{Rectangle} \li \l{Rectangle}
adds a rectangle that is painted with a solid fill color and an adds a rectangle that is painted with a solid fill color and an
optional border. You can also use the radius property to create optional border. You can also use the radius property to create
rounded rectangles. rounded rectangles.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-text.html}{Text} \li \l{Text} adds formatted read-only text.
adds formatted read-only text.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-textedit.html}{Text Edit} \li \l{TextEdit}
adds a single line of editable formatted text that can be validated. adds a single line of editable formatted text that can be validated.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-textinput.html}{Text Input} \li \l{TextInput}
adds a single line of editable plain text that can be validated. adds a single line of editable plain text that can be validated.
\omit \omit
\li \l{http://qt-project.org/doc/qt-5.0/qtwebkit/qml-qtwebkit3-webview.html}{Web View} \li \l{WebView} adds web content to a canvas.
adds web content to a canvas.
\endomit \endomit
\endlist \endlist

View File

@@ -105,7 +105,7 @@
\section2 Setting the Stacking Order \section2 Setting the Stacking Order
The \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-item.html#z-prop}{z property} of an The \l{Item#z-prop}{z property} of an
item determines its position in relation to its sibling items in the item determines its position in relation to its sibling items in the
type hierarchy. By default, items with a higher stacking value are type hierarchy. By default, items with a higher stacking value are
drawn on top of siblings with a lower stacking value. Items with the same drawn on top of siblings with a lower stacking value. Items with the same
@@ -334,8 +334,7 @@
transformations to an item. Each transformation is applied in order, one at transformations to an item. Each transformation is applied in order, one at
a time. a time.
For more information on Transform types, see For more information on Transform types, see \l{Transform}.
\l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-transform.html}{Transform}.
\section1 Adding States \section1 Adding States
@@ -373,8 +372,7 @@
\endlist \endlist
The \gui State pane displays the different The \gui State pane displays the different \l{State}{states}
\l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-state.html}{states}
of the component in the Qt Quick Designer. of the component in the Qt Quick Designer.
\image qmldesigner-transitions.png "State pane" \image qmldesigner-transitions.png "State pane"

View File

@@ -36,11 +36,9 @@
information for code completion and the semantic checks to work correctly. information for code completion and the semantic checks to work correctly.
When you write a QML module or use QML from a C++ application you typically When you write a QML module or use QML from a C++ application you typically
register new types with register new types with \l{QQmlEngine#qmlRegisterType-3}{qmlRegisterType()} or expose some
\l{http://qt-project.org/doc/qt-5.0/qtqml/qqmlengine.html#qmlRegisterType} class instances with \l{QQmlContext::setContextProperty()}. The \QC C++
{qmlRegisterType} or expose some class instances with code model now scans for these calls and
\l{http://qt-project.org/doc/qt-5.0/qtqml/qqmlcontext.html#setContextProperty}
{setContextProperty}. The \QC C++ code model now scans for these calls and
tells the QML code model about them. This means that properties are tells the QML code model about them. This means that properties are
displayed during code completion and the JavaScript code checker does not displayed during code completion and the JavaScript code checker does not
complain about unknown types. However, this works only when the source code complain about unknown types. However, this works only when the source code
@@ -55,8 +53,7 @@
For Qt 4.8 and later, one or more \c qmltypes files can be listed in the For Qt 4.8 and later, one or more \c qmltypes files can be listed in the
\c qmldir file under the \c typeinfo header. These files will be read in \c qmldir file under the \c typeinfo header. These files will be read in
addition to \c{plugins.qmltypes}. For more information, see addition to \c{plugins.qmltypes}. For more information, see
\l{http://qt-project.org/doc/qt-5.0/qtqml/qtqml-modules-qmldir.html#writing-a-qmltypes-file} \l{Writing a qmltypes File}.
{Writing a qmltypes File}.
\section1 Generating qmltypes Files \section1 Generating qmltypes Files

View File

@@ -62,23 +62,19 @@
\section1 Using Data Models \section1 Using Data Models
You can create the following types of views to organize items provided by You can create the following types of views to organize items provided by
\l{http://qt-project.org/doc/qt-5.0/qtquick/qtquick-modelviewsdata-modelview.html}{data models}: \l{Models and Views in Qt Quick}{data models}:
\list \list
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-gridview.html}{Grid View} \li GridView provides a grid vizualization of a model.
provides a grid vizualization of a model.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-listview.html}{List View} \li ListView provides a list vizualization of a model.
provides a list vizualization of a model.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-pathview.html}{Path View} \li PathView visualizes the contents of a model along a path.
visualizes the contents of a model along a path.
\endlist \endlist
When you add a Grid View, List View, or Path View, the When you add a GridView, ListView, or PathView, the ListModel and the
\l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-listmodel.html}{ListModel} and the
delegate component that creates an instance for each item in the model are delegate component that creates an instance for each item in the model are
added automatically. You can edit item properties added automatically. You can edit item properties
in the \gui Properties pane or in the \gui Properties pane or
@@ -89,7 +85,7 @@
The position of an item on the canvas can be either absolute or relative The position of an item on the canvas can be either absolute or relative
to other items. If you are designing a static user interface, to other items. If you are designing a static user interface,
\l{http://dev.qt-project.org/doc/qt-5.0/qtquick-positioning-topic.html#manual-positioning} \l{Important Concepts In Qt Quick - Positioning#manual-positioning}
{manual positioning} provides the most efficient form of positioning items {manual positioning} provides the most efficient form of positioning items
on the screen. For a dynamic user interface, you can employ the following on the screen. For a dynamic user interface, you can employ the following
positioning methods provided by Qt Quick: positioning methods provided by Qt Quick:
@@ -110,7 +106,7 @@
\section2 Setting Bindings \section2 Setting Bindings
\l{http://qt-project.org/doc/qt-5.0/qtquick-positioning-topic.html#positioning-with-bindings} \l{Positioning with Bindings}
{Property binding} is a declarative way of specifying the value of a property. {Property binding} is a declarative way of specifying the value of a property.
Binding allows a property value to be expressed as an JavaScript expression Binding allows a property value to be expressed as an JavaScript expression
that defines the value relative to other property values or data accessible that defines the value relative to other property values or data accessible
@@ -127,8 +123,7 @@
To remove bindings, select \gui Reset in the context menu. To remove bindings, select \gui Reset in the context menu.
For more information on the JavaScript environment provided by QML, see For more information on the JavaScript environment provided by QML, see
\l{http://qt-project.org/doc/qt-5.0/qtqml/qtqml-javascript-topic.html} \l{Integrating QML and JavaScript}.
{Integrating QML and JavaScript}.
\QMLD cannot show bindings and using them might have a negative impact on \QMLD cannot show bindings and using them might have a negative impact on
performance, so consider setting anchors and margins for items, instead. performance, so consider setting anchors and margins for items, instead.
@@ -138,8 +133,7 @@
\section2 Setting Anchors and Margins \section2 Setting Anchors and Margins
In an In an \l{Important Concepts In Qt Quick - Positioning#anchors}
\l{http://qt-project.org/doc/qt-5.0/qtquick-positioning-anchors.html}
{anchor-based} layout, each QML type can be thought of as having a set of {anchor-based} layout, each QML type can be thought of as having a set of
invisible \e anchor lines: top, bottom, left, right, fill, horizontal invisible \e anchor lines: top, bottom, left, right, fill, horizontal
center, vertical center, and baseline. center, vertical center, and baseline.
@@ -191,7 +185,7 @@
\section2 Using Positioners \section2 Using Positioners
\l{http://qt-project.org/doc/qt-5.0/qtquick-positioning-layouts.html} \l{Important Concepts In Qt Quick - Positioning#positioners}
{Positioner items} are container items that manage the positions of items in {Positioner items} are container items that manage the positions of items in
a declarative user interface. Positioners behave in a similar way to the a declarative user interface. Positioners behave in a similar way to the
layout managers used with standard Qt widgets, except that they are also layout managers used with standard Qt widgets, except that they are also
@@ -201,17 +195,15 @@
\list \list
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-column.html}{Column} \li \l{Column} arranges its child items vertically.
arranges its child items vertically.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-row.html}{Row} \li \l{Row} arranges its child items horizontally.
arranges its child items horizontally.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-grid.html}{Grid} \li \l{Grid}
arranges its child items so that they are aligned in a grid and arranges its child items so that they are aligned in a grid and
are not overlapping. are not overlapping.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-flow.html}{Flow} \li \l{Flow}
arranges its child items side by side, wrapping as necessary. arranges its child items side by side, wrapping as necessary.
\endlist \endlist
@@ -222,28 +214,23 @@
\section2 Using Layouts \section2 Using Layouts
From Qt 5.1, you can use QML types in the From Qt 5.1, you can use QML types in the \l{qtquicklayouts-index.html}
\l{http://qt-project.org/doc/qt-5.1/qtquicklayouts/qtquicklayouts-index.html} {Qt Quick Layouts} module to arrange Qt Quick items on screens. Unlike
{Qt Quick Layouts module} to arrange Qt Quick items on screens. Unlike p positioners, they manage both the positions and sizes of items in a
ositioners, they manage both the positions and sizes of items in a
declarative interface. They are well suited for resizable user interfaces. declarative interface. They are well suited for resizable user interfaces.
You can use the following layout types to arrange items on screens: You can use the following layout types to arrange items on screens:
\list \list
\li \l{http://qt-project.org/doc/qt-5.0/qml-qtquick-layouts-layout.html} \li \l{Layout} provides attached properties for items pushed onto a
{Layout} provides attached properties for items pushed onto a
\gui {Column Layout}, \gui {Row Layout}, or \gui {Grid Layout}. \gui {Column Layout}, \gui {Row Layout}, or \gui {Grid Layout}.
\li \l{http://qt-project.org/doc/qt-5.0/qml-qtquick-layouts-columnlayout.html} \li ColumnLayout provides a grid layout with only one column.
{Column Layout} provides a grid layout with only one column.
\li \l{http://qt-project.org/doc/qt-5.0/qml-qtquick-layouts-rowlayout.html} \li RowLayout provides a grid layout with only one row.
{Row Layout} provides a grid layout with only one row.
\li \l{http://qt-project.org/doc/qt-5.0/qml-qtquick-layouts-gridlayout.html} \li GridLayout provides a way of dynamically arranging items in a
{Grid Layout} provides a way of dynamically arranging items in a
grid. grid.
\endlist \endlist
@@ -259,9 +246,8 @@
\section2 Using Split Views \section2 Using Split Views
From Qt 5.1, you can use the From Qt 5.1, you can use the SplitView Qt Quick Control to arrange items
\l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-splitview.html} horizontally or vertically
{Split View} Qt Quick Control to arrange items horizontally or vertically
with a draggable splitter between each item. with a draggable splitter between each item.
@@ -344,16 +330,14 @@
use different types of animated transitions. For example, you can animate use different types of animated transitions. For example, you can animate
changes to property values and colors. You can use rotation animation to changes to property values and colors. You can use rotation animation to
control the direction of rotation. For more information, see control the direction of rotation. For more information, see
\l{http://qt-project.org/doc/qt-5.0/qtquick/qtquick-statesanimations-animations.html} \l{Animation and Transitions in Qt Quick}.
{Animation and Transitions in Qt Quick}.
You can use the \c ParallelAnimation type to start several animations at You can use the \c ParallelAnimation type to start several animations at
the same time. Or use the \c SequentialAnimation type to run them one the same time. Or use the \c SequentialAnimation type to run them one
after another. after another.
You can use the code editor to specify transitions. For more information, You can use the code editor to specify transitions. For more information,
see \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-transition.html} see \l{Transition}.
{Transition}.
\section1 Adding User Interaction Methods \section1 Adding User Interaction Methods
@@ -362,85 +346,70 @@
\list \list
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-flickable.html}{Flickable} \li \l{Flickable}
items can be flicked horizontally or vertically. items can be flicked horizontally or vertically.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-flipable.html}{Flipable} \li \l{Flipable}
items can be flipped between their front and back sides by using items can be flipped between their front and back sides by using
rotation, state, and transition. rotation, state, and transition.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-focusscope.html}{Focus Scope} \li FocusScope
assists in keyboard focus handling when building reusable QML assists in keyboard focus handling when building reusable QML
components. components.
\li \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-mousearea.html}{Mouse Area} \li MouseArea enables simple mouse handling.
enables simple mouse handling.
\endlist \endlist
From Qt 5.1, you can also use the following From Qt 5.1, you can also use the following
\l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qtquickcontrols-index.html} \l{Qt Quick Controls} to present or receive input from the user:
{Qt Quick Controls} to present or receive input from the user:
\list \list
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-button.html} \li \l{Button} provides a push button that you can associate with an
{Button} provides a push button that you can associate with an
action. action.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-checkbox.html} \li CheckBox provides an option button that can be toggled on
{Check Box} provides an option button that can be toggled on
(checked) or off (unchecked). (checked) or off (unchecked).
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-combobox.html} \li ComboBox provides a drop-down list. Add items to the combo box by
{Combo Box} provides a drop-down list. Add items to the combo box by
assigning it a ListModel, or a list of strings to the model assigning it a ListModel, or a list of strings to the model
property. property.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-groupbox.html} \li GroupBox provides a frame, a title on top, and place for various
{Group Box} provides a frame, a title on top, and place for various
other controls inside the frame. other controls inside the frame.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-label.html} \li \l{Label} provides a text label that follows the font and color scheme
{Label} provides a text label that follows the font and color scheme
of the system. of the system.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-progressbar.html} \li ProgressBar indicates the progress of an operation.
{Progress Bar} indicates the progress of an operation.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-radiobutton.html} \li RadioButton provides an option button that can be switched on
{Radio Button} provides an option button that can be switched on
(checked) or off (unchecked). (checked) or off (unchecked).
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-slider.html} \li \l{Slider}
{Slider (Horizontal) and Slider (Vertical)} enable the user to move {Slider (Horizontal) and Slider (Vertical)} enable the user to move
a slider handle along a horizontal or vertical groove and translate a slider handle along a horizontal or vertical groove and translate
the handle's position into a value within the specified range. the handle's position into a value within the specified range.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-spinbox.html} \li SpinBox enables the user to specify a value by clicking the up or
{Spin Box} enables the user to specify a value by clicking the up or
down buttons, by pressing up or down on the keyboard, or by entering down buttons, by pressing up or down on the keyboard, or by entering
a value in the box. a value in the box.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-statusbar.html} \li StatusBar contains status information in your application. It
{Status Bar} contains status information in your application. It
does not provide a layout of its own, but requires you to position does not provide a layout of its own, but requires you to position
its contents, for instance by creating a \gui {Row Layout}. its contents, for instance by creating a \gui {Row Layout}.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-textarea.html} \li TextArea displays multiple lines of editable formatted text.
{Text Area} displays multiple lines of editable formatted text.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-textfield.html} \li TextField displays a single line of editable plain text.
{Text Field} displays a single line of editable plain text.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-toolbar.html} \li ToolBar provides styling for ToolButton as well as other controls
{Tool Bar} provides styling for ToolButton as well as other controls
that it can contain. However, it does not provide a layout of its that it can contain. However, it does not provide a layout of its
own, but requires you to position its contents, for instance by own, but requires you to position its contents, for instance by
creating a \gui {Row Layout}. creating a \gui {Row Layout}.
\li \l{http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-toolbutton.html} \li ToolButton provides a button that is functionally similar to
{Tool Button} provides a button that is functionally similar to
\gui Button, but that looks more suitable on a \gui {Tool Bar}. \gui Button, but that looks more suitable on a \gui {Tool Bar}.
\endlist \endlist
@@ -450,12 +419,9 @@
A user interface is only a part of an application, and not really useful by itself. A user interface is only a part of an application, and not really useful by itself.
You can use Qt or JavaScript to implement the application logic. For more information on You can use Qt or JavaScript to implement the application logic. For more information on
using JavaScript, see using JavaScript, see \l{Integrating QML and JavaScript}.
\l{http://qt-project.org/doc/qt-5.0/qtqml/qtqml-javascript-topic.html}
{Integrating QML and JavaScript}.
For an example of how to use JavaScript to develop a game, see the For an example of how to use JavaScript to develop a game, see the
\l{http://qt-project.org/doc/qt-5.0/qtquick/qtquick2-qml-advtutorial.html} \l{QML Advanced Tutorial}.
{QML Advanced Tutorial}.
*/ */

View File

@@ -48,8 +48,7 @@
\section1 Previewing Images \section1 Previewing Images
The Qt Quick Toolbar for images allows you to edit the properties of The Qt Quick Toolbar for images allows you to edit the properties of
\l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-borderimage.html}{Border Image} BorderImage and \l{Image} items.
and \l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-image.html}{Image} items.
You can scale and tile the images, replace them with other images, You can scale and tile the images, replace them with other images,
preview them, and change the image margins. preview them, and change the image margins.
@@ -63,7 +62,7 @@
\section1 Formatting Text \section1 Formatting Text
The Qt Quick Toolbar for text allows you to edit the properties of The Qt Quick Toolbar for text allows you to edit the properties of
\l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-text.html}{Text} items. \l{Text} items.
You can change the font family and size as well as text formatting, style, You can change the font family and size as well as text formatting, style,
alignment, and color. alignment, and color.
@@ -79,8 +78,7 @@
\section1 Previewing Animation \section1 Previewing Animation
The Qt Quick Toolbar for animation allows you to edit the properties of The Qt Quick Toolbar for animation allows you to edit the properties of
\l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-propertyanimation.html} PropertyAnimation items and the items that inherit it. You can
{PropertyAnimation} items and the items that inherit it. You can
change the easing curve type and duration. For some curves, you can also change the easing curve type and duration. For some curves, you can also
specify amplitude, period, and overshoot values. specify amplitude, period, and overshoot values.
@@ -91,8 +89,7 @@
\section1 Editing Rectangles \section1 Editing Rectangles
The Qt Quick Toolbar for rectangles allows you to edit the properties of The Qt Quick Toolbar for rectangles allows you to edit the properties of
\l{http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-rectangle.html}{Rectangle} \l{Rectangle} items. You can change the fill and border colors and add
items. You can change the fill and border colors and add
gradients. gradients.
\image qml-toolbar-rectangle.png "Qt Quick Toolbar for rectangles" \image qml-toolbar-rectangle.png "Qt Quick Toolbar for rectangles"

View File

@@ -31,8 +31,7 @@
\title Creating a Qt Widget Based Application \title Creating a Qt Widget Based Application
This tutorial describes how to use \QC to create a small Qt application, This tutorial describes how to use \QC to create a small Qt application,
Text Finder. It is a simplified version of the Qt UI Tools Text Finder. It is a simplified version of the Qt UI Tools \l{Text Finder
\l{http://qt-project.org/doc/qt-5.0/qtuitools/textfinder.html}{Text Finder
example}. The application user interface is constructed from Qt widgets by example}. The application user interface is constructed from Qt widgets by
using \QD. The application logic is written in C++ by using the code editor. using \QD. The application logic is written in C++ by using the code editor.
@@ -198,7 +197,7 @@
\endlist \endlist
For more information about designing forms with \QD, see the For more information about designing forms with \QD, see the
\l{http://qt-project.org/doc/qt-5.0/qtdesigner/qtdesigner-manual.html}{Qt Designer Manual}. \l{Qt Designer Manual}.
\section2 Completing the Header File \section2 Completing the Header File
@@ -232,8 +231,7 @@
\li Add code to load a text file using QFile, read it with QTextStream, \li Add code to load a text file using QFile, read it with QTextStream,
and then display it on \c{textEdit} with and then display it on \c{textEdit} with
\l{http://qt-project.org/doc/qt-5.0/qtwidgets/qtextedit.html#plainText-prop} \l{QTextEdit::setPlainText()}.
{setPlainText()}.
This is illustrated by the following code snippet: This is illustrated by the following code snippet:
\snippet textfinder/textfinder.cpp 0 \snippet textfinder/textfinder.cpp 0
@@ -244,9 +242,7 @@
\snippet textfinder/textfinder.cpp 1 \snippet textfinder/textfinder.cpp 1
\li For the \c{on_findButton_clicked()} slot, add code to extract the \li For the \c{on_findButton_clicked()} slot, add code to extract the
search string and use the search string and use the \l{QTextEdit::find()} function
\l{http://qt-project.org/doc/qt-5.0/qtwidgets/qtextedit.html#find}{find()}
function
to look for the search string within the text file. This is to look for the search string within the text file. This is
illustrated by the following code snippet: illustrated by the following code snippet:

View File

@@ -35,8 +35,7 @@
\image qtcreator-formedit.png \image qtcreator-formedit.png
For more information about \QD, see the For more information about \QD, see the \l{Qt Designer Manual}.
\l{http://qt-project.org/doc/qt-5.0/qtdesigner/qtdesigner-manual.html}{Qt Designer Manual}.
Generally, the integrated \QD contains the same functions as the standalone Generally, the integrated \QD contains the same functions as the standalone
\QD. The following sections describe the differences. \QD. The following sections describe the differences.
@@ -124,5 +123,5 @@
You can use Qt APIs to create plugins that extend Qt applications. This You can use Qt APIs to create plugins that extend Qt applications. This
enables you to add your own widgets to \QD. For more information, see enables you to add your own widgets to \QD. For more information, see
\l{Adding Qt Designer Plugins} \l{Adding Qt Designer Plugins}.
*/ */

View File

@@ -41,8 +41,7 @@
and to change the default plugin path, see \l{How to Create Qt Plugins}. and to change the default plugin path, see \l{How to Create Qt Plugins}.
For more information about how to create plugins for \QD, see For more information about how to create plugins for \QD, see
\l{http://qt-project.org/doc/qt-5.0/qtdesigner/designer-using-custom-widgets.html} \l{Using Custom Widgets with Qt Designer}.
{Using Custom Widgets with Qt Designer}.
\section1 Locating Qt Designer Plugins \section1 Locating Qt Designer Plugins
@@ -75,8 +74,7 @@
\QC uses its own set of Qt Libraries located in the bundle, and therefore, \QC uses its own set of Qt Libraries located in the bundle, and therefore,
you need to configure the \QD plugins that you want to use with \QC. you need to configure the \QD plugins that you want to use with \QC.
Fore more information about how to deploy applications to Mac OS, see Fore more information about how to deploy applications to Mac OS, see
\l{http://qt-project.org/doc/qt-5.0/qtdoc/deployment-mac.html} \l{Deploying an Application on Mac OS X}.
{Deploying an Application on Mac OS X}.
The following example illustrates how to configure version 5.2.1 of the The following example illustrates how to configure version 5.2.1 of the
\l{http://qwt.sourceforge.net/}{Qwt - Qt Widgets for Technical Applications} \l{http://qwt.sourceforge.net/}{Qwt - Qt Widgets for Technical Applications}

View File

@@ -679,16 +679,17 @@ def qdump__std__vector(d, value):
impl = value["_M_impl"] impl = value["_M_impl"]
type = d.templateArgument(value.type, 0) type = d.templateArgument(value.type, 0)
alloc = impl["_M_end_of_storage"] alloc = impl["_M_end_of_storage"]
isBool = str(type) == 'bool' # The allocator case below is bogus, but that's what Apple
# LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
# produces.
isBool = str(type) == 'bool' or str(type) == 'std::allocator<bool>'
if isBool: if isBool:
start = impl["_M_start"]["_M_p"] start = impl["_M_start"]["_M_p"]
finish = impl["_M_finish"]["_M_p"] finish = impl["_M_finish"]["_M_p"]
# FIXME: 8 is CHAR_BIT # FIXME: 8 is CHAR_BIT
storage = d.lookupType("unsigned long") size = (int(finish) - int(start)) * 8
storagesize = storage.sizeof * 8 size += int(impl["_M_finish"]["_M_offset"])
size = (finish - start) * storagesize size -= int(impl["_M_start"]["_M_offset"])
size += impl["_M_finish"]["_M_offset"]
size -= impl["_M_start"]["_M_offset"]
else: else:
start = impl["_M_start"] start = impl["_M_start"]
finish = impl["_M_finish"] finish = impl["_M_finish"]
@@ -707,7 +708,8 @@ def qdump__std__vector(d, value):
with Children(d, size, maxNumChild=10000, childType=type): with Children(d, size, maxNumChild=10000, childType=type):
for i in d.childRange(): for i in d.childRange():
q = start + int(i / storagesize) q = start + int(i / storagesize)
d.putBoolItem(str(i), (q.dereference() >> (i % storagesize)) & 1) d.putBoolItem(str(i),
(int(q.dereference()) >> (i % storagesize)) & 1)
else: else:
d.putArrayData(type, start, size) d.putArrayData(type, start, size)

View File

@@ -64,6 +64,8 @@ Column {
id: colorEditor id: colorEditor
onColorChanged: { onColorChanged: {
if (!gradientLine.isCompleted)
return;
textField.text = gradientLine.colorToString(color); textField.text = gradientLine.colorToString(color);
if (supportGradient && gradientLine.visible) if (supportGradient && gradientLine.visible)
@@ -75,6 +77,7 @@ Column {
} }
GradientLine { GradientLine {
property bool isCompleted: false
visible: buttonRow.checkedIndex === 1 visible: buttonRow.checkedIndex === 1
id: gradientLine id: gradientLine
@@ -86,6 +89,7 @@ Column {
} }
onHasGradientChanged: { onHasGradientChanged: {
print("hasGradient")
if (!supportGradient) if (!supportGradient)
return return
@@ -95,6 +99,11 @@ Column {
buttonRow.initalChecked = 0 buttonRow.initalChecked = 0
buttonRow.checkedIndex = buttonRow.initalChecked buttonRow.checkedIndex = buttonRow.initalChecked
} }
Component.onCompleted: {
colorEditor.color = gradientLine.currentColor
isCompleted= true
}
} }
SectionLayout { SectionLayout {

View File

@@ -28,12 +28,17 @@
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.2
import QtQuick.Controls 1.1 as Controls import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
Controls.TextField { Controls.TextField {
Controls.Action {
//Workaround to avoid that "Delete" deletes the item.
shortcut: "Delete"
}
id: lineEdit id: lineEdit
property variant backendValue property variant backendValue
property color borderColor: "#222" property color borderColor: "#222"
@@ -57,7 +62,7 @@ Controls.TextField {
} }
} }
onAccepted: { onEditingFinished: {
if (backendValue.value !== text) if (backendValue.value !== text)
backendValue.value = text; backendValue.value = text;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,7 @@ import widgets 1.0
Rectangle { Rectangle {
id: rectangle1 id: rectangle1
width: parent.width width: parent.width
height: 600 height: Math.max(sessions.height, recentProjects.height)
Item { Item {
id: canvas id: canvas
@@ -45,21 +45,9 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 0 anchors.topMargin: 0
Rectangle {
width: 1
height: Math.max(Math.min(recentProjects.contentHeight + 120, recentProjects.height), sessions.height)
color: "#c4c4c4"
anchors.left: sessions.right
anchors.leftMargin: -1
anchors.top: sessions.top
visible: !sessions.scrollBarVisible
id: sessionLine
}
RecentProjects { RecentProjects {
x: 428 x: 428
height: 432
id: recentProjects id: recentProjects
anchors.leftMargin: 12 anchors.leftMargin: 12
@@ -67,25 +55,12 @@ Rectangle {
anchors.top: recentProjectsTitle.bottom anchors.top: recentProjectsTitle.bottom
anchors.topMargin: 20 anchors.topMargin: 20
anchors.bottom: parent.bottom
anchors.bottomMargin: 40
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 60 anchors.rightMargin: 60
model: projectList model: projectList
} }
Rectangle {
id: line
width: 1
height: sessionLine.height
color: "#c4c4c4"
anchors.left: recentProjects.right
anchors.leftMargin: -1
anchors.top: recentProjects.top
visible: !recentProjects.scrollBarVisible
}
NativeText { NativeText {
id: sessionsTitle id: sessionsTitle

View File

@@ -30,10 +30,10 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
ScrollView { Rectangle {
id: projectList id: projectList
height: column.height + 200
property bool scrollBarVisible: false//projectList.verticalScrollBar.visible
property alias model: repeater.model property alias model: repeater.model
// Behavior on verticalScrollBar.opacity { // Behavior on verticalScrollBar.opacity {
// PropertyAnimation { // PropertyAnimation {

View File

@@ -34,7 +34,7 @@ Item {
id: root id: root
property var model property var model
property int topMargin: 6 property int topMargin: 6
height: Math.min(content.contentHeight + topMargin, parent.height - 260) height: content.contentHeight + 200
ListView { ListView {
id: content id: content

View File

@@ -803,6 +803,17 @@ static inline int classify8(const char *s, LanguageFeatures features)
} }
} }
} }
else if (s[3] == 'h') {
if (s[4] == 'r') {
if (s[5] == 'e') {
if (s[6] == 'a') {
if (s[7] == 'd') {
return T___THREAD;
}
}
}
}
}
} }
} }
} }
@@ -1443,6 +1454,31 @@ static inline int classify12(const char *s, LanguageFeatures features)
} }
} }
} }
else if (features.cxx11Enabled && s[0] == 't') {
if (s[1] == 'h') {
if (s[2] == 'r') {
if (s[3] == 'e') {
if (s[4] == 'a') {
if (s[5] == 'd') {
if (s[6] == '_') {
if (s[7] == 'l') {
if (s[8] == 'o') {
if (s[9] == 'c') {
if (s[10] == 'a') {
if (s[11] == 'l') {
return T_THREAD_LOCAL;
}
}
}
}
}
}
}
}
}
}
}
}
return T_IDENTIFIER; return T_IDENTIFIER;
} }

View File

@@ -3725,7 +3725,10 @@ bool Parser::lookAtStorageClassSpecifier() const
case T_EXTERN: case T_EXTERN:
case T_MUTABLE: case T_MUTABLE:
case T_TYPEDEF: case T_TYPEDEF:
case T___THREAD:
return true; return true;
case T_THREAD_LOCAL:
return _languageFeatures.cxx11Enabled;
case T_CONSTEXPR: case T_CONSTEXPR:
if (_languageFeatures.cxx11Enabled) if (_languageFeatures.cxx11Enabled)
return true; return true;

View File

@@ -57,13 +57,13 @@ const char *token_names[] = {
("nullptr"), ("operator"), ("private"), ("nullptr"), ("operator"), ("private"),
("protected"), ("public"), ("register"), ("reinterpret_cast"), ("protected"), ("public"), ("register"), ("reinterpret_cast"),
("return"), ("short"), ("signed"), ("sizeof"), ("static"),("static_assert"), ("return"), ("short"), ("signed"), ("sizeof"), ("static"),("static_assert"),
("static_cast"), ("struct"), ("switch"), ("template"), ("this"), ("static_cast"), ("struct"), ("switch"), ("template"), ("this"), ("thread_local"),
("throw"), ("true"), ("try"), ("typedef"), ("typeid"), ("typename"), ("throw"), ("true"), ("try"), ("typedef"), ("typeid"), ("typename"),
("union"), ("unsigned"), ("using"), ("virtual"), ("void"), ("union"), ("unsigned"), ("using"), ("virtual"), ("void"),
("volatile"), ("wchar_t"), ("while"), ("volatile"), ("wchar_t"), ("while"),
// gnu // gnu
("__attribute__"), ("__typeof__"), ("__attribute__"), ("__thread"), ("__typeof__"),
// objc @keywords // objc @keywords
("@catch"), ("@class"), ("@compatibility_alias"), ("@defs"), ("@dynamic"), ("@catch"), ("@class"), ("@compatibility_alias"), ("@defs"), ("@dynamic"),

View File

@@ -173,6 +173,7 @@ enum Kind {
T_SWITCH, T_SWITCH,
T_TEMPLATE, T_TEMPLATE,
T_THIS, T_THIS,
T_THREAD_LOCAL,
T_THROW, T_THROW,
T_TRUE, T_TRUE,
T_TRY, T_TRY,
@@ -189,6 +190,7 @@ enum Kind {
T_WHILE, T_WHILE,
T___ATTRIBUTE__, T___ATTRIBUTE__,
T___THREAD,
T___TYPEOF__, T___TYPEOF__,
// obj c++ @ keywords // obj c++ @ keywords

View File

@@ -436,7 +436,7 @@ void TypePrettyPrinter::visit(Function *type)
if (_overview->showDefaultArguments) { if (_overview->showDefaultArguments) {
if (const StringLiteral *initializer = arg->initializer()) { if (const StringLiteral *initializer = arg->initializer()) {
_text += QLatin1String(" ="); _text += QLatin1String(" = ");
_text += QString::fromUtf8(initializer->chars(), initializer->size()); _text += QString::fromUtf8(initializer->chars(), initializer->size());
} }
} }

View File

@@ -654,7 +654,7 @@ int matchStrength(const QString &searchStr, const QString &str)
{ {
QString::const_iterator i = searchStr.constBegin(), iEnd = searchStr.constEnd(), QString::const_iterator i = searchStr.constBegin(), iEnd = searchStr.constEnd(),
j = str.constBegin(), jEnd = str.constEnd(); j = str.constBegin(), jEnd = str.constEnd();
bool lastWasNotUpper=true, lastWasSpacer=true, lastWasMatch = false; bool lastWasNotUpper=true, lastWasSpacer=true, lastWasMatch = false, didJump = false;
int res = 0; int res = 0;
while (i != iEnd && j != jEnd) { while (i != iEnd && j != jEnd) {
bool thisIsUpper = (*j).isUpper(); bool thisIsUpper = (*j).isUpper();
@@ -667,6 +667,7 @@ int matchStrength(const QString &searchStr, const QString &str)
lastWasMatch = true; lastWasMatch = true;
++i; ++i;
} else { } else {
didJump = true;
lastWasMatch = false; lastWasMatch = false;
} }
++j; ++j;
@@ -674,9 +675,11 @@ int matchStrength(const QString &searchStr, const QString &str)
lastWasSpacer = !thisIsLetterOrNumber; lastWasSpacer = !thisIsLetterOrNumber;
} }
if (i != iEnd) if (i != iEnd)
return iEnd - i; return i - iEnd;
if (j == jEnd) if (j == jEnd)
++res; ++res;
if (!didJump)
res+=2;
return res; return res;
} }

View File

@@ -314,7 +314,7 @@ int ImportKey::compare(const ImportKey &other) const
QString v2 = other.splitPath.at(i); QString v2 = other.splitPath.at(i);
if (v1 < v2) if (v1 < v2)
return -1; return -1;
if (v2 > v1) if (v1 > v2)
return 1; return 1;
} }
if (len1 < len2) if (len1 < len2)
@@ -626,7 +626,7 @@ void ImportDependencies::iterateOnCandidateImports(
break; break;
default: default:
{ {
QStringList imp = m_importCache.value(key.flatKey()); const QStringList imp = m_importCache.value(key.flatKey());
foreach (const QString &cImportName, imp) { foreach (const QString &cImportName, imp) {
CoreImport cImport = coreImport(cImportName); CoreImport cImport = coreImport(cImportName);
if (vContext.languageIsCompatible(cImport.language)) { if (vContext.languageIsCompatible(cImport.language)) {
@@ -928,4 +928,38 @@ QSet<ImportKey> ImportDependencies::subdirImports(
return res; return res;
} }
void ImportDependencies::checkConsistency() const
{
QMapIterator<ImportKey, QStringList> j(m_importCache);
while (j.hasNext()) {
j.next();
foreach (const QString &s, j.value()) {
bool found = false;
foreach (const Export &e, m_coreImports.value(s).possibleExports)
if (e.exportName == j.key())
found = true;
Q_ASSERT(found);
}
}
QMapIterator<QString,CoreImport> i(m_coreImports);
while (i.hasNext()) {
i.next();
foreach (const Export &e, i.value().possibleExports) {
if (!m_importCache.value(e.exportName).contains(i.key())) {
qDebug() << e.exportName.toString();
qDebug() << i.key();
QMapIterator<ImportKey, QStringList> j(m_importCache);
while (j.hasNext()) {
j.next();
qDebug() << j.key().toString() << j.value();
}
qDebug() << m_importCache.contains(e.exportName);
qDebug() << m_importCache.value(e.exportName);
}
Q_ASSERT(m_importCache.value(e.exportName).contains(i.key()));
}
}
}
} // namespace QmlJS } // namespace QmlJS

View File

@@ -223,6 +223,7 @@ public:
QSet<ImportKey> libraryImports(const ViewerContext &viewContext) const; QSet<ImportKey> libraryImports(const ViewerContext &viewContext) const;
QSet<ImportKey> subdirImports(const ImportKey &baseKey, const ViewerContext &viewContext) const; QSet<ImportKey> subdirImports(const ImportKey &baseKey, const ViewerContext &viewContext) const;
void checkConsistency() const;
private: private:
void removeImportCacheEntry(const ImportKey &importKey, const QString &importId); void removeImportCacheEntry(const ImportKey &importKey, const QString &importId);

View File

@@ -210,14 +210,14 @@ StaticAnalysisMessages::StaticAnalysisMessages()
tr("%1 elements expected in array value."), 1); tr("%1 elements expected in array value."), 1);
newMsg(WarnImperativeCodeNotEditableInVisualDesigner, Error, newMsg(WarnImperativeCodeNotEditableInVisualDesigner, Error,
tr("Imperative code is not supported in the Qt Quick Designer.")); tr("Imperative code is not supported in the Qt Quick Designer."));
newMsg(WarnUnsupportedTypeInVisualDesigner, Error, newMsg(WarnUnsupportedTypeInVisualDesigner, Warning,
tr("This type is not supported in the Qt Quick Designer.")); tr("This type is not supported in the Qt Quick Designer."));
newMsg(WarnReferenceToParentItemNotSupportedByVisualDesigner, Error, newMsg(WarnReferenceToParentItemNotSupportedByVisualDesigner, Error,
tr("Reference to parent item cannot be resolved correctly by the Qt Quick Designer.")); tr("Reference to parent item cannot be resolved correctly by the Qt Quick Designer."));
newMsg(WarnUndefinedValueForVisualDesigner, Error, newMsg(WarnUndefinedValueForVisualDesigner, Warning,
tr("This visual property binding cannot be evaluated in the local context " tr("This visual property binding cannot be evaluated in the local context "
"and might not show up in Qt Quick Designer as expected.")); "and might not show up in Qt Quick Designer as expected."));
newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Error, newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Warning,
tr("Qt Quick Designer only supports states in the root item.")); tr("Qt Quick Designer only supports states in the root item."));
newMsg(WarnAboutQtQuick1InsteadQtQuick2, Warning, newMsg(WarnAboutQtQuick1InsteadQtQuick2, Warning,
tr("Using Qt Quick 1 code model instead of Qt Quick 2.")); tr("Using Qt Quick 1 code model instead of Qt Quick 2."));

View File

@@ -99,7 +99,8 @@ AndroidManifestEditorWidget::AndroidManifestEditorWidget(QWidget *parent, TextEd
: TextEditor::PlainTextEditorWidget(parent), : TextEditor::PlainTextEditorWidget(parent),
m_dirty(false), m_dirty(false),
m_stayClean(false), m_stayClean(false),
m_setAppName(false) m_setAppName(false),
m_appNameInStringsXml(false)
{ {
QSharedPointer<AndroidManifestDocument> doc(new AndroidManifestDocument(this)); QSharedPointer<AndroidManifestDocument> doc(new AndroidManifestDocument(this));
doc->setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE)); doc->setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
@@ -586,7 +587,7 @@ void AndroidManifestEditorWidget::preSave()
if (activePage() != Source) if (activePage() != Source)
syncToEditor(); syncToEditor();
if (m_setAppName) { if (m_setAppName && m_appNameInStringsXml) {
QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->filePath()).absolutePath(); QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->filePath()).absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml"); QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QFile f(fileName); QFile f(fileName);
@@ -773,6 +774,8 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->filePath()).absolutePath(); QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->filePath()).absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml"); QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QDomElement applicationElement = manifest.firstChildElement(QLatin1String("application"));
QFile f(fileName); QFile f(fileName);
if (f.exists() && f.open(QIODevice::ReadOnly)) { if (f.exists() && f.open(QIODevice::ReadOnly)) {
QDomDocument doc; QDomDocument doc;
@@ -786,9 +789,13 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
metadataElem = metadataElem.nextSiblingElement(QLatin1String("string")); metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
} }
} }
m_appNameInStringsXml = true;
} else {
m_appNameLineEdit->setText(applicationElement.attribute(QLatin1String("android:label")));
m_appNameInStringsXml = false;
} }
QDomElement metadataElem = manifest.firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).firstChildElement(QLatin1String("meta-data")); QDomElement metadataElem = applicationElement.firstChildElement(QLatin1String("activity")).firstChildElement(QLatin1String("meta-data"));
while (!metadataElem.isNull()) { while (!metadataElem.isNull()) {
if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.lib_name")) { if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.lib_name")) {
m_targetLineEdit->setEditText(metadataElem.attribute(QLatin1String("android:value"))); m_targetLineEdit->setEditText(metadataElem.attribute(QLatin1String("android:value")));
@@ -893,6 +900,11 @@ void AndroidManifestEditorWidget::syncToEditor()
manifest.setAttribute(QLatin1String("android:versionCode"), m_versionCode->value()); manifest.setAttribute(QLatin1String("android:versionCode"), m_versionCode->value());
manifest.setAttribute(QLatin1String("android:versionName"), m_versionNameLinedit->text()); manifest.setAttribute(QLatin1String("android:versionName"), m_versionNameLinedit->text());
if (!m_appNameInStringsXml) {
QDomElement application = manifest.firstChildElement(QLatin1String("application"));
application.setAttribute(QLatin1String("android:label"), m_appNameLineEdit->text());
}
setUsesSdk(doc, manifest, extractVersion(m_androidMinSdkVersion->currentText()), setUsesSdk(doc, manifest, extractVersion(m_androidMinSdkVersion->currentText()),
extractVersion(m_androidTargetSdkVersion->currentText())); extractVersion(m_androidTargetSdkVersion->currentText()));

View File

@@ -138,6 +138,7 @@ private:
bool m_dirty; // indicates that we need to call syncToEditor() bool m_dirty; // indicates that we need to call syncToEditor()
bool m_stayClean; bool m_stayClean;
bool m_setAppName; bool m_setAppName;
bool m_appNameInStringsXml;
int m_errorLine; int m_errorLine;
int m_errorColumn; int m_errorColumn;

View File

@@ -126,11 +126,11 @@ void BinEditorWidget::init()
2*m_addressBytes + (m_addressBytes - 1) / 2; 2*m_addressBytes + (m_addressBytes - 1) / 2;
m_addressString = QString(addressStringWidth, QLatin1Char(':')); m_addressString = QString(addressStringWidth, QLatin1Char(':'));
QFontMetrics fm(fontMetrics()); QFontMetrics fm(fontMetrics());
m_margin = 4;
m_descent = fm.descent(); m_descent = fm.descent();
m_ascent = fm.ascent(); m_ascent = fm.ascent();
m_lineHeight = fm.lineSpacing(); m_lineHeight = fm.lineSpacing();
m_charWidth = fm.width(QChar(QLatin1Char('M'))); m_charWidth = fm.width(QChar(QLatin1Char('M')));
m_margin = m_charWidth;
m_columnWidth = 2 * m_charWidth + fm.width(QChar(QLatin1Char(' '))); m_columnWidth = 2 * m_charWidth + fm.width(QChar(QLatin1Char(' ')));
m_numLines = m_size / m_bytesPerLine + 1; m_numLines = m_size / m_bytesPerLine + 1;
m_numVisibleLines = viewport()->height() / m_lineHeight; m_numVisibleLines = viewport()->height() / m_lineHeight;
@@ -638,7 +638,7 @@ int BinEditorWidget::find(const QByteArray &pattern_arg, int from,
if (pos >= 0) { if (pos >= 0) {
setCursorPosition(pos); setCursorPosition(pos);
setCursorPosition(pos + (found == pos ? pattern.size() : hexPattern.size()), KeepAnchor); setCursorPosition(pos + (found == pos ? pattern.size() : hexPattern.size()) - 1, KeepAnchor);
} }
return pos; return pos;
} }
@@ -713,7 +713,7 @@ void BinEditorWidget::paintEvent(QPaintEvent *e)
QPainter painter(viewport()); QPainter painter(viewport());
const int topLine = verticalScrollBar()->value(); const int topLine = verticalScrollBar()->value();
const int xoffset = horizontalScrollBar()->value(); const int xoffset = horizontalScrollBar()->value();
const int x1 = -xoffset + m_margin + m_labelWidth - m_charWidth/2; const int x1 = -xoffset + m_margin + m_labelWidth - m_charWidth/2 - 1;
const int x2 = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth/2; const int x2 = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth/2;
painter.drawLine(x1, 0, x1, viewport()->height()); painter.drawLine(x1, 0, x1, viewport()->height());
painter.drawLine(x2, 0, x2, viewport()->height()); painter.drawLine(x2, 0, x2, viewport()->height());
@@ -836,7 +836,7 @@ void BinEditorWidget::paintEvent(QPaintEvent *e)
color = QColor(0xffef0b); color = QColor(0xffef0b);
if (color.isValid()) { if (color.isValid()) {
painter.fillRect(item_x, y-m_ascent, m_columnWidth, m_lineHeight, color); painter.fillRect(item_x - m_charWidth/2, y-m_ascent, m_columnWidth, m_lineHeight, color);
int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth
+ fm.width(printable.left(c)); + fm.width(printable.left(c));
painter.fillRect(printable_item_x, y-m_ascent, painter.fillRect(printable_item_x, y-m_ascent,
@@ -844,8 +844,8 @@ void BinEditorWidget::paintEvent(QPaintEvent *e)
m_lineHeight, color); m_lineHeight, color);
} }
if (selStart < selEnd && !isFullySelected && pos >= selStart && pos < selEnd) { if (!isFullySelected && pos >= selStart && pos <= selEnd) {
selectionRect |= QRect(item_x, y-m_ascent, m_columnWidth, m_lineHeight); selectionRect |= QRect(item_x - m_charWidth/2, y-m_ascent, m_columnWidth, m_lineHeight);
int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth
+ fm.width(printable.left(c)); + fm.width(printable.left(c));
printableSelectionRect |= QRect(printable_item_x, y-m_ascent, printableSelectionRect |= QRect(printable_item_x, y-m_ascent,
@@ -856,11 +856,10 @@ void BinEditorWidget::paintEvent(QPaintEvent *e)
} }
int x = -xoffset + m_margin + m_labelWidth; int x = -xoffset + m_margin + m_labelWidth;
bool cursorWanted = m_cursorPosition == m_anchorPosition;
if (isFullySelected) { if (isFullySelected) {
painter.save(); painter.save();
painter.fillRect(x, y-m_ascent, m_bytesPerLine*m_columnWidth, m_lineHeight, palette().highlight()); painter.fillRect(x - m_charWidth/2, y-m_ascent, m_bytesPerLine*m_columnWidth, m_lineHeight, palette().highlight());
painter.setPen(palette().highlightedText().color()); painter.setPen(palette().highlightedText().color());
drawItems(&painter, x, y, itemString); drawItems(&painter, x, y, itemString);
painter.restore(); painter.restore();
@@ -878,8 +877,7 @@ void BinEditorWidget::paintEvent(QPaintEvent *e)
} }
} }
if (cursor >= 0) {
if (cursor >= 0 && cursorWanted) {
int w = fm.boundingRect(itemString.mid(cursor*3, 2)).width(); int w = fm.boundingRect(itemString.mid(cursor*3, 2)).width();
QRect cursorRect(x + cursor * m_columnWidth, y - m_ascent, w + 1, m_lineHeight); QRect cursorRect(x + cursor * m_columnWidth, y - m_ascent, w + 1, m_lineHeight);
painter.save(); painter.save();
@@ -919,7 +917,7 @@ void BinEditorWidget::paintEvent(QPaintEvent *e)
} }
} }
if (cursor >= 0 && !printable.isEmpty() && cursorWanted) { if (cursor >= 0 && !printable.isEmpty()) {
QRect cursorRect(text_x + fm.width(printable.left(cursor)), QRect cursorRect(text_x + fm.width(printable.left(cursor)),
y-m_ascent, y-m_ascent,
fm.width(printable.at(cursor)), fm.width(printable.at(cursor)),
@@ -950,18 +948,14 @@ void BinEditorWidget::setCursorPosition(int pos, MoveMode moveMode)
pos = qMin(m_size-1, qMax(0, pos)); pos = qMin(m_size-1, qMax(0, pos));
int oldCursorPosition = m_cursorPosition; int oldCursorPosition = m_cursorPosition;
bool hadSelection = hasSelection();
m_lowNibble = false; m_lowNibble = false;
if (!hadSelection)
updateLines();
m_cursorPosition = pos; m_cursorPosition = pos;
if (moveMode == MoveAnchor) { if (moveMode == MoveAnchor) {
if (hadSelection) updateLines(m_anchorPosition, oldCursorPosition);
updateLines(m_anchorPosition, oldCursorPosition);
m_anchorPosition = m_cursorPosition; m_anchorPosition = m_cursorPosition;
} }
updateLines(hadSelection || hasSelection() ? oldCursorPosition : m_cursorPosition, m_cursorPosition); updateLines(oldCursorPosition, m_cursorPosition);
ensureCursorVisible(); ensureCursorVisible();
emit cursorPositionChanged(m_cursorPosition); emit cursorPositionChanged(m_cursorPosition);
} }
@@ -1087,20 +1081,14 @@ bool BinEditorWidget::event(QEvent *e)
QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const
{ {
// Selection if mouse is in, else 1 byte at cursor
int selStart = selectionStart(); int selStart = selectionStart();
int selEnd = selectionEnd(); int selEnd = selectionEnd();
int byteCount = selEnd - selStart; int byteCount = selEnd - selStart + 1;
if (byteCount < 1) {
selStart = posAt(helpEvent->pos());
selEnd = selStart + 1;
byteCount = 1;
}
if (m_hexCursor == 0 || byteCount > 8) if (m_hexCursor == 0 || byteCount > 8)
return QString(); return QString();
const QPoint &startPoint = offsetToPos(selStart); const QPoint &startPoint = offsetToPos(selStart);
const QPoint &endPoint = offsetToPos(selEnd); const QPoint &endPoint = offsetToPos(selEnd + 1);
QRect selRect(startPoint, endPoint); QRect selRect(startPoint, endPoint);
selRect.setHeight(m_lineHeight); selRect.setHeight(m_lineHeight);
if (!selRect.contains(helpEvent->pos())) if (!selRect.contains(helpEvent->pos()))
@@ -1385,10 +1373,7 @@ void BinEditorWidget::copy(bool raw)
{ {
int selStart = selectionStart(); int selStart = selectionStart();
int selEnd = selectionEnd(); int selEnd = selectionEnd();
if (selStart > selEnd) const int selectionLength = selEnd - selStart + 1;
qSwap(selStart, selEnd);
const int selectionLength = selEnd - selStart;
if (selectionLength >> 22) { if (selectionLength >> 22) {
QMessageBox::warning(this, tr("Copying Failed"), QMessageBox::warning(this, tr("Copying Failed"),
tr("You cannot copy more than 4 MB of binary data.")); tr("You cannot copy more than 4 MB of binary data."));
@@ -1496,7 +1481,7 @@ void BinEditorWidget::redo()
void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event) void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event)
{ {
const int selStart = selectionStart(); const int selStart = selectionStart();
const int byteCount = selectionEnd() - selStart; const int byteCount = selectionEnd() - selStart + 1;
QPointer<QMenu> contextMenu(new QMenu(this)); QPointer<QMenu> contextMenu(new QMenu(this));

View File

@@ -108,7 +108,6 @@ public:
Core::IEditor *editor() const { return m_ieditor; } Core::IEditor *editor() const { return m_ieditor; }
void setEditor(Core::IEditor *ieditor) { m_ieditor = ieditor; } void setEditor(Core::IEditor *ieditor) { m_ieditor = ieditor; }
bool hasSelection() const { return m_cursorPosition != m_anchorPosition; }
int selectionStart() const { return qMin(m_anchorPosition, m_cursorPosition); } int selectionStart() const { return qMin(m_anchorPosition, m_cursorPosition); }
int selectionEnd() const { return qMax(m_anchorPosition, m_cursorPosition); } int selectionEnd() const { return qMax(m_anchorPosition, m_cursorPosition); }

View File

@@ -90,7 +90,7 @@ void MakeStep::ctor()
{ {
m_percentProgress = QRegExp(QLatin1String("^\\[\\s*(\\d*)%\\]")); m_percentProgress = QRegExp(QLatin1String("^\\[\\s*(\\d*)%\\]"));
m_ninjaProgress = QRegExp(QLatin1String("^\\[\\s*(\\d*)/\\s*(\\d*)")); m_ninjaProgress = QRegExp(QLatin1String("^\\[\\s*(\\d*)/\\s*(\\d*)"));
m_ninjaProgressString = QLatin1String("[%s/%t "); // ninja: [33/100 m_ninjaProgressString = QLatin1String("[%f/%t "); // ninja: [33/100
//: Default display name for the cmake make step. //: Default display name for the cmake make step.
setDefaultDisplayName(tr("Make")); setDefaultDisplayName(tr("Make"));

View File

@@ -306,6 +306,9 @@ MainWindow::~MainWindow()
m_helpManager = 0; m_helpManager = 0;
delete m_variableManager; delete m_variableManager;
m_variableManager = 0; m_variableManager = 0;
delete m_navigationWidget;
m_navigationWidget = 0;
} }
bool MainWindow::init(QString *errorMessage) bool MainWindow::init(QString *errorMessage)

View File

@@ -119,7 +119,7 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function
{ {
m_function = function; m_function = function;
if (!m_function || !m_baseExpressionAST || !m_expressionDocument || !m_document || !m_scope if (!m_function || !m_baseExpressionAST || !m_expressionDocument || !m_document || !m_scope
|| m_scope->isClass() || m_snapshot.isEmpty()) { || m_scope->isClass() || m_scope->isFunction() || m_snapshot.isEmpty()) {
return false; return false;
} }

View File

@@ -1314,6 +1314,14 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_data()
<< (OverrideItemList() << (OverrideItemList()
<< OverrideItem(QLatin1String("Base::virt"), 1) << OverrideItem(QLatin1String("Base::virt"), 1)
<< OverrideItem(QLatin1String("Derived::virt"), 2)); << OverrideItem(QLatin1String("Derived::virt"), 2));
QTest::newRow("QTCREATORBUG-10294_cursorIsAtTheEndOfVirtualFunctionName") << _(
"struct Base { virtual void virt() {} };\n"
"struct Derived : Base { void virt() {} };\n"
"void client(Base *b) { b->virt$@(); }\n")
<< (OverrideItemList()
<< OverrideItem(QLatin1String("Base::virt"), 1)
<< OverrideItem(QLatin1String("Derived::virt"), 2));
} }
void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall() void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall()

View File

@@ -38,7 +38,7 @@
namespace CppTools { namespace CppTools {
AbstractEditorSupport::AbstractEditorSupport(CppModelManagerInterface *modelmanager) : AbstractEditorSupport::AbstractEditorSupport(CppModelManagerInterface *modelmanager) :
m_modelmanager(modelmanager) m_modelmanager(modelmanager), m_revision(0)
{ {
} }
@@ -48,6 +48,7 @@ AbstractEditorSupport::~AbstractEditorSupport()
void AbstractEditorSupport::updateDocument() void AbstractEditorSupport::updateDocument()
{ {
++m_revision;
m_modelmanager->updateSourceFiles(QStringList(fileName())); m_modelmanager->updateSourceFiles(QStringList(fileName()));
} }

View File

@@ -50,6 +50,7 @@ public:
virtual QString fileName() const = 0; virtual QString fileName() const = 0;
void updateDocument(); void updateDocument();
unsigned revision() const { return m_revision; }
// TODO: find a better place for common utility functions // TODO: find a better place for common utility functions
static QString functionAt(const CppModelManagerInterface *mm, static QString functionAt(const CppModelManagerInterface *mm,
@@ -60,6 +61,7 @@ public:
private: private:
CppModelManagerInterface *m_modelmanager; CppModelManagerInterface *m_modelmanager;
unsigned m_revision;
}; };
} // namespace CppTools } // namespace CppTools

View File

@@ -550,7 +550,7 @@ CppModelManager::WorkingCopy CppModelManager::buildWorkingCopyList()
QSetIterator<AbstractEditorSupport *> it(m_extraEditorSupports); QSetIterator<AbstractEditorSupport *> it(m_extraEditorSupports);
while (it.hasNext()) { while (it.hasNext()) {
AbstractEditorSupport *es = it.next(); AbstractEditorSupport *es = it.next();
workingCopy.insert(es->fileName(), es->contents()); workingCopy.insert(es->fileName(), es->contents(), es->revision());
} }
// Add the project configuration file // Add the project configuration file

View File

@@ -365,6 +365,8 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp) :
this, SLOT(operateByInstructionTriggered(bool))); this, SLOT(operateByInstructionTriggered(bool)));
connect(debuggerCore()->action(VerboseLog), SIGNAL(triggered(bool)), connect(debuggerCore()->action(VerboseLog), SIGNAL(triggered(bool)),
this, SLOT(verboseLogTriggered(bool))); this, SLOT(verboseLogTriggered(bool)));
connect(debuggerCore()->action(CreateFullBacktrace), SIGNAL(triggered()),
this, SLOT(createFullBacktrace()));
setObjectName(QLatin1String("CdbEngine")); setObjectName(QLatin1String("CdbEngine"));
connect(&m_process, SIGNAL(finished(int)), this, SLOT(processFinished())); connect(&m_process, SIGNAL(finished(int)), this, SLOT(processFinished()));
connect(&m_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError())); connect(&m_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError()));
@@ -597,6 +599,16 @@ void CdbEngine::consoleStubExited()
{ {
} }
void CdbEngine::createFullBacktrace()
{
postBuiltinCommand("~*kp", 0, &CdbEngine::handleCreateFullBackTrace);
}
void CdbEngine::handleCreateFullBackTrace(const CdbEngine::CdbBuiltinCommandPtr &cmd)
{
debuggerCore()->openTextEditor(QLatin1String("Backtrace $"), QLatin1String(cmd->joinedReply()));
}
void CdbEngine::setupEngine() void CdbEngine::setupEngine()
{ {
if (debug) if (debug)
@@ -1101,6 +1113,7 @@ bool CdbEngine::hasCapability(unsigned cap) const
|BreakOnThrowAndCatchCapability // Sort-of: Can break on throw(). |BreakOnThrowAndCatchCapability // Sort-of: Can break on throw().
|BreakConditionCapability|TracePointCapability |BreakConditionCapability|TracePointCapability
|BreakModuleCapability |BreakModuleCapability
|CreateFullBacktraceCapability
|OperateByInstructionCapability |OperateByInstructionCapability
|RunToLineCapability |RunToLineCapability
|MemoryAddressCapability); |MemoryAddressCapability);

View File

@@ -156,6 +156,8 @@ private slots:
void consoleStubProcessStarted(); void consoleStubProcessStarted();
void consoleStubExited(); void consoleStubExited();
void createFullBacktrace();
void handleDoInterruptInferior(const QString &errorMessage); void handleDoInterruptInferior(const QString &errorMessage);
private: private:
@@ -227,6 +229,7 @@ private:
void ensureUsing32BitStackInWow64(const CdbBuiltinCommandPtr &cmd); void ensureUsing32BitStackInWow64(const CdbBuiltinCommandPtr &cmd);
void handleSwitchWow64Stack(const CdbBuiltinCommandPtr &cmd); void handleSwitchWow64Stack(const CdbBuiltinCommandPtr &cmd);
void jumpToAddress(quint64 address); void jumpToAddress(quint64 address);
void handleCreateFullBackTrace(const CdbBuiltinCommandPtr &cmd);
// Extension commands // Extension commands
void handleThreads(const CdbExtensionCommandPtr &); void handleThreads(const CdbExtensionCommandPtr &);

View File

@@ -174,7 +174,7 @@ void DebuggerKitConfigWidget::onDebuggerRemoved(const QVariant &id)
{ {
if (const int pos = indexOf(id)) { if (const int pos = indexOf(id)) {
m_comboBox->removeItem(pos); m_comboBox->removeItem(pos);
updateComboBox(id); refresh();
} }
} }

View File

@@ -59,6 +59,9 @@ namespace {
class MyTestDataDir : public Core::Internal::Tests::TestDataDir { class MyTestDataDir : public Core::Internal::Tests::TestDataDir {
public: public:
MyTestDataDir()
: TestDataDir(QString())
{}
MyTestDataDir(const QString &dir) MyTestDataDir(const QString &dir)
: TestDataDir(QLatin1String(SRCDIR "/../../../tests/designer/") + dir) : TestDataDir(QLatin1String(SRCDIR "/../../../tests/designer/") + dir)
{} {}
@@ -77,6 +80,96 @@ QString expectedContentsForFile(const QString &filePath)
return QString(); return QString();
} }
class DocumentContainsFunctionDefinition: protected SymbolVisitor
{
public:
bool operator()(Scope *scope, const QString function)
{
if (!scope)
return false;
m_referenceFunction = function;
m_result = false;
accept(scope);
return m_result;
}
protected:
bool preVisit(Symbol *) { return !m_result; }
bool visit(Function *symbol)
{
const QString function = m_overview.prettyName(symbol->name());
if (function == m_referenceFunction)
m_result = true;
return false;
}
private:
bool m_result;
QString m_referenceFunction;
Overview m_overview;
};
class DocumentContainsDeclaration: protected SymbolVisitor
{
public:
bool operator()(Scope *scope, const QString function)
{
if (!scope)
return false;
m_referenceFunction = function;
m_result = false;
accept(scope);
return m_result;
}
protected:
bool preVisit(Symbol *) { return !m_result; }
void postVisit(Symbol *symbol)
{
if (symbol->isClass())
m_currentClass.clear();
}
bool visit(Class *symbol)
{
m_currentClass = m_overview.prettyName(symbol->name());
return true;
}
bool visit(Declaration *symbol)
{
QString declaration = m_overview.prettyName(symbol->name());
if (!m_currentClass.isEmpty())
declaration = m_currentClass + QLatin1String("::") + declaration;
if (m_referenceFunction == declaration)
m_result = true;
return false;
}
private:
bool m_result;
QString m_referenceFunction;
QString m_currentClass;
Overview m_overview;
};
bool documentContainsFunctionDefinition(const Document::Ptr &document, const QString function)
{
return DocumentContainsFunctionDefinition()(document->globalNamespace(), function);
}
bool documentContainsMemberFunctionDeclaration(const Document::Ptr &document,
const QString declaration)
{
return DocumentContainsDeclaration()(document->globalNamespace(), declaration);
}
class GoToSlotTest class GoToSlotTest
{ {
public: public:
@@ -129,8 +222,14 @@ public:
} }
// Compare // Compare
QCOMPARE(cppFileEditor->textDocument()->contents(), expectedContentsForFile(cppFile)); const Document::Ptr cppDocument
QCOMPARE(hFileEditor->textDocument()->contents(), expectedContentsForFile(hFile)); = m_modelManager->cppEditorSupport(cppFileEditor)->snapshotUpdater()->document();
const Document::Ptr hDocument
= m_modelManager->cppEditorSupport(hFileEditor)->snapshotUpdater()->document();
QVERIFY(documentContainsFunctionDefinition(cppDocument,
QLatin1String("Form::on_pushButton_clicked")));
QVERIFY(documentContainsMemberFunctionDeclaration(hDocument,
QLatin1String("Form::on_pushButton_clicked")));
} }
private: private:
@@ -152,7 +251,7 @@ private:
#endif #endif
/// Check: Executes "Go To Slot..." on a QPushButton in a *.ui file and checks if the respective /// Check: Executes "Go To Slot..." on a QPushButton in a *.ui file and checks if the respective
/// header and source files are updated. /// header and source files are correctly updated.
void Designer::Internal::FormEditorPlugin::test_gotoslot() void Designer::Internal::FormEditorPlugin::test_gotoslot()
{ {
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
@@ -165,15 +264,45 @@ void Designer::Internal::FormEditorPlugin::test_gotoslot()
#endif #endif
} }
void FormEditorPlugin::test_gotoslot_data() void Designer::Internal::FormEditorPlugin::test_gotoslot_data()
{ {
#if QT_VERSION >= 0x050000
typedef QLatin1String _; typedef QLatin1String _;
QTest::addColumn<QStringList>("files"); QTest::addColumn<QStringList>("files");
MyTestDataDir testData(QLatin1String("gotoslot_withoutProject")); MyTestDataDir testDataDirWithoutProject(_("gotoslot_withoutProject"));
QTest::newRow("withoutProject") QTest::newRow("withoutProject")
<< (QStringList() << (QStringList()
<< testData.file(_("form.cpp")) << testDataDirWithoutProject.file(_("form.cpp"))
<< testData.file(_("form.h")) << testDataDirWithoutProject.file(_("form.h"))
<< testData.file(_("form.ui"))); << testDataDirWithoutProject.file(_("form.ui")));
// Finding the right class for inserting definitions/declarations is based on
// finding a class with a member whose type is the class from the "ui_xxx.h" header.
// In the following test data the header files contain an extra class referencing
// the same class name.
MyTestDataDir testDataDir;
testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_pointer"));
QTest::newRow("insertIntoCorrectClass_pointer")
<< (QStringList()
<< testDataDir.file(_("form.cpp"))
<< testDataDir.file(_("form.h"))
<< testDataDirWithoutProject.file(_("form.ui"))); // reuse
testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_non-pointer"));
QTest::newRow("insertIntoCorrectClass_non-pointer")
<< (QStringList()
<< testDataDir.file(_("form.cpp"))
<< testDataDir.file(_("form.h"))
<< testDataDirWithoutProject.file(_("form.ui"))); // reuse
testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_pointer_ns_using"));
QTest::newRow("insertIntoCorrectClass_pointer_ns_using")
<< (QStringList()
<< testDataDir.file(_("form.cpp"))
<< testDataDir.file(_("form.h"))
<< testDataDir.file(_("form.ui")));
#endif
} }

View File

@@ -160,27 +160,26 @@ static bool inherits(const Overview &o, const Class *klass, const QString &baseC
return false; return false;
} }
// Check for a class name where haystack is a member class of an object. QString fullyQualifiedName(const LookupContext &context, const Name *name, Scope *scope)
// So, haystack can be shorter (can have some namespaces omitted because of a
// "using namespace" declaration, for example, comparing
// "foo::Ui::form", against "using namespace foo; Ui::form".
static bool matchMemberClassName(const QString &needle, const QString &hayStack)
{ {
if (needle == hayStack) if (!name || !scope)
return true; return QString();
if (!needle.endsWith(hayStack))
return false; const QList<LookupItem> items = context.lookup(name, scope);
// Check if there really is a separator "::" if (items.isEmpty()) { // "ui_xxx.h" might not be generated and nothing is forward declared.
const int separatorPos = needle.size() - hayStack.size() - 1; return Overview().prettyName(name);
return separatorPos > 1 && needle.at(separatorPos) == QLatin1Char(':'); } else {
Symbol *symbol = items.first().declaration();
return Overview().prettyName(LookupContext::fullyQualifiedName(symbol));
}
return QString();
} }
// Find class definition in namespace (that is, the outer class // Find class definition in namespace (that is, the outer class
// containing a member of the desired class type) or inheriting the desired class // containing a member of the desired class type) or inheriting the desired class
// in case of forms using the Multiple Inheritance approach // in case of forms using the Multiple Inheritance approach
static const Class *findClass(const Namespace *parentNameSpace, static const Class *findClass(const Namespace *parentNameSpace, const LookupContext &context,
const QString &className, QString *namespaceName) const QString &className, QString *namespaceName)
{ {
if (Designer::Constants::Internal::debug) if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << className; qDebug() << Q_FUNC_INFO << className;
@@ -194,16 +193,22 @@ static const Class *findClass(const Namespace *parentNameSpace,
// 1) we go through class members // 1) we go through class members
const unsigned classMemberCount = cl->memberCount(); const unsigned classMemberCount = cl->memberCount();
for (unsigned j = 0; j < classMemberCount; ++j) for (unsigned j = 0; j < classMemberCount; ++j)
if (const Declaration *decl = cl->memberAt(j)->asDeclaration()) { if (Declaration *decl = cl->memberAt(j)->asDeclaration()) {
// we want to know if the class contains a member (so we look into // we want to know if the class contains a member (so we look into
// a declaration) of uiClassName type // a declaration) of uiClassName type
const NamedType *nt = decl->type()->asNamedType(); QString nameToMatch;
if (const NamedType *nt = decl->type()->asNamedType()) {
nameToMatch = fullyQualifiedName(context, nt->name(),
decl->enclosingScope());
// handle pointers to member variables // handle pointers to member variables
if (PointerType *pt = decl->type()->asPointerType()) } else if (PointerType *pt = decl->type()->asPointerType()) {
nt = pt->elementType()->asNamedType(); if (NamedType *nt = pt->elementType()->asNamedType()) {
nameToMatch = fullyQualifiedName(context, nt->name(),
if (nt && matchMemberClassName(className, o.prettyName(nt->name()))) decl->enclosingScope());
return cl; }
}
if (!nameToMatch.isEmpty() && className == nameToMatch)
return cl;
} // decl } // decl
// 2) does it inherit the desired class // 2) does it inherit the desired class
if (inherits(o, cl, className)) if (inherits(o, cl, className))
@@ -214,7 +219,7 @@ static const Class *findClass(const Namespace *parentNameSpace,
QString tempNS = *namespaceName; QString tempNS = *namespaceName;
tempNS += o.prettyName(ns->name()); tempNS += o.prettyName(ns->name());
tempNS += QLatin1String("::"); tempNS += QLatin1String("::");
if (const Class *cl = findClass(ns, className, &tempNS)) { if (const Class *cl = findClass(ns, context, className, &tempNS)) {
*namespaceName = tempNS; *namespaceName = tempNS;
return cl; return cl;
} }
@@ -445,14 +450,15 @@ static QString addParameterNames(const QString &functionSignature, const QString
typedef QPair<const Class *, Document::Ptr> ClassDocumentPtrPair; typedef QPair<const Class *, Document::Ptr> ClassDocumentPtrPair;
static ClassDocumentPtrPair static ClassDocumentPtrPair
findClassRecursively(const Snapshot &docTable, findClassRecursively(const LookupContext &context, const QString &className,
const Document::Ptr &doc, const QString &className,
unsigned maxIncludeDepth, QString *namespaceName) unsigned maxIncludeDepth, QString *namespaceName)
{ {
const Document::Ptr doc = context.thisDocument();
const Snapshot docTable = context.snapshot();
if (Designer::Constants::Internal::debug) if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << doc->fileName() << className << maxIncludeDepth; qDebug() << Q_FUNC_INFO << doc->fileName() << className << maxIncludeDepth;
// Check document // Check document
if (const Class *cl = findClass(doc->globalNamespace(), className, namespaceName)) if (const Class *cl = findClass(doc->globalNamespace(), context, className, namespaceName))
return ClassDocumentPtrPair(cl, doc); return ClassDocumentPtrPair(cl, doc);
if (maxIncludeDepth) { if (maxIncludeDepth) {
// Check the includes // Check the includes
@@ -461,7 +467,9 @@ static ClassDocumentPtrPair
const Snapshot::const_iterator it = docTable.find(include); const Snapshot::const_iterator it = docTable.find(include);
if (it != docTable.end()) { if (it != docTable.end()) {
const Document::Ptr includeDoc = it.value(); const Document::Ptr includeDoc = it.value();
const ClassDocumentPtrPair irc = findClassRecursively(docTable, it.value(), className, recursionMaxIncludeDepth, namespaceName); LookupContext context(includeDoc, docTable);
const ClassDocumentPtrPair irc = findClassRecursively(context, className,
recursionMaxIncludeDepth, namespaceName);
if (irc.first) if (irc.first)
return irc; return irc;
} }
@@ -588,7 +596,8 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
Document::Ptr doc; Document::Ptr doc;
foreach (const Document::Ptr &d, docMap) { foreach (const Document::Ptr &d, docMap) {
const ClassDocumentPtrPair cd = findClassRecursively(docTable, d, uiClass, 1u , &namespaceName); LookupContext context(d, docTable);
const ClassDocumentPtrPair cd = findClassRecursively(context, uiClass, 1u , &namespaceName);
if (cd.first) { if (cd.first) {
cl = cd.first; cl = cd.first;
doc = cd.second; doc = cd.second;

View File

@@ -1022,6 +1022,9 @@ FakeVimPluginPrivate::~FakeVimPluginPrivate()
delete m_fakeVimUserCommandsPage; delete m_fakeVimUserCommandsPage;
m_fakeVimUserCommandsPage = 0; m_fakeVimUserCommandsPage = 0;
delete m_wordProvider;
m_wordProvider = 0;
theFakeVimSettings()->deleteLater(); theFakeVimSettings()->deleteLater();
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -1,5 +1,5 @@
<RCC> <RCC>
<qresource prefix="/ios"> <qresource prefix="/ios">
<file>images/QtIos.png</file> <file>images/iossettings.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -48,7 +48,7 @@ namespace Constants {
const char IOS_SETTINGS_ID[] = "ZZ.Ios Configurations"; const char IOS_SETTINGS_ID[] = "ZZ.Ios Configurations";
const char IOS_SETTINGS_CATEGORY[] = "XA.Ios"; const char IOS_SETTINGS_CATEGORY[] = "XA.Ios";
const char IOS_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Ios", "iOS"); const char IOS_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Ios", "iOS");
const char IOS_SETTINGS_CATEGORY_ICON[] = ":/ios/images/QtIos.png"; const char IOS_SETTINGS_CATEGORY_ICON[] = ":/ios/images/iossettings.png";
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios";
const char IOS_DEVICE_TYPE[] = "Ios.Device.Type"; const char IOS_DEVICE_TYPE[] = "Ios.Device.Type";

View File

@@ -62,7 +62,10 @@ public:
Target targetAt(int index) const; Target targetAt(int index) const;
int targetCount() const { return m_targets.size(); } int targetCount() const { return m_targets.size(); }
int currentIndex() const { return m_currentTargetIndex; } int currentIndex() const { return m_currentTargetIndex; }
int currentSubIndex() const { return m_targets.at(m_currentTargetIndex).currentSubIndex; } int currentSubIndex() const {
return m_currentTargetIndex == -1 ? -1
: m_targets.at(m_currentTargetIndex).currentSubIndex;
}
void setTargetMenu(QMenu *menu); void setTargetMenu(QMenu *menu);

View File

@@ -30,6 +30,7 @@
#include "taskmodel.h" #include "taskmodel.h"
#include "task.h" #include "task.h"
#include "taskhub.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -46,8 +47,6 @@ TaskModel::TaskModel(QObject *parent) :
QAbstractItemModel(parent), QAbstractItemModel(parent),
m_maxSizeOfFileName(0), m_maxSizeOfFileName(0),
m_lastMaxSizeIndex(0), m_lastMaxSizeIndex(0),
m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")),
m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png")),
m_sizeOfLineNumber(0) m_sizeOfLineNumber(0)
{ {
m_categories.insert(Core::Id(), CategoryData()); m_categories.insert(Core::Id(), CategoryData());
@@ -83,19 +82,6 @@ bool TaskModel::hasFile(const QModelIndex &index) const
return !m_tasks.at(row).file.isEmpty(); return !m_tasks.at(row).file.isEmpty();
} }
QIcon TaskModel::taskTypeIcon(Task::TaskType t) const
{
switch (t) {
case Task::Warning:
return m_warningIcon;
case Task::Error:
return m_errorIcon;
case Task::Unknown:
break;
}
return QIcon();
}
void TaskModel::addCategory(const Core::Id &categoryId, const QString &categoryName) void TaskModel::addCategory(const Core::Id &categoryId, const QString &categoryName)
{ {
QTC_ASSERT(categoryId.uniqueIdentifier(), return); QTC_ASSERT(categoryId.uniqueIdentifier(), return);
@@ -269,7 +255,7 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const
else if (role == TaskModel::Category) else if (role == TaskModel::Category)
return m_tasks.at(index.row()).category.uniqueIdentifier(); return m_tasks.at(index.row()).category.uniqueIdentifier();
else if (role == TaskModel::Icon) else if (role == TaskModel::Icon)
return taskTypeIcon(m_tasks.at(index.row()).type); return TaskHub::taskTypeIcon(m_tasks.at(index.row()).type);
else if (role == TaskModel::Task_t) else if (role == TaskModel::Task_t)
return QVariant::fromValue(task(index)); return QVariant::fromValue(task(index));
return QVariant(); return QVariant();

View File

@@ -71,8 +71,6 @@ public:
enum Roles { File = Qt::UserRole, Line, MovedLine, Description, FileNotFound, Type, Category, Icon, Task_t }; enum Roles { File = Qt::UserRole, Line, MovedLine, Description, FileNotFound, Type, Category, Icon, Task_t };
QIcon taskTypeIcon(Task::TaskType t) const;
int taskCount(const Core::Id &categoryId); int taskCount(const Core::Id &categoryId);
int errorTaskCount(const Core::Id &categoryId); int errorTaskCount(const Core::Id &categoryId);
int warningTaskCount(const Core::Id &categoryId); int warningTaskCount(const Core::Id &categoryId);
@@ -125,8 +123,6 @@ private:
int m_maxSizeOfFileName; int m_maxSizeOfFileName;
int m_lastMaxSizeIndex; int m_lastMaxSizeIndex;
QFont m_fileMeasurementFont; QFont m_fileMeasurementFont;
const QIcon m_errorIcon;
const QIcon m_warningIcon;
int m_sizeOfLineNumber; int m_sizeOfLineNumber;
QFont m_lineMeasurementFont; QFont m_lineMeasurementFont;
}; };

View File

@@ -261,7 +261,7 @@ TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu); d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
d->m_filterWarningsButton = createFilterButton(d->m_model->taskTypeIcon(Task::Warning), d->m_filterWarningsButton = createFilterButton(TaskHub::taskTypeIcon(Task::Warning),
tr("Show Warnings"), tr("Show Warnings"),
this, SLOT(setShowWarnings(bool))); this, SLOT(setShowWarnings(bool)));

View File

@@ -161,8 +161,8 @@ Rectangle {
width:100 width:100
height:100 height:100
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
anchors.leftMargin: (parent.width - width - container.baseStateOffset)/2 anchors.horizontalCenterOffset: -container.baseStateOffset / 2
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 9 anchors.bottomMargin: 9
Image { Image {

View File

@@ -985,13 +985,16 @@ const SemanticInfo &QmlJSCompletionAssistInterface::semanticInfo() const
namespace { namespace {
struct QmlJSLessThan class QmlJSLessThan
{ {
public:
QmlJSLessThan(const QString &searchString) : m_searchString(searchString)
{ }
bool operator() (const BasicProposalItem *a, const BasicProposalItem *b) bool operator() (const BasicProposalItem *a, const BasicProposalItem *b)
{ {
if (a->order() != b->order()) if (a->order() != b->order())
return a->order() > b->order(); return a->order() > b->order();
else if (a->text().isEmpty()) else if (a->text().isEmpty() && ! b->text().isEmpty())
return true; return true;
else if (b->text().isEmpty()) else if (b->text().isEmpty())
return false; return false;
@@ -1001,8 +1004,14 @@ struct QmlJSLessThan
return false; return false;
else if (a->text().at(0).isLower() && b->text().at(0).isUpper()) else if (a->text().at(0).isLower() && b->text().at(0).isUpper())
return true; return true;
int m1 = PersistentTrie::matchStrength(m_searchString, a->text());
int m2 = PersistentTrie::matchStrength(m_searchString, b->text());
if (m1 != m2)
return m1 > m2;
return a->text() < b->text(); return a->text() < b->text();
} }
private:
QString m_searchString;
}; };
} // Anonymous } // Anonymous
@@ -1023,9 +1032,9 @@ void QmlJSAssistProposalModel::filter(const QString &prefix)
m_currentItems = newCurrentItems; m_currentItems = newCurrentItems;
} }
void QmlJSAssistProposalModel::sort(const QString &) void QmlJSAssistProposalModel::sort(const QString &prefix)
{ {
qSort(currentItems().first, currentItems().second, QmlJSLessThan()); qSort(currentItems().first, currentItems().second, QmlJSLessThan(prefix));
} }
bool QmlJSAssistProposalModel::keepPerfectMatch(TextEditor::AssistReason reason) const bool QmlJSAssistProposalModel::keepPerfectMatch(TextEditor::AssistReason reason) const

View File

@@ -232,6 +232,7 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns()
ModelManager::ModelManager(QObject *parent): ModelManager::ModelManager(QObject *parent):
ModelManagerInterface(parent), ModelManagerInterface(parent),
m_shouldScanImports(false),
m_pluginDumper(new PluginDumper(this)) m_pluginDumper(new PluginDumper(this))
{ {
m_synchronizer.setCancelOnWait(true); m_synchronizer.setCancelOnWait(true);
@@ -380,6 +381,20 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles,
if (sourceFiles.count() > 1) if (sourceFiles.count() > 1)
ProgressManager::addTask(result, tr("Indexing"), Constants::TASK_INDEX); ProgressManager::addTask(result, tr("Indexing"), Constants::TASK_INDEX);
if (sourceFiles.count() > 1 && !m_shouldScanImports) {
bool scan = false;
{
QMutexLocker l(&m_mutex);
if (!m_shouldScanImports) {
m_shouldScanImports = true;
scan = true;
}
}
if (scan)
updateImportPaths();
}
return result; return result;
} }
@@ -939,24 +954,28 @@ void ModelManager::importScan(QFutureInterface<void> &future,
QVector<ScanItem> pathsToScan; QVector<ScanItem> pathsToScan;
pathsToScan.reserve(paths.size()); pathsToScan.reserve(paths.size());
foreach (const QString &path, paths) { {
QString cPath = QDir::cleanPath(path); QMutexLocker l(&modelManager->m_mutex);
if (modelManager->m_scannedPaths.contains(cPath)) foreach (const QString &path, paths) {
continue; QString cPath = QDir::cleanPath(path);
pathsToScan.append(ScanItem(cPath)); if (modelManager->m_scannedPaths.contains(cPath))
continue;
pathsToScan.append(ScanItem(cPath));
modelManager->m_scannedPaths.insert(cPath);
}
} }
const int maxScanDepth = 5; const int maxScanDepth = 5;
int progressRange = pathsToScan.size() * (1 << (2 + maxScanDepth)); int progressRange = pathsToScan.size() * (1 << (2 + maxScanDepth));
int totalWork(progressRange), workDone(0); int totalWork(progressRange), workDone(0);
future.setProgressRange(0, progressRange); // update max length while iterating? future.setProgressRange(0, progressRange); // update max length while iterating?
const bool libOnly = true; // FIXME remove when tested more const bool libOnly = true; // FIXME remove when tested more
const Snapshot snapshot = modelManager->snapshot();
while (!pathsToScan.isEmpty() && !future.isCanceled()) { while (!pathsToScan.isEmpty() && !future.isCanceled()) {
ScanItem toScan = pathsToScan.last(); ScanItem toScan = pathsToScan.last();
pathsToScan.pop_back(); pathsToScan.pop_back();
int pathBudget = (maxScanDepth + 2 - toScan.depth); int pathBudget = (maxScanDepth + 2 - toScan.depth);
if (!scannedPaths.contains(toScan.path)) { if (!scannedPaths.contains(toScan.path)) {
QStringList importedFiles; QStringList importedFiles;
const Snapshot snapshot = modelManager->snapshot();
if (!findNewQmlLibraryInPath(toScan.path, snapshot, modelManager, &importedFiles, if (!findNewQmlLibraryInPath(toScan.path, snapshot, modelManager, &importedFiles,
&scannedPaths, &newLibraries, true) &scannedPaths, &newLibraries, true)
&& !libOnly && snapshot.documentsInDirectory(toScan.path).isEmpty()) && !libOnly && snapshot.documentsInDirectory(toScan.path).isEmpty())
@@ -989,6 +1008,12 @@ void ModelManager::importScan(QFutureInterface<void> &future,
future.setProgressValue(progressRange * workDone / totalWork); future.setProgressValue(progressRange * workDone / totalWork);
} }
future.setProgressValue(progressRange); future.setProgressValue(progressRange);
if (future.isCanceled()) {
// assume no work has been done
QMutexLocker l(&modelManager->m_mutex);
foreach (const QString &path, paths)
modelManager->m_scannedPaths.remove(path);
}
} }
// Check whether fileMimeType is the same or extends knownMimeType // Check whether fileMimeType is the same or extends knownMimeType
@@ -1103,10 +1128,16 @@ void ModelManager::updateImportPaths()
updateSourceFiles(importedFiles, true); updateSourceFiles(importedFiles, true);
if (!m_shouldScanImports)
return;
QStringList pathToScan; QStringList pathToScan;
foreach (QString importPath, allImportPaths) {
if (!m_scannedPaths.contains(importPath)) QMutexLocker l(&m_mutex);
pathToScan.append(importPath); foreach (QString importPath, allImportPaths)
if (!m_scannedPaths.contains(importPath)) {
pathToScan.append(importPath);
}
}
if (pathToScan.count() > 1) { if (pathToScan.count() > 1) {
QFuture<void> result = QtConcurrent::run(&ModelManager::importScan, QFuture<void> result = QtConcurrent::run(&ModelManager::importScan,

View File

@@ -179,6 +179,7 @@ private:
QmlJS::QmlLanguageBundles m_activeBundles; QmlJS::QmlLanguageBundles m_activeBundles;
QmlJS::QmlLanguageBundles m_extendedBundles; QmlJS::QmlLanguageBundles m_extendedBundles;
QmlJS::ViewerContext m_vContext; QmlJS::ViewerContext m_vContext;
bool m_shouldScanImports;
QSet<QString> m_scannedPaths; QSet<QString> m_scannedPaths;
QTimer *m_updateCppQmlTypesTimer; QTimer *m_updateCppQmlTypesTimer;

View File

@@ -3863,8 +3863,6 @@ void BaseTextEditorWidget::drawFoldingMarker(QPainter *painter, const QPalette &
bool active, bool active,
bool hovered) const bool hovered) const
{ {
Q_UNUSED(active)
Q_UNUSED(hovered)
QStyle *s = style(); QStyle *s = style();
if (ManhattanStyle *ms = qobject_cast<ManhattanStyle*>(s)) if (ManhattanStyle *ms = qobject_cast<ManhattanStyle*>(s))
s = ms->baseStyle(); s = ms->baseStyle();

View File

@@ -290,6 +290,6 @@ void CodeStylePool::exportCodeStyle(const Utils::FileName &fileName, ICodeStyleP
tmp.insert(QLatin1String(displayNameKey), codeStyle->displayName()); tmp.insert(QLatin1String(displayNameKey), codeStyle->displayName());
tmp.insert(QLatin1String(codeStyleDataKey), map); tmp.insert(QLatin1String(codeStyleDataKey), map);
Utils::PersistentSettingsWriter writer(fileName, QLatin1String(codeStyleDocKey)); Utils::PersistentSettingsWriter writer(fileName, QLatin1String(codeStyleDocKey));
writer.save(tmp, 0); writer.save(tmp, Core::ICore::mainWindow());
} }

View File

@@ -50,6 +50,30 @@ namespace {
static const QLatin1Char kHash('#'); static const QLatin1Char kHash('#');
} }
class HighlighterCodeFormatterData : public CodeFormatterData
{
public:
HighlighterCodeFormatterData() : m_foldingIndentDelta(0), m_originalObservableState(-1) {}
~HighlighterCodeFormatterData() {}
int m_foldingIndentDelta;
int m_originalObservableState;
QStack<QString> m_foldingRegions;
QSharedPointer<Internal::Context> m_contextToContinue;
};
HighlighterCodeFormatterData *formatterData(const QTextBlock &block)
{
HighlighterCodeFormatterData *data = 0;
if (TextBlockUserData *userData = BaseTextDocumentLayout::userData(block)) {
data = static_cast<HighlighterCodeFormatterData *>(userData->codeFormatterData());
if (!data) {
data = new HighlighterCodeFormatterData;
userData->setCodeFormatterData(data);
}
}
return data;
}
Highlighter::Highlighter(QTextDocument *parent) : Highlighter::Highlighter(QTextDocument *parent) :
TextEditor::SyntaxHighlighter(parent), TextEditor::SyntaxHighlighter(parent),
m_regionDepth(0), m_regionDepth(0),
@@ -85,12 +109,6 @@ Highlighter::Highlighter(QTextDocument *parent) :
Highlighter::~Highlighter() Highlighter::~Highlighter()
{} {}
Highlighter::BlockData::BlockData() : m_foldingIndentDelta(0), m_originalObservableState(-1)
{}
Highlighter::BlockData::~BlockData()
{}
// Mapping from Kate format strings to format ids. // Mapping from Kate format strings to format ids.
struct KateFormatMap struct KateFormatMap
{ {
@@ -135,8 +153,6 @@ void Highlighter::highlightBlock(const QString &text)
{ {
if (!m_defaultContext.isNull() && !m_isBroken) { if (!m_defaultContext.isNull() && !m_isBroken) {
try { try {
if (!currentBlockUserData())
initializeBlockData();
setupDataForBlock(text); setupDataForBlock(text);
handleContextChange(m_currentContext->lineBeginContext(), handleContextChange(m_currentContext->lineBeginContext(),
@@ -188,8 +204,8 @@ void Highlighter::setupDataForBlock(const QString &text)
else else
setupFromPersistent(); setupFromPersistent();
blockData(currentBlockUserData())->m_foldingRegions = formatterData(currentBlock())->m_foldingRegions =
blockData(currentBlock().previous().userData())->m_foldingRegions; formatterData(currentBlock().previous())->m_foldingRegions;
} }
assignCurrentContext(); assignCurrentContext();
@@ -204,7 +220,7 @@ void Highlighter::setupDefault()
void Highlighter::setupFromWillContinue() void Highlighter::setupFromWillContinue()
{ {
BlockData *previousData = blockData(currentBlock().previous().userData()); HighlighterCodeFormatterData *previousData = formatterData(currentBlock().previous());
if (previousData->m_originalObservableState == Default || if (previousData->m_originalObservableState == Default ||
previousData->m_originalObservableState == -1) { previousData->m_originalObservableState == -1) {
m_contexts.push_back(previousData->m_contextToContinue); m_contexts.push_back(previousData->m_contextToContinue);
@@ -212,7 +228,7 @@ void Highlighter::setupFromWillContinue()
pushContextSequence(previousData->m_originalObservableState); pushContextSequence(previousData->m_originalObservableState);
} }
BlockData *data = blockData(currentBlock().userData()); HighlighterCodeFormatterData *data = formatterData(currentBlock());
data->m_originalObservableState = previousData->m_originalObservableState; data->m_originalObservableState = previousData->m_originalObservableState;
if (currentBlockState() == -1 || extractObservableState(currentBlockState()) == Default) if (currentBlockState() == -1 || extractObservableState(currentBlockState()) == Default)
@@ -221,7 +237,7 @@ void Highlighter::setupFromWillContinue()
void Highlighter::setupFromContinued() void Highlighter::setupFromContinued()
{ {
BlockData *previousData = blockData(currentBlock().previous().userData()); HighlighterCodeFormatterData *previousData = formatterData(currentBlock().previous());
Q_ASSERT(previousData->m_originalObservableState != WillContinue && Q_ASSERT(previousData->m_originalObservableState != WillContinue &&
previousData->m_originalObservableState != Continued); previousData->m_originalObservableState != Continued);
@@ -264,19 +280,19 @@ void Highlighter::iterateThroughRules(const QString &text,
if (!m_indentationBasedFolding) { if (!m_indentationBasedFolding) {
if (!rule->beginRegion().isEmpty()) { if (!rule->beginRegion().isEmpty()) {
blockData(currentBlockUserData())->m_foldingRegions.push(rule->beginRegion()); formatterData(currentBlock())->m_foldingRegions.push(rule->beginRegion());
++m_regionDepth; ++m_regionDepth;
if (progress->isOpeningBraceMatchAtFirstNonSpace()) if (progress->isOpeningBraceMatchAtFirstNonSpace())
++blockData(currentBlockUserData())->m_foldingIndentDelta; ++formatterData(currentBlock())->m_foldingIndentDelta;
} }
if (!rule->endRegion().isEmpty()) { if (!rule->endRegion().isEmpty()) {
QStack<QString> *currentRegions = QStack<QString> *currentRegions =
&blockData(currentBlockUserData())->m_foldingRegions; &formatterData(currentBlock())->m_foldingRegions;
if (!currentRegions->isEmpty() && rule->endRegion() == currentRegions->top()) { if (!currentRegions->isEmpty() && rule->endRegion() == currentRegions->top()) {
currentRegions->pop(); currentRegions->pop();
--m_regionDepth; --m_regionDepth;
if (progress->isClosingBraceMatchAtNonEnd()) if (progress->isClosingBraceMatchAtNonEnd())
--blockData(currentBlockUserData())->m_foldingIndentDelta; --formatterData(currentBlock())->m_foldingIndentDelta;
} }
} }
progress->clearBracesMatches(); progress->clearBracesMatches();
@@ -442,10 +458,10 @@ void Highlighter::applyFormat(int offset,
void Highlighter::createWillContinueBlock() void Highlighter::createWillContinueBlock()
{ {
BlockData *data = blockData(currentBlockUserData()); HighlighterCodeFormatterData *data = formatterData(currentBlock());
const int currentObservableState = extractObservableState(currentBlockState()); const int currentObservableState = extractObservableState(currentBlockState());
if (currentObservableState == Continued) { if (currentObservableState == Continued) {
BlockData *previousData = blockData(currentBlock().previous().userData()); HighlighterCodeFormatterData *previousData = formatterData(currentBlock().previous());
data->m_originalObservableState = previousData->m_originalObservableState; data->m_originalObservableState = previousData->m_originalObservableState;
} else if (currentObservableState != WillContinue) { } else if (currentObservableState != WillContinue) {
data->m_originalObservableState = currentObservableState; data->m_originalObservableState = currentObservableState;
@@ -464,7 +480,7 @@ void Highlighter::analyseConsistencyOfWillContinueBlock(const QString &text)
} }
if (text.length() == 0 || text.at(text.length() - 1) != kBackSlash) { if (text.length() == 0 || text.at(text.length() - 1) != kBackSlash) {
BlockData *data = blockData(currentBlockUserData()); HighlighterCodeFormatterData *data = formatterData(currentBlock());
data->m_contextToContinue.clear(); data->m_contextToContinue.clear();
setCurrentBlockState(computeState(data->m_originalObservableState)); setCurrentBlockState(computeState(data->m_originalObservableState));
} }
@@ -503,18 +519,6 @@ QString Highlighter::currentContextSequence() const
return sequence; return sequence;
} }
Highlighter::BlockData *Highlighter::initializeBlockData()
{
BlockData *data = new BlockData;
setCurrentBlockUserData(data);
return data;
}
Highlighter::BlockData *Highlighter::blockData(QTextBlockUserData *userData)
{
return static_cast<BlockData *>(userData);
}
void Highlighter::pushDynamicContext(const QSharedPointer<Context> &baseContext) void Highlighter::pushDynamicContext(const QSharedPointer<Context> &baseContext)
{ {
// A dynamic context is created from another context which serves as its basis. Then, // A dynamic context is created from another context which serves as its basis. Then,
@@ -556,26 +560,27 @@ int Highlighter::computeState(const int observableState) const
void Highlighter::applyRegionBasedFolding() const void Highlighter::applyRegionBasedFolding() const
{ {
int folding = 0; int folding = 0;
BlockData *data = blockData(currentBlockUserData()); TextBlockUserData *currentBlockUserData = BaseTextDocumentLayout::userData(currentBlock());
BlockData *previousData = blockData(currentBlock().previous().userData()); HighlighterCodeFormatterData *data = formatterData(currentBlock());
HighlighterCodeFormatterData *previousData = formatterData(currentBlock().previous());
if (previousData) { if (previousData) {
folding = extractRegionDepth(previousBlockState()); folding = extractRegionDepth(previousBlockState());
if (data->m_foldingIndentDelta != 0) { if (data->m_foldingIndentDelta != 0) {
folding += data->m_foldingIndentDelta; folding += data->m_foldingIndentDelta;
if (data->m_foldingIndentDelta > 0) if (data->m_foldingIndentDelta > 0)
data->setFoldingStartIncluded(true); currentBlockUserData->setFoldingStartIncluded(true);
else else
previousData->setFoldingEndIncluded(false); BaseTextDocumentLayout::userData(currentBlock().previous())->setFoldingEndIncluded(false);
data->m_foldingIndentDelta = 0; data->m_foldingIndentDelta = 0;
} }
} }
data->setFoldingEndIncluded(true); currentBlockUserData->setFoldingEndIncluded(true);
data->setFoldingIndent(folding); currentBlockUserData->setFoldingIndent(folding);
} }
void Highlighter::applyIndentationBasedFolding(const QString &text) const void Highlighter::applyIndentationBasedFolding(const QString &text) const
{ {
BlockData *data = blockData(currentBlockUserData()); TextBlockUserData *data = BaseTextDocumentLayout::userData(currentBlock());
data->setFoldingEndIncluded(true); data->setFoldingEndIncluded(true);
// If this line is empty, check its neighbours. They all might be part of the same block. // If this line is empty, check its neighbours. They all might be part of the same block.

View File

@@ -135,18 +135,7 @@ private:
void applyIndentationBasedFolding(const QString &text) const; void applyIndentationBasedFolding(const QString &text) const;
int neighbouringNonEmptyBlockIndent(QTextBlock block, const bool previous) const; int neighbouringNonEmptyBlockIndent(QTextBlock block, const bool previous) const;
struct BlockData : TextBlockUserData static TextBlockUserData *blockData(QTextBlockUserData *userData);
{
BlockData();
virtual ~BlockData();
int m_foldingIndentDelta;
int m_originalObservableState;
QStack<QString> m_foldingRegions;
QSharedPointer<Internal::Context> m_contextToContinue;
};
BlockData *initializeBlockData();
static BlockData *blockData(QTextBlockUserData *userData);
// Block states are composed by the region depth (used for code folding) and what I call // Block states are composed by the region depth (used for code folding) and what I call
// observable states. Observable states occupy the 12 least significant bits. They might have // observable states. Observable states occupy the 12 least significant bits. They might have

View File

@@ -107,6 +107,7 @@ private slots:
void gcc_attributes_2(); void gcc_attributes_2();
void gcc_attributes_3(); void gcc_attributes_3();
void crash_test_1(); void crash_test_1();
void thread_local_1();
// expressions // expressions
void simple_name_1(); void simple_name_1();
@@ -246,6 +247,16 @@ void tst_AST::crash_test_1()
QVERIFY(ast); QVERIFY(ast);
} }
void tst_AST::thread_local_1()
{
QSharedPointer<TranslationUnit> unit(parseStatement("__thread int i;\n"));
AST *ast = unit->ast();
QVERIFY(ast);
QCOMPARE(diag.errorCount, 0);
QCOMPARE(Token::name(T_THREAD_LOCAL), "thread_local");
QCOMPARE(Token::name(T___THREAD), "__thread");
}
void tst_AST::simple_declaration_1() void tst_AST::simple_declaration_1()
{ {
QSharedPointer<TranslationUnit> unit(parseStatement("\n" QSharedPointer<TranslationUnit> unit(parseStatement("\n"

View File

@@ -0,0 +1 @@
thread_local int i;

View File

@@ -151,6 +151,7 @@ void tst_cxx11::parse_data()
QTest::newRow("templateGreaterGreater.1") << "templateGreaterGreater.1.cpp" << ""; QTest::newRow("templateGreaterGreater.1") << "templateGreaterGreater.1.cpp" << "";
QTest::newRow("packExpansion.1") << "packExpansion.1.cpp" << ""; QTest::newRow("packExpansion.1") << "packExpansion.1.cpp" << "";
QTest::newRow("declType.1") << "declType.1.cpp" << ""; QTest::newRow("declType.1") << "declType.1.cpp" << "";
QTest::newRow("threadLocal.1") << "threadLocal.1.cpp" << "";
} }
void tst_cxx11::parse() void tst_cxx11::parse()

View File

@@ -1962,14 +1962,12 @@ void tst_Dumpers::dumper_data()
% CoreProfile() % CoreProfile()
% Check("map", "<3 items>", "@QMap<@QString, @QPointer<@QObject>>") % Check("map", "<3 items>", "@QMap<@QString, @QPointer<@QObject>>")
% Check("map.0", "[0]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.0", "[0]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
% Check("map.0.key", Value4("\".\""), "@QString") % Check("map.0.key", "\".\"", "@QString")
% Check("map.0.key", Value5("\"Hallo\""), "@QString")
% Check("map.0.value", "", "@QPointer<@QObject>") % Check("map.0.value", "", "@QPointer<@QObject>")
//% Check("map.0.value.o", Pointer(), "@QObject") //% Check("map.0.value.o", Pointer(), "@QObject")
// FIXME: it's '.wp' in Qt 5 // FIXME: it's '.wp' in Qt 5
% Check("map.1", "[1]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.1", "[1]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
% Check("map.1.key", Value4("\"Hallo\""), "@QString") % Check("map.1.key", "\"Hallo\"", "@QString")
% Check("map.1.key", Value5("\".\""), "@QString")
% Check("map.2", "[2]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.2", "[2]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
% Check("map.2.key", "\"Welt\"", "@QString"); % Check("map.2.key", "\"Welt\"", "@QString");
@@ -1989,8 +1987,7 @@ void tst_Dumpers::dumper_data()
% CoreProfile() % CoreProfile()
% Check("map", "<4 items>", "@QMap<@QString, @QList<nsA::nsB::SomeType*>>") % Check("map", "<4 items>", "@QMap<@QString, @QList<nsA::nsB::SomeType*>>")
% Check("map.0", "[0]", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>") % Check("map.0", "[0]", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>")
% Check("map.0.key", Value4("\"1\""), "@QString") % Check("map.0.key", "\"1\"", "@QString")
% Check("map.0.key", Value5("\"bar\""), "@QString")
% Check("map.0.value", "<3 items>", "@QList<nsA::nsB::SomeType*>") % Check("map.0.value", "<3 items>", "@QList<nsA::nsB::SomeType*>")
% Check("map.0.value.0", "[0]", "", "nsA::nsB::SomeType") % Check("map.0.value.0", "[0]", "", "nsA::nsB::SomeType")
% Check("map.0.value.0.a", "1", "int") % Check("map.0.value.0.a", "1", "int")
@@ -1999,8 +1996,7 @@ void tst_Dumpers::dumper_data()
% Check("map.0.value.2", "[2]", "", "nsA::nsB::SomeType") % Check("map.0.value.2", "[2]", "", "nsA::nsB::SomeType")
% Check("map.0.value.2.a", "3", "int") % Check("map.0.value.2.a", "3", "int")
% Check("map.3", "[3]", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>") % Check("map.3", "[3]", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>")
% Check("map.3.key", Value4("\"foo\""), "@QString") % Check("map.3.key", "\"foo\"", "@QString")
% Check("map.3.key", Value5("\"2\""), "@QString")
% Check("map.3.value", "<3 items>", "@QList<nsA::nsB::SomeType*>") % Check("map.3.value", "<3 items>", "@QList<nsA::nsB::SomeType*>")
% Check("map.3.value.2", "[2]", "", "nsA::nsB::SomeType") % Check("map.3.value.2", "[2]", "", "nsA::nsB::SomeType")
% Check("map.3.value.2.a", "3", "int") % Check("map.3.value.2.a", "3", "int")
@@ -2071,17 +2067,14 @@ void tst_Dumpers::dumper_data()
% CoreProfile() % CoreProfile()
% Check("map", "<4 items>", "@QMultiMap<@QString, @QPointer<@QObject>>") % Check("map", "<4 items>", "@QMultiMap<@QString, @QPointer<@QObject>>")
% Check("map.0", "[0]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.0", "[0]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
% Check("map.0.key", Value4("\".\""), "@QString") % Check("map.0.key", "\".\"", "@QString")
% Check("map.0.key", Value5("\"Hallo\""), "@QString")
% Check("map.0.value", "", "@QPointer<@QObject>") % Check("map.0.value", "", "@QPointer<@QObject>")
% Check("map.1", "[1]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.1", "[1]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
% Check("map.1.key", "\".\"", "@QString") % Check("map.1.key", "\".\"", "@QString")
% Check("map.2", "[2]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.2", "[2]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
% Check("map.2.key", Value4("\"Hallo\""), "@QString") % Check("map.2.key", "\"Hallo\"", "@QString")
% Check("map.2.key", Value5("\"Welt\""), "@QString")
% Check("map.3", "[3]", "", "@QMapNode<@QString, @QPointer<@QObject>>") % Check("map.3", "[3]", "", "@QMapNode<@QString, @QPointer<@QObject>>")
% Check("map.3.key", Value4("\"Welt\""), "@QString") % Check("map.3.key", "\"Welt\"", "@QString");
% Check("map.3.key", Value5("\".\""), "@QString");
QTest::newRow("QObject1") QTest::newRow("QObject1")
@@ -3122,6 +3115,7 @@ void tst_Dumpers::dumper_data()
"v.push_back(true);\n" "v.push_back(true);\n"
"v.push_back(false);\n" "v.push_back(false);\n"
"unused(&v);\n") "unused(&v);\n")
// Known issue: Clang produces "std::vector<std::allocator<bool>>
% Check("v", "<5 items>", "std::vector<bool>") % Check("v", "<5 items>", "std::vector<bool>")
% Check("v.0", "[0]", "1", "bool") % Check("v.0", "[0]", "1", "bool")
% Check("v.1", "[1]", "0", "bool") % Check("v.1", "[1]", "0", "bool")
@@ -3703,15 +3697,11 @@ void tst_Dumpers::dumper_data()
% CoreProfile() % CoreProfile()
% Check("vm", "<6 items>", "@QVariantMap") % Check("vm", "<6 items>", "@QVariantMap")
% Check("vm.0", "[0]", "", "@QMapNode<@QString, @QVariant>") % Check("vm.0", "[0]", "", "@QMapNode<@QString, @QVariant>")
% Check("vm.0.key", Value4("\"a\""), "@QString") % Check("vm.0.key", "\"a\"", "@QString")
% Check("vm.0.value", Value4("1"), "@QVariant (int)") % Check("vm.0.value", "1", "@QVariant (int)")
% Check("vm.0.key", Value5("\"b\""), "@QString")
% Check("vm.0.value", Value5("2"), "@QVariant (int)")
% Check("vm.5", "[5]", "", "@QMapNode<@QString, @QVariant>") % Check("vm.5", "[5]", "", "@QMapNode<@QString, @QVariant>")
% Check("vm.5.key", Value4("\"f\""), "@QString") % Check("vm.5.key", "\"f\"", "@QString")
% Check("vm.5.value", Value4("\"2Some String\""), "@QVariant (QString)") % Check("vm.5.value", "\"2Some String\"", "@QVariant (QString)");
% Check("vm.5.key", Value5("\"f\""), "@QString")
% Check("vm.5.value", Value5("\"2Some String\""), "@QVariant (QString)");
QTest::newRow("QVariantHash1") QTest::newRow("QVariantHash1")
<< Data("#include <QVariant>\n", << Data("#include <QVariant>\n",

View File

@@ -0,0 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "basetextdocumentlayout.h"
TextBlockUserData *BaseTextDocumentLayout::userData(const QTextBlock &block)
{
TextBlockUserData *data = static_cast<TextBlockUserData*>(block.userData());
if (!data && block.isValid())
const_cast<QTextBlock &>(block).setUserData((data = new TextBlockUserData));
return data;
}

View File

@@ -34,13 +34,21 @@
// Replaces the "real" basetextdocumentlayout.h file. // Replaces the "real" basetextdocumentlayout.h file.
struct CodeFormatterData {};
struct TextBlockUserData : QTextBlockUserData struct TextBlockUserData : QTextBlockUserData
{ {
virtual ~TextBlockUserData(){} TextBlockUserData() : m_data(0) {}
virtual ~TextBlockUserData() {}
void setFoldingStartIncluded(const bool) {} void setFoldingStartIncluded(const bool) {}
void setFoldingEndIncluded(const bool) {} void setFoldingEndIncluded(const bool) {}
void setFoldingIndent(const int) {} void setFoldingIndent(const int) {}
void setCodeFormatterData(CodeFormatterData *data) { m_data = data; }
CodeFormatterData *codeFormatterData() { return m_data; }
CodeFormatterData *m_data;
}; };
namespace BaseTextDocumentLayout { TextBlockUserData *userData(const QTextBlock &block); }
#endif // BASETEXTDOCUMENTLAYOUT_H #endif // BASETEXTDOCUMENTLAYOUT_H

View File

@@ -7,6 +7,7 @@ SOURCES += \
tst_highlighterengine.cpp \ tst_highlighterengine.cpp \
highlightermock.cpp \ highlightermock.cpp \
formats.cpp \ formats.cpp \
basetextdocumentlayout.cpp \
syntaxhighlighter.cpp \ syntaxhighlighter.cpp \
$$GENERICHIGHLIGHTERDIR/highlighter.cpp \ $$GENERICHIGHLIGHTERDIR/highlighter.cpp \
$$GENERICHIGHLIGHTERDIR/context.cpp \ $$GENERICHIGHLIGHTERDIR/context.cpp \

View File

@@ -31,7 +31,7 @@ Autotest {
Group { Group {
name: "Drop-in sources for the plugin" name: "Drop-in sources for the plugin"
files: [ files: [
"basetextdocumentlayout.h", "basetextdocumentlayout.h", "basetextdocumentlayout.cpp",
"syntaxhighlighter.h", "syntaxhighlighter.cpp", "syntaxhighlighter.h", "syntaxhighlighter.cpp",
"tabsettings.h" "tabsettings.h"
] ]

View File

@@ -3,9 +3,9 @@ include(../../qttest.pri)
DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\" DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\"
DEFINES+=TESTSRCDIR=\\\"$$PWD\\\" DEFINES+=TESTSRCDIR=\\\"$$PWD\\\"
include($$IDE_SOURCE_TREE/src/libs/utils/utils.pri) include($$IDE_SOURCE_TREE/src/libs/utils/utils-lib.pri)
include($$IDE_SOURCE_TREE/src/libs/languageutils/languageutils.pri) include($$IDE_SOURCE_TREE/src/libs/languageutils/languageutils-lib.pri)
include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs.pri) include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs-lib.pri)
TARGET = tst_trie_check TARGET = tst_trie_check

View File

@@ -350,7 +350,7 @@ void interactiveCompletionTester(){
res = matchStrengthSort(line,res); res = matchStrengthSort(line,res);
qDebug() << "possible completions:["; qDebug() << "possible completions:[";
foreach (const QString &s, res) { foreach (const QString &s, res) {
qDebug() << s; qDebug() << matchStrength(line,s) << " " << s;
} }
qDebug() << "]"; qDebug() << "]";
} }

View File

@@ -0,0 +1,9 @@
// Copyright header
#include "form.h"
Form::Form(QWidget *parent) :
QWidget(parent)
{
ui.setupUi(this);
}

View File

@@ -0,0 +1,27 @@
// Copyright header
#ifndef FORM_H
#define FORM_H
#include "ui_form.h"
#include <QWidget>
class Form;
struct MyClass
{
Form *form;
};
class Form : public QWidget
{
Q_OBJECT
public:
explicit Form(QWidget *parent = 0);
private:
Ui::Form ui;
};
#endif // FORM_H

View File

@@ -14,9 +14,3 @@ Form::~Form()
{ {
delete ui; delete ui;
} }
void Form::on_pushButton_clicked()
{
}

View File

@@ -9,6 +9,12 @@ namespace Ui {
class Form; class Form;
} }
class Form;
struct MyClass
{
Form *form;
};
class Form : public QWidget class Form : public QWidget
{ {
Q_OBJECT Q_OBJECT
@@ -17,9 +23,6 @@ public:
explicit Form(QWidget *parent = 0); explicit Form(QWidget *parent = 0);
~Form(); ~Form();
private slots:
void on_pushButton_clicked();
private: private:
Ui::Form *ui; Ui::Form *ui;
}; };

View File

@@ -0,0 +1,16 @@
// Copyright header
#include "form.h"
#include "ui_form.h"
Form::Form(QWidget *parent) :
QWidget(parent),
ui(new Ui::Form)
{
ui->setupUi(this);
}
Form::~Form()
{
delete ui;
}

View File

@@ -0,0 +1,28 @@
// Copyright header
#ifndef N_FORM_H
#define N_FORM_H
#include <QWidget>
namespace N {
namespace Ui {
class Form;
}
}
using namespace N;
class Form : public QWidget
{
Q_OBJECT
public:
explicit Form(QWidget *parent = 0);
~Form();
private:
Ui::Form *ui;
};
#endif // N_FORM_H

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>N::Form</class>
<widget class="QWidget" name="N::Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>60</x>
<y>60</y>
<width>80</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -176,6 +176,7 @@ void dummyStatement(...) {}
#if USE_CXX11 #if USE_CXX11
#include <array> #include <array>
#include <unordered_map>
#endif #endif
#include <complex> #include <complex>
#include <deque> #include <deque>
@@ -2802,6 +2803,220 @@ namespace stdlist {
} // namespace stdlist } // namespace stdlist
namespace stdunorderedmap {
#if USE_CXX11
void testStdUnorderedMapStringFoo()
{
// This is not supposed to work with the compiled dumpers.
std::unordered_map<std::string, Foo> map;
map["22.0"] = Foo(22);
map["33.0"] = Foo(33);
map["44.0"] = Foo(44);
BREAK_HERE;
// Expand map map.0 map.0.second map.2 map.2.second.
// Check map <3 items> std::unordered_map<QString, Foo>.
// Check map.0 std::pair<QString const, Foo>.
// Check map.0.first "22.0" QString.
// CheckType map.0.second Foo.
// Check map.0.second.a 22 int.
// Check map.1 std::pair<QString const, Foo>.
// Check map.2.first "44.0" QString.
// CheckType map.2.second Foo.
// Check map.2.second.a 44 int.
// Continue.
dummyStatement(&map);
}
void testStdUnorderedMapCharStarFoo()
{
std::unordered_map<const char *, Foo> map;
map["22.0"] = Foo(22);
map["33.0"] = Foo(33);
BREAK_HERE;
// Expand map map.0 map.0.first map.0.second map.1 map.1.second.
// Check map <2 items> std::unordered_map<char const*, Foo>.
// Check map.0 std::pair<char const* const, Foo>.
// CheckType map.0.first char *.
// Check map.0.first.*first 50 '2' char.
// CheckType map.0.second Foo.
// Check map.0.second.a 22 int.
// Check map.1 std::pair<char const* const, Foo>.
// CheckType map.1.first char *.
// Check map.1.first.*first 51 '3' char.
// CheckType map.1.second Foo.
// Check map.1.second.a 33 int.
// Continue.
dummyStatement(&map);
}
void testStdUnorderedMapUIntUInt()
{
std::unordered_map<uint, uint> map;
map[11] = 1;
map[22] = 2;
BREAK_HERE;
// Expand map.
// Check map <2 items> std::unordered_map<unsigned int, unsigned int>.
// Check map.11 1 unsigned int.
// Check map.22 2 unsigned int.
// Continue.
dummyStatement(&map);
}
void testStdUnorderedMapUIntStringList()
{
#if 0
std::unordered_map<uint, QStringList> map;
map[11] = QStringList() << "11";
map[22] = QStringList() << "22";
BREAK_HERE;
// Expand map map.0 map.0.first map.0.second map.1 map.1.second.
// Check map <2 items> std::unordered_map<unsigned int, QStringList>.
// Check map.0 std::pair<unsigned int const, QStringList>.
// Check map.0.first 11 unsigned int.
// Check map.0.second <1 items> QStringList.
// Check map.0.second.0 "11" QString.
// Check map.1 std::pair<unsigned int const, QStringList>.
// Check map.1.first 22 unsigned int.
// Check map.1.second <1 items> QStringList.
// Check map.1.second.0 "22" QString.
// Continue.
dummyStatement(&map);
#endif
}
void testStdUnorderedMapUIntStringListTypedef()
{
#if 0
typedef std::unordered_map<uint, QStringList> T;
T map;
map[11] = QStringList() << "11";
map[22] = QStringList() << "22";
BREAK_HERE;
// Check map <2 items> stdmap::T.
// Continue.
dummyStatement(&map);
#endif
}
void testStdUnorderedMapUIntFloat()
{
std::unordered_map<uint, float> map;
map[11] = 11.0;
map[22] = 22.0;
BREAK_HERE;
// Expand map.
// Check map <2 items> std::unordered_map<unsigned int, float>.
// Check map.11 11 float.
// Check map.22 22 float.
// Continue.
dummyStatement(&map);
}
void testStdUnorderedMapUIntFloatIterator()
{
typedef std::unordered_map<int, float> Map;
Map map;
map[11] = 11.0;
map[22] = 22.0;
map[33] = 33.0;
map[44] = 44.0;
map[55] = 55.0;
map[66] = 66.0;
Map::iterator it1 = map.begin();
Map::iterator it2 = it1; ++it2;
Map::iterator it3 = it2; ++it3;
Map::iterator it4 = it3; ++it4;
Map::iterator it5 = it4; ++it5;
Map::iterator it6 = it5; ++it6;
BREAK_HERE;
// Expand map.
// Check map <6 items> stdmap::Map.
// Check map.11 11 float.
// Check it1.first 11 int.
// Check it1.second 11 float.
// Check it6.first 66 int.
// Check it6.second 66 float.
// Continue.
dummyStatement(&map, &it1, &it2, &it3, &it4, &it5, &it6);
}
void testStdUnorderedMapStringFloat()
{
std::unordered_map<std::string, float> map;
map["11.0"] = 11.0;
map["22.0"] = 22.0;
BREAK_HERE;
// Expand map map.0 map.1.
// Check map <2 items> std::unordered_map<QString, float>.
// Check map.0 std::pair<QString const, float>.
// Check map.0.first "11.0" QString.
// Check map.0.second 11 float.
// Check map.1 std::pair<QString const, float>.
// Check map.1.first "22.0" QString.
// Check map.1.second 22 float.
// Continue.
dummyStatement(&map);
}
void testStdUnorderedMapIntString()
{
std::unordered_map<int, QString> map;
map[11] = "11.0";
map[22] = "22.0";
BREAK_HERE;
// Expand map map.0 map.1.
// Check map <2 items> std::unordered_map<int, QString>.
// Check map.0 std::pair<int const, QString>.
// Check map.0.first 11 int.
// Check map.0.second "11.0" QString.
// Check map.1 std::pair<int const, QString>.
// Check map.1.first 22 int.
// Check map.1.second "22.0" QString.
// Continue.
dummyStatement(&map);
}
void testStdUnorderedMapStringPointer()
{
QObject ob;
std::unordered_map<std::string, QPointer<QObject> > map;
map["Hallo"] = QPointer<QObject>(&ob);
map["Welt"] = QPointer<QObject>(&ob);
map["."] = QPointer<QObject>(&ob);
BREAK_HERE;
// Expand map map.0 map.2.
// Check map <3 items> std::unordered_map<QString, QPointer<QObject>>.
// Check map.0 std::pair<QString const, QPointer<QObject>>.
// Check map.0.first "." QString.
// CheckType map.0.second QPointer<QObject>.
// Check map.2 std::pair<QString const, QPointer<QObject>>.
// Check map.2.first "Welt" QString.
// Continue.
dummyStatement(&map);
}
#endif
void testStdUnorderedMap()
{
#if USE_CXX11
testStdUnorderedMapStringFoo();
testStdUnorderedMapCharStarFoo();
testStdUnorderedMapUIntUInt();
testStdUnorderedMapUIntStringList();
testStdUnorderedMapUIntStringListTypedef();
testStdUnorderedMapUIntFloat();
testStdUnorderedMapUIntFloatIterator();
testStdUnorderedMapStringFloat();
testStdUnorderedMapIntString();
testStdUnorderedMapStringPointer();
#endif
}
} // namespace stdunorderedmap
namespace stdmap { namespace stdmap {
@@ -3068,6 +3283,24 @@ namespace stdptr {
} // namespace stdptr } // namespace stdptr
namespace lambda {
void testLambda()
{
#ifdef USE_CXX11
std::string x;
auto f = [&] () -> const std::string & {
int z = x.size();
return x;
};
auto c = f();
BREAK_HERE;
dummyStatement(&x, &f, &c);
#endif
}
} // namespace lambda
namespace stdset { namespace stdset {
void testStdSetInt() void testStdSetInt()
@@ -6853,12 +7086,14 @@ int main(int argc, char *argv[])
stdlist::testStdList(); stdlist::testStdList();
stdhashset::testStdHashSet(); stdhashset::testStdHashSet();
stdmap::testStdMap(); stdmap::testStdMap();
stdunorderedmap::testStdUnorderedMap();
stdset::testStdSet(); stdset::testStdSet();
stdstack::testStdStack(); stdstack::testStdStack();
stdstream::testStdStream(); stdstream::testStdStream();
stdstring::testStdString(); stdstring::testStdString();
stdvector::testStdVector(); stdvector::testStdVector();
stdptr::testStdPtr(); stdptr::testStdPtr();
lambda::testLambda();
qbytearray::testQByteArray(); qbytearray::testQByteArray();
qdatetime::testDateTime(); qdatetime::testDateTime();

View File

@@ -65,7 +65,7 @@ def main():
return return
# wait until search finished and verify search results # wait until search finished and verify search results
waitFor("searchFinished", 20000) waitFor("searchFinished", 20000)
validateSearchResult(18) validateSearchResult(14)
result = re.search("QmlApplicationViewer", str(editorWidget.plainText)) result = re.search("QmlApplicationViewer", str(editorWidget.plainText))
test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. " test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. "
"File with used text is opened.") "File with used text is opened.")

View File

@@ -34,24 +34,34 @@ import re
# test search in help mode and advanced search # test search in help mode and advanced search
searchKeywordDictionary={ "deployment":True, "deplmint":False, "build":True, "bld":False } searchKeywordDictionary={ "deployment":True, "deplmint":False, "build":True, "bld":False }
def __getSelectedText__(): def __getSelectedText__():
hv = findObject(":Qt Creator_Help::Internal::HelpViewer")
try: try:
selText = findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText selText = hv.selectedText
if className(selText) != 'instancemethod': if className(selText) != 'instancemethod':
return str(selText) return str(selText)
except: except:
pass pass
try: try:
hv = findObject(":Qt Creator_Help::Internal::HelpViewer")
selText = getHighlightsInHtml(str(hv.toHtml())) selText = getHighlightsInHtml(str(hv.toHtml()))
except: except:
test.warning("Could not get highlighted text.") test.warning("Could not get highlighted text.")
selText = '' selText = ''
return str(selText) return str(selText)
def __handleTextChanged__(obj): def __getUrl__():
global textHasChanged helpViewer = findObject(":Qt Creator_Help::Internal::HelpViewer")
textHasChanged = True try:
url = helpViewer.url
except:
try:
url = helpViewer.source
except:
return ""
if isQt4Build:
return str(url.toString())
return str(url.scheme) + "://" + str(url.host) + str(url.path)
def getHighlightsInHtml(htmlCode): def getHighlightsInHtml(htmlCode):
pattern = re.compile('color:#ff0000;">(.*?)</span>') pattern = re.compile('color:#ff0000;">(.*?)</span>')
@@ -60,16 +70,14 @@ def getHighlightsInHtml(htmlCode):
if curr.group(1) in res: if curr.group(1) in res:
continue continue
res += "%s " % curr.group(1) res += "%s " % curr.group(1)
test.log(res)
return res return res
def main(): def main():
global sdkPath, textHasChanged global sdkPath
noMatch = "Your search did not match any documents." noMatch = "Your search did not match any documents."
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
installLazySignalHandler(":Qt Creator_Help::Internal::HelpViewer", "textChanged()", "__handleTextChanged__")
addHelpDocumentation([os.path.join(sdkPath, "Documentation", "qt.qch")]) addHelpDocumentation([os.path.join(sdkPath, "Documentation", "qt.qch")])
# switch to help mode # switch to help mode
switchViewTo(ViewConstants.HELP) switchViewTo(ViewConstants.HELP)
@@ -98,13 +106,13 @@ def main():
test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits'," test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits',"
"str(findObject(':Hits_QLabel').text))", 2000), "str(findObject(':Hits_QLabel').text))", 2000),
"Verifying if search results found with 1+ hits for: " + searchKeyword) "Verifying if search results found with 1+ hits for: " + searchKeyword)
textHasChanged = False
selText = __getSelectedText__() selText = __getSelectedText__()
url = __getUrl__()
# click in the widget, tab to first item and press enter # click in the widget, tab to first item and press enter
mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton) mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton)
type(waitForObject(":Hits_QCLuceneResultWidget"), "<Tab>") type(waitForObject(":Hits_QCLuceneResultWidget"), "<Tab>")
type(waitForObject(":Hits_QCLuceneResultWidget"), "<Return>") type(waitForObject(":Hits_QCLuceneResultWidget"), "<Return>")
waitFor("textHasChanged or selText != __getSelectedText__()") waitFor("__getUrl__() != url or selText != __getSelectedText__()")
# verify if search keyword is found in results # verify if search keyword is found in results
test.verify(searchKeyword.lower() in __getSelectedText__().lower(), test.verify(searchKeyword.lower() in __getSelectedText__().lower(),
searchKeyword + " search result can be found") searchKeyword + " search result can be found")
@@ -138,12 +146,12 @@ def main():
mouseClick(resultsView, 1, 1, 0, Qt.LeftButton) mouseClick(resultsView, 1, 1, 0, Qt.LeftButton)
type(resultsView, "<Tab>") type(resultsView, "<Tab>")
type(resultsView, "<Return>") type(resultsView, "<Return>")
test.verify("printing" in str(findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText).lower(), test.verify("printing" in str(__getSelectedText__()).lower(),
"printing advanced search result can be found") "printing advanced search result can be found")
for i in range(2): for i in range(2):
type(resultsView, "<Tab>") type(resultsView, "<Tab>")
type(resultsView, "<Return>") type(resultsView, "<Return>")
test.verify("sql" in str(findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText).lower(), test.verify("sql" in str(__getSelectedText__()).lower(),
"sql advanced search result can be found") "sql advanced search result can be found")
# verify if simple search is properly disabled # verify if simple search is properly disabled
test.verify(findObject(":Qt Creator.Help_Search for:_QLineEdit").enabled == False, test.verify(findObject(":Qt Creator.Help_Search for:_QLineEdit").enabled == False,

View File

@@ -59,10 +59,8 @@ def main():
manualQModelIndex = getQModelIndexStr("text?='Qt Creator Manual *'", manualQModelIndex = getQModelIndexStr("text?='Qt Creator Manual *'",
":Qt Creator_QHelpContentWidget") ":Qt Creator_QHelpContentWidget")
doubleClick(manualQModelIndex, 5, 5, 0, Qt.LeftButton) doubleClick(manualQModelIndex, 5, 5, 0, Qt.LeftButton)
gettingStartedQModelIndex = getQModelIndexStr("text='Getting Started'", manualQModelIndex)
doubleClick(gettingStartedQModelIndex, 5, 5, 0, Qt.LeftButton)
mouseClick(waitForObject(getQModelIndexStr("text='Building and Running an Example'", mouseClick(waitForObject(getQModelIndexStr("text='Building and Running an Example'",
gettingStartedQModelIndex)), 5, 5, 0, Qt.LeftButton) manualQModelIndex)), 5, 5, 0, Qt.LeftButton)
# open bookmarks window # open bookmarks window
clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton"))
clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton"))

View File

@@ -88,8 +88,8 @@ def main():
waitFor('"Elapsed: 5" in str(elapsedLabel.text)', 20000) waitFor('"Elapsed: 5" in str(elapsedLabel.text)', 20000)
clickButton(stopButton) clickButton(stopButton)
if safeClickTab("JavaScript"): if safeClickTab("JavaScript"):
model = waitForObject(":JavaScript.QmlProfilerEventsTable_QmlProfiler::" model = findObject(":JavaScript.QmlProfilerEventsTable_QmlProfiler::"
"Internal::QV8ProfilerEventsMainView").model() "Internal::QV8ProfilerEventsMainView").model()
test.compare(model.rowCount(), 0) test.compare(model.rowCount(), 0)
if safeClickTab("Events"): if safeClickTab("Events"):
colPercent, colTotal, colCalls, colMean, colMedian, colLongest, colShortest = range(2, 9) colPercent, colTotal, colCalls, colMean, colMedian, colLongest, colShortest = range(2, 9)

View File

@@ -33,24 +33,28 @@ cloneUrl = "https://codereview.qt-project.org/p/qt-labs/jom"
cloneDir = "myCloneOfJom" cloneDir = "myCloneOfJom"
def verifyCloneLog(targetDir, canceled): def verifyCloneLog(targetDir, canceled):
# Expect fails because of QTCREATORBUG-10531
cloneLog = waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit") cloneLog = waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit")
waitFor('"The process terminated " in str(cloneLog.plainText)', 30000) finish = findObject(":Git Repository Clone.Finish_QPushButton")
test.verify(("Executing in " + targetDir + ":" in str(cloneLog.plainText)), waitFor("finish.enabled", 30000)
"Searching for target directory in clone log") test.xverify(("Executing in " + targetDir + ":" in str(cloneLog.plainText)),
test.verify((" ".join(["clone", cloneUrl, cloneDir]) in str(cloneLog.plainText)), "Searching for target directory in clone log")
"Searching for git parameters in clone log") test.xverify((" ".join(["clone", cloneUrl, cloneDir]) in str(cloneLog.plainText)),
test.verify(("Stopping..." in str(cloneLog.plainText)) ^ (not canceled), "Searching for git parameters in clone log")
"Searching for 'Stopping...' in clone log")
if canceled: if canceled:
test.xverify("Stopping..." in str(cloneLog.plainText),
"Searching for 'Stopping...' in clone log")
result = "The process terminated in an abnormal way." result = "The process terminated in an abnormal way."
summary = "Failed." summary = "Failed."
else: else:
test.verify(not "Stopping..." in str(cloneLog.plainText),
"Searching for 'Stopping...' in clone log")
test.verify(("'" + cloneDir + "'..." in str(cloneLog.plainText)), test.verify(("'" + cloneDir + "'..." in str(cloneLog.plainText)),
"Searching for clone directory in clone log") "Searching for clone directory in clone log")
result = "The process terminated with exit code 0." result = "The process terminated with exit code 0."
summary = "Succeeded." summary = "Succeeded."
test.verify((result in str(cloneLog.plainText)), test.xverify((result in str(cloneLog.plainText)),
"Searching for result (%s) in clone log:\n%s" "Searching for result (%s) in clone log:\n%s"
% (result, str(cloneLog.plainText))) % (result, str(cloneLog.plainText)))
test.compare(waitForObject(":Git Repository Clone.Result._QLabel").text, summary) test.compare(waitForObject(":Git Repository Clone.Result._QLabel").text, summary)