From da7f8a556c122a31daa11f434d67c8bb96cbd5ec Mon Sep 17 00:00:00 2001 From: Roland Wolf Date: Thu, 29 Jul 2010 13:51:27 +0200 Subject: moving over work from 28b49e42f5bddec2d62e957f158cb848da134db8 --- doc/src/tutorials/modelview.qdoc | 661 +++++++++++---------- .../tutorials/modelview/1_readonly/1_readonly.pro | 13 +- examples/tutorials/modelview/1_readonly/main.cpp | 9 +- .../tutorials/modelview/1_readonly/modelview.cpp | 54 -- .../tutorials/modelview/1_readonly/modelview.h | 61 -- .../tutorials/modelview/1_readonly/mymodel.cpp | 0 examples/tutorials/modelview/1_readonly/mymodel.h | 0 .../modelview/2_formatting/2_formatting.pro | 12 +- examples/tutorials/modelview/2_formatting/main.cpp | 12 +- .../tutorials/modelview/2_formatting/modelview.cpp | 52 -- .../tutorials/modelview/2_formatting/modelview.h | 57 -- .../tutorials/modelview/2_formatting/mymodel.cpp | 6 +- .../tutorials/modelview/2_formatting/mymodel.h | 0 .../modelview/3_changingmodel/3_changingmodel.pro | 12 +- .../tutorials/modelview/3_changingmodel/main.cpp | 0 .../modelview/3_changingmodel/modelview.cpp | 52 -- .../modelview/3_changingmodel/modelview.h | 57 -- .../modelview/3_changingmodel/mymodel.cpp | 0 .../tutorials/modelview/3_changingmodel/mymodel.h | 2 +- .../tutorials/modelview/4_headers/4_headers.pro | 14 +- examples/tutorials/modelview/4_headers/main.cpp | 0 .../tutorials/modelview/4_headers/modelview.cpp | 54 -- examples/tutorials/modelview/4_headers/modelview.h | 58 -- examples/tutorials/modelview/4_headers/mymodel.cpp | 0 examples/tutorials/modelview/4_headers/mymodel.h | 0 examples/tutorials/modelview/5_edit/5_edit.pro | 12 +- examples/tutorials/modelview/5_edit/main.cpp | 4 +- examples/tutorials/modelview/5_edit/modelview.cpp | 60 -- examples/tutorials/modelview/5_edit/modelview.h | 59 -- examples/tutorials/modelview/5_edit/mymodel.cpp | 40 +- examples/tutorials/modelview/5_edit/mymodel.h | 9 +- .../tutorials/modelview/6_treeview/6_treeview.pro | 12 +- examples/tutorials/modelview/6_treeview/main.cpp | 4 +- .../tutorials/modelview/6_treeview/modelview.cpp | 82 --- .../tutorials/modelview/6_treeview/modelview.h | 65 -- .../modelview/7_selections/7_selections.pro | 12 +- examples/tutorials/modelview/7_selections/main.cpp | 4 +- .../tutorials/modelview/7_selections/modelview.cpp | 107 ---- .../tutorials/modelview/7_selections/modelview.h | 64 -- examples/tutorials/modelview/modelview.pro | 10 +- 40 files changed, 485 insertions(+), 1245 deletions(-) mode change 100755 => 100644 doc/src/tutorials/modelview.qdoc mode change 100644 => 100755 examples/tutorials/modelview/1_readonly/1_readonly.pro mode change 100644 => 100755 examples/tutorials/modelview/1_readonly/main.cpp delete mode 100644 examples/tutorials/modelview/1_readonly/modelview.cpp delete mode 100644 examples/tutorials/modelview/1_readonly/modelview.h mode change 100644 => 100755 examples/tutorials/modelview/1_readonly/mymodel.cpp mode change 100644 => 100755 examples/tutorials/modelview/1_readonly/mymodel.h mode change 100644 => 100755 examples/tutorials/modelview/2_formatting/2_formatting.pro mode change 100644 => 100755 examples/tutorials/modelview/2_formatting/main.cpp delete mode 100644 examples/tutorials/modelview/2_formatting/modelview.cpp delete mode 100644 examples/tutorials/modelview/2_formatting/modelview.h mode change 100644 => 100755 examples/tutorials/modelview/2_formatting/mymodel.cpp mode change 100644 => 100755 examples/tutorials/modelview/2_formatting/mymodel.h mode change 100644 => 100755 examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro mode change 100644 => 100755 examples/tutorials/modelview/3_changingmodel/main.cpp delete mode 100644 examples/tutorials/modelview/3_changingmodel/modelview.cpp delete mode 100644 examples/tutorials/modelview/3_changingmodel/modelview.h mode change 100644 => 100755 examples/tutorials/modelview/3_changingmodel/mymodel.cpp mode change 100644 => 100755 examples/tutorials/modelview/3_changingmodel/mymodel.h mode change 100644 => 100755 examples/tutorials/modelview/4_headers/4_headers.pro mode change 100644 => 100755 examples/tutorials/modelview/4_headers/main.cpp delete mode 100644 examples/tutorials/modelview/4_headers/modelview.cpp delete mode 100644 examples/tutorials/modelview/4_headers/modelview.h mode change 100644 => 100755 examples/tutorials/modelview/4_headers/mymodel.cpp mode change 100644 => 100755 examples/tutorials/modelview/4_headers/mymodel.h mode change 100644 => 100755 examples/tutorials/modelview/5_edit/5_edit.pro mode change 100644 => 100755 examples/tutorials/modelview/5_edit/main.cpp delete mode 100644 examples/tutorials/modelview/5_edit/modelview.cpp delete mode 100644 examples/tutorials/modelview/5_edit/modelview.h mode change 100644 => 100755 examples/tutorials/modelview/5_edit/mymodel.cpp mode change 100644 => 100755 examples/tutorials/modelview/5_edit/mymodel.h mode change 100644 => 100755 examples/tutorials/modelview/6_treeview/6_treeview.pro mode change 100644 => 100755 examples/tutorials/modelview/6_treeview/main.cpp delete mode 100644 examples/tutorials/modelview/6_treeview/modelview.cpp delete mode 100644 examples/tutorials/modelview/6_treeview/modelview.h mode change 100644 => 100755 examples/tutorials/modelview/7_selections/7_selections.pro mode change 100644 => 100755 examples/tutorials/modelview/7_selections/main.cpp delete mode 100644 examples/tutorials/modelview/7_selections/modelview.cpp delete mode 100644 examples/tutorials/modelview/7_selections/modelview.h mode change 100644 => 100755 examples/tutorials/modelview/modelview.pro diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc old mode 100755 new mode 100644 index 98096a0..f771726 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -34,46 +34,118 @@ \title Model/View Contents \brief An introduction to ModelView programming - This tutorial gives an introduction to ModelView programming using the Qt - cross-platform framework. + Every UI developer should know about ModelView programming and the goal of this tutorial is to provide you with an easily understandable introduction to this topic. - \image treeview.png +\raw HTML +
+\endraw +\raw HTML + + + + + + + +
+\endraw + +Table, list and tree widgets are components frequently used in GUIs. There are 2 different ways how these widgets can access their data. The traditional way involves widgets which include internal containers for storing data. This approach is very intuitive, however, in many non-trivial applications, it leads to data synchronization issues. The second approach is modelview programming, in which widgets do not maintain internal data containers. They access external data through a standardized interface and therefore avoid data dupplication. This may seem complicated at first, but once you take a closer look, it is not only easy to grasp, but the many benefits of modelview programming also become clearer. + +\raw HTML + +\endraw + +\raw HTML + + +
+\endraw + +\raw HTML +

Contents:

+\endraw + + \list 1 + \o \l{modelview-part1.html}{Introduction} + \o \l{modelview-part2.html}{Developing a Simple Model/View Application} + \o \l{modelview-part3.html}{Intermediate Topics} + \o \l{modelview-part4.html}{Good Sources of Additional Information} + \endlist + +\raw HTML +
+\endraw + + +\raw HTML +
+\endraw + \raw HTML +

+ \endraw \omit It doesn't cover everything; the emphasis is on teaching the programming philosophy of Model/View programming, and Qt's features are introduced as needed. Some commonly used features are never used in this tutorial. \endomit - In the process, we will learn about some basic technologies provided by Qt, - such as: + In the process, we will learn about some basic technologies provided by Qt, such as: \list \o The difference between standard and model/view widgets \o Adapters betweeen forms and models \o Developing a simple model/view application + \o Predefined models \o Intermediate topics such as: \list \o Tree views \o Selection - \o Predefined models \o Delegates \o Debugging with model test \endlist \endlist + - If you are completely new to Qt, please read \l{How to Learn Qt} if you - have not already done so. + \raw HTML +
+ \endraw + You will also learn whether your new application can be written easier with ModelView programming or if classic widgets will work just as well. + \raw HTML +
+ \endraw + This tutorial includes example code for you to edit and integrate into your project. The tutorial's source code is located in Qt's \c examples/tutorials/modelview directory. - The tutorial's source code is located in Qt's \c examples/tutorials/modelview - directory. + \raw HTML +
+ \endraw + For more detailed information you may also want to look at the \l {model-view-programming.html}{reference documentation} - \list 1 - \o \l{modelview-part1.html}{Introduction} - \o \l{modelview-part2.html}{Developing a Simple Model/View Application} - \o \l{modelview-part3.html}{Intermediate Topics} - \o \l{modelview-part4.html}{Good Sources of Additional Information} - \endlist + +\raw HTML +
+\endraw + + \raw HTML +

+ \endraw + + + + \image treeview.png + + +\raw HTML +
+\endraw + + + + \raw HTML +
+ \endraw + If you are completely new to Qt, please read \l{How to Learn Qt} if you have not already done so. */ @@ -84,13 +156,12 @@ \previouspage {modelview-index.html}{Model/View Contents} \nextpage {modelview-part2.html}{Developing a Simple Model/View Application} \title An Introduction to Model/View Programming - + \raw HTML +
+ \endraw \section1 1. Introduction - Model/View is a technology used to separate data from views in widgets that - handle data sets. Standard widgets are not designed for separating data - from views and this is why Qt 4 has two different types of widgets. Both - types of widgets look the same, but they interact with data differently. + Model/View is a technology used to separate data from views in widgets that handle data sets. Standard widgets are not designed for separating data from views and this is why Qt 4 has two different types of widgets. Both types of widgets look the same, but they interact with data differently. \table \row @@ -103,43 +174,22 @@ \section2 1.1 Standard Widgets - Let's have a closer look at a standard table widget. A table widget is a 2D - array of the data elements that the user can change. The table widget can - be integrated into a program flow by reading and writing the data elements - that the table widget provides. This method is very intuitive and useful in - many applications. + Let's have a closer look at a standard table widget. A table widget is a 2D array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. This method is very intuitive and useful in many applications. - Displaying and editing a database table with a standard table widget can be - problematic. Two copies of the data have to be coordinated: one outside the - widget; one inside the widget. The developer needs to know where up-to-date - data is so the both copies contain the most recent data. The tight coupling - of presentation and data makes it harder to write unit tests. + Displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the widget; one inside the widget. The developer is responsible for synchronizing both versions. The tight coupling of presentation and data makes it harder to write unit tests. \section2 1.2 Model/View to the Rescue - Model/view stepped up to provide a solution that uses a more versatile - architecture. Model/view eliminates the data consistency problems that may - occur with standard widgets. Model/view also makes it easier to use more - than one view of the same data because one model can be passed on to many - views. The most important difference is that model/view widgets do not - store data behind the table cells. In fact, they operate directly from your - data. Since view classes do not know your data's structure, you need to - provide a wrapper to make your data conform to the QAbstractItemModel - interface. A view uses this interface to read from and write to your data - and any class that implements QAbstractItemModel is a model. Once the view - receives a pointer to a model, it will read and display its content and be - its editor. + Model/view stepped up to provide a solution that uses a more versatile architecture. Model/view eliminates the data consistency problems that may occur with standard widgets. Model/view also makes it easier to use more than one view of the same data because one model can be passed on to many views. The most important difference is that model/view widgets do not store data behind the table cells. In fact, they operate directly from your data. Since view classes do not know your data's structure, you need to provide a wrapper to make your data conform to the QAbstractItemModel interface. A view uses this interface to read from and write to your data. Any instance of a class that implements QAbstractItemModel is said to be a model. Once the view receives a pointer to a model, it will read and display its content and be its editor. \section2 1.3 Overview of the Model/View Widgets - Here is an overview of the model/view widgets and their corresponding - standard widgets. + Here is an overview of the model/view widgets and their corresponding standard widgets. \table \header \o Widget - \o Standard Widget (a convenience class with data in - the widget) + \o Standard Widget (an item based convenience class) \o Model/View View Class (for use with external data) \row \o \inlineimage listview.png @@ -167,23 +217,37 @@ Having adapters between forms and models can come in handy. - We often prefer editing data stored in tables (e.g. in database tables) in - forms rather than in tables. There is no direct model/view counterpart for - separating data and views for widgets that operate on one value instead of - a dataset, so we need an adapter in order to connect the form to the source - of data. + We can edit data stored in tables directly from within the table itself, but it's much more comfortable to edit data in text fields. There is no direct model/view counterpart that separates data and views for widgets that operate on one value (QLineEdit, QCheckBox ...) instead of a dataset, so we need an adapter in order to connect the form to the source of data. - \l QDataWidgetMapper is a great solution because it maps form widgets to a - table row and it makes it very easy to build forms for database tables. + \l QDataWidgetMapper is a great solution because it maps form widgets to a table row and makes it very easy to build forms for database tables. \image widgetmapper.png - - Another example of an adapter is QCompleter. Qt has QCompleter for - providing auto-completions in Qt widgets such as QComboBox and, as shown - below, QLineEdit. QCompleter uses a model as its data source, so QCompleter, - in itself, is a very handy adapter. + + Another example of an adapter is \l QCompleter. Qt has \l QCompleter for providing auto-completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source. \image qcompleter.png + + +\raw HTML +
+
+
+
+
+\endraw + +\raw HTML +

+previous page +

+\endraw + +\raw HTML +

+next page +

+\endraw + */ /*! @@ -198,165 +262,143 @@ \previouspage {modelview-part1.html}{Introduction} \nextpage {modelview-part3.html}{Intermediate Topics} \title Model/View Chapter 2 - A Simple Model/View Application - + \raw HTML +
+ \endraw \section1 2. A Simple Model/View Application + If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. - If you want to develop a model/view application, where should you start? We - recommend starting with a simple example and extending it step-by-step. - This makes understanding the architecture a lot easier. Trying to - understand the model/view architecture in detail before invoking the IDE - has proven to be less convenient for many developers. It is substantially - easier to start with a simple model/view application that has demo data. - Give it a try! Simply replace the data in the examples below with your own. - - Below are 7 very simple and independent applications that show different - sides of model/view programming. The source code can be found inside the - \c{examples/tutorials/modelview} directory. + Below are 7 very simple and independent applications that show different sides of model/view programming. The source code can be found inside the \c{examples/tutorials/modelview} directory. \section2 2.1 A Read Only Table - - We start with an application that uses a QTableView to show data. We will - add editing capabilities later. - + We start with an application that uses a QTableView to show data. We will add editing capabilities later. + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/1_readonly/main.cpp) \snippet examples/tutorials/modelview/1_readonly/main.cpp Quoting ModelView Tutorial We have the usual \l {modelview-part2-main-cpp.html}{main()} function: - \snippet examples/tutorials/modelview/1_readonly/modelview.h Quoting ModelView Tutorial - - The application is a \l QMainWindow that holds a \l QTableView. - - \snippet examples/tutorials/modelview/1_readonly/modelview.cpp Quoting ModelView Tutorial - - Here is the interesting part: We use - \l{QTableView::setModel()}{tableView->setModel(new MyModel(this));} to - instantiate the Model and pass its pointer to \l {QTableView}{tableView()}. - \l{QTableView}{tableView} will invoke the methods of the pointer it has - received to find out two things: + \raw HTML +
+ \endraw + + Here is the interesting part: We create an instance of MyModel and use \l{QTableView::setModel()}{tableView.setModel( &myModel );} to pass a pointer of it to to \l {QTableView}{tableView}. \l{QTableView}{tableView} will invoke the methods of the pointer it has received to find out two things: \list \o How many rows and columns should be displayed \o What content should be printed into each cell. \endlist - The model needs some code to respond to this. + The model needs some code to respond to this. - We have a table data set, so let's start with QAbstractTableModel since it - is easier to use. + We have a table data set, so let's start with QAbstractTableModel since it is easier to use than the more general QAbstractItemModel. + + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/1_readonly/mymodel.h) \snippet examples/tutorials/modelview/1_readonly/mymodel.h Quoting ModelView Tutorial QAbstractTableModel requires the implementation of three abstract methods. + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/1_readonly/mymodel.cpp) \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp Quoting ModelView Tutorial - The number of rows and columns is set by - \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and - \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. - When the view has to know what the cell's text is, it calls the method. - Row and column information is specified with parameter \c index and the - role is set to \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are - covered in the next section. In our example, the data that should be - displayed is generated. In a real application, \c MyModel would have a - member called \c MyData, which serves as the target for all reading and - writing operations. - - This small example demonstrates the passive nature of a model. The model - does not know when it will be used or which data is needed. It simply - provides data each time the view requests it. - - What happens when the model 's data needs to be changed? How does the view - know when data changes and needs to be read again? The model has to emit a - signal that indicates what range of cells has changed. This will be - demonstrated in section 2.3. + The number of rows and columns is provided by \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. When the view has to know what the cell's text is, it calls the method \l{QAbstractItemModel::data()}{MyModel::data()}. Row and column information is specified with parameter \c index and the role is set to \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. + + This small example demonstrates the passive nature of a model. The model does not know when it will be used or which data is needed. It simply provides data each time the view requests it. + + What happens when the model 's data needs to be changed? How does the view realize that data has changed and needs to be read again? The model has to emit a signal that indicates what range of cells has changed. This will be demonstrated in section 2.3. \section2 2.2 Extending the Read Only Example with Roles - In addition to controlling what text the view displays, the model also - controls the text's appearance. When we slightly change the model, we get - the following result: \image readonlytable_role.png + In addition to controlling what text the view displays, the model also controls the text's appearance. When we slightly change the model, we get the following result: \image readonlytable_role.png + + In fact, nothing except for the \l{QAbstractItemModel::}{data()} method needs to be changed to set fonts, background colour, alignment and a checkbox. Below is the \l{QAbstractItemModel::data()}{data()} method that produces the result shown above. The difference is that this time we use parameter int role to return different pieces of information depending on its value. - In fact, nothing except for the \l{QAbstractItemModel::}{data()} - method needs to be changed to set fonts, background colour, alignment and a - checkbox. - Here is the \l{QAbstractItemModel::data()}{data()} method that produces the - result shown above: + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/2_formatting/mymodel.cpp) \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp Quoting ModelView Tutorial - Each formatting property will be requested from the model with a separate - call to the \l{QAbstractItemModel::data()}{data()} method. The \c role - parameter is used to let the model know which property is being requested: + Each formatting property will be requested from the model with a separate call to the \l{QAbstractItemModel::data()}{data()} method. The \c role parameter is used to let the model know which property is being requested: \table \header - \o Role (enum Qt::ItemDataRole ) + \o \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} \o Meaning \o Type \row - \o \l{Qt::ItemDataRole}{Qt::DisplayRole} + \o \l{Qt::ItemDataRole}{}Qt::DisplayRole \o text \o QString \row - \o Qt::FontRole + \o \l{Qt::ItemDataRole}{Qt::FontRole} \o font \o QFont \row - \o Qt::BackgroundRole + \o \l{Qt::ItemDataRole}{BackgroundRole} \o brush for the background of the cell \o QBrush \row - \o Qt::TextAlignmentRole + \o \l{Qt::ItemDataRole}{Qt::TextAlignmentRole} \o text alignment - \o enum Qt::AlignmentFlag - \row - \o {1, 3} Qt::CheckStateRole - \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()}, - sets checkboxes with Qt::Checked or Qt::Unchecked - \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} + \o \l{Qt::AlignmentFlag-enum}{enum Qt::AlignmentFlag} + \row + \o {1, 3} \l{Qt::ItemDataRole}{Qt::CheckStateRole} + \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()}, + + sets checkboxes with \l{Qt::CheckState-enum}{Qt::Checked} + + or \l{Qt::CheckState-enum}{Qt::Unchecked} + \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} \endtable - Refer to the Qt namespace documentation to learn more about the - Qt::ItemDataRole enum's capabilities. - - Now we need to determine how using a seperated model impacts the - application's performance, so let's trace how often the view calls the - \l{QAbstractItemModel::}{data()} method. In order to track how often - the view calls the model, we have put a debug statement in the - \l{QAbstractItemModel::}{data()} method, which logs onto stdio. In - our small example, \l{QAbstractItemModel::}{data()} will be called 42 - times. - Each time you hover the cursor over the field, - \l{QAbstractItemModel::}{data()} will be called again \mdash 7 times for - each cell. That's why it is important to make sure that your data is - available when \l{QAbstractItemModel::}{data()} is invoked and expensive - lookup operations are cached. + Refer to the Qt namespace documentation to learn more about the \l{Qt::ItemDataRole}{Qt::ItemDataRole} enum's capabilities. + + Now we need to determine how using a separated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::}{data()} will be called 42 times. + Each time you hover the cursor over the field, \l{QAbstractItemModel::}{data()} will be called again \mdash 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::}{data()} is invoked and expensive lookup operations are cached. \section2 2.3 A Clock inside a Table Cell \image clock.png - We still have a read only table, but this time the content changes every - second because we are showing the current time. + We still have a read only table, but this time the content changes every second because we are showing the current time. + + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_QVariant - Something is missing to make the clock tick. We need to tell the view every - second that the time has changed and that it needs to be read again. We do - this with a timer. In the constructor, we set its interval to 1 second and - connect its timeout signal. + Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and connect its timeout signal. + + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_a Here is the corresponding slot: + + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_b - We ask the view to read the data in the top left cell again by emitting the - \l{QAbstractItemModel::}{dataChanged()} signal. Note that we did not - explicitly connect the \l{QAbstractItemModel::}{dataChanged()} signal to - the view. This happened automatically when we called - \l{QTableView::}{setModel()}. + We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::}{dataChanged()} signal to the view. This happened automatically when we called \l{QTableView::}{setModel()}. \section2 2.4 Setting up Headers for Columns and Rows @@ -366,52 +408,75 @@ The header content, however, is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: - \snippet examples/tutorials/modelview/4_headers/mymodel.cpp quoting mymodel_c + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/4_headers/mymodel.cpp) + \snippet examples/tutorials/modelview/4_headers/mymodel.cpp quoting mymodel_c + Note that method \l{QAbstractItemModel::headerData()}{headerData()} also has a parameter role which has the same meaning as in \l{QAbstractItemModel::data()}{MyModel::data()}. \section2 2.5 The Minimal Editing Example - In this example, we are going to build an application that automatically - populates a window title with content by repeating values entered into - table cells. + In this example, we are going to build an application that automatically populates a window title with content by repeating values entered into table cells. To be able to access the window title easily we put the QTableView in a QMainWindow. - The model decides whether editing capabilities are available . We only have - to modify the model in order for the available editing capabilities to be - enabled. This is done by reimplementing the following virtual methods: - \l{QAbstractItemModel::}{setData()} and \l{QAbstractItemModel::}{flags()}. + The model decides whether editing capabilities are available . We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::}{setData()} and \l{QAbstractItemModel::}{flags()}. - \snippet examples/tutorials/modelview/5_edit/mymodel.h Quoting ModelView Tutorial - We use \c QStringList m_gridData to store our data. This makes - \c m_gridData the core of MyModel. The rest of \c MyModel acts like a - wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We - have also introduced the \c editCompleted() signal, - which makes it possible to transfer the modified text to the window title. - \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_d + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/5_edit/mymodel.h) + \snippet examples/tutorials/modelview/5_edit/mymodel.h Quoting ModelView Tutorial - In the constructor, we fill \c QStringList gridData with 6 items (one item - for every field in the table): + We use \c the two-dimensional array QString m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \c editCompleted() signal, which makes it possible to transfer the modified text to the window title. + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/5_edit/mymodel.cpp) \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_e - \l{QAbstractItemModel::setData()}{setData()} will be called each time the - user edits a cell. The \c index parameter tells us which field has been - edited and \c value provides the result of the editing process. The role - will always be set to \c Qt::EditRole because our cells only contain text. - If a checkbox were present and user permissions are set to allow the - checkbox to be selected, calls would also be made with the role set to - \c Qt::CheckStateRole. + \l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. + + + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/5_edit/mymodel.cpp) \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_f - Various properties of a cell can be adjusted with - \l{QAbstractItemModel::flags()}{flags()}. Returning - \c Qt::ItemIsEditable | \c Qt::ItemIsEnabled is enough to show an editor - that a cell has been selected. If editing one cell modifies more data than - the data in that particular cell, the model must emit a - \l{QAbstractItemModel::}{dataChanged()} signal in order for the data that - has been changed to be read. + Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. + + \raw HTML +

Returning Qt::ItemIsEditable | Qt::ItemIsEnabled is enough to show an editor that a cell has been selected.

+ \endraw + If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. + + + +\raw HTML +
+
+
+
+
+\endraw + +\raw HTML +

+previous page +

+\endraw + +\raw HTML +

+next page +

+\endraw + */ /*! @@ -420,21 +485,20 @@ \previouspage {modelview-part2.html}{Developing a Simple Model/View Application} \nextpage {modelview-part4.html}{Good Sources of Additional Information} \title Model/View Chapter 3 - Intermediate Topics - +\raw HTML +
+\endraw \section1 3. Intermediate Topics - +\raw HTML +
+\endraw \section2 3.1 TreeView - You can convert the example above into an application with a tree view. - Simply replace QTableView with QTreeView, which results in a read/write - tree. No changes have to be made to the model. The tree won't have any - hierarchies because there aren't any hierarchies in the model itself. + You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. \image dummy_tree.png - QListView, QTableView and QTreeView all use a model abstraction, which is a - merged list, table and tree. This makes it possible to use several different - types of view classes from the same model. + QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. \image list_table_tree.png @@ -442,21 +506,17 @@ \image example_model.png - We want to present a real tree. We have wrapped our data in the examples - above in order to make a model. This time we use QStandardItemModel, which - is a container for hierarchical data that also implements - QAbstractItemModel. To show a tree, QStandardItemModel must be populated - with \l{QStandardItem}{QStandardItems}, which are able to hold all the - standard properties of items like text, fonts, checkboxes or brushes. - \image tree_2_with_algorithm.png + We want to present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with \l{QStandardItem}{QStandardItems}, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png + + + \raw HTML +
+ \endraw + (file source: examples/tutorials/modelview/6_treeview/mainwindow.cpp) - \snippet examples/tutorials/modelview/6_treeview/modelview.cpp Quoting ModelView Tutorial + \snippet examples/tutorials/modelview/6_treeview/mainwindow.cpp Quoting ModelView Tutorial - We simply instantiate a QStandardItemModel and add a couple of - \l{QStandardItem}{QStandardItems} to the constructor. We can then make a - hierarchical data structure because a QStandardItem can hold other - \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within - the view. + We simply instantiate a QStandardItemModel and add a couple of \l{QStandardItem}{QStandardItems} to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within the view. \section2 3.2 Working with Selections @@ -466,38 +526,29 @@ So let's create a couple of items: - \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_a - Views manage selections within a separate selection model, which can be - retrieved with the \l{QAbstractItemView::}{selectionModel()} - method. We retrieve the selection Model in order to connect a slot to its - \l{QAbstractItemView::}{selectionChanged()} signal. + \raw HTML +
+

(file source: examples/tutorials/modelview/7_selections/mainwindow.cpp)

+ \endraw + \snippet examples/tutorials/modelview/7_selections/mainwindow.cpp quoting modelview_a + + Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemView::}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemView::}{selectionChanged()} signal. + - \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_b + \raw HTML +
+

(file source: examples/tutorials/modelview/7_selections/mainwindow.cpp)

+ \endraw + \snippet examples/tutorials/modelview/7_selections/mainwindow.cpp quoting modelview_b - We get the model index that corresponds to the selection by calling - \l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} - and we get the the field's string by using the model index. Then we just - calculate the item's \c hierarchyLevel. Top level items do not have - parents and the \l{QAbstractItemModel::}{parent()} method will return a - default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the - \l{QAbstractItemModel::}{parent()} method to iterate to the top level while - counting the steps performed during iteration. + We get the model index that corresponds to the selection by calling \l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::}{parent()} method will return a default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the \l{QAbstractItemModel::}{parent()} method to iterate to the top level while counting the steps performed during iteration. - The selection model (as shown above) can be retrieved, but it can also be - set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This - is how it's possible to have 3 view classes with synchronised selections - because only one instance of a selection model is used. The instance of a - selection model is retrieved from the first view class with - \l{QAbstractItemView::}{selectionModel()} and the result is assigned to the - second and third view class with \l{QAbstractItemView::}{setSelectionModel()}. + The selection model (as shown above) can be retrieved, but it can also be set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. To share a selection model between 3 views use \l{QAbstractItemView::}{selectionModel()} and assign the result to the second and third view class with \l{QAbstractItemView::}{setSelectionModel()}. \section2 3.3 Predefined Models - The typical way to use model/view is to wrap specific data to make it - usable with view classes. Qt, however, also provides predefined models for - common underlying data structures. If one of the available data structures - is suitable for your application, a predefined model can be a good choice. + The typical way to use model/view is to wrap specific data to make it usable with view classes. Qt, however, also provides predefined models for common underlying data structures. If one of the available data structures is suitable for your application, a predefined model can be a good choice. \table \row @@ -527,23 +578,14 @@ \section2 3.4 Delegates - In all examples so far, data is presented as text or a checkbox in a cell - and is edited as text or a checkbox. The component that provides these - presentation and editing services is called a \e delegate. We are only just - beginning to work with the delegate because the view uses a default - delegate. But imagine that we want to have a different editor.(e.g. a - slider or a drop down list) Or imagine that we want to present data as - graphics. Let's take a look at an example called - \l{Star Delegate Example}{Star Delegate}, in which stars are used to show - a rating: + In all examples so far, data is presented as text or a checkbox in a cell and is edited as text or a checkbox. The component that provides these presentation and editing services is called a \e delegate. We are only just beginning to work with the delegate because the view uses a default delegate. But imagine that we want to have a different editor.(e.g. a slider or a drop down list) Or imagine that we want to present data as graphics. Let's take a look at an example called \l{Star Delegate Example}{Star Delegate}, in which stars are used to show a rating: + \raw HTML +

+ (Star Delegate Example)

+ \endraw \image stardelegate.png - The view has a method that replaces the default delegate and installs a - custom delegate. This method is called - \l{QAbstractItemView::}{setItemDelegate()}. A new delegate can be written - by creating a class that inherits from QStyledItemDelegate. In order to - write a delegate that displays stars and has no input capabilities, we only - need to overwrite 2 methods. + The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemView::}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. \code class StarDelegate : public QStyledItemDelegate @@ -558,36 +600,31 @@ }; \endcode - \l{QStyledItemDelegate::}{paint()} draws stars depending on the content - of the underlying data. The data can be looked up with parameter - \l{QModelIndex::data()}{index.data()}. - \l{QAbstractItemDelegate::}{sizeHint()} specifies each star's dimensions - so the the cell will provide enough height and width to accommodate the - stars. + \l{QStyledItemDelegate::}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \l{QModelIndex::data()}{index.data()}. \l{QAbstractItemDelegate::}{sizeHint()} specifies each star's dimensions so the the cell will provide enough height and width to accommodate the stars. + + Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you would not use a custom delegate but a custom view class. + +Other references to delegates in Qt Documentation: +\raw HTML +

+Spin Box Delegate Example
+QAbstractItemDelegate Class Reference
+QSqlRelationalDelegate Class Reference
+QStyledItemDelegate Class Reference
+QItemDelegate Class Reference
+

+

+\endraw + - Writing custom delegates is the right choice if you want to show your data - with a custom graphical representation inside the grid of the view class. - If you want to leave the grid, you can write a custom view class. \section2 3.5 Debugging with ModelTest - The passive nature of models provides new challenges for programmers. - Inconsistencies in the model can cause the application to crash. Since the - model is hit by numerous calls from the view, it is hard to find out which - call has crashed the application and which operation has introduced the - problem. + The passive nature of models provides new challenges for programmers. Inconsistencies in the model can cause the application to crash. Since the model is hit by numerous calls from the view, it is hard to find out which call has crashed the application and which operation has introduced the problem. - Qt provides software called - \l{http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest}{ModelTest}, - which checks models while your programming is running. Every time the model - is changed, ModelTest scans the model and reports errors with an assert. - This is especially important for tree models, since their hierarchical - nature leaves many possibilities for subtle inconsistencies. + Qt provides software called \l{http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest}{ModelTest}, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical nature leaves many possibilities for subtle inconsistencies. - Unlike view classes, ModelTest uses out of range indexes to test the model. - This means your application may crash with ModelTest even if it runs - perfectly without it. So you also need to handle all of the indexes that - are out of range when using ModelTest. + Unlike view classes, ModelTest uses out of range indexes to test the model. This means your application may crash with ModelTest even if it runs perfectly without it. So you also need to handle all of the indexes that are out of range when using ModelTest. \section2 3.6 Model/View NG @@ -601,25 +638,23 @@ \endraw - Model/View was introduced in Qt 4.0 and is a frequently used technology. - Feedback from developers and new development trends have shown that there - is a need to further develop the model/view technology. Therefore a - research project originated at Nokia is looking into ways to go beyond the - current implementation. - - One limitation of model/view is that view classes are basically all fixed - grids. It is possible, but really hard to make a list view with icons - placed on a curve; or cells expanding on mouse over events to show - additional information. - In order to achieve graphically rich view experiences, Model/View NG will - use QGraphicsView to render elements. Nodel/View NG also aims to make - model/view programming more intuitive. One way to achieve this is to have - separate models for lists, tables and trees. The current model abstraction - is complex because it is capable of representing a list, a table or a tree. - - Model/View NG is a research project. You are welcome to checkout the source - code, monitor progress and take part in discussions at the following - address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} + Model/View was introduced in Qt 4.0 and is a frequently used technology. Feedback from developers and new development trends have shown that there is a need to further develop the model/view technology. Therefore a research project originated at Nokia is looking into ways to go beyond the current implementation. + \raw HTML +

+ \endraw + One limitation of model/view is that view classes are basically all fixed grids. It is possible, but really hard to make a list view with icons placed on a curve; or cells expanding on mouse over events to show additional information. In order to achieve graphically rich view experiences, Model/View NG will use QGraphicsView to render elements. Nodel/View NG also aims to make model/view programming more intuitive. One way to achieve this is to have separate models for lists, tables and trees. The current model abstraction is complex because it is capable of representing a list, a table or a tree. + \raw HTML +

+ \endraw + Model/View NG is a research project. You are welcome to checkout the source code, monitor progress and take part in discussions at the following address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} + + + + +\raw HTML +

+\endraw + \raw HTML @@ -630,6 +665,26 @@ \raw HTML \endraw + +\raw HTML +
+
+
+
+\endraw + + +\raw HTML +

+previous page +

+\endraw + +\raw HTML +

+last page +

+\endraw */ /*! @@ -637,9 +692,13 @@ \contentspage {modelview-index.html}{Model/View Contents} \previouspage {modelview-part3.html}{Intermediate Topics} \title Model/View Chapter 4 - Good Sources of Additional Information - +\raw HTML +
+\endraw \section1 4. Good Sources of Additional Information - +\raw HTML +
+\endraw \section2 4.1 Books Model/View programming is covered quite extensively in the documentation of @@ -657,12 +716,9 @@ \o \bold{Foundations of Qt Development} / Johan Thelin, \e{Apress}, ISBN 1-59059-831-8. \endlist - More information about these books is available on the - \l{Books about Qt Programming}{Qt Web site}. + More information about these books is available on the \l{Books about Qt Programming}{Qt Web site}. - The following list provides an overview of example programs contained in the - books above. Some of them make very good templates for developing similar - applications. + The following list provides an overview of example programs contained in the books above. Some of them make very good templates for developing similar applications. \table \header @@ -921,9 +977,7 @@ \o comprehensive custom delegate example. \endtable - \l{Qt Demonstrations}{Demonstrations} are similar to examples except - that no walkthrough is provided for the code. Demonstrations are also - sometimes more feature rich. + \l{Qt Demonstrations}{Demonstrations} are similar to examples except that no walkthrough is provided for the code lines. Demonstrations are also sometimes more feature rich. ( \l demos.html ) \list \o The \bold Interview demonstration shows the same model and @@ -933,6 +987,5 @@ each item according to the type of data it contains. \endlist - A \l{Model/View Programming}{reference document} for model/view technology - is also available. + A \l{Model/View Programming}{reference document} for model/view technology is also available. */ diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.pro b/examples/tutorials/modelview/1_readonly/1_readonly.pro old mode 100644 new mode 100755 index 1162d5a..3ecebc2 --- a/examples/tutorials/modelview/1_readonly/1_readonly.pro +++ b/examples/tutorials/modelview/1_readonly/1_readonly.pro @@ -3,8 +3,15 @@ TARGET = mv_readonly TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp \ mymodel.cpp -HEADERS += modelview.h \ - mymodel.h +HEADERS += mymodel.h + + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/1_readonly +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 1_readonly.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/1_readonly +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp old mode 100644 new mode 100755 index fb4726a..2143854 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -41,13 +41,16 @@ //! [Quoting ModelView Tutorial] // main.cpp #include -#include "modelview.h" +#include +#include "mymodel.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; - w.show(); + QTableView tableView; + MyModel myModel(0); + tableView.setModel( &myModel ); + tableView.show(); return a.exec(); } //! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp deleted file mode 100644 index 91a97bf..0000000 --- a/examples/tutorials/modelview/1_readonly/modelview.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [Quoting ModelView Tutorial] -// modelview.cpp -#include -#include "modelview.h" -#include "mymodel.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this)); -} -//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/modelview.h b/examples/tutorials/modelview/1_readonly/modelview.h deleted file mode 100644 index cc14d90..0000000 --- a/examples/tutorials/modelview/1_readonly/modelview.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MODELVIEW_H -#define MODELVIEW_H - -//! [Quoting ModelView Tutorial] -// modelview.h -#include - -QT_FORWARD_DECLARE_CLASS(QTableView) - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); - -}; -//! [Quoting ModelView Tutorial] - -#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp old mode 100644 new mode 100755 diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h old mode 100644 new mode 100755 diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.pro b/examples/tutorials/modelview/2_formatting/2_formatting.pro old mode 100644 new mode 100755 index 7e70d81..c6ad27c --- a/examples/tutorials/modelview/2_formatting/2_formatting.pro +++ b/examples/tutorials/modelview/2_formatting/2_formatting.pro @@ -3,8 +3,14 @@ TARGET = mv_formatting TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp \ mymodel.cpp -HEADERS += modelview.h \ - mymodel.h +HEADERS += mymodel.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/2_formatting +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 2_formatting.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/2_formatting +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/2_formatting/main.cpp b/examples/tutorials/modelview/2_formatting/main.cpp old mode 100644 new mode 100755 index 7be212e..2143854 --- a/examples/tutorials/modelview/2_formatting/main.cpp +++ b/examples/tutorials/modelview/2_formatting/main.cpp @@ -38,13 +38,19 @@ ** ****************************************************************************/ +//! [Quoting ModelView Tutorial] +// main.cpp #include -#include "modelview.h" +#include +#include "mymodel.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; - w.show(); + QTableView tableView; + MyModel myModel(0); + tableView.setModel( &myModel ); + tableView.show(); return a.exec(); } +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/2_formatting/modelview.cpp b/examples/tutorials/modelview/2_formatting/modelview.cpp deleted file mode 100644 index 9a5ce64..0000000 --- a/examples/tutorials/modelview/2_formatting/modelview.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "modelview.h" -#include "mymodel.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this)); -} - diff --git a/examples/tutorials/modelview/2_formatting/modelview.h b/examples/tutorials/modelview/2_formatting/modelview.h deleted file mode 100644 index b2943ac..0000000 --- a/examples/tutorials/modelview/2_formatting/modelview.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MODELVIEW_H -#define MODELVIEW_H - -#include - -QT_FORWARD_DECLARE_CLASS(QTableView) - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); -}; - -#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp old mode 100644 new mode 100755 index f7ff504..3e13ff4 --- a/examples/tutorials/modelview/2_formatting/mymodel.cpp +++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp @@ -43,8 +43,6 @@ #include "mymodel.h" #include -//! [Quoting ModelView Tutorial] -// mymodel.cpp MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { @@ -60,6 +58,8 @@ int MyModel::columnCount(const QModelIndex & /*parent */) const return 3; } +//! [Quoting ModelView Tutorial] +// mymodel.cpp QVariant MyModel::data(const QModelIndex &index, int role) const { int row = index.row(); @@ -89,7 +89,7 @@ QVariant MyModel::data(const QModelIndex &index, int role) const if (row == 1 && col == 2) //change background only for cell(1,2) { - QBrush redBackground = QBrush(Qt::red); + QBrush redBackground(QColor(Qt::red)); return redBackground; } break; diff --git a/examples/tutorials/modelview/2_formatting/mymodel.h b/examples/tutorials/modelview/2_formatting/mymodel.h old mode 100644 new mode 100755 diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro old mode 100644 new mode 100755 index d61ee4c..e977731 --- a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro +++ b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro @@ -3,8 +3,14 @@ TARGET = mv_changingmodel TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp \ mymodel.cpp -HEADERS += modelview.h \ - mymodel.h +HEADERS += mymodel.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/3_changingmodel +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 3_changingmodel.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/3_changingmodel +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/3_changingmodel/main.cpp b/examples/tutorials/modelview/3_changingmodel/main.cpp old mode 100644 new mode 100755 diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.cpp b/examples/tutorials/modelview/3_changingmodel/modelview.cpp deleted file mode 100644 index 9a5ce64..0000000 --- a/examples/tutorials/modelview/3_changingmodel/modelview.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "modelview.h" -#include "mymodel.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this)); -} - diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.h b/examples/tutorials/modelview/3_changingmodel/modelview.h deleted file mode 100644 index b2943ac..0000000 --- a/examples/tutorials/modelview/3_changingmodel/modelview.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MODELVIEW_H -#define MODELVIEW_H - -#include - -QT_FORWARD_DECLARE_CLASS(QTableView) - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); -}; - -#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp old mode 100644 new mode 100755 diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.h b/examples/tutorials/modelview/3_changingmodel/mymodel.h old mode 100644 new mode 100755 index 01ad88d..47b026e --- a/examples/tutorials/modelview/3_changingmodel/mymodel.h +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.h @@ -43,7 +43,7 @@ #include -QT_FORWARD_DECLARE_CLASS(QTimer) +class QTimer; // forward declaration class MyModel : public QAbstractTableModel { diff --git a/examples/tutorials/modelview/4_headers/4_headers.pro b/examples/tutorials/modelview/4_headers/4_headers.pro old mode 100644 new mode 100755 index d6f8d23..f6c60b2 --- a/examples/tutorials/modelview/4_headers/4_headers.pro +++ b/examples/tutorials/modelview/4_headers/4_headers.pro @@ -2,9 +2,15 @@ TARGET = mv_headers TEMPLATE = app -SOURCES += main.cpp \ - modelview.cpp \ +SOURCES += main.cpp \ mymodel.cpp -HEADERS += modelview.h \ - mymodel.h +HEADERS += mymodel.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/4_headers +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 4_headers.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/4_headers +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/4_headers/main.cpp b/examples/tutorials/modelview/4_headers/main.cpp old mode 100644 new mode 100755 diff --git a/examples/tutorials/modelview/4_headers/modelview.cpp b/examples/tutorials/modelview/4_headers/modelview.cpp deleted file mode 100644 index 449dbbc..0000000 --- a/examples/tutorials/modelview/4_headers/modelview.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include "modelview.h" -#include "mymodel.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this)); - tableView->verticalHeader()->hide(); -} - diff --git a/examples/tutorials/modelview/4_headers/modelview.h b/examples/tutorials/modelview/4_headers/modelview.h deleted file mode 100644 index 03f99c0..0000000 --- a/examples/tutorials/modelview/4_headers/modelview.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MODELVIEW_H -#define MODELVIEW_H - -#include - -QT_FORWARD_DECLARE_CLASS(QTableView) - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); - -}; - -#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp old mode 100644 new mode 100755 diff --git a/examples/tutorials/modelview/4_headers/mymodel.h b/examples/tutorials/modelview/4_headers/mymodel.h old mode 100644 new mode 100755 diff --git a/examples/tutorials/modelview/5_edit/5_edit.pro b/examples/tutorials/modelview/5_edit/5_edit.pro old mode 100644 new mode 100755 index e18c596..2ef343f --- a/examples/tutorials/modelview/5_edit/5_edit.pro +++ b/examples/tutorials/modelview/5_edit/5_edit.pro @@ -3,8 +3,16 @@ TARGET = mv_edit TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp \ + mainwindow.cpp \ mymodel.cpp -HEADERS += modelview.h \ +HEADERS += mainwindow.h \ mymodel.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/5_edit +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 5_edit.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/5_edit +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/5_edit/main.cpp b/examples/tutorials/modelview/5_edit/main.cpp old mode 100644 new mode 100755 index 7be212e..59e82ef --- a/examples/tutorials/modelview/5_edit/main.cpp +++ b/examples/tutorials/modelview/5_edit/main.cpp @@ -39,12 +39,12 @@ ****************************************************************************/ #include -#include "modelview.h" +#include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; + MainWindow w; w.show(); return a.exec(); } diff --git a/examples/tutorials/modelview/5_edit/modelview.cpp b/examples/tutorials/modelview/5_edit/modelview.cpp deleted file mode 100644 index a6c6ef5..0000000 --- a/examples/tutorials/modelview/5_edit/modelview.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "modelview.h" -#include "mymodel.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - QAbstractTableModel *myModel = new MyModel(this); - tableView->setModel(myModel); - - //transfer changes to the model to the window title - connect(myModel, SIGNAL(editCompleted(const QString &)), this, SLOT(setWindowTitle(const QString &))); -} - -void ModelView::showWindowTitle(const QString & title) -{ -setWindowTitle(title); -} diff --git a/examples/tutorials/modelview/5_edit/modelview.h b/examples/tutorials/modelview/5_edit/modelview.h deleted file mode 100644 index 069107b..0000000 --- a/examples/tutorials/modelview/5_edit/modelview.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MODELVIEW_H -#define MODELVIEW_H - -#include - -QT_FORWARD_DECLARE_CLASS(QTableView) - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); -public slots: - void showWindowTitle(const QString & title); -}; - -#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp old mode 100644 new mode 100755 index 67181ca..e2fd391 --- a/examples/tutorials/modelview/5_edit/mymodel.cpp +++ b/examples/tutorials/modelview/5_edit/mymodel.cpp @@ -38,62 +38,64 @@ ** ****************************************************************************/ -//! [quoting mymodel_d] + #include "mymodel.h" -const int COLS= 3; -const int ROWS= 2; MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { - //gridData needs to have 6 element, one for each table cell - m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; } -//! [quoting mymodel_d] -//! [quoting mymodel_e] +//----------------------------------------------------------------- int MyModel::rowCount(const QModelIndex & /*parent*/) const { return ROWS; } +//----------------------------------------------------------------- int MyModel::columnCount(const QModelIndex & /*parent*/) const { return COLS; } +//----------------------------------------------------------------- QVariant MyModel::data(const QModelIndex &index, int role) const { if (role == Qt::DisplayRole) { - return m_gridData[modelIndexToOffset(index)]; + return m_gridData[index.row()][index.column()]; } return QVariant(); } -//! [quoting mymodel_e] //----------------------------------------------------------------- - -//! [quoting mymodel_f] +//! [quoting mymodel_e] bool MyModel::setData(const QModelIndex & index, const QVariant & value, int role) { if (role == Qt::EditRole) { - m_gridData[modelIndexToOffset(index)] = value.toString(); - emit editCompleted(m_gridData.join(" | ")); + //save value from editor to member m_gridData + m_gridData[index.row()][index.column()] = value.toString(); + //for presentation purposes only: build and emit a joined string + QString result; + for(int row= 0; row < ROWS; row++) + { + for(int col= 0; col < COLS; col++) + { + result += m_gridData[row][col] + " "; + } + } + emit editCompleted( result ); } return true; } +//! [quoting mymodel_e] +//----------------------------------------------------------------- +//! [quoting mymodel_f] Qt::ItemFlags MyModel::flags(const QModelIndex & /*index*/) const { return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled ; } - -//convert row and column information to array offset -int MyModel::modelIndexToOffset(const QModelIndex & index) const -{ - return index.row()*COLS + index.column(); -} //! [quoting mymodel_f] diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h old mode 100644 new mode 100755 index 0d2a1b8..574808e --- a/examples/tutorials/modelview/5_edit/mymodel.h +++ b/examples/tutorials/modelview/5_edit/mymodel.h @@ -44,7 +44,11 @@ //! [Quoting ModelView Tutorial] // mymodel.h #include -#include +#include + +const int COLS= 3; +const int ROWS= 2; + class MyModel : public QAbstractTableModel { @@ -57,8 +61,7 @@ public: bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); Qt::ItemFlags flags(const QModelIndex & index) const ; private: - QStringList m_gridData; //holds text entered into QTableView - int modelIndexToOffset(const QModelIndex & index) const; + QString m_gridData[ROWS][COLS]; //holds text entered into QTableView signals: void editCompleted(const QString &); }; diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.pro b/examples/tutorials/modelview/6_treeview/6_treeview.pro old mode 100644 new mode 100755 index 6d078be..e79ef20 --- a/examples/tutorials/modelview/6_treeview/6_treeview.pro +++ b/examples/tutorials/modelview/6_treeview/6_treeview.pro @@ -1,5 +1,13 @@ TARGET = mv_tree TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp -HEADERS += modelview.h + mainwindow.cpp +HEADERS += mainwindow.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/6_treeview +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 6_treeview.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/6_treeview +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/6_treeview/main.cpp b/examples/tutorials/modelview/6_treeview/main.cpp old mode 100644 new mode 100755 index 7be212e..59e82ef --- a/examples/tutorials/modelview/6_treeview/main.cpp +++ b/examples/tutorials/modelview/6_treeview/main.cpp @@ -39,12 +39,12 @@ ****************************************************************************/ #include -#include "modelview.h" +#include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; + MainWindow w; w.show(); return a.exec(); } diff --git a/examples/tutorials/modelview/6_treeview/modelview.cpp b/examples/tutorials/modelview/6_treeview/modelview.cpp deleted file mode 100644 index 772dbdd..0000000 --- a/examples/tutorials/modelview/6_treeview/modelview.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [Quoting ModelView Tutorial] -// modelview.cpp -#include -#include -#include -#include "modelview.h" - - -const int ROWS = 2; -const int COLUMNS = 3; - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - treeView = new QTreeView(this); - setCentralWidget(treeView); - standardModel = new QStandardItemModel ; - - QList preparedColumn =prepareColumn("first", "second", "third"); - QStandardItem *item = standardModel->invisibleRootItem(); - // adding a row to the invisible root item produces a root element - item->appendRow(preparedColumn); - - QList secondRow =prepareColumn("111", "222", "333"); - // adding a row to an item starts a subtree - preparedColumn.first()->appendRow(secondRow); - - treeView->setModel(standardModel); - treeView->expandAll(); -} - -QList ModelView::prepareColumn(const QString &first, - const QString &second, - const QString &third) -{ - QList colItems; - colItems << new QStandardItem(first); - colItems << new QStandardItem(second); - colItems << new QStandardItem(third); - return colItems; -} -//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/6_treeview/modelview.h b/examples/tutorials/modelview/6_treeview/modelview.h deleted file mode 100644 index 55f3470..0000000 --- a/examples/tutorials/modelview/6_treeview/modelview.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MODELVIEW_H -#define MODELVIEW_H - -#include - -QT_BEGIN_NAMESPACE -class QTreeView; //forward declaration -class QStandardItemModel; -class QStandardItem; -QT_END_NAMESPACE - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTreeView *treeView; - QStandardItemModel *standardModel; - QList prepareColumn(const QString &first, - const QString &second, - const QString &third); -public: - ModelView(QWidget *parent = 0); -}; - -#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/7_selections/7_selections.pro b/examples/tutorials/modelview/7_selections/7_selections.pro old mode 100644 new mode 100755 index 952641c6..6945bf7 --- a/examples/tutorials/modelview/7_selections/7_selections.pro +++ b/examples/tutorials/modelview/7_selections/7_selections.pro @@ -1,5 +1,13 @@ TARGET = mv_selections TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp -HEADERS += modelview.h + mainwindow.cpp +HEADERS += mainwindow.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/7_selections +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 7_selections.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/7_selections +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/7_selections/main.cpp b/examples/tutorials/modelview/7_selections/main.cpp old mode 100644 new mode 100755 index 7be212e..59e82ef --- a/examples/tutorials/modelview/7_selections/main.cpp +++ b/examples/tutorials/modelview/7_selections/main.cpp @@ -39,12 +39,12 @@ ****************************************************************************/ #include -#include "modelview.h" +#include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; + MainWindow w; w.show(); return a.exec(); } diff --git a/examples/tutorials/modelview/7_selections/modelview.cpp b/examples/tutorials/modelview/7_selections/modelview.cpp deleted file mode 100644 index 3b373c6..0000000 --- a/examples/tutorials/modelview/7_selections/modelview.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [quoting modelview_a] -#include -#include -#include -#include "modelview.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - treeView = new QTreeView(this); - setCentralWidget(treeView); - standardModel = new QStandardItemModel ; - QStandardItem *rootNode = standardModel->invisibleRootItem(); - - - //defining a couple of items - QStandardItem *americaItem = new QStandardItem("America"); - QStandardItem *mexicoItem = new QStandardItem("Canada"); - QStandardItem *usaItem = new QStandardItem("USA"); - QStandardItem *bostonItem = new QStandardItem("Boston"); - QStandardItem *europeItem = new QStandardItem("Europe"); - QStandardItem *italyItem = new QStandardItem("Italy"); - QStandardItem *romeItem = new QStandardItem("Rome"); - QStandardItem *veronaItem = new QStandardItem("Verona"); - - //building up the hierarchy - rootNode-> appendRow(americaItem); - rootNode-> appendRow(europeItem); - americaItem-> appendRow(mexicoItem); - americaItem-> appendRow(usaItem); - usaItem-> appendRow(bostonItem); - europeItem-> appendRow(italyItem); - italyItem-> appendRow(romeItem); - italyItem-> appendRow(veronaItem); - - //register the model - treeView->setModel(standardModel); - treeView->expandAll(); - - //selection changes shall trigger a slot - QItemSelectionModel *selectionModel= treeView->selectionModel(); - connect(selectionModel, SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)), - this, SLOT(selectionChangedSlot(const QItemSelection &, const QItemSelection &))); -} -//! [quoting modelview_a] - -//------------------------------------------------------------------------------------ - -//! [quoting modelview_b] -void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/) -{ - const QModelIndex index = treeView->selectionModel()->currentIndex(); - QString selectedText = index.data(Qt::DisplayRole).toString(); - int hierarchyLevel=1; - QModelIndex seekRoot = index; - while(seekRoot.parent() != QModelIndex()) - { - seekRoot = seekRoot.parent(); - hierarchyLevel++; - } - QString showString = QString("%1, Level %2").arg(selectedText) - .arg(hierarchyLevel); - setWindowTitle(showString); -} -//! [quoting modelview_b] - - diff --git a/examples/tutorials/modelview/7_selections/modelview.h b/examples/tutorials/modelview/7_selections/modelview.h deleted file mode 100644 index d20797e..0000000 --- a/examples/tutorials/modelview/7_selections/modelview.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MODELVIEW_H -#define MODELVIEW_H - -#include - -QT_BEGIN_NAMESPACE -class QTreeView; //forward declaration -class QStandardItemModel; -class QItemSelection; -QT_END_NAMESPACE - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTreeView *treeView; - QStandardItemModel *standardModel; -private slots: - void selectionChangedSlot(const QItemSelection & newSelection, const QItemSelection & oldSelection); -public: - ModelView(QWidget *parent = 0); -}; - -#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/modelview.pro b/examples/tutorials/modelview/modelview.pro old mode 100644 new mode 100755 index 7f684ba..50f5c3a --- a/examples/tutorials/modelview/modelview.pro +++ b/examples/tutorials/modelview/modelview.pro @@ -1,5 +1,4 @@ -TEMPLATE = subdirs - +TEMPLATE = subdirs SUBDIRS = 1_readonly \ 2_formatting \ 3_changingmodel \ @@ -8,3 +7,10 @@ SUBDIRS = 1_readonly \ 6_treeview \ 7_selections +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS modelview.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) -- cgit v0.12 From aa7af0612b13717a449075e0bfb30d618f66436a Mon Sep 17 00:00:00 2001 From: Michael D Scull Date: Thu, 29 Jul 2010 15:56:52 +0200 Subject: problem: 2 images that were in raw html tables appeared smaller in konqueror for some reason - solution: fixed width for right columns in 2 raw html tables --- doc/src/tutorials/modelview.qdoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index f771726..82e0c85 100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -123,7 +123,7 @@ Table, list and tree widgets are components frequently used in GUIs. There are 2 \raw HTML - + \endraw \raw HTML @@ -657,10 +657,10 @@ Other references to delegates in Qt Documentation: \raw HTML - + \endraw - \inlineimage path.png + \image path.png \raw HTML -- cgit v0.12 From eec71645f7e0e41786f01c09e30817d898ff3cc0 Mon Sep 17 00:00:00 2001 From: Roland Wolf Date: Fri, 30 Jul 2010 11:05:40 +0200 Subject: added missing files --- examples/tutorials/modelview/5_edit/mainwindow.cpp | 60 ++++++++++++++++++++++ examples/tutorials/modelview/5_edit/mainwindow.h | 59 +++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100755 examples/tutorials/modelview/5_edit/mainwindow.cpp create mode 100755 examples/tutorials/modelview/5_edit/mainwindow.h diff --git a/examples/tutorials/modelview/5_edit/mainwindow.cpp b/examples/tutorials/modelview/5_edit/mainwindow.cpp new file mode 100755 index 0000000..542f3d6 --- /dev/null +++ b/examples/tutorials/modelview/5_edit/mainwindow.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "mainwindow.h" +#include "mymodel.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + tableView = new QTableView(this); + setCentralWidget(tableView); + QAbstractTableModel *myModel = new MyModel(this); + tableView->setModel(myModel); + + //transfer changes to the model to the window title + connect(myModel, SIGNAL(editCompleted(const QString &)), this, SLOT(setWindowTitle(const QString &))); +} + +void MainWindow::showWindowTitle(const QString & title) +{ +setWindowTitle(title); +} diff --git a/examples/tutorials/modelview/5_edit/mainwindow.h b/examples/tutorials/modelview/5_edit/mainwindow.h new file mode 100755 index 0000000..1d49f47 --- /dev/null +++ b/examples/tutorials/modelview/5_edit/mainwindow.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class QTableView; //forward declaration + +class MainWindow : public QMainWindow +{ + Q_OBJECT +private: + QTableView *tableView; +public: + MainWindow(QWidget *parent = 0); +public slots: + void showWindowTitle(const QString & title); +}; + +#endif // MAINWINDOW_H -- cgit v0.12 From 5148f9e02483598d7e916845ccd0712e5e24f45d Mon Sep 17 00:00:00 2001 From: Roland Wolf Date: Fri, 30 Jul 2010 11:08:32 +0200 Subject: added missing files --- .../tutorials/modelview/6_treeview/mainwindow.cpp | 82 ++++++++++++++++ .../tutorials/modelview/6_treeview/mainwindow.h | 64 ++++++++++++ .../modelview/7_selections/mainwindow.cpp | 109 +++++++++++++++++++++ .../tutorials/modelview/7_selections/mainwindow.h | 63 ++++++++++++ 4 files changed, 318 insertions(+) create mode 100755 examples/tutorials/modelview/6_treeview/mainwindow.cpp create mode 100755 examples/tutorials/modelview/6_treeview/mainwindow.h create mode 100755 examples/tutorials/modelview/7_selections/mainwindow.cpp create mode 100755 examples/tutorials/modelview/7_selections/mainwindow.h diff --git a/examples/tutorials/modelview/6_treeview/mainwindow.cpp b/examples/tutorials/modelview/6_treeview/mainwindow.cpp new file mode 100755 index 0000000..a105232 --- /dev/null +++ b/examples/tutorials/modelview/6_treeview/mainwindow.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [Quoting ModelView Tutorial] +// modelview.cpp +#include +#include +#include +#include "mainwindow.h" + + +const int ROWS = 2; +const int COLUMNS = 3; + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + treeView = new QTreeView(this); + setCentralWidget(treeView); + standardModel = new QStandardItemModel ; + + QList preparedRow =prepareRow("first", "second", "third"); + QStandardItem *item = standardModel->invisibleRootItem(); + // adding a row to the invisible root item produces a root element + item->appendRow(preparedRow); + + QList secondRow =prepareRow("111", "222", "333"); + // adding a row to an item starts a subtree + preparedRow.first()->appendRow(secondRow); + + treeView->setModel(standardModel); + treeView->expandAll(); +} + +QList MainWindow::prepareRow(const QString &first, + const QString &second, + const QString &third) +{ + QList rowItems; + rowItems << new QStandardItem(first); + rowItems << new QStandardItem(second); + rowItems << new QStandardItem(third); + return rowItems; +} +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/6_treeview/mainwindow.h b/examples/tutorials/modelview/6_treeview/mainwindow.h new file mode 100755 index 0000000..fb8de79 --- /dev/null +++ b/examples/tutorials/modelview/6_treeview/mainwindow.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class QTreeView; //forward declaration +class QStandardItemModel; +class QStandardItem; + + +class MainWindow : public QMainWindow +{ + Q_OBJECT +private: + QTreeView *treeView; + QStandardItemModel *standardModel; + QList prepareRow( const QString &first, + const QString &second, + const QString &third ); +public: + MainWindow(QWidget *parent = 0); +}; + +#endif // MAINWINDOW_H diff --git a/examples/tutorials/modelview/7_selections/mainwindow.cpp b/examples/tutorials/modelview/7_selections/mainwindow.cpp new file mode 100755 index 0000000..cb09633 --- /dev/null +++ b/examples/tutorials/modelview/7_selections/mainwindow.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [quoting modelview_a] +#include +#include +#include +#include "mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + treeView = new QTreeView(this); + setCentralWidget(treeView); + standardModel = new QStandardItemModel ; + QStandardItem *rootNode = standardModel->invisibleRootItem(); + + + //defining a couple of items + QStandardItem *americaItem = new QStandardItem("America"); + QStandardItem *mexicoItem = new QStandardItem("Canada"); + QStandardItem *usaItem = new QStandardItem("USA"); + QStandardItem *bostonItem = new QStandardItem("Boston"); + QStandardItem *europeItem = new QStandardItem("Europe"); + QStandardItem *italyItem = new QStandardItem("Italy"); + QStandardItem *romeItem = new QStandardItem("Rome"); + QStandardItem *veronaItem = new QStandardItem("Verona"); + + //building up the hierarchy + rootNode-> appendRow(americaItem); + rootNode-> appendRow(europeItem); + americaItem-> appendRow(mexicoItem); + americaItem-> appendRow(usaItem); + usaItem-> appendRow(bostonItem); + europeItem-> appendRow(italyItem); + italyItem-> appendRow(romeItem); + italyItem-> appendRow(veronaItem); + + //register the model + treeView->setModel(standardModel); + treeView->expandAll(); + + //selection changes shall trigger a slot + QItemSelectionModel *selectionModel= treeView->selectionModel(); + connect(selectionModel, SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)), + this, SLOT(selectionChangedSlot(const QItemSelection &, const QItemSelection &))); +} +//! [quoting modelview_a] + +//------------------------------------------------------------------------------------ + +//! [quoting modelview_b] +void MainWindow::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/) +{ + //get the text of the selected item + const QModelIndex index = treeView->selectionModel()->currentIndex(); + QString selectedText = index.data(Qt::DisplayRole).toString(); + //find out the hierarchy level of the selected item + int hierarchyLevel=1; + QModelIndex seekRoot = index; + while(seekRoot.parent() != QModelIndex()) + { + seekRoot = seekRoot.parent(); + hierarchyLevel++; + } + QString showString = QString("%1, Level %2").arg(selectedText) + .arg(hierarchyLevel); + setWindowTitle(showString); +} +//! [quoting modelview_b] + + diff --git a/examples/tutorials/modelview/7_selections/mainwindow.h b/examples/tutorials/modelview/7_selections/mainwindow.h new file mode 100755 index 0000000..f2defb5 --- /dev/null +++ b/examples/tutorials/modelview/7_selections/mainwindow.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class QTreeView; //forward declaration +class QStandardItemModel; +class QItemSelection; + + +class MainWindow : public QMainWindow +{ + Q_OBJECT +private: + QTreeView *treeView; + QStandardItemModel *standardModel; +private slots: + void selectionChangedSlot(const QItemSelection & newSelection, const QItemSelection & oldSelection); +public: + MainWindow(QWidget *parent = 0); +}; + +#endif // MAINWINDOW_H -- cgit v0.12 From 2299cc27db5e40fe43c6b46d5560fe65bc9e6da5 Mon Sep 17 00:00:00 2001 From: Roland Wolf Date: Fri, 30 Jul 2010 13:17:02 +0200 Subject: fixed compilation problem --- examples/tutorials/modelview/3_changingmodel/main.cpp | 9 ++++++--- examples/tutorials/modelview/4_headers/main.cpp | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/tutorials/modelview/3_changingmodel/main.cpp b/examples/tutorials/modelview/3_changingmodel/main.cpp index 7be212e..3b6061a 100755 --- a/examples/tutorials/modelview/3_changingmodel/main.cpp +++ b/examples/tutorials/modelview/3_changingmodel/main.cpp @@ -39,12 +39,15 @@ ****************************************************************************/ #include -#include "modelview.h" +#include +#include "mymodel.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; - w.show(); + QTableView tableView; + MyModel myModel(0); + tableView.setModel( &myModel ); + tableView.show(); return a.exec(); } diff --git a/examples/tutorials/modelview/4_headers/main.cpp b/examples/tutorials/modelview/4_headers/main.cpp index 7be212e..5f5d05f 100755 --- a/examples/tutorials/modelview/4_headers/main.cpp +++ b/examples/tutorials/modelview/4_headers/main.cpp @@ -39,12 +39,15 @@ ****************************************************************************/ #include -#include "modelview.h" +#include +#include "mymodel.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; - w.show(); + QTableView tableView; + MyModel myModel(0); + tableView.setModel( &myModel ); + tableView.show(); return a.exec(); -} +} \ No newline at end of file -- cgit v0.12 From 87750fe0cfc3861dbe3421bdd3f20dc0f97ad45a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 27 Aug 2010 11:06:07 +1000 Subject: Improve stability of test on loaded hw. --- tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml index 804559c..d41add3 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml @@ -11,7 +11,7 @@ Rectangle { width: 100 height: 100 Behavior on x { - NumberAnimation {} + NumberAnimation { duration: 500 } } } } -- cgit v0.12 From 93c8a38e5f4912c51c4484975ebd433bec43a0f1 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 27 Aug 2010 11:11:29 +1000 Subject: Improve stability of test on loaded hw. --- .../qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index 6d5a357..d0afc8a 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -389,6 +389,7 @@ void tst_qdeclarativeimageprovider::threadTest() } provider->ok = true; provider->cond.wakeAll(); + QTest::qWait(250); foreach(QDeclarativeImage *img, images) { TRY_WAIT(img->status() == QDeclarativeImage::Ready); } -- cgit v0.12 From 94d7ec29f177665e8e2a218a161df517f3ae51d5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 27 Aug 2010 11:46:45 +1000 Subject: Improve test reliability when running in parallel with other tests. --- .../qdeclarativegridview/tst_qdeclarativegridview.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 896d69e..d4d8bf6 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -655,6 +655,15 @@ void tst_QDeclarativeGridView::currentIndex() gridview->setFlow(QDeclarativeGridView::TopToBottom); + qApp->setActiveWindow(canvas); +#ifdef Q_WS_X11 + // to be safe and avoid failing setFocus with window managers + qt_x11_wait_for_window_manager(canvas); +#endif + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); + qApp->processEvents(); + QTest::keyClick(canvas, Qt::Key_Right); QCOMPARE(gridview->currentIndex(), 5); -- cgit v0.12 From 34a107454426db2f40b3be31923b8a5ce1d84f6e Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 27 Aug 2010 14:32:25 +1000 Subject: Internal QML API cleanup --- .../qml/qdeclarativecompiledbindings.cpp | 2 +- src/declarative/qml/qdeclarativecompiler.cpp | 18 +-- .../qml/qdeclarativecompositetypemanager.cpp | 18 +-- src/declarative/qml/qdeclarativeimport.cpp | 157 +++++++++++---------- src/declarative/qml/qdeclarativeimport_p.h | 37 ++--- 5 files changed, 124 insertions(+), 108 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 723da94..9402596 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -1874,7 +1874,7 @@ bool QDeclarativeBindingCompilerPrivate::parseName(AST::Node *node, Result &type return false; QDeclarativeImportedNamespace *ns = 0; - if (!engine->importDatabase.resolveType(imports, name.toUtf8(), &attachType, 0, 0, 0, &ns)) + if (!imports.resolveType(name.toUtf8(), &attachType, 0, 0, 0, &ns)) return false; if (ns || !attachType || !attachType->attachedPropertiesType()) return false; diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 2b4a4a5..34d33bb 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -703,7 +703,7 @@ void QDeclarativeCompiler::compileTree(Object *tree) for (int ii = 0; ii < importedScriptIndexes.count(); ++ii) output->importCache->add(importedScriptIndexes.at(ii), ii); - unit->imports.cache(output->importCache, engine); + unit->imports.populateCache(output->importCache, engine); Q_ASSERT(tree->metatype); @@ -1403,8 +1403,7 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, QDeclarativeType *type = 0; QDeclarativeImportedNamespace *typeNamespace = 0; - enginePrivate->importDatabase.resolveType(unit->imports, prop->name, - &type, 0, 0, 0, &typeNamespace); + unit->imports.resolveType(prop->name, &type, 0, 0, 0, &typeNamespace); if (typeNamespace) { // ### We might need to indicate that this property is a namespace @@ -1512,7 +1511,7 @@ bool QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeImportedNamespac // Setup attached property data QDeclarativeType *type = 0; - enginePrivate->importDatabase.resolveTypeInNamespace(ns, prop->name, &type, 0, 0, 0); + unit->imports.resolveType(ns, prop->name, &type, 0, 0, 0); if (!type || !type->attachedPropertiesType()) COMPILE_EXCEPTION(prop, tr("Non-existent attached object")); @@ -2139,8 +2138,7 @@ bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop QString typeName = parts.at(0); QDeclarativeType *type = 0; - enginePrivate->importDatabase.resolveType(unit->imports, typeName.toUtf8(), - &type, 0, 0, 0, 0); + unit->imports.resolveType(typeName.toUtf8(), &type, 0, 0, 0, 0); if (!type || obj->typeName != type->qmlTypeName()) return true; @@ -2167,7 +2165,7 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const int dot = script.indexOf('.'); if (dot > 0) { QDeclarativeType *type = 0; - enginePrivate->importDatabase.resolveType(unit->imports, script.left(dot), &type, 0, 0, 0, 0); + unit->imports.resolveType(script.left(dot), &type, 0, 0, 0, 0); if (!type) return -1; const QMetaObject *mo = type->metaObject(); @@ -2185,8 +2183,7 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) const { QDeclarativeType *qmltype = 0; - if (!enginePrivate->importDatabase.resolveType(unit->imports, name, &qmltype, - 0, 0, 0, 0)) + if (!unit->imports.resolveType(name, &qmltype, 0, 0, 0, 0)) return 0; if (!qmltype) return 0; @@ -2344,8 +2341,7 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn QByteArray customTypeName; QDeclarativeType *qmltype = 0; QUrl url; - if (!enginePrivate->importDatabase.resolveType(unit->imports, p.customType, &qmltype, - &url, 0, 0, 0)) + if (!unit->imports.resolveType(p.customType, &qmltype, &url, 0, 0, 0)) COMPILE_EXCEPTION(&p, tr("Invalid property type")); if (!qmltype) { diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp index 2e77534..cc8f887 100644 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp @@ -523,7 +523,7 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData int waiting = 0; QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); - QDeclarativeImportDatabase &importDatabase = ep->importDatabase; + QDeclarativeImportDatabase *importDatabase = &ep->importDatabase; // For local urls, add an implicit import "." as first (most overridden) lookup. // This will also trigger the loading of the qmldir and the import of any native @@ -538,9 +538,10 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData qmldircomponentsnetwork = parser.components(); } - importDatabase.addToImport(&unit->imports, qmldircomponentsnetwork, QLatin1String("."), - QString(), -1, -1, QDeclarativeScriptParser::Import::File, - 0); // error ignored (just means no fallback) + unit->imports.addImport(importDatabase, + QLatin1String("."), QString(), -1, -1, QDeclarativeScriptParser::Import::File, + qmldircomponentsnetwork, + 0); // error ignored (just means no fallback) } @@ -577,8 +578,9 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData } QString errorString; - if (!importDatabase.addToImport(&unit->imports, qmldircomponentsnetwork, imp.uri, imp.qualifier, - vmaj, vmin, imp.type, &errorString)) { + if (!unit->imports.addImport(importDatabase, + imp.uri, imp.qualifier, vmaj, vmin, imp.type, + qmldircomponentsnetwork, &errorString)) { QDeclarativeError error; error.setUrl(unit->imports.baseUrl()); error.setDescription(errorString); @@ -606,8 +608,8 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData int minorVersion; QDeclarativeImportedNamespace *typeNamespace = 0; QString errorString; - if (!importDatabase.resolveType(unit->imports, typeName, &ref.type, &url, &majorVersion, &minorVersion, - &typeNamespace, &errorString) || typeNamespace) { + if (!unit->imports.resolveType(typeName, &ref.type, &url, &majorVersion, &minorVersion, + &typeNamespace, &errorString) || typeNamespace) { // Known to not be a type: // - known to be a namespace (Namespace {}) // - type with unknown namespace (UnknownNamespace.SomeType {}) diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index 5c21ebc..8f95e26 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -109,6 +109,11 @@ public: QHash set; }; +/*! +\class QDeclarativeImports +\brief The QDeclarativeImports class encapsulates one QML document's import statements. +\internal +*/ QDeclarativeImports::QDeclarativeImports(const QDeclarativeImports ©) : d(copy.d) { @@ -181,7 +186,7 @@ cacheForNamespace(QDeclarativeEngine *engine, const QDeclarativeImportedNamespac return cache; } -void QDeclarativeImports::cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *engine) const +void QDeclarativeImports::populateCache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *engine) const { const QDeclarativeImportedNamespace &set = d->unqualifiedset; @@ -201,6 +206,67 @@ void QDeclarativeImports::cache(QDeclarativeTypeNameCache *cache, QDeclarativeEn cacheForNamespace(engine, set, cache); } + +/*! + \internal + + The given (namespace qualified) \a type is resolved to either + \list + \o a QDeclarativeImportedNamespace stored at \a ns_return, + \o a QDeclarativeType stored at \a type_return, or + \o a component located at \a url_return. + \endlist + + If any return pointer is 0, the corresponding search is not done. + + \sa addImport() +*/ +bool QDeclarativeImports::resolveType(const QByteArray& type, + QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin, + QDeclarativeImportedNamespace** ns_return, QString *errorString) const +{ + QDeclarativeImportedNamespace* ns = d->findNamespace(QString::fromUtf8(type)); + if (ns) { + if (ns_return) + *ns_return = ns; + return true; + } + if (type_return || url_return) { + if (d->find(type,vmaj,vmin,type_return,url_return, errorString)) { + if (qmlImportTrace()) { + if (type_return && *type_return && url_return && !url_return->isEmpty()) + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(baseUrl().toString()) << ")" << "::resolveType: " + << type << " => " << (*type_return)->typeName() << " " << *url_return; + if (type_return && *type_return) + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(baseUrl().toString()) << ")" << "::resolveType: " + << type << " => " << (*type_return)->typeName(); + if (url_return && !url_return->isEmpty()) + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(baseUrl().toString()) << ")" << "::resolveType: " + << type << " => " << *url_return; + } + return true; + } + } + return false; +} + +/*! + \internal + + Searching \e only in the namespace \a ns (previously returned in a call to + resolveType(), \a type is found and returned to either + a QDeclarativeType stored at \a type_return, or + a component located at \a url_return. + + If either return pointer is 0, the corresponding search is not done. +*/ +bool QDeclarativeImports::resolveType(QDeclarativeImportedNamespace* ns, const QByteArray& type, + QDeclarativeType** type_return, QUrl* url_return, + int *vmaj, int *vmin) const +{ + return ns->find(type,vmaj,vmin,type_return,url_return); +} + bool QDeclarativeImportedNamespace::find_helper(int i, const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return, QUrl* url_return, QUrl *base, bool *typeRecursionDetected) @@ -280,15 +346,16 @@ QDeclarativeImportsPrivate::~QDeclarativeImportsPrivate() } bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath, const QString &uri, - QDeclarativeImportDatabase *database, - QDeclarativeDirComponents* components, QString *errorString) + QDeclarativeImportDatabase *database, + QDeclarativeDirComponents* components, QString *errorString) { QFile file(absoluteFilePath); QString filecontent; if (file.open(QFile::ReadOnly)) { filecontent = QString::fromUtf8(file.readAll()); if (qmlImportTrace()) - qDebug() << "QDeclarativeImportDatabase::add: loaded" << absoluteFilePath; + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(base.toString()) << "::importExtension: " + << "loaded " << absoluteFilePath; } else { if (errorString) *errorString = QDeclarativeImportDatabase::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); @@ -576,6 +643,10 @@ bool QDeclarativeImportedNamespace::find(const QByteArray& type, int *vmajor, in return false; } +/*! +\class QDeclarativeImportDatabase +\brief The QDeclarativeImportDatabase class manages the QML imports for a QDeclarativeEngine. +*/ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) : engine(e) { @@ -619,75 +690,19 @@ QDeclarativeImportDatabase::~QDeclarativeImportDatabase() The base URL must already have been set with Import::setBaseUrl(). */ -bool QDeclarativeImportDatabase::addToImport(QDeclarativeImports* imports, - const QDeclarativeDirComponents &qmldircomponentsnetwork, - const QString& uri, const QString& prefix, int vmaj, int vmin, - QDeclarativeScriptParser::Import::Type importType, - QString *errorString) +bool QDeclarativeImports::addImport(QDeclarativeImportDatabase *importDb, + const QString& uri, const QString& prefix, int vmaj, int vmin, + QDeclarativeScriptParser::Import::Type importType, + const QDeclarativeDirComponents &qmldircomponentsnetwork, + QString *errorString) { if (qmlImportTrace()) - qDebug().nospace() << "QDeclarativeImportDatabase::addToImport " << imports << " " << uri << " " - << vmaj << '.' << vmin << " " + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(baseUrl().toString()) << ")" << "::addImport: " + << uri << " " << vmaj << '.' << vmin << " " << (importType==QDeclarativeScriptParser::Import::Library? "Library" : "File") << " as " << prefix; - bool ok = imports->d->add(qmldircomponentsnetwork, uri, prefix, vmaj, vmin, importType, this, errorString); - return ok; -} - -/*! - \internal - - Using the given \a imports, the given (namespace qualified) \a type is resolved to either - a QDeclarativeImportedNamespace stored at \a ns_return, - a QDeclarativeType stored at \a type_return, or - a component located at \a url_return. - - If any return pointer is 0, the corresponding search is not done. - - \sa addToImport() -*/ -bool QDeclarativeImportDatabase::resolveType(const QDeclarativeImports& imports, const QByteArray& type, - QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin, - QDeclarativeImportedNamespace** ns_return, QString *errorString) const -{ - QDeclarativeImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type)); - if (ns) { - if (ns_return) - *ns_return = ns; - return true; - } - if (type_return || url_return) { - if (imports.d->find(type,vmaj,vmin,type_return,url_return, errorString)) { - if (qmlImportTrace()) { - if (type_return && *type_return && url_return && !url_return->isEmpty()) - qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << (*type_return)->typeName() << *url_return; - if (type_return && *type_return) - qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << (*type_return)->typeName(); - if (url_return && !url_return->isEmpty()) - qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << *url_return; - } - return true; - } - } - return false; -} - -/*! - \internal - - Searching \e only in the namespace \a ns (previously returned in a call to - resolveType(), \a type is found and returned to either - a QDeclarativeType stored at \a type_return, or - a component located at \a url_return. - - If either return pointer is 0, the corresponding search is not done. -*/ -bool QDeclarativeImportDatabase::resolveTypeInNamespace(QDeclarativeImportedNamespace* ns, const QByteArray& type, - QDeclarativeType** type_return, QUrl* url_return, - int *vmaj, int *vmin) const -{ - return ns->find(type,vmaj,vmin,type_return,url_return); + return d->add(qmldircomponentsnetwork, uri, prefix, vmaj, vmin, importType, importDb, errorString); } /*! @@ -834,7 +849,7 @@ void QDeclarativeImportDatabase::setPluginPathList(const QStringList &paths) void QDeclarativeImportDatabase::addPluginPath(const QString& path) { if (qmlImportTrace()) - qDebug() << "QDeclarativeImportDatabase::addPluginPath" << path; + qDebug().nospace() << "QDeclarativeImportDatabase::addPluginPath: " << path; QUrl url = QUrl(path); if (url.isRelative() || url.scheme() == QLatin1String("file")) { @@ -848,7 +863,7 @@ void QDeclarativeImportDatabase::addPluginPath(const QString& path) void QDeclarativeImportDatabase::addImportPath(const QString& path) { if (qmlImportTrace()) - qDebug() << "QDeclarativeImportDatabase::addImportPath" << path; + qDebug().nospace() << "QDeclarativeImportDatabase::addImportPath: " << path; if (path.isEmpty()) return; @@ -882,7 +897,7 @@ void QDeclarativeImportDatabase::setImportPathList(const QStringList &paths) bool QDeclarativeImportDatabase::importPlugin(const QString &filePath, const QString &uri, QString *errorString) { if (qmlImportTrace()) - qDebug() << "QDeclarativeImportDatabase::importPlugin" << uri << "from" << filePath; + qDebug().nospace() << "QDeclarativeImportDatabase::importPlugin: " << uri << " from " << filePath; QFileInfo fileInfo(filePath); const QString absoluteFilePath = fileInfo.absoluteFilePath(); diff --git a/src/declarative/qml/qdeclarativeimport_p.h b/src/declarative/qml/qdeclarativeimport_p.h index 88246d4..84802de 100644 --- a/src/declarative/qml/qdeclarativeimport_p.h +++ b/src/declarative/qml/qdeclarativeimport_p.h @@ -65,9 +65,10 @@ QT_BEGIN_NAMESPACE class QDeclarativeTypeNameCache; class QDeclarativeEngine; class QDir; - class QDeclarativeImportedNamespace; class QDeclarativeImportsPrivate; +class QDeclarativeImportDatabase; + class QDeclarativeImports { public: @@ -79,7 +80,24 @@ public: void setBaseUrl(const QUrl &url); QUrl baseUrl() const; - void cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const; + bool resolveType(const QByteArray& type, + QDeclarativeType** type_return, QUrl* url_return, + int *version_major, int *version_minor, + QDeclarativeImportedNamespace** ns_return, + QString *errorString = 0) const; + bool resolveType(QDeclarativeImportedNamespace*, + const QByteArray& type, + QDeclarativeType** type_return, QUrl* url_return, + int *version_major, int *version_minor) const; + + bool addImport(QDeclarativeImportDatabase *, + const QString& uri, const QString& prefix, int vmaj, int vmin, + QDeclarativeScriptParser::Import::Type importType, + const QDeclarativeDirComponents &qmldircomponentsnetwork, + QString *errorString); + + void populateCache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const; + private: friend class QDeclarativeImportDatabase; QDeclarativeImportsPrivate *d; @@ -102,21 +120,6 @@ public: void setPluginPathList(const QStringList &paths); void addPluginPath(const QString& path); - - bool addToImport(QDeclarativeImports*, const QDeclarativeDirComponents &qmldircomponentsnetwork, - const QString& uri, const QString& prefix, int vmaj, int vmin, - QDeclarativeScriptParser::Import::Type importType, - QString *errorString); - bool resolveType(const QDeclarativeImports&, const QByteArray& type, - QDeclarativeType** type_return, QUrl* url_return, - int *version_major, int *version_minor, - QDeclarativeImportedNamespace** ns_return, - QString *errorString = 0) const; - bool resolveTypeInNamespace(QDeclarativeImportedNamespace*, const QByteArray& type, - QDeclarativeType** type_return, QUrl* url_return, - int *version_major, int *version_minor ) const; - - private: friend class QDeclarativeImportsPrivate; QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, -- cgit v0.12 From c43cf8ad4f1ba7d6d9e2403520a7e54ceadee60c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 27 Aug 2010 14:57:02 +1000 Subject: Fix VisualDataModel model update handling when rootIndex is specified. Task-number: QTBUG-13038 --- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 15 +++--- .../qdeclarativevisualdatamodel/data/datalist.qml | 16 +++--- .../tst_qdeclarativevisualdatamodel.cpp | 61 ++++++++++++++++++++++ 3 files changed, 80 insertions(+), 12 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index b4e8bda..a46ee73 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1305,24 +1305,27 @@ void QDeclarativeVisualDataModel::_q_itemsMoved(int from, int to, int count) void QDeclarativeVisualDataModel::_q_rowsInserted(const QModelIndex &parent, int begin, int end) { - if (!parent.isValid()) + Q_D(QDeclarativeVisualDataModel); + if (parent == d->m_root) _q_itemsInserted(begin, end - begin + 1); } void QDeclarativeVisualDataModel::_q_rowsRemoved(const QModelIndex &parent, int begin, int end) { - if (!parent.isValid()) + Q_D(QDeclarativeVisualDataModel); + if (parent == d->m_root) _q_itemsRemoved(begin, end - begin + 1); } void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) { + Q_D(QDeclarativeVisualDataModel); const int count = sourceEnd - sourceStart + 1; - if (!destinationParent.isValid() && !sourceParent.isValid()) { + if (destinationParent == d->m_root && sourceParent == d->m_root) { _q_itemsMoved(sourceStart, destinationRow, count); - } else if (!sourceParent.isValid()) { + } else if (sourceParent == d->m_root) { _q_itemsRemoved(sourceStart, count); - } else if (!destinationParent.isValid()) { + } else if (destinationParent == d->m_root) { _q_itemsInserted(destinationRow, count); } } @@ -1330,7 +1333,7 @@ void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end) { Q_D(QDeclarativeVisualDataModel); - if (!begin.parent().isValid()) + if (begin.parent() == d->m_root) _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles); } diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml index a798f77..c5e945a 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml @@ -4,12 +4,16 @@ ListView { width: 100 height: 100 anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - Text { objectName: "display"; text: display } + model: VisualDataModel { + id: visualModel + objectName: "visualModel" + model: myModel + delegate: Component { + Rectangle { + height: 25 + width: 100 + Text { objectName: "display"; text: display } + } } } } diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index 3cd786f..95ef4fc 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -84,6 +84,7 @@ public: private slots: void rootIndex(); void updateLayout(); + void childChanged(); void objectListModel(); private: @@ -174,22 +175,82 @@ void tst_qdeclarativevisualdatamodel::updateLayout() QVERIFY(contentItem != 0); QDeclarativeText *name = findItem(contentItem, "display", 0); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 1 Item")); name = findItem(contentItem, "display", 1); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 2 Item")); name = findItem(contentItem, "display", 2); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 3 Item")); model.invisibleRootItem()->sortChildren(0, Qt::DescendingOrder); name = findItem(contentItem, "display", 0); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 3 Item")); name = findItem(contentItem, "display", 1); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 2 Item")); name = findItem(contentItem, "display", 2); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 1 Item")); } +void tst_qdeclarativevisualdatamodel::childChanged() +{ + QDeclarativeView view; + + QStandardItemModel model; + initStandardTreeModel(&model); + + view.rootContext()->setContextProperty("myModel", &model); + + view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml")); + + QDeclarativeListView *listview = qobject_cast(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + QDeclarativeVisualDataModel *vdm = listview->findChild("visualModel"); + vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0)))); + + QDeclarativeText *name = findItem(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 Child Item")); + + model.item(1,0)->child(0,0)->setText("Row 2 updated child"); + + name = findItem(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 updated child")); + + model.item(1,0)->appendRow(new QStandardItem(QLatin1String("Row 2 Child Item 2"))); + QTest::qWait(300); + + name = findItem(contentItem, "display", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), QString("Row 2 Child Item 2")); + + model.item(1,0)->takeRow(1); + name = findItem(contentItem, "display", 1); + QVERIFY(name == 0); + + vdm->setRootIndex(QVariant::fromValue(QModelIndex())); + QTest::qWait(300); + name = findItem(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 1 Item")); + name = findItem(contentItem, "display", 1); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 Item")); + name = findItem(contentItem, "display", 2); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 3 Item")); +} + void tst_qdeclarativevisualdatamodel::objectListModel() { QDeclarativeView view; -- cgit v0.12 From f37a3adcdb990015f1f1583b267ff6f680844236 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 27 Aug 2010 15:02:50 +1000 Subject: Remove pointless \internal docs (that contain no information) --- .../graphicsitems/qdeclarativeanchors.cpp | 9 ---- .../graphicsitems/qdeclarativeborderimage.cpp | 6 --- .../graphicsitems/qdeclarativeevents.cpp | 5 -- .../graphicsitems/qdeclarativeflipable.cpp | 9 ---- .../graphicsitems/qdeclarativefocuspanel.cpp | 5 -- .../graphicsitems/qdeclarativefocusscope.cpp | 5 -- .../graphicsitems/qdeclarativegraphicswidget.cpp | 19 ------- .../graphicsitems/qdeclarativeimage.cpp | 13 ----- .../graphicsitems/qdeclarativeimagebase.cpp | 7 --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 12 ----- .../graphicsitems/qdeclarativelayoutitem.cpp | 7 --- .../graphicsitems/qdeclarativeloader.cpp | 11 ---- .../graphicsitems/qdeclarativemousearea.cpp | 11 ---- src/declarative/graphicsitems/qdeclarativepath.cpp | 58 ---------------------- .../graphicsitems/qdeclarativepositioners.cpp | 18 +------ .../graphicsitems/qdeclarativerectangle.cpp | 5 -- .../graphicsitems/qdeclarativerepeater.cpp | 21 -------- src/declarative/graphicsitems/qdeclarativetext.cpp | 26 ---------- .../graphicsitems/qdeclarativetextedit.cpp | 17 ------- .../graphicsitems/qdeclarativetextinput.cpp | 2 - .../graphicsitems/qdeclarativetranslate.cpp | 3 -- src/declarative/util/qdeclarativeanimation.cpp | 54 +------------------- src/declarative/util/qdeclarativebind.cpp | 15 +----- src/declarative/util/qdeclarativeconnections.cpp | 7 --- .../util/qdeclarativepropertychanges.cpp | 6 --- src/declarative/util/qdeclarativestate.cpp | 17 ------- src/declarative/util/qdeclarativetransition.cpp | 6 --- src/declarative/util/qdeclarativexmllistmodel.cpp | 5 -- 28 files changed, 4 insertions(+), 375 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp index 7ac2b17..26fb97f 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp @@ -148,15 +148,6 @@ static qreal adjustedPosition(QGraphicsObject *item, QDeclarativeAnchorLine::Anc return ret; } -/*! - \internal - \class QDeclarativeAnchors - \since 4.7 - \brief The QDeclarativeAnchors class provides a way to lay out items relative to other items. - - \warning Currently, only anchoring to siblings or parent is supported. -*/ - QDeclarativeAnchors::QDeclarativeAnchors(QObject *parent) : QObject(*new QDeclarativeAnchorsPrivate(0), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index e0c7fc2..f16770b 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -79,12 +79,6 @@ QT_BEGIN_NAMESPACE rectangular item. */ -/*! - \class QDeclarativeBorderImage BorderImage - \internal - \brief The QDeclarativeBorderImage class provides an image item that you can add to a QDeclarativeView. -*/ - QDeclarativeBorderImage::QDeclarativeBorderImage(QDeclarativeItem *parent) : QDeclarativeImageBase(*(new QDeclarativeBorderImagePrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp index 0a35a3f..dbfb3fb 100644 --- a/src/declarative/graphicsitems/qdeclarativeevents.cpp +++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp @@ -60,11 +60,6 @@ Item { */ /*! - \internal - \class QDeclarativeKeyEvent -*/ - -/*! \qmlproperty int KeyEvent::key This property holds the code of the key that was pressed or released. diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index 6ce0fa6..69dd66a 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -99,15 +99,6 @@ public: \sa {declarative/ui-components/flipable}{Flipable example} */ -/*! - \internal - \class QDeclarativeFlipable - \brief The Flipable item provides a surface that can be flipped. - - Flipable is an item that can be visibly "flipped" between its front and - back sides. -*/ - QDeclarativeFlipable::QDeclarativeFlipable(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeFlipablePrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp index 5c7959a..f345a14 100644 --- a/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp +++ b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp @@ -61,11 +61,6 @@ QT_BEGIN_NAMESPACE \l {qmlfocus}{keyboard focus documentation}. */ -/*! - \internal - \class QDeclarativeFocusPanel -*/ - QDeclarativeFocusPanel::QDeclarativeFocusPanel(QDeclarativeItem *parent) : QDeclarativeItem(parent) { diff --git a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp index 4498275..da97a46 100644 --- a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp +++ b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp @@ -60,11 +60,6 @@ QT_BEGIN_NAMESPACE \sa {declarative/keyinteraction/focus}{Keyboard focus example} */ -/*! - \internal - \class QDeclarativeFocusScope -*/ - QDeclarativeFocusScope::QDeclarativeFocusScope(QDeclarativeItem *parent) : QDeclarativeItem(parent) { diff --git a/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp b/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp index ee45406..d45fe83 100644 --- a/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp +++ b/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp @@ -68,7 +68,6 @@ QDeclarativeGraphicsWidget::~QDeclarativeGraphicsWidget() delete d->_anchors; d->_anchors = 0; } -/*! \internal */ QDeclarativeAnchors *QDeclarativeGraphicsWidget::anchors() { Q_D(QDeclarativeGraphicsWidget); @@ -85,54 +84,36 @@ QDeclarativeItemPrivate::AnchorLines *QDeclarativeGraphicsWidgetPrivate::anchorL return _anchorLines; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::left() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->left; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::right() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->right; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::horizontalCenter() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->hCenter; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::top() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->top; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::bottom() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->bottom; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::verticalCenter() const { Q_D(const QDeclarativeGraphicsWidget); diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 1cc5f81..7a88e78 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -91,19 +91,6 @@ QT_BEGIN_NAMESPACE \sa {declarative/imageelements/image}{Image example}, QDeclarativeImageProvider */ -/*! - \internal - \class QDeclarativeImage Image - \brief The QDeclarativeImage class provides an image item that you can add to a QDeclarativeView. - - Example: - \qml - Image { source: "pics/star.png" } - \endqml - - A QDeclarativeImage object can be instantiated in QML using the tag \l Image. -*/ - QDeclarativeImage::QDeclarativeImage(QDeclarativeItem *parent) : QDeclarativeImageBase(*(new QDeclarativeImagePrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index d6b935b..416604b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -50,13 +50,6 @@ QT_BEGIN_NAMESPACE - -/*! - \class QDeclarativeImageBase - \internal - \brief The base class for declarative images. - */ - QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent) : QDeclarativeItem(dd, parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 0f16a79..1054898 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -229,12 +229,6 @@ QT_BEGIN_NAMESPACE The angle to rotate, in degrees clockwise. */ -/*! - \internal - \class QDeclarativeContents - \brief The QDeclarativeContents class gives access to the height and width of an item's contents. - -*/ QDeclarativeContents::QDeclarativeContents(QDeclarativeItem *item) : m_item(item), m_x(0), m_y(0), m_width(0), m_height(0) { //### optimize @@ -1728,7 +1722,6 @@ void QDeclarativeItemPrivate::parentProperty(QObject *o, void *rv, QDeclarativeN specify it. */ -/*! \internal */ QDeclarativeListProperty QDeclarativeItemPrivate::data() { return QDeclarativeListProperty(q_func(), 0, QDeclarativeItemPrivate::data_append); @@ -2416,7 +2409,6 @@ void QDeclarativeItemPrivate::focusChanged(bool flag) emit q->focusChanged(flag); } -/*! \internal */ QDeclarativeListProperty QDeclarativeItemPrivate::resources() { return QDeclarativeListProperty(q_func(), 0, QDeclarativeItemPrivate::resources_append, @@ -2441,7 +2433,6 @@ QDeclarativeListProperty QDeclarativeItemPrivate::resources() \sa {qmlstate}{States} */ -/*! \internal */ QDeclarativeListProperty QDeclarativeItemPrivate::states() { return _states()->statesProperty(); @@ -2465,7 +2456,6 @@ QDeclarativeListProperty QDeclarativeItemPrivate::states() */ -/*! \internal */ QDeclarativeListProperty QDeclarativeItemPrivate::transitions() { return _states()->transitionsProperty(); @@ -2538,7 +2528,6 @@ QDeclarativeListProperty QDeclarativeItemPrivate::transi \sa {qmlstates}{States} */ -/*! \internal */ QString QDeclarativeItemPrivate::state() const { if (!_stateGroup) @@ -2547,7 +2536,6 @@ QString QDeclarativeItemPrivate::state() const return _stateGroup->state(); } -/*! \internal */ void QDeclarativeItemPrivate::setState(const QString &state) { _states()->setState(state); diff --git a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp index 8509473..d71b2c5 100644 --- a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp @@ -66,13 +66,6 @@ QT_BEGIN_NAMESPACE */ /*! - \internal - \class QDeclarativeLayoutItem - \brief The QDeclarativeLayoutItem class allows you to place your QML UI elements inside Qt's Graphics View layouts. -*/ - - -/*! \qmlproperty QSizeF LayoutItem::maximumSize The maximumSize property can be set to specify the maximum desired size of this LayoutItem diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 2fde4c8..5d71625 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -189,14 +189,6 @@ void QDeclarativeLoaderPrivate::initResize() \sa {dynamic-object-creation}{Dynamic Object Creation} */ -/*! - \internal - \class QDeclarativeLoader - */ - -/*! - Create a new QDeclarativeLoader instance. - */ QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeLoaderPrivate), parent) { @@ -204,9 +196,6 @@ QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent) d->flags |= QGraphicsItem::ItemIsFocusScope; } -/*! - Destroy the loader instance. - */ QDeclarativeLoader::~QDeclarativeLoader() { Q_D(QDeclarativeLoader); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 2823888..ec01549 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -317,16 +317,6 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() \l Flickable, \c onCanceled should be used in addition to onReleased. */ -/*! - \internal - \class QDeclarativeMouseArea - \brief The QDeclarativeMouseArea class provides a simple mouse handling abstraction for use within QML. - - All QDeclarativeItem derived classes can do mouse handling but the QDeclarativeMouseArea class exposes mouse - handling data as properties and tracks flicking and dragging of the mouse. - - A QDeclarativeMouseArea object can be instantiated in QML using the tag \l MouseArea. - */ QDeclarativeMouseArea::QDeclarativeMouseArea(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeMouseAreaPrivate), parent) { @@ -690,7 +680,6 @@ void QDeclarativeMouseArea::geometryChanged(const QRectF &newGeometry, d->lastPos = mapFromScene(d->lastScenePos); } -/*! \internal */ QVariant QDeclarativeMouseArea::itemChange(GraphicsItemChange change, const QVariant &value) { diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index 0c069ce..f93357d 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -62,11 +62,6 @@ QT_BEGIN_NAMESPACE */ /*! - \internal - \class QDeclarativePathElement -*/ - -/*! \qmlclass Path QDeclarativePath \ingroup qml-view-elements \since 4.7 @@ -83,13 +78,6 @@ QT_BEGIN_NAMESPACE \sa PathView, PathAttribute, PathPercent, PathLine, PathQuad, PathCubic */ - -/*! - \internal - \class QDeclarativePath - \brief The QDeclarativePath class defines a path. - \sa QDeclarativePathView -*/ QDeclarativePath::QDeclarativePath(QObject *parent) : QObject(*(new QDeclarativePathPrivate), parent) { @@ -527,15 +515,6 @@ void QDeclarativeCurve::setY(qreal y) */ /*! - \internal - \class QDeclarativePathAttribute - \brief The QDeclarativePathAttribute class allows to set the value of an attribute at a given position in the path. - - \sa QDeclarativePath -*/ - - -/*! \qmlproperty string PathAttribute::name the name of the attribute to change. @@ -608,14 +587,6 @@ void QDeclarativePathAttribute::setValue(qreal value) */ /*! - \internal - \class QDeclarativePathLine - \brief The QDeclarativePathLine class defines a straight line. - - \sa QDeclarativePath -*/ - -/*! \qmlproperty real PathLine::x \qmlproperty real PathLine::y @@ -652,15 +623,6 @@ void QDeclarativePathLine::addToPath(QPainterPath &path) */ /*! - \internal - \class QDeclarativePathQuad - \brief The QDeclarativePathQuad class defines a quadratic Bezier curve with a control point. - - \sa QDeclarativePath -*/ - - -/*! \qmlproperty real PathQuad::x \qmlproperty real PathQuad::y @@ -743,14 +705,6 @@ void QDeclarativePathQuad::addToPath(QPainterPath &path) */ /*! - \internal - \class QDeclarativePathCubic - \brief The QDeclarativePathCubic class defines a cubic Bezier curve with two control points. - - \sa QDeclarativePath -*/ - -/*! \qmlproperty real PathCubic::x \qmlproperty real PathCubic::y @@ -872,18 +826,6 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) \sa Path */ -/*! - \internal - \class QDeclarativePathPercent - \brief The QDeclarativePathPercent class manipulates the way a path is interpreted. - - QDeclarativePathPercent allows you to bunch up items (or spread out items) along various - segments of a QDeclarativePathView's path. - - \sa QDeclarativePath - -*/ - qreal QDeclarativePathPercent::value() const { return _value; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 4ceb5d9..b776b8e 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -108,8 +108,7 @@ void QDeclarativeBasePositioner::graphicsWidgetGeometryChanged() You also need to set a PositionerType, to declare whether you are positioning the x, y or both for the child items. Depending on the chosen type, only x or y changes will be applied. - Note that the subclass is responsible for adding the - spacing in between items. + Note that the subclass is responsible for adding the spacing in between items. */ QDeclarativeBasePositioner::QDeclarativeBasePositioner(PositionerType at, QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeBasePositionerPrivate), parent) @@ -439,11 +438,6 @@ Column { \image spacing_b.png */ -/*! - \internal - \class QDeclarativeColumn - \brief The QDeclarativeColumn class lines up items vertically. -*/ QDeclarativeColumn::QDeclarativeColumn(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Vertical, parent) { @@ -579,11 +573,6 @@ Row { \image spacing_b.png */ -/*! - \internal - \class QDeclarativeRow - \brief The QDeclarativeRow class lines up items horizontally. -*/ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Horizontal, parent) { @@ -736,11 +725,6 @@ Grid { \image spacing_b.png */ -/*! - \internal - \class QDeclarativeGrid - \brief The QDeclarativeGrid class lays out items in a grid. -*/ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight) { diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 5990c2d..d027924 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -180,11 +180,6 @@ void QDeclarativeGradient::doUpdate() int QDeclarativeRectanglePrivate::doUpdateSlotIdx = -1; -/*! - \internal - \class QDeclarativeRectangle - \brief The QDeclarativeRectangle class provides a rectangle item that you can add to a QDeclarativeView. -*/ QDeclarativeRectangle::QDeclarativeRectangle(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeRectanglePrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 4a951a2..97cf05c 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -146,23 +146,11 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \endcode */ -/*! - \internal - \class QDeclarativeRepeater - */ - -/*! - Create a new QDeclarativeRepeater instance. - */ QDeclarativeRepeater::QDeclarativeRepeater(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeRepeaterPrivate), parent) { } -/*! - Destroy the repeater instance. All items it instantiated are also - destroyed. - */ QDeclarativeRepeater::~QDeclarativeRepeater() { } @@ -301,18 +289,12 @@ int QDeclarativeRepeater::count() const } -/*! - \internal - */ void QDeclarativeRepeater::componentComplete() { QDeclarativeItem::componentComplete(); regenerate(); } -/*! - \internal - */ QVariant QDeclarativeRepeater::itemChange(GraphicsItemChange change, const QVariant &value) { @@ -335,9 +317,6 @@ void QDeclarativeRepeater::clear() d->deletables.clear(); } -/*! - \internal - */ void QDeclarativeRepeater::regenerate() { Q_D(QDeclarativeRepeater); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index e5ad743..f16af88 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -190,32 +190,6 @@ QSet QTextDocumentWithImageResources::errors; \sa {declarative/text/fonts}{Fonts example} */ - -/*! - \internal - \class QDeclarativeText - \qmlclass Text - - \brief The QDeclarativeText class provides a formatted text item that you can add to a QDeclarativeView. - - Text was designed for read-only text; it does not allow for any text editing. - It can display both plain and rich text. For example: - - \qml - Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" } - Text { text: "Hello World!" } - \endqml - - \image text.png - - If height and width are not explicitly set, Text will attempt to determine how - much room is needed and set it accordingly. Unless \c wrapMode is set, it will always - prefer width to height (all text will be placed on a single line). - - The \c elide property can alternatively be used to fit a line of plain text to a set width. - - A QDeclarativeText object can be instantiated in QML using the tag \c Text. -*/ QDeclarativeText::QDeclarativeText(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeTextPrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index b8e8726..b1c0fcd 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -103,23 +103,6 @@ TextEdit { \sa Text, TextInput, {declarative/text/textselection}{Text Selection example} */ -/*! - \internal - \class QDeclarativeTextEdit - \qmlclass TextEdit - - \brief The QDeclarativeTextEdit class provides an editable formatted text item that you can add to a QDeclarativeView. - - It can display both plain and rich text. - - \image declarative-textedit.png - - A QDeclarativeTextEdit object can be instantiated in QML using the tag \c <TextEdit>. -*/ - -/*! - Constructs a new QDeclarativeTextEdit. -*/ QDeclarativeTextEdit::QDeclarativeTextEdit(QDeclarativeItem *parent) : QDeclarativePaintedItem(*(new QDeclarativeTextEditPrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index b4f36f4..5604b82 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -437,8 +437,6 @@ void QDeclarativeTextInput::setCursorPosition(int cp) } /*! - \internal - Returns a Rect which encompasses the cursor, but which may be larger than is required. Ignores custom cursor delegates. */ diff --git a/src/declarative/graphicsitems/qdeclarativetranslate.cpp b/src/declarative/graphicsitems/qdeclarativetranslate.cpp index 0bae0cd..2e0af2a 100644 --- a/src/declarative/graphicsitems/qdeclarativetranslate.cpp +++ b/src/declarative/graphicsitems/qdeclarativetranslate.cpp @@ -116,9 +116,6 @@ void QDeclarativeTranslate::setY(qreal y) emit yChanged(); } -/*! - \internal -*/ void QDeclarativeTranslate::applyTo(QMatrix4x4 *matrix) const { Q_D(const QDeclarativeTranslate); diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 4e9e8d5..267642d 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -84,11 +84,6 @@ QT_BEGIN_NAMESPACE element directly will result in an error. */ -/*! - \class QDeclarativeAbstractAnimation - \internal -*/ - QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(QObject *parent) : QObject(*(new QDeclarativeAbstractAnimationPrivate), parent) { @@ -574,12 +569,6 @@ void QDeclarativeAbstractAnimation::timelineComplete() \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ -/*! - \internal - \class QDeclarativePauseAnimation -*/ - - QDeclarativePauseAnimation::QDeclarativePauseAnimation(QObject *parent) : QDeclarativeAbstractAnimation(*(new QDeclarativePauseAnimationPrivate), parent) { @@ -659,11 +648,6 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation() \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ -/*! - \internal - \class QDeclarativeColorAnimation -*/ - QDeclarativeColorAnimation::QDeclarativeColorAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) { @@ -776,10 +760,6 @@ void QDeclarativeColorAnimation::setTo(const QColor &t) \sa StateChangeScript */ -/*! - \internal - \class QDeclarativeScriptAction -*/ QDeclarativeScriptAction::QDeclarativeScriptAction(QObject *parent) :QDeclarativeAbstractAnimation(*(new QDeclarativeScriptActionPrivate), parent) { @@ -933,10 +913,6 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() \sa {QML Animation}, QtDeclarative */ -/*! - \internal - \class QDeclarativePropertyAction -*/ QDeclarativePropertyAction::QDeclarativePropertyAction(QObject *parent) : QDeclarativeAbstractAnimation(*(new QDeclarativePropertyActionPrivate), parent) { @@ -1185,12 +1161,6 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ - -/*! - \internal - \class QDeclarativeNumberAnimation -*/ - QDeclarativeNumberAnimation::QDeclarativeNumberAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) { @@ -1276,7 +1246,7 @@ void QDeclarativeNumberAnimation::setTo(qreal t) /*! \qmlclass Vector3dAnimation QDeclarativeVector3dAnimation - \ingroup qml-animation-transition + \ingroup qml-animation-transition \since 4.7 \inherits PropertyAnimation \brief The Vector3dAnimation element animates changes in QVector3d values. @@ -1291,12 +1261,6 @@ void QDeclarativeNumberAnimation::setTo(qreal t) \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ - -/*! - \internal - \class QDeclarativeVector3dAnimation -*/ - QDeclarativeVector3dAnimation::QDeclarativeVector3dAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) { @@ -1396,12 +1360,6 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ - -/*! - \internal - \class QDeclarativeRotationAnimation -*/ - QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress) { qreal newt = t; @@ -1702,11 +1660,6 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio \sa SequentialAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} */ -/*! - \internal - \class QDeclarativeParallelAnimation -*/ - QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) : QDeclarativeAnimationGroup(parent) { @@ -2512,11 +2465,6 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ - -/*! - \internal - \class QDeclarativeParentAnimation -*/ QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent) : QDeclarativeAnimationGroup(*(new QDeclarativeParentAnimationPrivate), parent) { diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp index 86d08f5..88b45ae 100644 --- a/src/declarative/util/qdeclarativebind.cpp +++ b/src/declarative/util/qdeclarativebind.cpp @@ -72,7 +72,7 @@ public: /*! \qmlclass Binding QDeclarativeBind - \ingroup qml-working-with-data + \ingroup qml-working-with-data \since 4.7 \brief The Binding element allows arbitrary property bindings to be created. @@ -95,18 +95,7 @@ public: immediately pushed onto the new target. \sa QtDeclarative - */ -/*! - \internal - \class QDeclarativeBind - \brief The QDeclarativeBind class allows arbitrary property bindings to be created. - - Simple bindings are usually earier to do in-place rather than creating a - QDeclarativeBind item. For that reason, QDeclarativeBind is usually used to transfer property information - from Qml to C++. - - \sa cppqml - */ +*/ QDeclarativeBind::QDeclarativeBind(QObject *parent) : QObject(*(new QDeclarativeBindPrivate), parent) { diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp index 293928e..15e5ac5 100644 --- a/src/declarative/util/qdeclarativeconnections.cpp +++ b/src/declarative/util/qdeclarativeconnections.cpp @@ -124,13 +124,6 @@ public: \sa QtDeclarative */ - -/*! - \internal - \class QDeclarativeConnections - \brief The QDeclarativeConnections class describes generalized connections to signals. - -*/ QDeclarativeConnections::QDeclarativeConnections(QObject *parent) : QObject(*(new QDeclarativeConnectionsPrivate), parent) { diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index c28ada3..e897458 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -127,12 +127,6 @@ QT_BEGIN_NAMESPACE */ /*! - \internal - \class QDeclarativePropertyChanges - \brief The QDeclarativePropertyChanges class describes new property values for a state. -*/ - -/*! \qmlproperty Object PropertyChanges::target This property holds the object which contains the properties to be changed. */ diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 6e17cf2..1ed7923 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -123,9 +123,6 @@ bool QDeclarativeActionEvent::override(QDeclarativeActionEvent *other) return false; } -/*! - \internal -*/ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObject *parent) : QObject(dd, parent) { @@ -164,20 +161,6 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {qdeclarativeanimation.html#transitions}{QML Transitions}, QtDeclarative */ - -/*! - \internal - \class QDeclarativeState - \brief The QDeclarativeState class allows you to define configurations of objects and properties. - - - QDeclarativeState allows you to specify a state as a set of batched changes from the default - configuration. - - \sa {states-transitions}{States and Transitions} -*/ - - QDeclarativeState::QDeclarativeState(QObject *parent) : QObject(*(new QDeclarativeStatePrivate), parent) { diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 21d7ded..478c7f4 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -99,12 +99,6 @@ QT_BEGIN_NAMESPACE \sa {QML Animation}, {declarative/animation/states}{states example}, {qmlstates}{States}, {QtDeclarative} */ -/*! - \internal - \class QDeclarativeTransition - \brief The QDeclarativeTransition class allows you to define animated transitions that occur on state changes. -*/ - //ParallelAnimationWrapper allows us to do a "callback" when the animation finishes, rather than connecting //and disconnecting signals and slots frequently class ParallelAnimationWrapper : public QParallelAnimationGroup diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 02bf370..47b502d 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -498,11 +498,6 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty Date: Fri, 27 Aug 2010 15:11:39 +1000 Subject: Remove pointless \internal docs (that contain no information) --- .../graphicsitems/qdeclarativeanimatedimage.cpp | 5 ---- src/imports/particles/qdeclarativeparticles.cpp | 33 ---------------------- 2 files changed, 38 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index e0a2149..a95e944 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -54,11 +54,6 @@ QT_BEGIN_NAMESPACE /*! - \class QDeclarativeAnimatedImage - \internal -*/ - -/*! \qmlclass AnimatedImage QDeclarativeAnimatedImage \inherits Image \since 4.7 diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp index 5cd9c0c..edb69bc 100644 --- a/src/imports/particles/qdeclarativeparticles.cpp +++ b/src/imports/particles/qdeclarativeparticles.cpp @@ -165,14 +165,6 @@ void QDeclarativeParticleMotion::destroy(QDeclarativeParticle &particle) It has no further properties. */ - -/*! - \internal - \class QDeclarativeParticleMotionLinear - \ingroup group_effects - \brief The QDeclarativeParticleMotionLinear class moves the particles linearly. -*/ - void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int interval) { p.x += interval * p.x_velocity; @@ -196,14 +188,6 @@ void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int inte */ /*! - \internal - \class QDeclarativeParticleMotionGravity - \ingroup group_effects - \brief The QDeclarativeParticleMotionGravity class moves the particles towards a point. - -*/ - -/*! \qmlproperty real ParticleMotionGravity::xattractor \qmlproperty real ParticleMotionGravity::yattractor These properties hold the x and y coordinates of the point attracting the particles. @@ -311,16 +295,6 @@ Rectangle { */ /*! - \internal - \class QDeclarativeParticleMotionWander - \ingroup group_effects - \brief The QDeclarativeParticleMotionWander class moves particles in a somewhat random fashion. - - The particles will continue roughly in the original direction, however will randomly - drift to each side. -*/ - -/*! \qmlproperty real ParticleMotionWander::xvariance \qmlproperty real ParticleMotionWander::yvariance @@ -709,13 +683,6 @@ Rectangle { \image particles.gif */ -/*! - \internal - \class QDeclarativeParticles - \ingroup group_effects - \brief The QDeclarativeParticles class generates and moves particles. -*/ - QDeclarativeParticles::QDeclarativeParticles(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeParticlesPrivate), parent) { -- cgit v0.12 From 7f69818e7dcd5b029010e5f930abed519956a8ff Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 27 Aug 2010 15:44:20 +1000 Subject: Cleanup --- src/declarative/qml/qdeclarativecompiler.cpp | 9 +++++---- src/declarative/qml/qdeclarativecontext.cpp | 8 +++----- src/declarative/qml/qdeclarativeparser_p.h | 7 +++---- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 34d33bb..f044e1a 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -668,13 +668,14 @@ void QDeclarativeCompiler::compileTree(Object *tree) QString scriptCode = QString::fromUtf8(unit->scripts.at(ii).resource->data); Object::ScriptBlock::Pragmas pragmas = QDeclarativeScriptParser::extractPragmas(scriptCode); + Q_ASSERT(!importedScripts.contains(unit->scripts.at(ii).qualifier)); + if (!scriptCode.isEmpty()) { Object::ScriptBlock &scriptBlock = importedScripts[unit->scripts.at(ii).qualifier]; - scriptBlock.codes.append(scriptCode); - scriptBlock.lineNumbers.append(1); - scriptBlock.files.append(unit->scripts.at(ii).resource->url); - scriptBlock.pragmas.append(pragmas); + scriptBlock.code = scriptCode; + scriptBlock.file = unit->scripts.at(ii).resource->url; + scriptBlock.pragmas = pragmas; } } diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index a3b16d9..de45a95 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -660,14 +660,12 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object if (!engine) return; - Q_ASSERT(script.codes.count() == 1); - QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); - const QString &code = script.codes.at(0); - const QString &url = script.files.at(0); - const QDeclarativeParser::Object::ScriptBlock::Pragmas &pragmas = script.pragmas.at(0); + const QString &code = script.code; + const QString &url = script.file; + const QDeclarativeParser::Object::ScriptBlock::Pragmas &pragmas = script.pragmas; Q_ASSERT(!url.isEmpty()); diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index d192f3a..c58aebc 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -183,10 +183,9 @@ namespace QDeclarativeParser }; Q_DECLARE_FLAGS(Pragmas, Pragma) - QStringList codes; - QStringList files; - QList lineNumbers; - QList pragmas; + QString code; + QString file; + Pragmas pragmas; }; // The bytes to cast instances by to get to the QDeclarativeParserStatus -- cgit v0.12 From e68270fab9b718f8dbef0b6f17573355ae704643 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 27 Aug 2010 15:50:34 +1000 Subject: QML JavaScript .import parser --- src/declarative/qml/qdeclarativescriptparser.cpp | 211 +++++++++++++++++++++++ src/declarative/qml/qdeclarativescriptparser_p.h | 11 ++ 2 files changed, 222 insertions(+) diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 0b3b35f..6460448 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -960,6 +960,217 @@ QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptParser::extra return rv; } +#define CHECK_LINE if(l.currentLineNo() != startLine) return rv; +#define CHECK_TOKEN(t) if (token != QDeclarativeJSGrammar:: t) return rv; + +static const int uriTokens[] = { + QDeclarativeJSGrammar::T_IDENTIFIER, + QDeclarativeJSGrammar::T_PROPERTY, + QDeclarativeJSGrammar::T_SIGNAL, + QDeclarativeJSGrammar::T_READONLY, + QDeclarativeJSGrammar::T_ON, + QDeclarativeJSGrammar::T_BREAK, + QDeclarativeJSGrammar::T_CASE, + QDeclarativeJSGrammar::T_CATCH, + QDeclarativeJSGrammar::T_CONTINUE, + QDeclarativeJSGrammar::T_DEFAULT, + QDeclarativeJSGrammar::T_DELETE, + QDeclarativeJSGrammar::T_DO, + QDeclarativeJSGrammar::T_ELSE, + QDeclarativeJSGrammar::T_FALSE, + QDeclarativeJSGrammar::T_FINALLY, + QDeclarativeJSGrammar::T_FOR, + QDeclarativeJSGrammar::T_FUNCTION, + QDeclarativeJSGrammar::T_IF, + QDeclarativeJSGrammar::T_IN, + QDeclarativeJSGrammar::T_INSTANCEOF, + QDeclarativeJSGrammar::T_NEW, + QDeclarativeJSGrammar::T_NULL, + QDeclarativeJSGrammar::T_RETURN, + QDeclarativeJSGrammar::T_SWITCH, + QDeclarativeJSGrammar::T_THIS, + QDeclarativeJSGrammar::T_THROW, + QDeclarativeJSGrammar::T_TRUE, + QDeclarativeJSGrammar::T_TRY, + QDeclarativeJSGrammar::T_TYPEOF, + QDeclarativeJSGrammar::T_VAR, + QDeclarativeJSGrammar::T_VOID, + QDeclarativeJSGrammar::T_WHILE, + QDeclarativeJSGrammar::T_CONST, + QDeclarativeJSGrammar::T_DEBUGGER, + QDeclarativeJSGrammar::T_RESERVED_WORD, + QDeclarativeJSGrammar::T_WITH, + + QDeclarativeJSGrammar::EOF_SYMBOL +}; +static inline bool isUriToken(int token) +{ + const int *current = uriTokens; + while (*current != QDeclarativeJSGrammar::EOF_SYMBOL) { + if (*current == token) + return true; + ++current; + } + return false; +} + +QDeclarativeScriptParser::JavaScriptMetaData QDeclarativeScriptParser::extractMetaData(QString &script) +{ + JavaScriptMetaData rv; + + QDeclarativeParser::Object::ScriptBlock::Pragmas &pragmas = rv.pragmas; + + const QString pragma(QLatin1String("pragma")); + const QString js(QLatin1String(".js")); + const QString library(QLatin1String("library")); + + QDeclarativeJS::Lexer l(0); + l.setCode(script, 0); + + int token = l.lex(); + + while (true) { + if (token != QDeclarativeJSGrammar::T_DOT) + return rv; + + int startOffset = l.tokenOffset(); + int startLine = l.currentLineNo(); + + token = l.lex(); + + CHECK_LINE; + + if (token == QDeclarativeJSGrammar::T_IMPORT) { + + // .import as + // .import as + + token = l.lex(); + + CHECK_LINE; + + if (token == QDeclarativeJSGrammar::T_STRING_LITERAL) { + + QString file(l.characterBuffer(), l.characterCount()); + if (!file.endsWith(js)) + return rv; + + token = l.lex(); + + CHECK_TOKEN(T_AS); + CHECK_LINE; + + token = l.lex(); + + CHECK_TOKEN(T_IDENTIFIER); + CHECK_LINE; + + int endOffset = l.tokenLength() + l.tokenOffset(); + + QString importId = script.mid(l.tokenOffset(), l.tokenLength()); + + if (!importId.at(0).isUpper()) + return rv; + + token = l.lex(); + if (l.currentLineNo() == startLine) + return rv; + + replaceWithSpace(script, startOffset, endOffset - startOffset); + + Import import; + import.type = Import::Script; + import.uri = file; + import.qualifier = importId; + + rv.imports << import; + + } else { + // URI + QString uri; + QString version; + + while (true) { + if (!isUriToken(token)) + return rv; + + uri.append(QString(l.characterBuffer(), l.characterCount())); + + token = l.lex(); + CHECK_LINE; + if (token != QDeclarativeJSGrammar::T_DOT) + break; + + uri.append(QLatin1Char('.')); + + token = l.lex(); + CHECK_LINE; + } + + CHECK_TOKEN(T_NUMERIC_LITERAL); + version = script.mid(l.tokenOffset(), l.tokenLength()); + + token = l.lex(); + + CHECK_TOKEN(T_AS); + CHECK_LINE; + + token = l.lex(); + + CHECK_TOKEN(T_IDENTIFIER); + CHECK_LINE; + + int endOffset = l.tokenLength() + l.tokenOffset(); + + QString importId = script.mid(l.tokenOffset(), l.tokenLength()); + + if (!importId.at(0).isUpper()) + return rv; + + token = l.lex(); + if (l.currentLineNo() == startLine) + return rv; + + replaceWithSpace(script, startOffset, endOffset - startOffset); + + Import import; + import.type = Import::Library; + import.uri = uri; + import.version = version; + import.qualifier = importId; + + rv.imports << import; + } + + } else if (token == QDeclarativeJSGrammar::T_IDENTIFIER && + script.mid(l.tokenOffset(), l.tokenLength()) == pragma) { + + token = l.lex(); + + CHECK_TOKEN(T_IDENTIFIER); + CHECK_LINE; + + QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength()); + int endOffset = l.tokenLength() + l.tokenOffset(); + + if (pragmaValue == QLatin1String("library")) { + pragmas |= QDeclarativeParser::Object::ScriptBlock::Shared; + replaceWithSpace(script, startOffset, endOffset - startOffset); + } else { + return rv; + } + + token = l.lex(); + if (l.currentLineNo() == startLine) + return rv; + + } else { + return rv; + } + } + return rv; +} + void QDeclarativeScriptParser::clear() { if (root) { diff --git a/src/declarative/qml/qdeclarativescriptparser_p.h b/src/declarative/qml/qdeclarativescriptparser_p.h index 28e960b..6f191af 100644 --- a/src/declarative/qml/qdeclarativescriptparser_p.h +++ b/src/declarative/qml/qdeclarativescriptparser_p.h @@ -112,7 +112,18 @@ public: QList errors() const; + class JavaScriptMetaData { + public: + JavaScriptMetaData() + : pragmas(QDeclarativeParser::Object::ScriptBlock::None) {} + + QDeclarativeParser::Object::ScriptBlock::Pragmas pragmas; + QList imports; + }; + static QDeclarativeParser::Object::ScriptBlock::Pragmas extractPragmas(QString &); + static JavaScriptMetaData extractMetaData(QString &); + // ### private: TypeReference *findOrCreateType(const QString &name); -- cgit v0.12 From a4d3ffe03359e415f4a4a5740eb19bbb9dfddc0b Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 27 Aug 2010 15:55:57 +1000 Subject: Simplify type management code --- src/declarative/qml/qdeclarativecompiler.cpp | 75 +- src/declarative/qml/qdeclarativecompiler_p.h | 6 +- src/declarative/qml/qdeclarativecomponent.cpp | 55 +- src/declarative/qml/qdeclarativecomponent.h | 1 + src/declarative/qml/qdeclarativecomponent_p.h | 12 +- .../qml/qdeclarativecompositetypedata_p.h | 161 --- .../qml/qdeclarativecompositetypemanager.cpp | 778 -------------- .../qml/qdeclarativecompositetypemanager_p.h | 120 --- src/declarative/qml/qdeclarativedom.cpp | 35 +- src/declarative/qml/qdeclarativeengine.cpp | 4 +- src/declarative/qml/qdeclarativeengine_p.h | 4 +- src/declarative/qml/qdeclarativeproperty.cpp | 1 - src/declarative/qml/qdeclarativescriptparser.cpp | 6 - src/declarative/qml/qdeclarativescriptparser_p.h | 2 - src/declarative/qml/qdeclarativetypeloader.cpp | 1070 ++++++++++++++++++++ src/declarative/qml/qdeclarativetypeloader_p.h | 321 ++++++ src/declarative/qml/qml.pri | 5 +- .../data/nestedErrors.errors.txt | 2 +- .../qdeclarativeloader/tst_qdeclarativeloader.cpp | 4 +- .../tst_qdeclarativetextedit.cpp | 2 +- 20 files changed, 1474 insertions(+), 1190 deletions(-) delete mode 100644 src/declarative/qml/qdeclarativecompositetypedata_p.h delete mode 100644 src/declarative/qml/qdeclarativecompositetypemanager.cpp delete mode 100644 src/declarative/qml/qdeclarativecompositetypemanager_p.h create mode 100644 src/declarative/qml/qdeclarativetypeloader.cpp create mode 100644 src/declarative/qml/qdeclarativetypeloader_p.h diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index f044e1a..a6b0b34 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -41,7 +41,6 @@ #include "private/qdeclarativecompiler_p.h" -#include "private/qdeclarativecompositetypedata_p.h" #include "private/qdeclarativeparser_p.h" #include "private/qdeclarativescriptparser_p.h" #include "qdeclarativepropertyvaluesource.h" @@ -562,7 +561,7 @@ void QDeclarativeCompiler::reset(QDeclarativeCompiledData *data) on a successful compiler. */ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, - QDeclarativeCompositeTypeData *unit, + QDeclarativeTypeData *unit, QDeclarativeCompiledData *out) { exceptions.clear(); @@ -573,10 +572,15 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, output = out; // Compile types - for (int ii = 0; ii < unit->types.count(); ++ii) { - QDeclarativeCompositeTypeData::TypeReference &tref = unit->types[ii]; + const QList &resolvedTypes = unit->resolvedTypes(); + QList referencedTypes = unit->parser().referencedTypes(); + + for (int ii = 0; ii < resolvedTypes.count(); ++ii) { QDeclarativeCompiledData::TypeReference ref; - QDeclarativeScriptParser::TypeReference *parserRef = unit->data.referencedTypes().at(ii); + + const QDeclarativeTypeData::TypeReference &tref = resolvedTypes.at(ii); + QDeclarativeScriptParser::TypeReference *parserRef = referencedTypes.at(ii); + if (tref.type) { ref.type = tref.type; if (!ref.type->isCreatable()) { @@ -585,33 +589,16 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, err = tr( "Element is not creatable."); COMPILE_EXCEPTION(parserRef->refObjects.first(), err); } - } else if (tref.unit) { - ref.component = tref.unit->toComponent(engine); - - if (ref.component->isError()) { - QDeclarativeError error; - error.setUrl(output->url); - error.setDescription(QLatin1String("Unable to create type ") + - parserRef->name); - if (!parserRef->refObjects.isEmpty()) { - QDeclarativeParser::Object *parserObject = parserRef->refObjects.first(); - error.setLine(parserObject->location.start.line); - error.setColumn(parserObject->location.start.column); - } - - exceptions << error; - exceptions << ref.component->errors(); - reset(out); - return false; - } - ref.ref = tref.unit; + } else if (tref.typeData) { + ref.component = tref.typeData->component(); + ref.ref = tref.typeData; ref.ref->addref(); } ref.className = parserRef->name.toUtf8(); out->types << ref; } - Object *root = unit->data.tree(); + Object *root = unit->parser().tree(); Q_ASSERT(root); this->engine = engine; @@ -664,17 +651,17 @@ void QDeclarativeCompiler::compileTree(Object *tree) QHash importedScripts; QStringList importedScriptIndexes; - for (int ii = 0; ii < unit->scripts.count(); ++ii) { - QString scriptCode = QString::fromUtf8(unit->scripts.at(ii).resource->data); - Object::ScriptBlock::Pragmas pragmas = QDeclarativeScriptParser::extractPragmas(scriptCode); + foreach (const QDeclarativeTypeData::ScriptReference &script, unit->resolvedScripts()) { + QString scriptCode = script.script->scriptSource(); + Object::ScriptBlock::Pragmas pragmas = script.script->pragmas(); - Q_ASSERT(!importedScripts.contains(unit->scripts.at(ii).qualifier)); + Q_ASSERT(!importedScripts.contains(script.qualifier)); if (!scriptCode.isEmpty()) { - Object::ScriptBlock &scriptBlock = importedScripts[unit->scripts.at(ii).qualifier]; + Object::ScriptBlock &scriptBlock = importedScripts[script.qualifier]; scriptBlock.code = scriptCode; - scriptBlock.file = unit->scripts.at(ii).resource->url; + scriptBlock.file = script.script->finalUrl().toString(); scriptBlock.pragmas = pragmas; } } @@ -704,7 +691,7 @@ void QDeclarativeCompiler::compileTree(Object *tree) for (int ii = 0; ii < importedScriptIndexes.count(); ++ii) output->importCache->add(importedScriptIndexes.at(ii), ii); - unit->imports.populateCache(output->importCache, engine); + unit->imports().populateCache(output->importCache, engine); Q_ASSERT(tree->metatype); @@ -1404,7 +1391,7 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, QDeclarativeType *type = 0; QDeclarativeImportedNamespace *typeNamespace = 0; - unit->imports.resolveType(prop->name, &type, 0, 0, 0, &typeNamespace); + unit->imports().resolveType(prop->name, &type, 0, 0, 0, &typeNamespace); if (typeNamespace) { // ### We might need to indicate that this property is a namespace @@ -1512,7 +1499,7 @@ bool QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeImportedNamespac // Setup attached property data QDeclarativeType *type = 0; - unit->imports.resolveType(ns, prop->name, &type, 0, 0, 0); + unit->imports().resolveType(ns, prop->name, &type, 0, 0, 0); if (!type || !type->attachedPropertiesType()) COMPILE_EXCEPTION(prop, tr("Non-existent attached object")); @@ -2139,7 +2126,7 @@ bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop QString typeName = parts.at(0); QDeclarativeType *type = 0; - unit->imports.resolveType(typeName.toUtf8(), &type, 0, 0, 0, 0); + unit->imports().resolveType(typeName.toUtf8(), &type, 0, 0, 0, 0); if (!type || obj->typeName != type->qmlTypeName()) return true; @@ -2166,7 +2153,7 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const int dot = script.indexOf('.'); if (dot > 0) { QDeclarativeType *type = 0; - unit->imports.resolveType(script.left(dot), &type, 0, 0, 0, 0); + unit->imports().resolveType(script.left(dot), &type, 0, 0, 0, 0); if (!type) return -1; const QMetaObject *mo = type->metaObject(); @@ -2184,7 +2171,7 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) const { QDeclarativeType *qmltype = 0; - if (!unit->imports.resolveType(name, &qmltype, 0, 0, 0, 0)) + if (!unit->imports().resolveType(name, &qmltype, 0, 0, 0, 0)) return 0; if (!qmltype) return 0; @@ -2342,16 +2329,18 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn QByteArray customTypeName; QDeclarativeType *qmltype = 0; QUrl url; - if (!unit->imports.resolveType(p.customType, &qmltype, &url, 0, 0, 0)) + if (!unit->imports().resolveType(p.customType, &qmltype, &url, 0, 0, 0)) COMPILE_EXCEPTION(&p, tr("Invalid property type")); if (!qmltype) { - QDeclarativeCompositeTypeData *tdata = enginePrivate->typeManager.get(url); + QDeclarativeTypeData *tdata = enginePrivate->typeLoader.get(url); Q_ASSERT(tdata); - Q_ASSERT(tdata->status == QDeclarativeCompositeTypeData::Complete); + Q_ASSERT(tdata->isComplete()); - QDeclarativeCompiledData *data = tdata->toCompiledComponent(engine); + QDeclarativeCompiledData *data = tdata->compiledData(); customTypeName = data->root->className(); + data->release(); + tdata->release(); } else { customTypeName = qmltype->typeName(); } @@ -2746,7 +2735,7 @@ bool QDeclarativeCompiler::completeComponentBuild() expr.context = binding.bindingContext.object; expr.property = binding.property; expr.expression = binding.expression; - expr.imports = unit->imports; + expr.imports = unit->imports(); int index = bindingCompiler.compile(expr, enginePrivate); if (index != -1) { diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 49dc53f..89eef09 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -56,13 +56,13 @@ #include "qdeclarative.h" #include "qdeclarativeerror.h" #include "private/qdeclarativeinstruction_p.h" -#include "private/qdeclarativecompositetypemanager_p.h" #include "private/qdeclarativeparser_p.h" #include "private/qdeclarativeengine_p.h" #include "private/qbitfield_p.h" #include "private/qdeclarativepropertycache_p.h" #include "private/qdeclarativeintegercache_p.h" #include "private/qdeclarativetypenamecache_p.h" +#include "private/qdeclarativetypeloader_p.h" #include #include @@ -152,7 +152,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeCompiler public: QDeclarativeCompiler(); - bool compile(QDeclarativeEngine *, QDeclarativeCompositeTypeData *, QDeclarativeCompiledData *); + bool compile(QDeclarativeEngine *, QDeclarativeTypeData *, QDeclarativeCompiledData *); bool isError() const; QList errors() const; @@ -338,7 +338,7 @@ private: QDeclarativeEngine *engine; QDeclarativeEnginePrivate *enginePrivate; QDeclarativeParser::Object *unitRoot; - QDeclarativeCompositeTypeData *unit; + QDeclarativeTypeData *unit; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index d2d1f19..75bb5db 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -44,7 +44,6 @@ #include "private/qdeclarativecompiler_p.h" #include "private/qdeclarativecontext_p.h" -#include "private/qdeclarativecompositetypedata_p.h" #include "private/qdeclarativeengine_p.h" #include "private/qdeclarativevme_p.h" #include "qdeclarative.h" @@ -197,7 +196,7 @@ class QByteArray; \value Error An error has occurred. Call errors() to retrieve a list of \{QDeclarativeError}{errors}. */ -void QDeclarativeComponentPrivate::typeDataReady() +void QDeclarativeComponentPrivate::typeDataReady(QDeclarativeTypeData *) { Q_Q(QDeclarativeComponent); @@ -209,28 +208,25 @@ void QDeclarativeComponentPrivate::typeDataReady() emit q->statusChanged(q->status()); } -void QDeclarativeComponentPrivate::updateProgress(qreal p) +void QDeclarativeComponentPrivate::typeDataProgress(QDeclarativeTypeData *, qreal p) { Q_Q(QDeclarativeComponent); progress = p; + emit q->progressChanged(p); } -void QDeclarativeComponentPrivate::fromTypeData(QDeclarativeCompositeTypeData *data) +void QDeclarativeComponentPrivate::fromTypeData(QDeclarativeTypeData *data) { - url = data->imports.baseUrl(); - QDeclarativeCompiledData *c = data->toCompiledComponent(engine); + url = data->finalUrl(); + QDeclarativeCompiledData *c = data->compiledData(); if (!c) { - Q_ASSERT(data->status == QDeclarativeCompositeTypeData::Error); - - state.errors = data->errors; - + Q_ASSERT(data->isError()); + state.errors = data->errors(); } else { - cc = c; - } data->release(); @@ -239,7 +235,7 @@ void QDeclarativeComponentPrivate::fromTypeData(QDeclarativeCompositeTypeData *d void QDeclarativeComponentPrivate::clear() { if (typeData) { - typeData->remWaiter(this); + typeData->unregisterCallback(this); typeData->release(); typeData = 0; } @@ -271,7 +267,7 @@ QDeclarativeComponent::~QDeclarativeComponent() } if (d->typeData) { - d->typeData->remWaiter(d); + d->typeData->unregisterCallback(d); d->typeData->release(); } if (d->cc) @@ -443,19 +439,13 @@ void QDeclarativeComponent::setData(const QByteArray &data, const QUrl &url) d->url = url; - QDeclarativeCompositeTypeData *typeData = - QDeclarativeEnginePrivate::get(d->engine)->typeManager.getImmediate(data, url); + QDeclarativeTypeData *typeData = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(data, url); - if (typeData->status == QDeclarativeCompositeTypeData::Waiting - || typeData->status == QDeclarativeCompositeTypeData::WaitingResources) - { - d->typeData = typeData; - d->typeData->addWaiter(d); - - } else { - + if (typeData->isCompleteOrError()) { d->fromTypeData(typeData); - + } else { + d->typeData = typeData; + d->typeData->registerCallback(d); } d->progress = 1.0; @@ -501,18 +491,15 @@ void QDeclarativeComponent::loadUrl(const QUrl &url) return; } - QDeclarativeCompositeTypeData *data = - QDeclarativeEnginePrivate::get(d->engine)->typeManager.get(d->url); + QDeclarativeTypeData *data = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(d->url); - if (data->status == QDeclarativeCompositeTypeData::Waiting - || data->status == QDeclarativeCompositeTypeData::WaitingResources) - { - d->typeData = data; - d->typeData->addWaiter(d); - d->progress = data->progress; - } else { + if (data->isCompleteOrError()) { d->fromTypeData(data); d->progress = 1.0; + } else { + d->typeData = data; + d->typeData->registerCallback(d); + d->progress = data->progress(); } emit statusChanged(status()); diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h index 1d1fca7..fd9cb2b 100644 --- a/src/declarative/qml/qdeclarativecomponent.h +++ b/src/declarative/qml/qdeclarativecomponent.h @@ -117,6 +117,7 @@ private: Q_DISABLE_COPY(QDeclarativeComponent) friend class QDeclarativeVME; friend class QDeclarativeCompositeTypeData; + friend class QDeclarativeTypeData; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h index 2a7d633..1b1454b 100644 --- a/src/declarative/qml/qdeclarativecomponent_p.h +++ b/src/declarative/qml/qdeclarativecomponent_p.h @@ -56,7 +56,7 @@ #include "qdeclarativecomponent.h" #include "private/qdeclarativeengine_p.h" -#include "private/qdeclarativecompositetypemanager_p.h" +#include "private/qdeclarativetypeloader_p.h" #include "private/qbitfield_p.h" #include "qdeclarativeerror.h" #include "qdeclarative.h" @@ -74,7 +74,7 @@ class QDeclarativeEngine; class QDeclarativeCompiledData; class QDeclarativeComponentAttached; -class QDeclarativeComponentPrivate : public QObjectPrivate +class QDeclarativeComponentPrivate : public QObjectPrivate, public QDeclarativeTypeData::TypeDataCallback { Q_DECLARE_PUBLIC(QDeclarativeComponent) @@ -85,11 +85,11 @@ public: QObject *beginCreate(QDeclarativeContextData *, const QBitField &); void completeCreate(); - QDeclarativeCompositeTypeData *typeData; - void typeDataReady(); - void updateProgress(qreal); + QDeclarativeTypeData *typeData; + virtual void typeDataReady(QDeclarativeTypeData *); + virtual void typeDataProgress(QDeclarativeTypeData *, qreal); - void fromTypeData(QDeclarativeCompositeTypeData *data); + void fromTypeData(QDeclarativeTypeData *data); QUrl url; qreal progress; diff --git a/src/declarative/qml/qdeclarativecompositetypedata_p.h b/src/declarative/qml/qdeclarativecompositetypedata_p.h deleted file mode 100644 index a0e4cc2..0000000 --- a/src/declarative/qml/qdeclarativecompositetypedata_p.h +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVECOMPOSITETYPEDATA_P_H -#define QDECLARATIVECOMPOSITETYPEDATA_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "private/qdeclarativeengine_p.h" - -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeCompositeTypeResource; -class QDeclarativeCompositeTypeData : public QDeclarativeRefCount -{ -public: - QDeclarativeCompositeTypeData(); - virtual ~QDeclarativeCompositeTypeData(); - - enum Status { - Invalid, - Complete, - Error, - Waiting, - WaitingResources - }; - Status status; - enum ErrorType { - NoError, - AccessError, - GeneralError - }; - ErrorType errorType; - - QList errors; - - QDeclarativeImports imports; - - QList dependants; - - // Return a QDeclarativeComponent if the QDeclarativeCompositeTypeData is not in the Waiting - // state. The QDeclarativeComponent is owned by the QDeclarativeCompositeTypeData, so a - // reference should be kept to keep the QDeclarativeComponent alive. - QDeclarativeComponent *toComponent(QDeclarativeEngine *); - // Return a QDeclarativeCompiledData if possible, or 0 if an error - // occurs - QDeclarativeCompiledData *toCompiledComponent(QDeclarativeEngine *); - - struct TypeReference - { - TypeReference(); - - QDeclarativeType *type; - QDeclarativeCompositeTypeData *unit; - }; - - struct ScriptReference - { - ScriptReference(); - - QString qualifier; - QDeclarativeCompositeTypeResource *resource; - }; - - QList types; - QList scripts; - QList resources; - - // Add or remove p as a waiter. When the QDeclarativeCompositeTypeData becomes - // ready, the QDeclarativeComponentPrivate::typeDataReady() method will be invoked on - // p. The waiter is automatically removed when the typeDataReady() method - // is invoked, so there is no need to call remWaiter() in this case. - void addWaiter(QDeclarativeComponentPrivate *p); - void remWaiter(QDeclarativeComponentPrivate *p); - - qreal progress; - -private: - friend class QDeclarativeCompositeTypeManager; - friend class QDeclarativeCompiler; - friend class QDeclarativeDomDocument; - - QDeclarativeScriptParser data; - QList waiters; - QDeclarativeComponent *component; - QDeclarativeCompiledData *compiledComponent; -}; - -class QDeclarativeCompositeTypeResource : public QDeclarativeRefCount -{ -public: - QDeclarativeCompositeTypeResource(); - virtual ~QDeclarativeCompositeTypeResource(); - - enum Status { - Invalid, - Complete, - Error, - Waiting - }; - Status status; - - QList dependants; - - QString url; - QByteArray data; -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVECOMPOSITETYPEDATA_P_H - diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp deleted file mode 100644 index cc8f887..0000000 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ /dev/null @@ -1,778 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "private/qdeclarativecompositetypemanager_p.h" - -#include "private/qdeclarativecompositetypedata_p.h" -#include "private/qdeclarativescriptparser_p.h" -#include "qdeclarativeengine.h" -#include "private/qdeclarativeengine_p.h" -#include "qdeclarativecomponent.h" -#include "private/qdeclarativecomponent_p.h" -#include "private/qdeclarativecompiler_p.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QDeclarativeCompositeTypeData::QDeclarativeCompositeTypeData() -: status(Invalid), errorType(NoError), component(0), compiledComponent(0) -{ -} - -QDeclarativeCompositeTypeData::~QDeclarativeCompositeTypeData() -{ - for (int ii = 0; ii < dependants.count(); ++ii) - dependants.at(ii)->release(); - - for (int ii = 0; ii < resources.count(); ++ii) - resources.at(ii)->release(); - - if (compiledComponent) - compiledComponent->release(); - - if (component) - delete component; -} - -QDeclarativeCompositeTypeResource::QDeclarativeCompositeTypeResource() -{ -} - -QDeclarativeCompositeTypeResource::~QDeclarativeCompositeTypeResource() -{ - for (int ii = 0; ii < dependants.count(); ++ii) - dependants.at(ii)->release(); -} - -void QDeclarativeCompositeTypeData::addWaiter(QDeclarativeComponentPrivate *p) -{ - waiters << p; -} - -void QDeclarativeCompositeTypeData::remWaiter(QDeclarativeComponentPrivate *p) -{ - waiters.removeAll(p); -} - -QDeclarativeComponent *QDeclarativeCompositeTypeData::toComponent(QDeclarativeEngine *engine) -{ - if (!component) { - - QDeclarativeCompiledData *cc = toCompiledComponent(engine); - if (cc) { - component = new QDeclarativeComponent(engine, cc, -1, -1, 0); - cc->release(); - } else { - component = new QDeclarativeComponent(engine, 0); - component->d_func()->url = imports.baseUrl(); - component->d_func()->state.errors = errors; - } - - } - - return component; -} - -QDeclarativeCompiledData * -QDeclarativeCompositeTypeData::toCompiledComponent(QDeclarativeEngine *engine) -{ - if (status == Complete && !compiledComponent) { - - // Build script imports - foreach (const QDeclarativeScriptParser::Import &import, data.imports()) { - if (import.type == QDeclarativeScriptParser::Import::Script) { - QString url = imports.baseUrl().resolved(QUrl(import.uri)).toString(); - - ScriptReference ref; - ref.qualifier = import.qualifier; - - for (int ii = 0; ii < resources.count(); ++ii) { - if (resources.at(ii)->url == url) { - ref.resource = resources.at(ii); - break; - } - } - - Q_ASSERT(ref.resource); - - scripts << ref; - } - } - - compiledComponent = new QDeclarativeCompiledData(engine); - compiledComponent->url = imports.baseUrl(); - compiledComponent->name = compiledComponent->url.toString(); - - QDeclarativeCompiler compiler; - if (!compiler.compile(engine, this, compiledComponent)) { - status = Error; - errors = compiler.errors(); - compiledComponent->release(); - compiledComponent = 0; - } - - // Data is no longer needed once we have a compiled component - data.clear(); - } - - if (compiledComponent) - compiledComponent->addref(); - - return compiledComponent; -} - -QDeclarativeCompositeTypeData::TypeReference::TypeReference() -: type(0), unit(0) -{ -} - -QDeclarativeCompositeTypeData::ScriptReference::ScriptReference() -: resource(0) -{ -} - -QDeclarativeCompositeTypeManager::QDeclarativeCompositeTypeManager(QDeclarativeEngine *e) -: engine(e), redirectCount(0) -{ -} - -QDeclarativeCompositeTypeManager::~QDeclarativeCompositeTypeManager() -{ - for (Components::Iterator iter = components.begin(); iter != components.end();) { - (*iter)->release(); - iter = components.erase(iter); - } - for (Resources::Iterator iter = resources.begin(); iter != resources.end();) { - (*iter)->release(); - iter = resources.erase(iter); - } -} - -QDeclarativeCompositeTypeData *QDeclarativeCompositeTypeManager::get(const QUrl &url) -{ - Redirects::Iterator redir = redirects.find(url); - if (redir != redirects.end()) - return get(*redir); - - QDeclarativeCompositeTypeData *unit = components.value(url); - - if (!unit) { - unit = new QDeclarativeCompositeTypeData; - unit->status = QDeclarativeCompositeTypeData::Waiting; - unit->progress = 0.0; - unit->imports.setBaseUrl(url); - components.insert(url, unit); - - loadSource(unit); - } - - unit->addref(); - return unit; -} - -QDeclarativeCompositeTypeData * -QDeclarativeCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url) -{ - QDeclarativeCompositeTypeData *unit = new QDeclarativeCompositeTypeData; - unit->status = QDeclarativeCompositeTypeData::Waiting; - unit->imports.setBaseUrl(url); - setData(unit, data, url); - return unit; -} - -void QDeclarativeCompositeTypeManager::clearCache() -{ - for (Components::Iterator iter = components.begin(); iter != components.end();) { - if ((*iter)->status != QDeclarativeCompositeTypeData::Waiting) { - (*iter)->release(); - iter = components.erase(iter); - } else { - ++iter; - } - } - - for (Resources::Iterator iter = resources.begin(); iter != resources.end();) { - if ((*iter)->status != QDeclarativeCompositeTypeResource::Waiting) { - (*iter)->release(); - iter = resources.erase(iter); - } else { - ++iter; - } - } -} - -#define TYPEMANAGER_MAXIMUM_REDIRECT_RECURSION 16 - -void QDeclarativeCompositeTypeManager::replyFinished() -{ - QNetworkReply *reply = static_cast(sender()); - - QDeclarativeCompositeTypeData *unit = components.value(reply->url()); - Q_ASSERT(unit); - - redirectCount++; - if (redirectCount < TYPEMANAGER_MAXIMUM_REDIRECT_RECURSION) { - QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); - if (redirect.isValid()) { - QUrl url = reply->url().resolved(redirect.toUrl()); - redirects.insert(reply->url(),url); - unit->imports.setBaseUrl(url); - components.remove(reply->url()); - components.insert(url, unit); - reply->deleteLater(); - reply = engine->networkAccessManager()->get(QNetworkRequest(url)); - QObject::connect(reply, SIGNAL(finished()), - this, SLOT(replyFinished())); - QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), - this, SLOT(requestProgress(qint64,qint64))); - return; - } - } - redirectCount = 0; - - if (reply->error() != QNetworkReply::NoError) { - QString errorDescription; - // ### - Fill in error - errorDescription = QLatin1String("Network error for URL ") + - reply->url().toString(); - - unit->status = QDeclarativeCompositeTypeData::Error; - // ### FIXME - QDeclarativeError error; - error.setDescription(errorDescription); - unit->errorType = QDeclarativeCompositeTypeData::AccessError; - unit->errors << error; - doComplete(unit); - - } else { - QByteArray data = reply->readAll(); - - setData(unit, data, reply->url()); - } - - reply->deleteLater(); -} - -void QDeclarativeCompositeTypeManager::resourceReplyFinished() -{ - QNetworkReply *reply = static_cast(sender()); - - QDeclarativeCompositeTypeResource *resource = resources.value(reply->url()); - Q_ASSERT(resource); - - redirectCount++; - if (redirectCount < TYPEMANAGER_MAXIMUM_REDIRECT_RECURSION) { - QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); - if (redirect.isValid()) { - QUrl url = reply->url().resolved(redirect.toUrl()); - redirects.insert(reply->url(),url); - resource->url = url.toString(); - resources.remove(reply->url()); - resources.insert(url, resource); - reply->deleteLater(); - reply = engine->networkAccessManager()->get(QNetworkRequest(url)); - QObject::connect(reply, SIGNAL(finished()), - this, SLOT(resourceReplyFinished())); - return; - } - } - redirectCount = 0; - - if (reply->error() != QNetworkReply::NoError) { - - resource->status = QDeclarativeCompositeTypeResource::Error; - - } else { - - resource->status = QDeclarativeCompositeTypeResource::Complete; - resource->data = reply->readAll(); - - } - - doComplete(resource); - reply->deleteLater(); -} - -void QDeclarativeCompositeTypeManager::loadResource(QDeclarativeCompositeTypeResource *resource) -{ - QUrl url(resource->url); - - QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); - if (!lf.isEmpty()) { - - QFile file(lf); - if (file.open(QFile::ReadOnly)) { - resource->data = file.readAll(); - resource->status = QDeclarativeCompositeTypeResource::Complete; - } else { - resource->status = QDeclarativeCompositeTypeResource::Error; - } - } else if (url.scheme().isEmpty()) { - - // We can't open this, so just declare as an error - resource->status = QDeclarativeCompositeTypeResource::Error; - } else { - - QNetworkReply *reply = - engine->networkAccessManager()->get(QNetworkRequest(url)); - QObject::connect(reply, SIGNAL(finished()), - this, SLOT(resourceReplyFinished())); - - } -} - -void QDeclarativeCompositeTypeManager::loadSource(QDeclarativeCompositeTypeData *unit) -{ - QUrl url(unit->imports.baseUrl()); - - QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); - if (!lf.isEmpty()) { - - QFile file(lf); - if (file.open(QFile::ReadOnly)) { - QByteArray data = file.readAll(); - setData(unit, data, url); - return; // success - } - } else if (!url.scheme().isEmpty()) { - QNetworkReply *reply = - engine->networkAccessManager()->get(QNetworkRequest(url)); - QObject::connect(reply, SIGNAL(finished()), - this, SLOT(replyFinished())); - QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), - this, SLOT(requestProgress(qint64,qint64))); - return; // waiting - } - - // error happened - QString errorDescription; - // ### - Fill in error - errorDescription = QLatin1String("File error for URL ") + url.toString(); - unit->status = QDeclarativeCompositeTypeData::Error; - // ### FIXME - QDeclarativeError error; - error.setDescription(errorDescription); - unit->errorType = QDeclarativeCompositeTypeData::AccessError; - unit->errors << error; - doComplete(unit); -} - -void QDeclarativeCompositeTypeManager::requestProgress(qint64 received, qint64 total) -{ - if (total <= 0) - return; - QNetworkReply *reply = static_cast(sender()); - - QDeclarativeCompositeTypeData *unit = components.value(reply->url()); - Q_ASSERT(unit); - - unit->progress = qreal(received)/total; - - foreach (QDeclarativeComponentPrivate *comp, unit->waiters) - comp->updateProgress(unit->progress); -} - -void QDeclarativeCompositeTypeManager::setData(QDeclarativeCompositeTypeData *unit, - const QByteArray &data, - const QUrl &url) -{ - bool ok = true; - if (!unit->data.parse(data, url)) { - ok = false; - unit->errors << unit->data.errors(); - } - - if (ok) { - compile(unit); - } else { - unit->status = QDeclarativeCompositeTypeData::Error; - unit->errorType = QDeclarativeCompositeTypeData::GeneralError; - doComplete(unit); - } -} - -void QDeclarativeCompositeTypeManager::doComplete(QDeclarativeCompositeTypeData *unit) -{ - for (int ii = 0; ii < unit->dependants.count(); ++ii) { - checkComplete(unit->dependants.at(ii)); - unit->dependants.at(ii)->release(); - } - unit->dependants.clear(); - - while(!unit->waiters.isEmpty()) { - QDeclarativeComponentPrivate *p = unit->waiters.takeFirst(); - p->typeDataReady(); - } -} - -void QDeclarativeCompositeTypeManager::doComplete(QDeclarativeCompositeTypeResource *resource) -{ - for (int ii = 0; ii < resource->dependants.count(); ++ii) { - checkComplete(resource->dependants.at(ii)); - resource->dependants.at(ii)->release(); - } - resource->dependants.clear(); -} - -void QDeclarativeCompositeTypeManager::checkComplete(QDeclarativeCompositeTypeData *unit) -{ - if (unit->status != QDeclarativeCompositeTypeData::Waiting - && unit->status != QDeclarativeCompositeTypeData::WaitingResources) - return; - - int waiting = 0; - for (int ii = 0; ii < unit->resources.count(); ++ii) { - QDeclarativeCompositeTypeResource *r = unit->resources.at(ii); - - if (!r) - continue; - - if (r->status == QDeclarativeCompositeTypeResource::Error) { - unit->status = QDeclarativeCompositeTypeData::Error; - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Resource %1 unavailable").arg(r->url)); - unit->errors << error; - doComplete(unit); - return; - } else if (r->status == QDeclarativeCompositeTypeResource::Waiting) { - waiting++; - } - } - - if (waiting == 0) { - if (unit->status == QDeclarativeCompositeTypeData::WaitingResources) { - waiting += resolveTypes(unit); - if (unit->status != QDeclarativeCompositeTypeData::Error) { - if (waiting) - unit->status = QDeclarativeCompositeTypeData::Waiting; - } else { - return; - } - } else { - for (int ii = 0; ii < unit->types.count(); ++ii) { - QDeclarativeCompositeTypeData *u = unit->types.at(ii).unit; - - if (!u) - continue; - - if (u->status == QDeclarativeCompositeTypeData::Error) { - unit->status = QDeclarativeCompositeTypeData::Error; - unit->errors = u->errors; - doComplete(unit); - return; - } else if (u->status == QDeclarativeCompositeTypeData::Waiting - || u->status == QDeclarativeCompositeTypeData::WaitingResources) - { - waiting++; - } - } - } - } - - if (!waiting) { - unit->status = QDeclarativeCompositeTypeData::Complete; - doComplete(unit); - } -} - -int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData *unit) -{ - // not called until all resources are loaded (they include import URLs) - int waiting = 0; - - QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); - QDeclarativeImportDatabase *importDatabase = &ep->importDatabase; - - // For local urls, add an implicit import "." as first (most overridden) lookup. - // This will also trigger the loading of the qmldir and the import of any native - // types from available plugins. - { - QDeclarativeDirComponents qmldircomponentsnetwork; - if (QDeclarativeCompositeTypeResource *resource - = resources.value(unit->imports.baseUrl().resolved(QUrl(QLatin1String("./qmldir"))))) { - QDeclarativeDirParser parser; - parser.setSource(QString::fromUtf8(resource->data)); - parser.parse(); - qmldircomponentsnetwork = parser.components(); - } - - unit->imports.addImport(importDatabase, - QLatin1String("."), QString(), -1, -1, QDeclarativeScriptParser::Import::File, - qmldircomponentsnetwork, - 0); // error ignored (just means no fallback) - } - - - foreach (const QDeclarativeScriptParser::Import &imp, unit->data.imports()) { - QDeclarativeDirComponents qmldircomponentsnetwork; - if (imp.type == QDeclarativeScriptParser::Import::Script) - continue; - - if (imp.type == QDeclarativeScriptParser::Import::File && imp.qualifier.isEmpty()) { - QString importUrl = unit->imports.baseUrl().resolved(QUrl(imp.uri + QLatin1String("/qmldir"))).toString(); - for (int ii = 0; ii < unit->resources.count(); ++ii) { - if (unit->resources.at(ii)->url == importUrl) { - QDeclarativeDirParser parser; - parser.setSource(QString::fromUtf8(unit->resources.at(ii)->data)); - parser.parse(); - qmldircomponentsnetwork = parser.components(); - break; - } - } - } - - - int vmaj = -1; - int vmin = -1; - if (!imp.version.isEmpty()) { - int dot = imp.version.indexOf(QLatin1Char('.')); - if (dot < 0) { - vmaj = imp.version.toInt(); - vmin = 0; - } else { - vmaj = imp.version.left(dot).toInt(); - vmin = imp.version.mid(dot+1).toInt(); - } - } - - QString errorString; - if (!unit->imports.addImport(importDatabase, - imp.uri, imp.qualifier, vmaj, vmin, imp.type, - qmldircomponentsnetwork, &errorString)) { - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - error.setDescription(errorString); - error.setLine(imp.location.start.line); - error.setColumn(imp.location.start.column); - unit->status = QDeclarativeCompositeTypeData::Error; - unit->errorType = QDeclarativeCompositeTypeData::GeneralError; - unit->errors << error; - doComplete(unit); - return 0; - } - } - - - QList types = unit->data.referencedTypes(); - - for (int ii = 0; ii < types.count(); ++ii) { - QDeclarativeScriptParser::TypeReference *parserRef = types.at(ii); - QByteArray typeName = parserRef->name.toUtf8(); - - QDeclarativeCompositeTypeData::TypeReference ref; - - QUrl url; - int majorVersion; - int minorVersion; - QDeclarativeImportedNamespace *typeNamespace = 0; - QString errorString; - if (!unit->imports.resolveType(typeName, &ref.type, &url, &majorVersion, &minorVersion, - &typeNamespace, &errorString) || typeNamespace) { - // Known to not be a type: - // - known to be a namespace (Namespace {}) - // - type with unknown namespace (UnknownNamespace.SomeType {}) - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - QString userTypeName = QString::fromUtf8(typeName); - userTypeName.replace(QLatin1Char('/'),QLatin1Char('.')); - if (typeNamespace) - error.setDescription(tr("Namespace %1 cannot be used as a type").arg(userTypeName)); - else - error.setDescription(tr("%1 %2").arg(userTypeName).arg(errorString)); - - if (!parserRef->refObjects.isEmpty()) { - QDeclarativeParser::Object *obj = parserRef->refObjects.first(); - error.setLine(obj->location.start.line); - error.setColumn(obj->location.start.column); - } - unit->status = QDeclarativeCompositeTypeData::Error; - unit->errorType = QDeclarativeCompositeTypeData::GeneralError; - unit->errors << error; - doComplete(unit); - return 0; - } - - if (ref.type) { - foreach (QDeclarativeParser::Object *obj, parserRef->refObjects) { - // store namespace for DOM - obj->majorVersion = majorVersion; - obj->minorVersion = minorVersion; - } - unit->types << ref; - continue; - } - - Redirects::Iterator redir = redirects.find(url); - if (redir != redirects.end()) - url = *redir; - - QDeclarativeCompositeTypeData *urlUnit = components.value(url); - - if (!urlUnit) { - urlUnit = new QDeclarativeCompositeTypeData; - urlUnit->status = QDeclarativeCompositeTypeData::Waiting; - urlUnit->imports.setBaseUrl(url); - components.insert(url, urlUnit); - - loadSource(urlUnit); - } - - ref.unit = urlUnit; - switch(urlUnit->status) { - case QDeclarativeCompositeTypeData::Invalid: - case QDeclarativeCompositeTypeData::Error: - unit->status = QDeclarativeCompositeTypeData::Error; - { - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Type %1 unavailable").arg(QString::fromUtf8(typeName))); - if (!parserRef->refObjects.isEmpty()) { - QDeclarativeParser::Object *obj = parserRef->refObjects.first(); - error.setLine(obj->location.start.line); - error.setColumn(obj->location.start.column); - } - unit->errors << error; - } - if (urlUnit->errorType != QDeclarativeCompositeTypeData::AccessError) - unit->errors << urlUnit->errors; - doComplete(unit); - return 0; - - case QDeclarativeCompositeTypeData::Complete: - break; - - case QDeclarativeCompositeTypeData::Waiting: - case QDeclarativeCompositeTypeData::WaitingResources: - unit->addref(); - ref.unit->dependants << unit; - waiting++; - break; - } - - unit->types << ref; - } - return waiting; -} - -// ### Check ref counting in here -void QDeclarativeCompositeTypeManager::compile(QDeclarativeCompositeTypeData *unit) -{ - int waiting = 0; - - QList resourceList = unit->data.referencedResources(); - - foreach (QDeclarativeScriptParser::Import imp, unit->data.imports()) { - if (imp.type == QDeclarativeScriptParser::Import::File && imp.qualifier.isEmpty()) { - QUrl importUrl = unit->imports.baseUrl().resolved(QUrl(imp.uri + QLatin1String("/qmldir"))); - if (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl).isEmpty()) { - // Import requires remote qmldir - resourceList.prepend(importUrl); - } - } - } - - QUrl importUrl; - if (!unit->imports.baseUrl().scheme().isEmpty()) - importUrl = unit->imports.baseUrl().resolved(QUrl(QLatin1String("qmldir"))); - if (!importUrl.scheme().isEmpty() && QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl).isEmpty()) - resourceList.prepend(importUrl); - - for (int ii = 0; ii < resourceList.count(); ++ii) { - QUrl url = unit->imports.baseUrl().resolved(resourceList.at(ii)); - - QDeclarativeCompositeTypeResource *resource = resources.value(url); - - if (!resource) { - resource = new QDeclarativeCompositeTypeResource; - resource->status = QDeclarativeCompositeTypeResource::Waiting; - resource->url = url.toString(); - resources.insert(url, resource); - - loadResource(resource); - } - - switch(resource->status) { - case QDeclarativeCompositeTypeResource::Invalid: - case QDeclarativeCompositeTypeResource::Error: - unit->status = QDeclarativeCompositeTypeData::Error; - { - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Resource %1 unavailable").arg(resource->url)); - unit->errors << error; - } - doComplete(unit); - return; - - case QDeclarativeCompositeTypeData::Complete: - break; - - case QDeclarativeCompositeTypeData::Waiting: - unit->addref(); - resource->dependants << unit; - waiting++; - break; - } - - resource->addref(); - unit->resources << resource; - } - - if (waiting == 0) { - waiting += resolveTypes(unit); - if (unit->status != QDeclarativeCompositeTypeData::Error) { - if (!waiting) { - unit->status = QDeclarativeCompositeTypeData::Complete; - doComplete(unit); - } else { - unit->status = QDeclarativeCompositeTypeData::Waiting; - } - } - } else { - unit->status = QDeclarativeCompositeTypeData::WaitingResources; - } -} - -QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecompositetypemanager_p.h b/src/declarative/qml/qdeclarativecompositetypemanager_p.h deleted file mode 100644 index 5c82c4c..0000000 --- a/src/declarative/qml/qdeclarativecompositetypemanager_p.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVECOMPOSITETYPEMANAGER_P_H -#define QDECLARATIVECOMPOSITETYPEMANAGER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "private/qdeclarativescriptparser_p.h" -#include "private/qdeclarativerefcount_p.h" -#include "qdeclarativeerror.h" -#include "qdeclarativeengine.h" - -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeCompiledData; -class QDeclarativeComponentPrivate; -class QDeclarativeComponent; -class QDeclarativeDomDocument; - -class QDeclarativeCompositeTypeData; -class QDeclarativeCompositeTypeResource; - -class QDeclarativeCompositeTypeManager : public QObject -{ - Q_OBJECT -public: - QDeclarativeCompositeTypeManager(QDeclarativeEngine *); - ~QDeclarativeCompositeTypeManager(); - - // Return a QDeclarativeCompositeTypeData for url. The QDeclarativeCompositeTypeData may be - // cached. - QDeclarativeCompositeTypeData *get(const QUrl &url); - // Return a QDeclarativeCompositeTypeData for data, with the provided base url. The - // QDeclarativeCompositeTypeData will not be cached. - QDeclarativeCompositeTypeData *getImmediate(const QByteArray &data, const QUrl &url); - - // Clear cached types. Only types that aren't in the Waiting state will - // be cleared. - void clearCache(); - -private Q_SLOTS: - void replyFinished(); - void resourceReplyFinished(); - void requestProgress(qint64 received, qint64 total); - -private: - void loadSource(QDeclarativeCompositeTypeData *); - void loadResource(QDeclarativeCompositeTypeResource *); - void compile(QDeclarativeCompositeTypeData *); - void setData(QDeclarativeCompositeTypeData *, const QByteArray &, const QUrl &); - - void doComplete(QDeclarativeCompositeTypeData *); - void doComplete(QDeclarativeCompositeTypeResource *); - void checkComplete(QDeclarativeCompositeTypeData *); - int resolveTypes(QDeclarativeCompositeTypeData *); - - QDeclarativeEngine *engine; - typedef QHash Components; - Components components; - typedef QHash Resources; - Resources resources; - typedef QHash Redirects; - Redirects redirects; - int redirectCount; -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVECOMPOSITETYPEMANAGER_P_H - diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index 5b30bde..1a9b501 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -42,7 +42,6 @@ #include "private/qdeclarativedom_p.h" #include "private/qdeclarativedom_p_p.h" -#include "private/qdeclarativecompositetypedata_p.h" #include "private/qdeclarativecompiler_p.h" #include "private/qdeclarativeengine_p.h" #include "private/qdeclarativescriptparser_p.h" @@ -145,37 +144,23 @@ bool QDeclarativeDomDocument::load(QDeclarativeEngine *engine, const QByteArray d->errors.clear(); d->imports.clear(); - QDeclarativeCompiledData *component = new QDeclarativeCompiledData(engine); - QDeclarativeCompiler compiler; + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + QDeclarativeTypeData *td = ep->typeLoader.get(data, url, QDeclarativeTypeLoader::PreserveParser); - QDeclarativeCompositeTypeData *td = ((QDeclarativeEnginePrivate *)QDeclarativeEnginePrivate::get(engine))->typeManager.getImmediate(data, url); - - if(td->status == QDeclarativeCompositeTypeData::Error) { - d->errors = td->errors; + if(td->isError()) { + d->errors = td->errors(); td->release(); - component->release(); return false; - } else if(td->status == QDeclarativeCompositeTypeData::Waiting || - td->status == QDeclarativeCompositeTypeData::WaitingResources) { + } else if(!td->isCompleteOrError()) { QDeclarativeError error; error.setDescription(QLatin1String("QDeclarativeDomDocument supports local types only")); d->errors << error; td->release(); - component->release(); - return false; - } - - compiler.compile(engine, td, component); - - if (compiler.isError()) { - d->errors = compiler.errors(); - td->release(); - component->release(); return false; } - for (int i = 0; i < td->data.imports().size(); ++i) { - QDeclarativeScriptParser::Import parserImport = td->data.imports().at(i); + for (int i = 0; i < td->parser().imports().size(); ++i) { + QDeclarativeScriptParser::Import parserImport = td->parser().imports().at(i); QDeclarativeDomImport domImport; domImport.d->type = static_cast(parserImport.type); domImport.d->uri = parserImport.uri; @@ -184,12 +169,12 @@ bool QDeclarativeDomDocument::load(QDeclarativeEngine *engine, const QByteArray d->imports += domImport; } - if (td->data.tree()) { - d->root = td->data.tree(); + if (td->parser().tree()) { + d->root = td->parser().tree(); d->root->addref(); } - component->release(); + td->release(); return true; } diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index c5a5c18..6a2808c 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -259,7 +259,7 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) objectClass(0), valueTypeClass(0), globalClass(0), cleanup(0), erroredBindings(0), inProgressCreations(0), scriptEngine(this), workerScriptEngine(0), componentAttached(0), inBeginCreate(false), networkAccessManager(0), networkAccessManagerFactory(0), - typeManager(e), importDatabase(e), uniqueId(1) + typeLoader(e), importDatabase(e), uniqueId(1) { if (!qt_QmlQtModule_registered) { qt_QmlQtModule_registered = true; @@ -565,7 +565,7 @@ QDeclarativeEngine::~QDeclarativeEngine() void QDeclarativeEngine::clearComponentCache() { Q_D(QDeclarativeEngine); - d->typeManager.clearCache(); + d->typeLoader.clearCache(); } /*! diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index db2db35..dc7315d 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -56,7 +56,7 @@ #include "qdeclarativeengine.h" #include "private/qdeclarativeclassfactory_p.h" -#include "private/qdeclarativecompositetypemanager_p.h" +#include "private/qdeclarativetypeloader_p.h" #include "private/qdeclarativeimport_p.h" #include "private/qpodvector_p.h" #include "qdeclarative.h" @@ -239,7 +239,7 @@ public: mutable QMutex mutex; - QDeclarativeCompositeTypeManager typeManager; + QDeclarativeTypeLoader typeLoader; QDeclarativeImportDatabase importDatabase; QString offlineStoragePath; diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 515c4d6..d0dd2e8 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -42,7 +42,6 @@ #include "qdeclarativeproperty.h" #include "private/qdeclarativeproperty_p.h" -#include "private/qdeclarativecompositetypedata_p.h" #include "qdeclarative.h" #include "private/qdeclarativebinding_p.h" #include "qdeclarativecontext.h" diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 6460448..c956051 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -387,7 +387,6 @@ bool ProcessAST::visit(AST::UiImport *node) if (uri.endsWith(QLatin1String(".js"))) { import.type = QDeclarativeScriptParser::Import::Script; - _parser->_refUrls << QUrl(uri); } else { import.type = QDeclarativeScriptParser::Import::File; } @@ -878,11 +877,6 @@ QList QDeclarativeScriptParser::refere return _refTypes; } -QList QDeclarativeScriptParser::referencedResources() const -{ - return _refUrls; -} - Object *QDeclarativeScriptParser::tree() const { return root; diff --git a/src/declarative/qml/qdeclarativescriptparser_p.h b/src/declarative/qml/qdeclarativescriptparser_p.h index 6f191af..6319e11 100644 --- a/src/declarative/qml/qdeclarativescriptparser_p.h +++ b/src/declarative/qml/qdeclarativescriptparser_p.h @@ -103,7 +103,6 @@ public: bool parse(const QByteArray &data, const QUrl &url = QUrl()); QList referencedTypes() const; - QList referencedResources() const; QDeclarativeParser::Object *tree() const; QList imports() const; @@ -138,7 +137,6 @@ public: QDeclarativeParser::Object *root; QList _imports; QList _refTypes; - QList _refUrls; QString _scriptFile; QDeclarativeScriptParserJsASTData *data; }; diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp new file mode 100644 index 0000000..8c291f2 --- /dev/null +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -0,0 +1,1070 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativetypeloader_p.h" + +#include +#include +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/*! +\class QDeclarativeDataBlob +\brief The QDeclarativeDataBlob encapsulates a data request that can be issued to a QDeclarativeDataLoader. +\internal + +QDeclarativeDataBlob's are loaded by a QDeclarativeDataLoader. The user creates the QDeclarativeDataBlob +and then calls QDeclarativeDataLoader::load() or QDeclarativeDataLoader::loadWithStaticData() to load it. +The QDeclarativeDataLoader invokes callbacks on the QDeclarativeDataBlob as data becomes available. +*/ + +/*! +\enum QDeclarativeDataBlob::Status + +\o Null The blob has not yet been loaded by a QDeclarativeDataLoader +\o Loading The blob is loading network data. The QDeclarativeDataBlob::setData() callback has not yet been +invoked or has not yet returned. +\o WaitingForDependencies The blob is waiting for dependencies to be done before continueing. This status +only occurs after the QDeclarativeDataBlob::setData() callback has been made, and when the blob has outstanding +dependencies. +\o Complete The blob's data has been loaded and all dependencies are done. +\o Error An error has been set on this blob. +*/ + +/*! +\enum QDeclarativeDataBlob::Type +\o QmlFile This is a QDeclarativeTypeData +\o JavaScriptFile This is a QDeclarativeScriptData +\o QmldirFile This is a QDeclarativeQmldirData +*/ + +/*! +Create a new QDeclarativeDataBlob for \a url and of the provided \a type. +*/ +QDeclarativeDataBlob::QDeclarativeDataBlob(const QUrl &url, Type type) +: m_type(type), m_status(Null), m_progress(0), m_url(url), m_finalUrl(url), m_manager(0), + m_redirectCount(0), m_inCallback(false), m_isDone(false) +{ +} + +/*! \internal */ +QDeclarativeDataBlob::~QDeclarativeDataBlob() +{ + Q_ASSERT(m_waitingOnMe.isEmpty()); + + cancelAllWaitingFor(); +} + +/*! +Returns the type provided to the constructor. +*/ +QDeclarativeDataBlob::Type QDeclarativeDataBlob::type() const +{ + return m_type; +} + +/*! +Returns the blob's status. +*/ +QDeclarativeDataBlob::Status QDeclarativeDataBlob::status() const +{ + return m_status; +} + +/*! +Returns true if the status is Null. +*/ +bool QDeclarativeDataBlob::isNull() const +{ + return m_status == Null; +} + +/*! +Returns true if the status is Loading. +*/ +bool QDeclarativeDataBlob::isLoading() const +{ + return m_status == Loading; +} + +/*! +Returns true if the status is WaitingForDependencies. +*/ +bool QDeclarativeDataBlob::isWaiting() const +{ + return m_status == WaitingForDependencies; +} + +/*! +Returns true if the status is Complete. +*/ +bool QDeclarativeDataBlob::isComplete() const +{ + return m_status == Complete; +} + +/*! +Returns true if the status is Error. +*/ +bool QDeclarativeDataBlob::isError() const +{ + return m_status == Error; +} + +/*! +Returns true if the status is Complete or Error. +*/ +bool QDeclarativeDataBlob::isCompleteOrError() const +{ + return isComplete() || isError(); +} + +/*! +Returns the data download progress from 0 to 1. +*/ +qreal QDeclarativeDataBlob::progress() const +{ + return m_progress; +} + +/*! +Returns the blob url passed to the constructor. If a network redirect +happens while fetching the data, this url remains the same. + +\sa finalUrl() +*/ +QUrl QDeclarativeDataBlob::url() const +{ + return m_url; +} + +/*! +Returns the final url of the data. Initially this is the same as +url(), but if a network redirect happens while fetching the data, this url +is updated to reflect the new location. +*/ +QUrl QDeclarativeDataBlob::finalUrl() const +{ + return m_finalUrl; +} + +/*! +Return the errors on this blob. +*/ +QList QDeclarativeDataBlob::errors() const +{ + return m_errors; +} + +/*! +Mark this blob as having \a errors. + +All outstanding dependencies will be cancelled. Requests to add new dependencies +will be ignored. Entry into the Error state is irreversable, although you can change the +specific errors by additional calls to setError. +*/ +void QDeclarativeDataBlob::setError(const QDeclarativeError &errors) +{ + QList l; + l << errors; + setError(l); +} + +/*! +\override +*/ +void QDeclarativeDataBlob::setError(const QList &errors) +{ + m_status = Error; + m_errors = errors; + + cancelAllWaitingFor(); + + if (!m_inCallback) + tryDone(); +} + +/*! +Wait for \a blob to become complete or to error. If \a blob is already +complete or in error, or this blob is already complete, this has no effect. +*/ +void QDeclarativeDataBlob::addDependency(QDeclarativeDataBlob *blob) +{ + Q_ASSERT(status() != Null); + + if (!blob || + blob->status() == Error || blob->status() == Complete || + status() == Error || status() == Complete || + m_waitingFor.contains(blob)) + return; + + blob->addref(); + m_status = WaitingForDependencies; + m_waitingFor.append(blob); + blob->m_waitingOnMe.append(this); +} + +/*! +\fn void QDeclarativeDataBlob::dataReceived(const QByteArray &data) + +Invoked when data for the blob is received. Implementors should use this callback +to determine a blob's dependencies. Within this callback you may call setError() +or addDependency(). +*/ + +/*! +Invoked once data has either been received or a network error occurred, and all +dependencies are complete. + +You can set an error in this method, but you cannot add new dependencies. Implementors +should use this callback to finalize processing of data. + +The default implementation does nothing. +*/ +void QDeclarativeDataBlob::done() +{ +} + +/*! +Invoked if there is a network error while fetching this blob. + +The default implementation sets an appropriate QDeclarativeError. +*/ +void QDeclarativeDataBlob::networkError(QNetworkReply::NetworkError networkError) +{ + Q_UNUSED(networkError); + + QDeclarativeError error; + error.setUrl(m_finalUrl); + + const char *errorString = 0; + switch (networkError) { + default: + errorString = "Network error"; + break; + case QNetworkReply::ConnectionRefusedError: + errorString = "Connection refused"; + break; + case QNetworkReply::RemoteHostClosedError: + errorString = "Remote host closed the connection"; + break; + case QNetworkReply::HostNotFoundError: + errorString = "Host not found"; + break; + case QNetworkReply::TimeoutError: + errorString = "Timeout"; + break; + case QNetworkReply::ProxyConnectionRefusedError: + case QNetworkReply::ProxyConnectionClosedError: + case QNetworkReply::ProxyNotFoundError: + case QNetworkReply::ProxyTimeoutError: + case QNetworkReply::ProxyAuthenticationRequiredError: + case QNetworkReply::UnknownProxyError: + errorString = "Proxy error"; + break; + case QNetworkReply::ContentAccessDenied: + errorString = "Access denied"; + break; + case QNetworkReply::ContentNotFoundError: + errorString = "File not found"; + break; + case QNetworkReply::AuthenticationRequiredError: + errorString = "Authentication required"; + break; + }; + + error.setDescription(QLatin1String(errorString)); + + setError(error); +} + +/*! +Called if \a blob, which was previously waited for, has an error. + +The default implementation does nothing. +*/ +void QDeclarativeDataBlob::dependencyError(QDeclarativeDataBlob *blob) +{ + Q_UNUSED(blob); +} + +/*! +Called if \a blob, which was previously waited for, has completed. + +The default implementation does nothing. +*/ +void QDeclarativeDataBlob::dependencyComplete(QDeclarativeDataBlob *blob) +{ + Q_UNUSED(blob); +} + +/*! +Called when all blobs waited for have completed. This occurs regardless of +whether they are in error, or complete state. + +The default implementation does nothing. +*/ +void QDeclarativeDataBlob::allDependenciesDone() +{ +} + +/*! +Called when the download progress of this blob changes. \a progress goes +from 0 to 1. +*/ +void QDeclarativeDataBlob::downloadProgressChanged(qreal progress) +{ + Q_UNUSED(progress); +} + +void QDeclarativeDataBlob::tryDone() +{ + if (status() != Loading && m_waitingFor.isEmpty() && !m_isDone) { + if (status() != Error) + m_status = Complete; + + m_isDone = true; + done(); + notifyAllWaitingOnMe(); + } +} + +void QDeclarativeDataBlob::cancelAllWaitingFor() +{ + while (m_waitingFor.count()) { + QDeclarativeDataBlob *blob = m_waitingFor.takeLast(); + + Q_ASSERT(blob->m_waitingOnMe.contains(this)); + + blob->m_waitingOnMe.removeOne(this); + + blob->release(); + } +} + +void QDeclarativeDataBlob::notifyAllWaitingOnMe() +{ + while (m_waitingOnMe.count()) { + QDeclarativeDataBlob *blob = m_waitingOnMe.takeLast(); + + Q_ASSERT(blob->m_waitingFor.contains(this)); + + blob->notifyComplete(this); + } +} + +void QDeclarativeDataBlob::notifyComplete(QDeclarativeDataBlob *blob) +{ + Q_ASSERT(m_waitingFor.contains(blob)); + Q_ASSERT(blob->status() == Error || blob->status() == Complete); + + m_inCallback = true; + + if (blob->status() == Error) { + dependencyError(blob); + } else if (blob->status() == Complete) { + dependencyComplete(blob); + } + + m_waitingFor.removeOne(blob); + blob->release(); + + if (!isError() && m_waitingFor.isEmpty()) + allDependenciesDone(); + + m_inCallback = false; + + tryDone(); +} + +/*! +\class QDeclarativeDataLoader +\brief The QDeclarativeDataLoader class abstracts loading files and their dependecies over the network. +\internal + +The QDeclarativeDataLoader class is provided for the exclusive use of the QDeclarativeTypeLoader class. + +Clients create QDeclarativeDataBlob instances and submit them to the QDeclarativeDataLoader class +through the QDeclarativeDataLoader::load() or QDeclarativeDataLoader::loadWithStaticData() methods. +The loader then fetches the data over the network or from the local file system in an efficient way. +QDeclarativeDataBlob is an abstract class, so should always be specialized. + +Once data is received, the QDeclarativeDataBlob::dataReceived() method is invoked on the blob. The +derived class should use this callback to process the received data. Processing of the data can +result in an error being set (QDeclarativeDataBlob::setError()), or one or more dependencies being +created (QDeclarativeDataBlob::addDependency()). Dependencies are other QDeclarativeDataBlob's that +are required before processing can fully complete. + +To complete processing, the QDeclarativeDataBlob::done() callback is invoked. done() is called when +one of these three preconditions are met. + +1. The QDeclarativeDataBlob has no dependencies. +2. The QDeclarativeDataBlob has an error set. +3. All the QDeclarativeDataBlob's dependencies are themselves "done()". + +Thus QDeclarativeDataBlob::done() will always eventually be called, even if the blob has an error set. +*/ + +/*! +Create a new QDeclarativeDataLoader for \a engine. +*/ +QDeclarativeDataLoader::QDeclarativeDataLoader(QDeclarativeEngine *engine) +: m_engine(engine) +{ +} + +/*! \internal */ +QDeclarativeDataLoader::~QDeclarativeDataLoader() +{ + for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter) + (*iter)->release(); +} + +/*! +Load the provided \a blob from the network or filesystem. +*/ +void QDeclarativeDataLoader::load(QDeclarativeDataBlob *blob) +{ + Q_ASSERT(blob->status() == QDeclarativeDataBlob::Null); + Q_ASSERT(blob->m_manager == 0); + + blob->m_status = QDeclarativeDataBlob::Loading; + + if (blob->m_url.isEmpty()) { + QDeclarativeError error; + error.setDescription(QLatin1String("Invalid null URL")); + blob->setError(error); + return; + } + + QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(blob->m_url); + + if (!lf.isEmpty()) { + QFile file(lf); + if (file.open(QFile::ReadOnly)) { + QByteArray data = file.readAll(); + + blob->m_progress = 1.; + blob->downloadProgressChanged(1.); + + setData(blob, data); + } else { + blob->networkError(QNetworkReply::ContentNotFoundError); + } + + } else { + + blob->m_manager = this; + QNetworkReply *reply = m_engine->networkAccessManager()->get(QNetworkRequest(blob->m_url)); + QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(networkReplyProgress(qint64,qint64))); + QObject::connect(reply, SIGNAL(finished()), + this, SLOT(networkReplyFinished())); + m_networkReplies.insert(reply, blob); + + blob->addref(); + } +} + +#define DATALOADER_MAXIMUM_REDIRECT_RECURSION 16 + +void QDeclarativeDataLoader::networkReplyFinished() +{ + QNetworkReply *reply = static_cast(sender()); + reply->deleteLater(); + + QDeclarativeDataBlob *blob = m_networkReplies.take(reply); + + Q_ASSERT(blob); + + blob->m_redirectCount++; + + if (blob->m_redirectCount < DATALOADER_MAXIMUM_REDIRECT_RECURSION) { + QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); + if (redirect.isValid()) { + QUrl url = reply->url().resolved(redirect.toUrl()); + blob->m_finalUrl = url; + + QNetworkReply *reply = m_engine->networkAccessManager()->get(QNetworkRequest(url)); + QObject::connect(reply, SIGNAL(finished()), this, SLOT(networkReplyFinished())); + m_networkReplies.insert(reply, blob); + return; + } + } + + if (reply->error()) { + blob->networkError(reply->error()); + } else { + QByteArray data = reply->readAll(); + setData(blob, data); + } + + blob->release(); +} + +void QDeclarativeDataLoader::networkReplyProgress(qint64 bytesReceived, qint64 bytesTotal) +{ + QNetworkReply *reply = static_cast(sender()); + QDeclarativeDataBlob *blob = m_networkReplies.value(reply); + + Q_ASSERT(blob); + + if (bytesTotal != 0) { + blob->m_progress = bytesReceived / bytesTotal; + blob->downloadProgressChanged(blob->m_progress); + } +} + +/*! +Load the provided \a blob with \a data. The blob's URL is not used by the data loader in this case. +*/ +void QDeclarativeDataLoader::loadWithStaticData(QDeclarativeDataBlob *blob, const QByteArray &data) +{ + Q_ASSERT(blob->status() == QDeclarativeDataBlob::Null); + Q_ASSERT(blob->m_manager == 0); + + blob->m_status = QDeclarativeDataBlob::Loading; + + setData(blob, data); +} + +/*! +Return the QDeclarativeEngine associated with this loader +*/ +QDeclarativeEngine *QDeclarativeDataLoader::engine() const +{ + return m_engine; +} + +void QDeclarativeDataLoader::setData(QDeclarativeDataBlob *blob, const QByteArray &data) +{ + blob->m_inCallback = true; + + blob->dataReceived(data); + + if (!blob->isError() && !blob->isWaiting()) + blob->allDependenciesDone(); + + if (blob->status() != QDeclarativeDataBlob::Error) + blob->m_status = QDeclarativeDataBlob::WaitingForDependencies; + + blob->m_inCallback = false; + + blob->tryDone(); +} + +/*! +\class QDeclarativeTypeLoader +*/ +QDeclarativeTypeLoader::QDeclarativeTypeLoader(QDeclarativeEngine *engine) +: QDeclarativeDataLoader(engine) +{ +} + +QDeclarativeTypeLoader::~QDeclarativeTypeLoader() +{ + clearCache(); +} + +/*! +Return a QDeclarativeTypeData for \a url. The QDeclarativeTypeData may be cached. +*/ +QDeclarativeTypeData *QDeclarativeTypeLoader::get(const QUrl &url) +{ + Q_ASSERT(!url.isRelative() && + (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url).isEmpty() || + !QDir::isRelativePath(QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url)))); + + QDeclarativeTypeData *typeData = m_typeCache.value(url); + + if (!typeData) { + typeData = new QDeclarativeTypeData(url, None, this); + m_typeCache.insert(url, typeData); + QDeclarativeDataLoader::load(typeData); + } + + typeData->addref(); + return typeData; +} + +/*! +Return a QDeclarativeTypeData for \a data with the provided base \a url. The +QDeclarativeTypeData will not be cached. +*/ +QDeclarativeTypeData *QDeclarativeTypeLoader::get(const QByteArray &data, const QUrl &url, Options options) +{ + QDeclarativeTypeData *typeData = new QDeclarativeTypeData(url, options, this); + QDeclarativeDataLoader::loadWithStaticData(typeData, data); + return typeData; +} + +/*! +Return a QDeclarativeScriptData for \a url. The QDeclarativeScriptData may be cached. +*/ +QDeclarativeScriptData *QDeclarativeTypeLoader::getScript(const QUrl &url) +{ + Q_ASSERT(!url.isRelative() && + (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url).isEmpty() || + !QDir::isRelativePath(QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url)))); + + QDeclarativeScriptData *scriptData = m_scriptCache.value(url); + + if (!scriptData) { + scriptData = new QDeclarativeScriptData(url); + m_scriptCache.insert(url, scriptData); + QDeclarativeDataLoader::load(scriptData); + } + + scriptData->addref(); + return scriptData; +} + +/*! +Return a QDeclarativeQmldirData for \a url. The QDeclarativeQmldirData may be cached. +*/ +QDeclarativeQmldirData *QDeclarativeTypeLoader::getQmldir(const QUrl &url) +{ + Q_ASSERT(!url.isRelative() && + (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url).isEmpty() || + !QDir::isRelativePath(QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url)))); + + QDeclarativeQmldirData *qmldirData = m_qmldirCache.value(url); + + if (!qmldirData) { + qmldirData = new QDeclarativeQmldirData(url); + m_qmldirCache.insert(url, qmldirData); + QDeclarativeDataLoader::load(qmldirData); + } + + qmldirData->addref(); + return qmldirData; +} + +void QDeclarativeTypeLoader::clearCache() +{ + for (TypeCache::Iterator iter = m_typeCache.begin(); iter != m_typeCache.end(); ++iter) + (*iter)->release(); + for (ScriptCache::Iterator iter = m_scriptCache.begin(); iter != m_scriptCache.end(); ++iter) + (*iter)->release(); + for (QmldirCache::Iterator iter = m_qmldirCache.begin(); iter != m_qmldirCache.end(); ++iter) + (*iter)->release(); + + m_typeCache.clear(); + m_scriptCache.clear(); + m_qmldirCache.clear(); +} + + +QDeclarativeTypeData::QDeclarativeTypeData(const QUrl &url, QDeclarativeTypeLoader::Options options, + QDeclarativeTypeLoader *manager) +: QDeclarativeDataBlob(url, QmlFile), m_options(options), m_typesResolved(false), + m_compiledData(0), m_component(0), m_typeLoader(manager) +{ +} + +QDeclarativeTypeData::~QDeclarativeTypeData() +{ + for (int ii = 0; ii < m_scripts.count(); ++ii) + m_scripts.at(ii).script->release(); + for (int ii = 0; ii < m_qmldirs.count(); ++ii) + m_qmldirs.at(ii)->release(); + for (int ii = 0; ii < m_types.count(); ++ii) + if (m_types.at(ii).typeData) m_types.at(ii).typeData->release(); + if (m_compiledData) + m_compiledData->release(); +} + +QDeclarativeTypeLoader *QDeclarativeTypeData::typeLoader() const +{ + return m_typeLoader; +} + +const QDeclarativeImports &QDeclarativeTypeData::imports() const +{ + return m_imports; +} + +const QDeclarativeScriptParser &QDeclarativeTypeData::parser() const +{ + return scriptParser; +} + +const QList &QDeclarativeTypeData::resolvedTypes() const +{ + return m_types; +} + +const QList &QDeclarativeTypeData::resolvedScripts() const +{ + return m_scripts; +} + +QDeclarativeCompiledData *QDeclarativeTypeData::compiledData() const +{ + if (m_compiledData) + m_compiledData->addref(); + + return m_compiledData; +} + +QDeclarativeComponent *QDeclarativeTypeData::component() const +{ + if (!m_component) { + + if (m_compiledData) { + m_component = new QDeclarativeComponent(typeLoader()->engine(), m_compiledData, -1, -1, 0); + } else { + m_component = new QDeclarativeComponent(typeLoader()->engine()); + QDeclarativeComponentPrivate::get(m_component)->url = finalUrl(); + QDeclarativeComponentPrivate::get(m_component)->state.errors = errors(); + } + + } + + return m_component; +} + +void QDeclarativeTypeData::registerCallback(TypeDataCallback *callback) +{ + Q_ASSERT(!m_callbacks.contains(callback)); + m_callbacks.append(callback); +} + +void QDeclarativeTypeData::unregisterCallback(TypeDataCallback *callback) +{ + Q_ASSERT(m_callbacks.contains(callback)); + m_callbacks.removeOne(callback); + Q_ASSERT(!m_callbacks.contains(callback)); +} + +void QDeclarativeTypeData::done() +{ + addref(); + + // Check all script dependencies for errors + for (int ii = 0; !isError() && ii < m_scripts.count(); ++ii) { + const ScriptReference &script = m_scripts.at(ii); + Q_ASSERT(script.script->isCompleteOrError()); + if (script.script->isError()) { + QList errors = script.script->errors(); + QDeclarativeError error; + error.setUrl(finalUrl()); + error.setLine(script.location.line); + error.setColumn(script.location.column); + error.setDescription(typeLoader()->tr("Script %1 unavailable").arg(script.script->url().toString())); + errors.prepend(error); + setError(errors); + } + } + + // Check all type dependencies for errors + for (int ii = 0; !isError() && ii < m_types.count(); ++ii) { + const TypeReference &type = m_types.at(ii); + Q_ASSERT(!type.typeData || type.typeData->isCompleteOrError()); + if (type.typeData && type.typeData->isError()) { + QString typeName = scriptParser.referencedTypes().at(ii)->name; + + QList errors = type.typeData->errors(); + QDeclarativeError error; + error.setUrl(finalUrl()); + error.setLine(type.location.line); + error.setColumn(type.location.column); + error.setDescription(typeLoader()->tr("Type %1 unavailable").arg(typeName)); + errors.prepend(error); + setError(errors); + } + } + + // Compile component + if (!isError()) + compile(); + + if (!(m_options & QDeclarativeTypeLoader::PreserveParser)) + scriptParser.clear(); + + // Notify callbacks + while (!m_callbacks.isEmpty()) { + TypeDataCallback *callback = m_callbacks.takeFirst(); + callback->typeDataReady(this); + } + + release(); +} + +void QDeclarativeTypeData::dataReceived(const QByteArray &data) +{ + if (!scriptParser.parse(data, finalUrl())) { + setError(scriptParser.errors()); + return; + } + + m_imports.setBaseUrl(finalUrl()); + + foreach (const QDeclarativeScriptParser::Import &import, scriptParser.imports()) { + if (import.type == QDeclarativeScriptParser::Import::File && import.qualifier.isEmpty()) { + QUrl importUrl = finalUrl().resolved(QUrl(import.uri + QLatin1String("/qmldir"))); + if (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl).isEmpty()) { + QDeclarativeQmldirData *data = typeLoader()->getQmldir(importUrl); + addDependency(data); + m_qmldirs << data; + } + } else if (import.type == QDeclarativeScriptParser::Import::Script) { + QUrl scriptUrl = finalUrl().resolved(QUrl(import.uri)); + QDeclarativeScriptData *data = typeLoader()->getScript(scriptUrl); + addDependency(data); + + ScriptReference ref; + ref.location = import.location.start; + ref.qualifier = import.qualifier; + ref.script = data; + m_scripts << ref; + + } + } + + if (!finalUrl().scheme().isEmpty()) { + QUrl importUrl = finalUrl().resolved(QUrl(QLatin1String("qmldir"))); + if (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl).isEmpty()) { + QDeclarativeQmldirData *data = typeLoader()->getQmldir(importUrl); + addDependency(data); + m_qmldirs << data; + } + } +} + +void QDeclarativeTypeData::allDependenciesDone() +{ + if (!m_typesResolved) { + resolveTypes(); + m_typesResolved = true; + } +} + +void QDeclarativeTypeData::downloadProgressChanged(qreal p) +{ + for (int ii = 0; ii < m_callbacks.count(); ++ii) { + TypeDataCallback *callback = m_callbacks.at(ii); + callback->typeDataProgress(this, p); + } +} + +void QDeclarativeTypeData::compile() +{ + Q_ASSERT(m_compiledData == 0); + + m_compiledData = new QDeclarativeCompiledData(typeLoader()->engine()); + m_compiledData->url = m_imports.baseUrl(); + m_compiledData->name = m_compiledData->url.toString(); + + QDeclarativeCompiler compiler; + if (!compiler.compile(typeLoader()->engine(), this, m_compiledData)) { + setError(compiler.errors()); + m_compiledData->release(); + m_compiledData = 0; + } +} + +void QDeclarativeTypeData::resolveTypes() +{ + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(m_typeLoader->engine()); + QDeclarativeImportDatabase *importDatabase = &ep->importDatabase; + + // For local urls, add an implicit import "." as first (most overridden) lookup. + // This will also trigger the loading of the qmldir and the import of any native + // types from available plugins. + if (QDeclarativeQmldirData *qmldir = qmldirForUrl(finalUrl().resolved(QUrl(QLatin1String("./qmldir"))))) { + m_imports.addImport(importDatabase, QLatin1String("."), + QString(), -1, -1, QDeclarativeScriptParser::Import::File, + qmldir->dirComponents(), 0); + } else { + m_imports.addImport(importDatabase, QLatin1String("."), + QString(), -1, -1, QDeclarativeScriptParser::Import::File, + QDeclarativeDirComponents(), 0); + } + + foreach (const QDeclarativeScriptParser::Import &import, scriptParser.imports()) { + QDeclarativeDirComponents qmldircomponentsnetwork; + if (import.type == QDeclarativeScriptParser::Import::Script) + continue; + + if (import.type == QDeclarativeScriptParser::Import::File && import.qualifier.isEmpty()) { + QUrl qmldirUrl = finalUrl().resolved(QUrl(import.uri + QLatin1String("/qmldir"))); + if (QDeclarativeQmldirData *qmldir = qmldirForUrl(qmldirUrl)) + qmldircomponentsnetwork = qmldir->dirComponents(); + } + + int vmaj = -1; + int vmin = -1; + + if (!import.version.isEmpty()) { + int dot = import.version.indexOf(QLatin1Char('.')); + if (dot < 0) { + vmaj = import.version.toInt(); + vmin = 0; + } else { + vmaj = import.version.left(dot).toInt(); + vmin = import.version.mid(dot+1).toInt(); + } + } + + QString errorString; + if (!m_imports.addImport(importDatabase, import.uri, import.qualifier, + vmaj, vmin, import.type, qmldircomponentsnetwork, &errorString)) { + QDeclarativeError error; + error.setUrl(m_imports.baseUrl()); + error.setDescription(errorString); + error.setLine(import.location.start.line); + error.setColumn(import.location.start.column); + + setError(error); + return; + } + } + + foreach (QDeclarativeScriptParser::TypeReference *parserRef, scriptParser.referencedTypes()) { + QByteArray typeName = parserRef->name.toUtf8(); + + TypeReference ref; + + QUrl url; + int majorVersion; + int minorVersion; + QDeclarativeImportedNamespace *typeNamespace = 0; + QString errorString; + + if (!m_imports.resolveType(typeName, &ref.type, &url, &majorVersion, &minorVersion, + &typeNamespace, &errorString) || typeNamespace) { + // Known to not be a type: + // - known to be a namespace (Namespace {}) + // - type with unknown namespace (UnknownNamespace.SomeType {}) + QDeclarativeError error; + error.setUrl(m_imports.baseUrl()); + QString userTypeName = parserRef->name; + userTypeName.replace(QLatin1Char('/'),QLatin1Char('.')); + if (typeNamespace) + error.setDescription(typeLoader()->tr("Namespace %1 cannot be used as a type").arg(userTypeName)); + else + error.setDescription(typeLoader()->tr("%1 %2").arg(userTypeName).arg(errorString)); + + if (!parserRef->refObjects.isEmpty()) { + QDeclarativeParser::Object *obj = parserRef->refObjects.first(); + error.setLine(obj->location.start.line); + error.setColumn(obj->location.start.column); + } + + setError(error); + return; + } + + if (ref.type) { + foreach (QDeclarativeParser::Object *obj, parserRef->refObjects) { + // store namespace for DOM + obj->majorVersion = majorVersion; + obj->minorVersion = minorVersion; + } + } else { + ref.typeData = typeLoader()->get(url); + addDependency(ref.typeData); + } + + if (parserRef->refObjects.count()) + ref.location = parserRef->refObjects.first()->location.start; + + m_types << ref; + } +} + +QDeclarativeQmldirData *QDeclarativeTypeData::qmldirForUrl(const QUrl &url) +{ + for (int ii = 0; ii < m_qmldirs.count(); ++ii) { + if (m_qmldirs.at(ii)->url() == url) + return m_qmldirs.at(ii); + } + return 0; +} + +QDeclarativeScriptData::QDeclarativeScriptData(const QUrl &url) +: QDeclarativeDataBlob(url, JavaScriptFile), m_pragmas(QDeclarativeParser::Object::ScriptBlock::None) +{ +} + +QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptData::pragmas() const +{ + return m_pragmas; +} + +QString QDeclarativeScriptData::scriptSource() const +{ + return m_source; +} + +void QDeclarativeScriptData::dataReceived(const QByteArray &data) +{ + m_source = QString::fromUtf8(data); + m_pragmas = QDeclarativeScriptParser::extractPragmas(m_source); +} + +QDeclarativeQmldirData::QDeclarativeQmldirData(const QUrl &url) +: QDeclarativeDataBlob(url, QmldirFile) +{ +} + +const QDeclarativeDirComponents &QDeclarativeQmldirData::dirComponents() const +{ + return m_components; +} + +void QDeclarativeQmldirData::dataReceived(const QByteArray &data) +{ + QDeclarativeDirParser parser; + parser.setSource(QString::fromUtf8(data)); + parser.parse(); + m_components = parser.components(); +} + +QT_END_NAMESPACE + diff --git a/src/declarative/qml/qdeclarativetypeloader_p.h b/src/declarative/qml/qdeclarativetypeloader_p.h new file mode 100644 index 0000000..7381f28 --- /dev/null +++ b/src/declarative/qml/qdeclarativetypeloader_p.h @@ -0,0 +1,321 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVETYPELOADER_P_H +#define QDECLARATIVETYPELOADER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeScriptData; +class QDeclarativeQmldirData; +class QDeclarativeTypeLoader; +class QDeclarativeCompiledData; +class QDeclarativeComponentPrivate; +class QDeclarativeTypeData; +class QDeclarativeDataLoader; + +class Q_AUTOTEST_EXPORT QDeclarativeDataBlob : public QDeclarativeRefCount +{ +public: + enum Status { + Null, // Prior to QDeclarativeDataLoader::load() + Loading, // Prior to data being received and dataReceived() being called + WaitingForDependencies, // While there are outstanding addDependency()s + Complete, // Finished + Error, // Error + }; + + enum Type { + QmlFile, + JavaScriptFile, + QmldirFile + }; + + QDeclarativeDataBlob(const QUrl &, Type); + virtual ~QDeclarativeDataBlob(); + + Type type() const; + + Status status() const; + bool isNull() const; + bool isLoading() const; + bool isWaiting() const; + bool isComplete() const; + bool isError() const; + bool isCompleteOrError() const; + + qreal progress() const; + + QUrl url() const; + QUrl finalUrl() const; + + QList errors() const; + + void setError(const QDeclarativeError &); + void setError(const QList &errors); + + void addDependency(QDeclarativeDataBlob *); + +protected: + virtual void dataReceived(const QByteArray &) = 0; + + virtual void done(); + virtual void networkError(QNetworkReply::NetworkError); + + virtual void dependencyError(QDeclarativeDataBlob *); + virtual void dependencyComplete(QDeclarativeDataBlob *); + virtual void allDependenciesDone(); + + virtual void downloadProgressChanged(qreal); + +private: + friend class QDeclarativeDataLoader; + void tryDone(); + void cancelAllWaitingFor(); + void notifyAllWaitingOnMe(); + void notifyComplete(QDeclarativeDataBlob *); + + Type m_type; + Status m_status; + qreal m_progress; + + QUrl m_url; + QUrl m_finalUrl; + + // List of QDeclarativeDataBlob's that are waiting for me to complete. + QList m_waitingOnMe; + + // List of QDeclarativeDataBlob's that I am waiting for to complete. + QList m_waitingFor; + + // Manager that is currently fetching data for me + QDeclarativeDataLoader *m_manager; + int m_redirectCount:30; + bool m_inCallback:1; + bool m_isDone:1; + + QList m_errors; +}; + +class Q_AUTOTEST_EXPORT QDeclarativeDataLoader : public QObject +{ + Q_OBJECT +public: + QDeclarativeDataLoader(QDeclarativeEngine *); + ~QDeclarativeDataLoader(); + + void load(QDeclarativeDataBlob *); + void loadWithStaticData(QDeclarativeDataBlob *, const QByteArray &); + + QDeclarativeEngine *engine() const; + +private slots: + void networkReplyFinished(); + void networkReplyProgress(qint64,qint64); + +private: + void setData(QDeclarativeDataBlob *, const QByteArray &); + + QDeclarativeEngine *m_engine; + typedef QHash NetworkReplies; + NetworkReplies m_networkReplies; +}; + + +class Q_AUTOTEST_EXPORT QDeclarativeTypeLoader : public QDeclarativeDataLoader +{ + Q_OBJECT +public: + QDeclarativeTypeLoader(QDeclarativeEngine *); + ~QDeclarativeTypeLoader(); + + enum Option { + None, + PreserveParser + }; + Q_DECLARE_FLAGS(Options, Option) + + QDeclarativeTypeData *get(const QUrl &url); + QDeclarativeTypeData *get(const QByteArray &, const QUrl &url, Options = None); + void clearCache(); + + QDeclarativeScriptData *getScript(const QUrl &); + QDeclarativeQmldirData *getQmldir(const QUrl &); +private: + typedef QHash TypeCache; + typedef QHash ScriptCache; + typedef QHash QmldirCache; + + TypeCache m_typeCache; + ScriptCache m_scriptCache; + QmldirCache m_qmldirCache; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeTypeLoader::Options) + +class Q_AUTOTEST_EXPORT QDeclarativeTypeData : public QDeclarativeDataBlob +{ +public: + struct TypeReference + { + TypeReference() : type(0), typeData(0) {} + + QDeclarativeParser::Location location; + QDeclarativeType *type; + QDeclarativeTypeData *typeData; + }; + + struct ScriptReference + { + ScriptReference() : script(0) {} + + QDeclarativeParser::Location location; + QString qualifier; + QDeclarativeScriptData *script; + }; + + QDeclarativeTypeData(const QUrl &, QDeclarativeTypeLoader::Options, QDeclarativeTypeLoader *); + ~QDeclarativeTypeData(); + + QDeclarativeTypeLoader *typeLoader() const; + + const QDeclarativeImports &imports() const; + const QDeclarativeScriptParser &parser() const; + + const QList &resolvedTypes() const; + const QList &resolvedScripts() const; + + QDeclarativeCompiledData *compiledData() const; + QDeclarativeComponent *component() const; + + // Used by QDeclarativeComponent to get notifications + struct TypeDataCallback { + ~TypeDataCallback() {} + virtual void typeDataProgress(QDeclarativeTypeData *, qreal) {} + virtual void typeDataReady(QDeclarativeTypeData *) {} + }; + void registerCallback(TypeDataCallback *); + void unregisterCallback(TypeDataCallback *); + +protected: + virtual void done(); + virtual void dataReceived(const QByteArray &); + virtual void allDependenciesDone(); + virtual void downloadProgressChanged(qreal); + +private: + void resolveTypes(); + void compile(); + + QDeclarativeTypeLoader::Options m_options; + + QDeclarativeQmldirData *qmldirForUrl(const QUrl &); + + QDeclarativeScriptParser scriptParser; + QDeclarativeImports m_imports; + + QList m_scripts; + QList m_qmldirs; + + QList m_types; + bool m_typesResolved:1; + + QDeclarativeCompiledData *m_compiledData; + mutable QDeclarativeComponent *m_component; + + QList m_callbacks; + + QDeclarativeTypeLoader *m_typeLoader; +}; + +class Q_AUTOTEST_EXPORT QDeclarativeScriptData : public QDeclarativeDataBlob +{ +public: + QDeclarativeScriptData(const QUrl &); + + QDeclarativeParser::Object::ScriptBlock::Pragmas pragmas() const; + QString scriptSource() const; + +protected: + virtual void dataReceived(const QByteArray &); + +private: + QDeclarativeParser::Object::ScriptBlock::Pragmas m_pragmas; + QString m_source; +}; + +class Q_AUTOTEST_EXPORT QDeclarativeQmldirData : public QDeclarativeDataBlob +{ +public: + QDeclarativeQmldirData(const QUrl &); + + const QDeclarativeDirComponents &dirComponents() const; + +protected: + virtual void dataReceived(const QByteArray &); + +private: + QDeclarativeDirComponents m_components; + +}; + +QT_END_NAMESPACE + +#endif // QDECLARATIVETYPELOADER_P_H diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 12f9794..687ff52 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -24,7 +24,7 @@ SOURCES += \ $$PWD/qdeclarativestringconverters.cpp \ $$PWD/qdeclarativeclassfactory.cpp \ $$PWD/qdeclarativeparserstatus.cpp \ - $$PWD/qdeclarativecompositetypemanager.cpp \ + $$PWD/qdeclarativetypeloader.cpp \ $$PWD/qdeclarativeinfo.cpp \ $$PWD/qdeclarativeerror.cpp \ $$PWD/qdeclarativescriptparser.cpp \ @@ -94,8 +94,7 @@ HEADERS += \ $$PWD/qdeclarativeproperty_p.h \ $$PWD/qdeclarativecontext_p.h \ $$PWD/qdeclarativeinclude_p.h \ - $$PWD/qdeclarativecompositetypedata_p.h \ - $$PWD/qdeclarativecompositetypemanager_p.h \ + $$PWD/qdeclarativetypeloader_p.h \ $$PWD/qdeclarativelist.h \ $$PWD/qdeclarativelist_p.h \ $$PWD/qdeclarativedata_p.h \ diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt index 6e11786..53e752b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt @@ -1,2 +1,2 @@ -4:5:Unable to create type NestedErrorsType +4:5:Type NestedErrorsType unavailable 4:8:Invalid property assignment: number expected diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index b0b7a3b..3baf848 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -146,7 +146,7 @@ void tst_QDeclarativeLoader::component() void tst_QDeclarativeLoader::invalidUrl() { - QTest::ignoreMessage(QtWarningMsg, QString(": File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString()).toUtf8().constData()); + QTest::ignoreMessage(QtWarningMsg, QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found").toUtf8().constData()); QDeclarativeComponent component(&engine); component.setData(QByteArray("import Qt 4.7\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); @@ -508,7 +508,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); - QTest::ignoreMessage(QtWarningMsg, ": Network error for URL http://127.0.0.1:14450/IDontExist.qml"); + QTest::ignoreMessage(QtWarningMsg, "http://127.0.0.1:14450/IDontExist.qml: File not found"); QDeclarativeComponent component(&engine); component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load: 123; source: \"http://127.0.0.1:14450/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 56a3121..84f4230 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -777,7 +777,7 @@ void tst_qdeclarativetextedit::delegateLoading_data() // import installed QTest::newRow("pass") << "cursorHttpTestPass.qml" << ""; - QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << ": Network error for URL http://localhost:42332/FailItem.qml "; + QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "http://localhost:42332/FailItem.qml: Remote host closed the connection "; QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type "; } -- cgit v0.12 From 74a7c2e6d179e809c93422c8aa590c922be6b6e8 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 27 Aug 2010 10:21:03 +0300 Subject: Updated some URLs and required tools versions for Symbian Reviewed-by: Janne Koskinen --- doc/src/getting-started/installation.qdoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 629d8b7..708f166 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -1211,9 +1211,9 @@ applications using Qt for Symbian can start right away.} Qt for the Symbian platform requires the following software installed on your development PC: \list - \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide_cpp/}{Carbide.c++ v2.0.0 or higher} + \o \l{http://www.forum.nokia.com/Library/Tools_and_downloads/Other/Carbide.c++/}{Carbide.c++ v2.3.0 or higher recommended}. \list - \o \bold{Note:} It may be necessary to update the Carbide compiler. + \o \bold{Note:} It may be necessary to update the Carbide compiler depending on Carbide version. See \l{http://pepper.troll.no/s60prereleases/patches/}{here} for instructions how to check your compiler version and how to patch it, if needed. \endlist @@ -1223,18 +1223,18 @@ applications using Qt for Symbian can start right away.} but that version is no longer available from ActiveState. However, Qt for Symbian has been successfully compiled using both 5.8.x and 5.10.x versions. \endlist - \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/S60SDK/}{S60 Platform SDK 3rd Edition FP1 or higher} + \o \l{http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html}{S60 Platform SDK 3rd Edition FP1 or higher} \list \o \bold{Note:} Users of \bold{S60 Platform SDK 3rd Edition FP1} also need special update. The update can be found \l{http://pepper.troll.no/s60prereleases/patches/}{here}. \endlist - \o \l{http://www.forum.nokia.com/main/resources/technologies/openc_cpp/}{Open C/C++ v1.6.0 or higher}. + \o \l{http://www.forum.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html}{Open C/C++ v1.7.5 or higher}. Install this to all Symbian SDKs you plan to use Qt with. \o Building Qt tools from scratch requires \l{http://www.mingw.org/}{MinGW 3.4.5 or higher}, or another windows compiler. \list \o \bold{Note:} This is not required if you are using pre-built binary package. \endlist - \o Building Qt libraries requires \l{http://www.arm.com/products/DevTools/RVCT.html}{RVCT} version 2.2 (build 686 or later), + \o Building Qt libraries requires \l{http://www.arm.com/products/tools/software-development-tools.php}{RVCT} version 2.2 (build 686 or later), which is not available free of charge. Usage of later versions of RVCT, including the 3.x and 4.x series, is not supported in this release. \endlist -- cgit v0.12 From a9500afc79d3f4b33b4506c15deeb21d2a910a44 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 27 Aug 2010 11:42:55 +0200 Subject: doc: Fixed numerous qdoc warnings. --- src/gui/graphicsview/qgraphicsitem.cpp | 39 +++++++++-------------------- src/gui/graphicsview/qgraphicstransform.cpp | 32 ++++++----------------- 2 files changed, 19 insertions(+), 52 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 0b3b164..57d1071 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7758,19 +7758,22 @@ void QGraphicsItemPrivate::resetHeight() } /*! - \property QGraphicsObject::children - \internal -*/ + \property QGraphicsObject::children + \since 4.7 + \internal + */ /*! - \property QGraphicsObject::width - \internal -*/ + \property QGraphicsObject::width + \since 4.7 + \internal + */ /*! - \property QGraphicsObject::height - \internal -*/ + \property QGraphicsObject::height + \since 4.7 + \internal + */ /*! \property QGraphicsObject::parent @@ -7985,24 +7988,6 @@ void QGraphicsItemPrivate::resetHeight() */ /*! - \property QGraphicsObject::children - \since 4.7 - \internal -*/ - -/*! - \property QGraphicsObject::width - \since 4.7 - \internal -*/ - -/*! - \property QGraphicsObject::height - \since 4.7 - \internal -*/ - -/*! \class QAbstractGraphicsShapeItem \brief The QAbstractGraphicsShapeItem class provides a common base for all path items. diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index bd3f2ef..1f155c6 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -346,21 +346,24 @@ void QGraphicsScale::applyTo(QMatrix4x4 *matrix) const /*! \fn QGraphicsScale::xScaleChanged() + \since 4.7 - QGraphicsScale emits this signal when its xScale changes. + This signal is emitted whenever the \l xScale property changes. */ /*! \fn QGraphicsScale::yScaleChanged() + \since 4.7 - QGraphicsScale emits this signal when its yScale changes. + This signal is emitted whenever the \l yScale property changes. */ /*! \fn QGraphicsScale::zScaleChanged() + \since 4.7 - QGraphicsScale emits this signal when its zScale changes. -*/ + This signal is emitted whenever the \l zScale property changes. +*/ /*! \fn QGraphicsScale::scaleChanged() @@ -583,27 +586,6 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const \sa QGraphicsRotation::axis */ -/*! - \fn QGraphicsScale::xScaleChanged() - \since 4.7 - - This signal is emitted whenever the \l xScale property changes. -*/ - -/*! - \fn QGraphicsScale::yScaleChanged() - \since 4.7 - - This signal is emitted whenever the \l yScale property changes. -*/ - -/*! - \fn QGraphicsScale::zScaleChanged() - \since 4.7 - - This signal is emitted whenever the \l zScale property changes. -*/ - #include "moc_qgraphicstransform.cpp" QT_END_NAMESPACE -- cgit v0.12 From bd521ed56f8e4be7117dc3534c6fded68f7a70c5 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Fri, 27 Aug 2010 13:05:25 +0200 Subject: QDeclarativeDebug: Destroy incoming connections if already connected Without this, QML Inspector in Qt Creator gets no error message for failed connections, which can lead to confusion. Reviewed-by: ogoffart --- src/declarative/debugger/qdeclarativedebugservice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index dca2695..1bbfcf4 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -128,6 +128,8 @@ void QDeclarativeDebugServer::newConnection() if (d->connection) { qWarning("QDeclarativeDebugServer error: another client is already connected"); + QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); + delete faultyConnection; return; } -- cgit v0.12 From 9ef61d3d1e53d32dc2568cbfb9f8ff5b19cb4ffc Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 27 Aug 2010 14:09:40 +0300 Subject: QLineEdit cursor is shown when asked to be non-visible If QLineEdit is sent a QInputMethodEvent::Cursor event with value zero, widget still shows blinking cursor. This is due to that QLineControl ignores its internal state variable m_hideCursor value. As a fix, m_hideCursor is now considered when drawing the cursor. Additionally, the cursor blinking timer is stopped when cursor is hidden. Task-number: QT-3670 Reviewed-by: axis --- src/gui/widgets/qlinecontrol.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index d027b91..7f0c6c8 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -464,6 +464,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) if (a.type == QInputMethodEvent::Cursor) { m_preeditCursor = a.start; m_hideCursor = !a.length; + if (m_hideCursor) + setCursorBlinkPeriod(0); } else if (a.type == QInputMethodEvent::TextFormat) { QTextCharFormat f = qvariant_cast(a.value).toCharFormat(); if (f.isValid()) { @@ -527,7 +529,7 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl int cursor = m_cursor; if (m_preeditCursor != -1) cursor += m_preeditCursor; - if(!m_blinkPeriod || m_blinkStatus) + if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus)) m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth); } } -- cgit v0.12 From cf8b664a89b40d6fce4f1da7233a5563b67ba60c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 27 Aug 2010 16:58:49 +0200 Subject: Doc: Fixed snippets in QML introduction broken in an earlier commit. Reported on the qt-qml mailing list. --- doc/src/declarative/qml-intro.qdoc | 54 +++++-------- .../snippets/declarative/qml-intro/anchors1.qml | 56 +++++++++++++ .../snippets/declarative/qml-intro/anchors2.qml | 58 +++++++++++++ .../snippets/declarative/qml-intro/anchors3.qml | 65 +++++++++++++++ .../declarative/qml-intro/basic-syntax.qml | 48 +++++++++++ .../declarative/qml-intro/hello-world1.qml | 53 ++++++++++++ .../declarative/qml-intro/hello-world2.qml | 56 +++++++++++++ .../declarative/qml-intro/hello-world3.qml | 57 +++++++++++++ .../declarative/qml-intro/hello-world4.qml | 61 ++++++++++++++ .../declarative/qml-intro/hello-world5.qml | 65 +++++++++++++++ .../declarative/qml-intro/number-animation1.qml | 64 +++++++++++++++ .../declarative/qml-intro/number-animation2.qml | 66 +++++++++++++++ .../snippets/declarative/qml-intro/rectangle.qml | 50 ++++++++++++ .../qml-intro/sequential-animation1.qml | 65 +++++++++++++++ .../qml-intro/sequential-animation2.qml | 73 +++++++++++++++++ .../qml-intro/sequential-animation3.qml | 88 ++++++++++++++++++++ doc/src/snippets/declarative/qml-intro/states1.qml | 94 ++++++++++++++++++++++ .../declarative/qml-intro/transformations1.qml | 80 ++++++++++++++++++ 18 files changed, 1119 insertions(+), 34 deletions(-) create mode 100644 doc/src/snippets/declarative/qml-intro/anchors1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/anchors2.qml create mode 100644 doc/src/snippets/declarative/qml-intro/anchors3.qml create mode 100644 doc/src/snippets/declarative/qml-intro/basic-syntax.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world2.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world3.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world4.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world5.qml create mode 100644 doc/src/snippets/declarative/qml-intro/number-animation1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/number-animation2.qml create mode 100644 doc/src/snippets/declarative/qml-intro/rectangle.qml create mode 100644 doc/src/snippets/declarative/qml-intro/sequential-animation1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/sequential-animation2.qml create mode 100644 doc/src/snippets/declarative/qml-intro/sequential-animation3.qml create mode 100644 doc/src/snippets/declarative/qml-intro/states1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/transformations1.qml diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index 69dd500..63d6825 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -47,7 +47,7 @@ Javascript is easier to learn than C++ and can be embedded into the QML files or imported from a separate file. \bold{In QML the types of various 'objects' are referred to as \l {QML -Elements}{ elements}}. +Elements}{elements}}. An element usually has various \e properties that help define the element. For example, if we created an element called Circle then the radius of the circle @@ -56,7 +56,7 @@ would be a property. \section1 A First Look -The basic syntax of an \l {QML Elements}{element} is +The basic syntax of an \l{QML Elements}{element} is \snippet doc/src/snippets/declarative/qml-intro/basic-syntax.qml basic syntax @@ -82,7 +82,7 @@ want a rectangle that is 500 pixels by 400 pixels in the x and y directions We can implement this \l Rectangle with these properties this way -\quotefile doc/src/snippets/declarative/qml-intro/rectangle.qml +\snippet doc/src/snippets/declarative/qml-intro/rectangle.qml document This is a valid QML script. To run it, copy it and save it to a file, say myexample.qml, and on the command line run the following command: @@ -113,7 +113,7 @@ Text is handled by a different element called \l Text. We need to create a property to "Hello World!". So to set the text to "Hello world" and the background colour to light gray, -\quotefile doc/src/snippets/declarative/qml-intro/hello-world1.qml +\snippet doc/src/snippets/declarative/qml-intro/hello-world1.qml document \section1 Hello World Again @@ -172,7 +172,7 @@ text, also make it 150 by 150 pixels in size, Adding the Hello World example, with the text and the image example we can write a simple piece of QML that starts to look a bit better. -\quotefile doc/src/snippets/declarative/qml-intro/hello-world5.qml +\snippet doc/src/snippets/declarative/qml-intro/hello-world5.qml document The result is still quite simple @@ -203,7 +203,7 @@ If we want to position an image at the bottom of the rectangle it is inside. I have to specify that the bottom of the image is also at the bottom of the rectangle -\quotefile doc/src/snippets/declarative/qml-intro/anchors1.qml +\snippet doc/src/snippets/declarative/qml-intro/anchors1.qml document This places the logo at the bottom left of the window. @@ -222,7 +222,7 @@ the bottomMargin property is used. So the new actions for the script are Encoded into QML the script becomes -\quotefile doc/src/snippets/declarative/qml-intro/anchors2.qml +\snippet doc/src/snippets/declarative/qml-intro/anchors2.qml document Run this and resize the window. You will see that now the position of the image adjusts during the resize. @@ -282,7 +282,7 @@ vertically by a factor of 1.5 and by 1.2 horizontally. Using the example above as the basis for this we have, -\quotefile doc/src/snippets/declarative/qml-intro/transformations1.qml +\snippet doc/src/snippets/declarative/qml-intro/transformations1.qml document The code block in \c image1 starting with \c transform specifies that the \l {Item::transform}{transform} property will be a Rotation through -90 @@ -320,7 +320,7 @@ from \l Item. The rotation property is a real number that specifies the angle in a clockwise direction for the rotation of the object. Here is the code for our animated rotating image. -\quotefile doc/src/snippets/declarative/number-animation1.qml +\snippet doc/src/snippets/declarative/qml-intro/number-animation1.qml document The \c {transformOrigin: Item.Center} is redundant since this is the default axis of rotation anyway. But if you change \c Center to \c BottomRight you @@ -333,7 +333,7 @@ combination. For example, if the task had been to animate the rotation about the y-axis passing through the center of the image then the following code would do it. -\quotefile doc/src/snippets/declarative/number-animation2.qml +\snippet doc/src/snippets/declarative/qml-intro/number-animation2.qml document Here there is a rectangle 600 by 400 pixels. Placed within that rectangle is an image 100 by 100 pixels. It is rotated about the center of the image @@ -362,7 +362,7 @@ will be animating the position and the size of the image. First create two images -\quotefile doc/src/snippets/declarative/sequential-animation1.qml +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation1.qml document We will add to 'image1' a SequentialAnimation from x = 20 to the target of x = 450. The 'from' values will be used because we will be repeating the @@ -375,7 +375,7 @@ between the x values and over a given duration. After the NumberAnimation there will be a PauseAnimation that will pause the animation for 500 milliseconds (half a second) simply for the visual effect. -\snippet doc/src/snippets/declarative/sequential-animation2.qml adding a sequential animation +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation2.qml adding a sequential animation A similar block of code is written for the animation of the 'y' value of the position. @@ -390,7 +390,7 @@ and image1 to 1 and image2 to 2 then image2 will be in the foreground and image1 in the background. When image1 passes image2 it will pass behind it. The completed code looks like -\quotefile doc/src/snippets/declarative/sequential-animation3.qml +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation3.qml document The \c {easing.type} has many options, expressed as a string. It specifies the kind of equation that describes the acceleration of the property value, not @@ -439,9 +439,6 @@ delivers some of the best examples that illustrate these new elements. \endtable - - - \section1 Using States A state is a defined set of values in the configuration of an object and @@ -471,7 +468,7 @@ will be the default state. We will just go to 'night' by clicking and holding the left mouse button down, releasing the mouse button will reverse the process -\quotefile doc/src/snippets/declarative/states1.qml +\snippet doc/src/snippets/declarative/qml-intro/states1.qml document Several new things appear in this sample. Firstly, we use a \l MouseArea element to detect mouse clicks in the \e mainRectangle. Secondly, we use @@ -549,15 +546,15 @@ needle_shadow have the same default \e x and \e y values but the rotation origin for the needle is slightly different so that a shadow will be evident as the needle moves. -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow And the needle -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle The final image is the overlay which simply has a position defined. -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay \e {dialcontrol.qml} in the \e {examples/declarative/ui-components/dialcontrol} directory is the main file of the example. It defines the visual environment that the Dial @@ -565,17 +562,14 @@ will fit into. Because the \e Dial component and the images live in the \e content sub-directory we will have to import this into \e dialcontrol.qml. So the start of the file looks like - \code - import Qt 4.7 - import "content" - \endcode +\snippet examples/declarative/ui-components/dialcontrol/dialcontrol.qml imports The visual space is bound by a 300 by 300 pixel \l Rectangle which is given a gray color. Inside this rectangle is our component \e Dial and a \l Rectangle. Inside the rectangle called 'container' is another rectangle with the interesting name 'slider'. -\snippet ../../examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0 +\snippet examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0 The Dial component, named 'dial, is \e anchored to the center of the main rectangle. The \c value attribute of 'dial' is set to a value based on the @@ -584,15 +578,7 @@ rectangle. The \c value attribute of 'dial' is set to a value based on the the rotation of the needle image. Notice this piece of code in Dial where the change in \c value modifies the position of the needle. - \code - angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133) - Behavior on angle { - SpringAnimation { - spring: 1.4 - damping: .15 - } - } - \endcode +\snippet examples/declarative/ui-components/dialcontrol/Dial.qml needle angle This is part of the \c needleRotation that rotates the needle and causes the rotation of its shadow. \l SpringAnimation is an element that modifies the value diff --git a/doc/src/snippets/declarative/qml-intro/anchors1.qml b/doc/src/snippets/declarative/qml-intro/anchors1.qml new file mode 100644 index 0000000..09ef3b2 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/anchors1.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/anchors2.qml b/doc/src/snippets/declarative/qml-intro/anchors2.qml new file mode 100644 index 0000000..ef0ec1f --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/anchors2.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml new file mode 100644 index 0000000..008ad1a --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/anchors3.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + } + +//! [adding some text] + Text { + text: "

The Qt Logo

" + anchors.bottom: image1.top + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 15 + } +//! [adding some text] +} diff --git a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml new file mode 100644 index 0000000..686a927 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Note: this file is not intended to be run. + +//! [basic syntax] +SomeElement { + id: myObject + ... some other things here ... +} +//! [basic syntax] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world1.qml b/doc/src/snippets/declarative/qml-intro/hello-world1.qml new file mode 100644 index 0000000..9b91049 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world1.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { text: "Hello World!" } + + color: "lightgray" +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world2.qml b/doc/src/snippets/declarative/qml-intro/hello-world2.qml new file mode 100644 index 0000000..ddc1017 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world2.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + +//! [updated text] + Text { + text: "

Hello World

"; color: "darkgreen" + x: 100; y:100 + } +//! [updated text] + + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world3.qml b/doc/src/snippets/declarative/qml-intro/hello-world3.qml new file mode 100644 index 0000000..f1102c2 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world3.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + +//! [updated text] + Text { + text: "

Hello world again

" + color: "#002288" + x: 100; y: 100 + } +//! [updated text] + + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/qml-intro/hello-world4.qml new file mode 100644 index 0000000..c18fe15 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world4.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { + text: "

Hello world again

" + color: "#002288" + x: 100; y: 100 + } + +//! [added an image] + Image { + source: "images/qt-logo.png" + } +//! [added an image] + + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world5.qml b/doc/src/snippets/declarative/qml-intro/hello-world5.qml new file mode 100644 index 0000000..bde8dc3 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world5.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { + text: "

Hello world again

" + color: "#002288" + x: 100; y: 100 + } + +//! [positioning the image] + Image { + source: "images/qt-logo.png" + x: 100; y: 150 + width: 150; height: 150 + } +//! [positioning the image] + + color: "lightgray" +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/qml-intro/number-animation1.qml new file mode 100644 index 0000000..8d8d747 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/number-animation1.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 200; y: 100 + width: 100; height: 100 + + // Animate a rotation + transformOrigin: Item.Center + NumberAnimation on rotation { + from: 0; to: 360 + duration: 2000 + loops: Animation.Infinite + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml new file mode 100644 index 0000000..d556c21 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/number-animation2.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 200; y: 100 + width: 100; height: 100 + + // Animate a rotation + transform: Rotation { + origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0 + NumberAnimation on angle { + from: 0; to: 360; + duration: 3000; + loops: Animation.Infinite + } + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/rectangle.qml b/doc/src/snippets/declarative/qml-intro/rectangle.qml new file mode 100644 index 0000000..0078813 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/rectangle.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +// This is a comment. And below myRectangle is defined. +Rectangle { + id: myRectangle + width: 500 + height: 400 +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml new file mode 100644 index 0000000..e68de20 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 20; y: 20 ; z: 1 + width: 100; height: 100 + } + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml new file mode 100644 index 0000000..31835a1 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + +//! [adding a sequential animation] + Image { + id: image1 + source: "images/qt-logo.png" + width: 100; height: 100 + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 450; easing.type: "InOutQuad"; + duration: 2000 + } + PauseAnimation { duration: 500 } + } + } +//! [adding a sequential animation] + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } +} diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml new file mode 100644 index 0000000..f83a966 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } + + Image { + id: image1 + source: "images/qt-logo.png" + x: 20; y: 20 ; z: 1 + width: 100; height: 100 + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 450 + easing.type: "InOutQuad"; duration: 2000 + } + PauseAnimation { duration: 500 } + } + + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 250 + easing.type: "InOutQuad"; duration: 2000 + } + PauseAnimation { duration: 500 } + } + + SequentialAnimation on scale { + loops: Animation.Infinite + NumberAnimation { from: 1; to: 0.5; duration: 1000 } + NumberAnimation { from: 0.5; to: 1; duration: 1000 } + PauseAnimation { duration: 500 } + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/states1.qml b/doc/src/snippets/declarative/qml-intro/states1.qml new file mode 100644 index 0000000..9619eb7 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/states1.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRectangle + width: 600 + height: 400 + color: "black" + + Rectangle { + id: sky + width: 600 + height: 200 + y: 0 + color: "lightblue" + } + + Rectangle { + id: ground + width: 600; height: 200 + y: 200 + color: "green" + } + + MouseArea { + id: mousearea + anchors.fill: mainRectangle + } + + states: [ State { + name: "night" + when: mousearea.pressed == true + PropertyChanges { target: sky; color: "darkblue" } + PropertyChanges { target: ground; color: "black" } + }, + State { + name: "daylight" + when: mousearea.pressed == false + PropertyChanges { target: sky; color: "lightblue" } + PropertyChanges { target: ground; color: "green" } + } + ] + + transitions: [ Transition { + from: "daylight"; to: "night" + ColorAnimation { duration: 1000 } + }, + Transition { + from: "night"; to: "daylight" + ColorAnimation { duration: 500 } + } + ] +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/transformations1.qml b/doc/src/snippets/declarative/qml-intro/transformations1.qml new file mode 100644 index 0000000..af39e69 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/transformations1.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + + transform: Rotation { + origin.x: 75; origin.y: 75 + axis{ x: 0; y: 0; z:1 } angle: -90 + } + + } + + Text { + text: "

The Qt Logo -- taking it easy

" + anchors.bottom: image1.top + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 15 + + transform: [ + Scale { xScale: 1.5; yScale: 1.2 } , + + Rotation { + origin.x: 75; origin.y: 75 + axis{ x: 0; y: 0; z:1 } angle: -45 + } + ] + } +} +//! [document] -- cgit v0.12 From f4675d875b4a46eaea3140b9dfe5b035dce91f7b Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 27 Aug 2010 17:06:46 +0200 Subject: Doc: Whitespace fixes. --- src/gui/graphicsview/qgraphicsitem.cpp | 6 ++--- tools/qdoc3/test/qt-defines.qdocconf | 46 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 57d1071..7a622f1 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7761,19 +7761,19 @@ void QGraphicsItemPrivate::resetHeight() \property QGraphicsObject::children \since 4.7 \internal - */ +*/ /*! \property QGraphicsObject::width \since 4.7 \internal - */ +*/ /*! \property QGraphicsObject::height \since 4.7 \internal - */ +*/ /*! \property QGraphicsObject::parent diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf index 9e41d93..344bbb0 100644 --- a/tools/qdoc3/test/qt-defines.qdocconf +++ b/tools/qdoc3/test/qt-defines.qdocconf @@ -20,29 +20,29 @@ codeindent = 1 # See also qhp.Qt.extraFiles extraimages.HTML = qt-logo \ trolltech-logo \ - bg_l.png \ - bg_l_blank.png \ - bg_ll_blank.png \ - bg_ul_blank.png \ - header_bg.png \ - bg_r.png \ - box_bg.png \ - breadcrumb.png \ - bullet_gt.png \ - bullet_dn.png \ - bullet_sq.png \ - bullet_up.png \ - arrow_down.png \ - feedbackground.png \ - horBar.png \ - page.png \ - page_bg.png \ - sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png \ + bg_l.png \ + bg_l_blank.png \ + bg_ll_blank.png \ + bg_ul_blank.png \ + header_bg.png \ + bg_r.png \ + box_bg.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + arrow_down.png \ + feedbackground.png \ + horBar.png \ + page.png \ + page_bg.png \ + sprites-combined.png \ + spinner.gif \ + stylesheet-coffee-plastique.png \ + taskmenuextension-example.png \ + coloreditorfactoryimage.png \ + dynamiclayouts-example.png # This stuff is used by the new doc format. scriptdirs = $QT_SOURCE_TREE/doc/src/template/scripts -- cgit v0.12 From 2d42128a7aad4a13b99198d13d7681c75ed568cf Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 27 Aug 2010 17:07:12 +0200 Subject: Doc: Fixed qdoc warnings and generalized the date and time descriptions. --- src/gui/widgets/qdatetimeedit.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 7a61dc7..bd6c577 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -248,7 +248,7 @@ void QDateTimeEdit::setDateTime(const QDateTime &datetime) /*! \property QDateTimeEdit::date - \brief the QDate that is set in the QDateTimeEdit + \brief the QDate that is set in the widget By default, this property contains a date that refers to January 1, 2000. @@ -279,7 +279,7 @@ void QDateTimeEdit::setDate(const QDate &date) /*! \property QDateTimeEdit::time - \brief the QTime that is set in the QDateTimeEdit + \brief the QTime that is set in the widget By default, this property contains a time of 00:00:00 and 0 milliseconds. @@ -1555,13 +1555,6 @@ QTimeEdit::QTimeEdit(const QTime &time, QWidget *parent) { } -/*! - \property QTimeEdit::time - \brief the QTime that is shown in the widget - - By default, this property contains a time of 00:00:00 and 0 milliseconds. -*/ - /*! \class QDateEdit @@ -1616,13 +1609,6 @@ QDateEdit::QDateEdit(const QDate &date, QWidget *parent) { } -/*! - \property QDateEdit::date - \brief the QDate that is shown in the widget - - By default, this property contains a date referring to January 1, 2000. -*/ - // --- QDateTimeEditPrivate --- -- cgit v0.12 From fce17c2847fa48410adae098b1df3db76fa4ef67 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 26 Aug 2010 15:08:41 +1000 Subject: Fix application exiting in embedded qml examples Task-number: QTBUG-13178 Reviewed-by: Martin Jones --- demos/embedded/qmlcalculator/qmlcalculator.cpp | 4 +++- demos/embedded/qmlclocks/qmlclocks.cpp | 2 ++ demos/embedded/qmldialcontrol/qmldialcontrol.cpp | 2 ++ demos/embedded/qmleasing/deployment.pri | 2 +- demos/embedded/qmleasing/qmleasing.cpp | 2 ++ demos/embedded/qmlflickr/qmlflickr.cpp | 4 +++- demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp | 2 ++ demos/embedded/qmltwitter/qmltwitter.cpp | 3 ++- .../animation/easing/content/QuitButton.qml | 12 ++++++++++++ .../declarative/animation/easing/content/quit.png | Bin 0 -> 583 bytes examples/declarative/animation/easing/easing.qml | 19 ++++++++++++++++--- examples/declarative/toys/clocks/clocks.qml | 5 +++++ .../declarative/toys/clocks/content/QuitButton.qml | 12 ++++++++++++ examples/declarative/toys/clocks/content/quit.png | Bin 0 -> 583 bytes .../ui-components/dialcontrol/content/QuitButton.qml | 12 ++++++++++++ .../ui-components/dialcontrol/content/quit.png | Bin 0 -> 583 bytes .../ui-components/dialcontrol/dialcontrol.qml | 5 +++++ src/declarative/qml/qdeclarativeengine.cpp | 3 +++ 18 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 examples/declarative/animation/easing/content/QuitButton.qml create mode 100644 examples/declarative/animation/easing/content/quit.png create mode 100644 examples/declarative/toys/clocks/content/QuitButton.qml create mode 100644 examples/declarative/toys/clocks/content/quit.png create mode 100644 examples/declarative/ui-components/dialcontrol/content/QuitButton.qml create mode 100644 examples/declarative/ui-components/dialcontrol/content/quit.png diff --git a/demos/embedded/qmlcalculator/qmlcalculator.cpp b/demos/embedded/qmlcalculator/qmlcalculator.cpp index 3030e81..6c41e61 100644 --- a/demos/embedded/qmlcalculator/qmlcalculator.cpp +++ b/demos/embedded/qmlcalculator/qmlcalculator.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #if defined(Q_OS_SYMBIAN) #include @@ -58,7 +59,8 @@ int main(int argc, char *argv[]) QDeclarativeView view; view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + #if defined(QT_KEYPAD_NAVIGATION) QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); #endif // QT_KEYPAD_NAVIGATION diff --git a/demos/embedded/qmlclocks/qmlclocks.cpp b/demos/embedded/qmlclocks/qmlclocks.cpp index d94cbdd..a09801b 100644 --- a/demos/embedded/qmlclocks/qmlclocks.cpp +++ b/demos/embedded/qmlclocks/qmlclocks.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #if defined(Q_OS_SYMBIAN) #include @@ -58,6 +59,7 @@ int main(int argc, char *argv[]) QDeclarativeView view; view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); #if defined(QT_KEYPAD_NAVIGATION) QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); diff --git a/demos/embedded/qmldialcontrol/qmldialcontrol.cpp b/demos/embedded/qmldialcontrol/qmldialcontrol.cpp index 311cee0..56b21d7 100644 --- a/demos/embedded/qmldialcontrol/qmldialcontrol.cpp +++ b/demos/embedded/qmldialcontrol/qmldialcontrol.cpp @@ -42,6 +42,7 @@ #include #include #include +#include int main(int argc, char *argv[]) { @@ -51,6 +52,7 @@ int main(int argc, char *argv[]) QDeclarativeView view; view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); #if defined(QT_KEYPAD_NAVIGATION) QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); diff --git a/demos/embedded/qmleasing/deployment.pri b/demos/embedded/qmleasing/deployment.pri index 984f5c8..d3621cb 100644 --- a/demos/embedded/qmleasing/deployment.pri +++ b/demos/embedded/qmleasing/deployment.pri @@ -4,5 +4,5 @@ symbian { qmleasing_uid3 = A000E3FE qmleasing_files.path = $$APP_PRIVATE_DIR_BASE/$$qmleasing_uid3 } -qmleasing_files.sources = $$qmleasing_src/easing.qml +qmleasing_files.sources = $$qmleasing_src/easing.qml $$qmleasing_src/content DEPLOYMENT += qmleasing_files diff --git a/demos/embedded/qmleasing/qmleasing.cpp b/demos/embedded/qmleasing/qmleasing.cpp index d326468..713fe67 100644 --- a/demos/embedded/qmleasing/qmleasing.cpp +++ b/demos/embedded/qmleasing/qmleasing.cpp @@ -42,6 +42,7 @@ #include #include #include +#include int main(int argc, char *argv[]) { @@ -51,6 +52,7 @@ int main(int argc, char *argv[]) QDeclarativeView view; view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); #if defined(QT_KEYPAD_NAVIGATION) QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); diff --git a/demos/embedded/qmlflickr/qmlflickr.cpp b/demos/embedded/qmlflickr/qmlflickr.cpp index 7068f88..c05806c 100644 --- a/demos/embedded/qmlflickr/qmlflickr.cpp +++ b/demos/embedded/qmlflickr/qmlflickr.cpp @@ -48,6 +48,7 @@ #include #include #include +#include // Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise // the system default. @@ -95,7 +96,8 @@ int main(int argc, char *argv[]) view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + #if defined(Q_OS_SYMBIAN) view.showFullScreen(); #else // Q_OS_SYMBIAN diff --git a/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp b/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp index 2b9db5e..d9cf67c 100644 --- a/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp +++ b/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp @@ -96,6 +96,8 @@ int main(int argc, char *argv[]) view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + #if defined(Q_OS_SYMBIAN) view.showFullScreen(); #else // Q_OS_SYMBIAN diff --git a/demos/embedded/qmltwitter/qmltwitter.cpp b/demos/embedded/qmltwitter/qmltwitter.cpp index c53098a4..30c4601 100644 --- a/demos/embedded/qmltwitter/qmltwitter.cpp +++ b/demos/embedded/qmltwitter/qmltwitter.cpp @@ -95,7 +95,8 @@ int main(int argc, char *argv[]) view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + #if defined(Q_OS_SYMBIAN) view.showFullScreen(); #else // Q_OS_SYMBIAN diff --git a/examples/declarative/animation/easing/content/QuitButton.qml b/examples/declarative/animation/easing/content/QuitButton.qml new file mode 100644 index 0000000..70747a8 --- /dev/null +++ b/examples/declarative/animation/easing/content/QuitButton.qml @@ -0,0 +1,12 @@ +import Qt 4.7 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +} \ No newline at end of file diff --git a/examples/declarative/animation/easing/content/quit.png b/examples/declarative/animation/easing/content/quit.png new file mode 100644 index 0000000..b822057 Binary files /dev/null and b/examples/declarative/animation/easing/content/quit.png differ diff --git a/examples/declarative/animation/easing/easing.qml b/examples/declarative/animation/easing/easing.qml index 9cdbad1..b53cb98 100644 --- a/examples/declarative/animation/easing/easing.qml +++ b/examples/declarative/animation/easing/easing.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import Qt 4.7 +import "content" Rectangle { id: window @@ -134,11 +135,23 @@ Rectangle { } Flickable { - anchors.fill: parent; contentHeight: layout.height - + anchors.fill: parent + contentHeight: layout.height + Rectangle { + id: titlePane + color: "#444444" + height: 35 + anchors { top: parent.top; left: parent.left; right: parent.right } + QuitButton { + id: quitButton + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 10 + } + } Column { id: layout - anchors.left: parent.left; anchors.right: parent.right + anchors { top: titlePane.bottom; topMargin: 10; left: parent.left; right: parent.right } Repeater { model: easingTypes; delegate: delegate } } } diff --git a/examples/declarative/toys/clocks/clocks.qml b/examples/declarative/toys/clocks/clocks.qml index 124e391..82a1dbf 100644 --- a/examples/declarative/toys/clocks/clocks.qml +++ b/examples/declarative/toys/clocks/clocks.qml @@ -51,4 +51,9 @@ Rectangle { Clock { city: "Mumbai"; shift: 5.5 } Clock { city: "Tokyo"; shift: 9 } } + QuitButton { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 10 + } } diff --git a/examples/declarative/toys/clocks/content/QuitButton.qml b/examples/declarative/toys/clocks/content/QuitButton.qml new file mode 100644 index 0000000..70747a8 --- /dev/null +++ b/examples/declarative/toys/clocks/content/QuitButton.qml @@ -0,0 +1,12 @@ +import Qt 4.7 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +} \ No newline at end of file diff --git a/examples/declarative/toys/clocks/content/quit.png b/examples/declarative/toys/clocks/content/quit.png new file mode 100644 index 0000000..b822057 Binary files /dev/null and b/examples/declarative/toys/clocks/content/quit.png differ diff --git a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml new file mode 100644 index 0000000..70747a8 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml @@ -0,0 +1,12 @@ +import Qt 4.7 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +} \ No newline at end of file diff --git a/examples/declarative/ui-components/dialcontrol/content/quit.png b/examples/declarative/ui-components/dialcontrol/content/quit.png new file mode 100644 index 0000000..b822057 Binary files /dev/null and b/examples/declarative/ui-components/dialcontrol/content/quit.png differ diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml index 46cc3e6..a7da5c6 100644 --- a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml @@ -88,5 +88,10 @@ Rectangle { } } } + QuitButton { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 10 + } } //! [0] diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index c5a5c18..0fe1ea3 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1716,6 +1716,9 @@ void QDeclarativeEnginePrivate::sendQuit() { Q_Q(QDeclarativeEngine); emit q->quit(); + if (q->receivers(SIGNAL(quit())) == 0) { + qWarning("Signal QDeclarativeEngine::quit() emitted, but no receivers connected to handle it."); + } } static void dumpwarning(const QDeclarativeError &error) -- cgit v0.12 From bcef15f4134a0825db85e1749aa90c60d94ab04b Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 27 Aug 2010 12:14:24 +1000 Subject: QML Viewer should be put under QtDemos instead of QtExamples folder in Symbian app menu Task-number: Reviewed-by: Martin Jones --- tools/qml/qml.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index d794005..3927dd6 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -34,7 +34,7 @@ maemo5 { } symbian { TARGET.UID3 = 0x20021317 - include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.EPOCHEAPSIZE = 0x20000 0x4000000 TARGET.CAPABILITY = NetworkServices ReadUserData !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { -- cgit v0.12 From 75fc8a8dd52156b2089764ce82925289877eee1d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 30 Aug 2010 15:22:28 +1000 Subject: Snake: Don't use Behavior with states. Changing states mid-animation confuses states where property value is not specified explicitly for each state. Task-number: QT-3823 --- demos/declarative/snake/content/Cookie.qml | 6 +++++- demos/declarative/snake/content/Link.qml | 8 +++++++- demos/declarative/snake/content/snake.js | 2 +- demos/declarative/snake/snake.qml | 7 +++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index e67a7af..eb57fd2 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -59,7 +59,6 @@ Item { anchors.fill: parent source: "pics/cookie.png" opacity: 0 - Behavior on opacity { NumberAnimation { duration: 100 } } Text { font.bold: true anchors.verticalCenter: parent.verticalCenter @@ -87,4 +86,9 @@ Item { PropertyChanges { target: img; opacity: 0 } } ] + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 100 } + } + ] } diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 9aa6006..942008d 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -86,7 +86,6 @@ Item { id:link } opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } } @@ -114,4 +113,11 @@ Item { id:link PropertyChanges { target: img; opacity: 0 } } ] + + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 200 } + } + ] + } diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index fab7834..c2e9d3a 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -35,7 +35,7 @@ function startNewGame() if (heartbeat.running) { endGame(); startNewGameTimer.running = true; - state = "starting"; + state = ""; return; } diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 12ad71c..cf037fc 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -106,7 +106,7 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - Behavior on opacity { NumberAnimation { duration: 500 } } + onOpacityChanged: console.log("opacity: "+opacity); Text { color: "white" @@ -236,7 +236,10 @@ Rectangle { from: "*" to: "starting" NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } - + NumberAnimation { target: title; property: "opacity"; duration: 500 } + }, + Transition { + NumberAnimation { target: title; property: "opacity"; duration: 500 } } ] -- cgit v0.12 From 755dee37d9eef756642ff0e9f40547b1ab3f8d0b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 30 Aug 2010 16:25:42 +1000 Subject: Remove debug. --- demos/declarative/snake/snake.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index cf037fc..4d989df 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -106,7 +106,6 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - onOpacityChanged: console.log("opacity: "+opacity); Text { color: "white" -- cgit v0.12 From 1760f0e50cc2f5b39edb5fc751198a2f28871d83 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 30 Aug 2010 11:30:39 +0300 Subject: Text is inputted on top of existing text in anomaly Switch Anomaly demo app to use QLineEdit::setPlaceHolderText instead of using own internal paint event handling for Address bar widget. Task-number: QT-3657 Reviewed-by: Miikka Heikkinen --- demos/embedded/anomaly/src/AddressBar.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/demos/embedded/anomaly/src/AddressBar.cpp b/demos/embedded/anomaly/src/AddressBar.cpp index 12523f2..f83876e 100644 --- a/demos/embedded/anomaly/src/AddressBar.cpp +++ b/demos/embedded/anomaly/src/AddressBar.cpp @@ -44,27 +44,11 @@ #include #include -class LineEdit: public QLineEdit -{ -public: - LineEdit(QWidget *parent = 0): QLineEdit(parent) {} - - void paintEvent(QPaintEvent *event) { - QLineEdit::paintEvent(event); - if (text().isEmpty()) { - QPainter p(this); - int flags = Qt::AlignLeft | Qt::AlignVCenter; - p.setPen(palette().color(QPalette::Disabled, QPalette::Text)); - p.drawText(rect().adjusted(10, 0, 0, 0), flags, "Enter address or search terms"); - p.end(); - } - } -}; - AddressBar::AddressBar(QWidget *parent) : QWidget(parent) { - m_lineEdit = new LineEdit(parent); + m_lineEdit = new QLineEdit(parent); + m_lineEdit->setPlaceholderText("Enter address or search terms"); connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(processAddress())); m_toolButton = new QToolButton(parent); m_toolButton->setText("Go"); -- cgit v0.12 From 55dab21c6c139efe82228abfc9875d265ed1bd14 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 30 Aug 2010 10:51:38 +0200 Subject: Designer: Fix crash on unsupported Language/Country combination. ...in the property editor (QLocale). Reviewed-by: Denis Dzyubenko Task-number: QTBUG-13267 Task-number: QTCREATORBUG-2212 --- tools/shared/qtpropertybrowser/qtpropertymanager.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp index d9ff10a..a0bef0a 100644 --- a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -2399,15 +2399,23 @@ QString QtLocalePropertyManager::valueText(const QtProperty *property) const if (it == d_ptr->m_values.constEnd()) return QString(); - QLocale loc = it.value(); + const QLocale loc = it.value(); int langIdx = 0; int countryIdx = 0; - metaEnumProvider()->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx); - QString str = tr("%1, %2") - .arg(metaEnumProvider()->languageEnumNames().at(langIdx)) - .arg(metaEnumProvider()->countryEnumNames(loc.language()).at(countryIdx)); - return str; + const QtMetaEnumProvider *me = metaEnumProvider(); + me->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx); + if (langIdx < 0) { + qWarning("QtLocalePropertyManager::valueText: Unknown language %d", loc.language()); + return tr(""); + } + const QString languageName = me->languageEnumNames().at(langIdx); + if (countryIdx < 0) { + qWarning("QtLocalePropertyManager::valueText: Unknown country %d for %s", loc.country(), qPrintable(languageName)); + return languageName; + } + const QString countryName = me->countryEnumNames(loc.language()).at(countryIdx); + return tr("%1, %2").arg(languageName, countryName); } /*! -- cgit v0.12 From 2acd16ec844980efc32937bc0a6a52ef2299c161 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 Aug 2010 11:06:27 +0200 Subject: Updated and new Slovenian translations for Qt 4.7 Merge-request: 793 Reviewed-by: Oswald Buddenhagen --- translations/assistant_sl.ts | 972 +++++++++++++++++++++++++ translations/designer_sl.ts | 8 +- translations/linguist_sl.ts | 1596 ++++++++++++++++++++++++++++++++++++++++++ translations/qt_help_sl.ts | 329 +++++++++ translations/qt_sl.ts | 696 +++++++++--------- translations/qtconfig_sl.ts | 732 +++++++++++++++++++ translations/qvfb_sl.ts | 422 +++++++++++ 7 files changed, 4403 insertions(+), 352 deletions(-) create mode 100644 translations/assistant_sl.ts create mode 100644 translations/linguist_sl.ts create mode 100644 translations/qt_help_sl.ts create mode 100644 translations/qtconfig_sl.ts create mode 100644 translations/qvfb_sl.ts diff --git a/translations/assistant_sl.ts b/translations/assistant_sl.ts new file mode 100644 index 0000000..05429bd --- /dev/null +++ b/translations/assistant_sl.ts @@ -0,0 +1,972 @@ + + + + 2010-08-28 14:36+0200 + MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator + Lokalize 1.1 + Slovenian <lugos-slo@lugos.si> + + # Jure Repinc <jlp@holodeck1.com>, 2010. + Jure Repinc <jlp@holodeck1.com> + + AboutDialog + + &Close + &Zapri + + + + AboutLabel + + Warning + Opozorilo + + + Unable to launch external application. + + Zunanjega programa ni moč zagnati. + + + + OK + V redu + + + + Assistant + + Error registering documentation file '%1': %2 + Napaka pri registraciji datoteke z dokumentacijo »%1«: %2 + + + Error: %1 + Napaka: %1 + + + Could not register documentation file +%1 + +Reason: +%2 + Ni bilo moč registrirati datoteke z dokumentacijo +%1 + +Razlog: +%2 + + + Documentation successfully registered. + Dokumentacija je bila uspešno registrirana. + + + Could not unregister documentation file +%1 + +Reason: +%2 + Ni bilo moč od-registrirati datoteke z dokumentacijo +%1 + +Razlog: +%2 + + + Documentation successfully unregistered. + Dokumentacija je bila uspešno odstranjena iz registrira. + + + Error reading collection file '%1': %2. + Napaka pri branju datoteke zbirke »%1«: %2. + + + Error creating collection file '%1': %2. + Napaka pri ustvarjanju datoteke zbirke »%1«: %2. + + + Cannot load sqlite database driver! + Ni moč naložiti gonilnika za podatkovno zbirko SQLite. + + + + BookmarkDialog + + Add Bookmark + Dodaj zaznamek + + + Bookmark: + Zaznamek: + + + Add in Folder: + Dodaj v mapo: + + + + + + + + + New Folder + Nova mapa + + + Rename Folder + Preimenuj mapo + + + + BookmarkManager + + Untitled + Brez naslova + + + Remove + Odstrani + + + You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue? + Nameravate zbrisati mapo, pri čemer bo zbrisana<br>tudi njena vsebina. Ali res želite nadaljevati? + + + Manage Bookmarks... + Upravljanje zaznamkov ... + + + Add Bookmark... + Dodaj zaznamek ... + + + Ctrl+D + Ctrl+D + + + Delete Folder + Izbriši mapo + + + Rename Folder + Preimenuj mapo + + + Show Bookmark + Prikaži zaznamek + + + Show Bookmark in New Tab + Prikaži zaznamek v novem zavihku + + + Delete Bookmark + Izbriši zaznamek + + + Rename Bookmark + Preimenuj zaznamek + + + + BookmarkManagerWidget + + Manage Bookmarks + Upravljanje zaznamkov + + + Search: + Išči: + + + Remove + Odstrani + + + Import and Backup + Uvozi in ustvari varnostno kopijo + + + OK + V redu + + + Import... + Uvozi ... + + + Export... + Izvozi ... + + + Open File + Odpri datoteko + + + Files (*.xbel) + Datoteke (*.xbel) + + + Save File + Shrani datoteko + + + Qt Assistant + Qt Assistant + + + Unable to save bookmarks. + Zaznamkov ni moč shraniti. + + + You are goingto delete a Folder, this will also<br> remove it's content. Are you sure to continue? + Nameravate zbrisati mapo, pri čemer bo zbrisana<br>tudi njena vsebina. Ali res želite nadaljevati? + + + Delete Folder + Izbriši mapo + + + Rename Folder + Preimenuj mapo + + + Show Bookmark + Prikaži zaznamek + + + Show Bookmark in New Tab + Prikaži zaznamek v novem zavihku + + + Delete Bookmark + Izbriši zaznamek + + + Rename Bookmark + Preimenuj zaznamek + + + + BookmarkModel + + Name + Ime + + + Address + Naslov + + + Bookmarks Menu + Meni z zaznamki + + + + BookmarkWidget + + Bookmarks + Zaznamki + + + Filter: + Filter: + + + Add + Dodaj + + + Remove + Odstrani + + + + CentralWidget + + Add new page + Dodaj novo stran + + + Close current page + Zapri trenutno stran + + + Print Document + Natisni dokument + + + unknown + neznano + + + Add New Page + Dodaj novo stran + + + Close This Page + Zapri to stran + + + Close Other Pages + Zapri druge strani + + + Add Bookmark for this Page... + Dodaj zaznamek za to stran ... + + + Search + Iskanje + + + + CmdLineParser + + Unknown option: %1 + Neznana možnost: %1 + + + The collection file '%1' does not exist. + Datoteka zbirke »%1« ne obstaja. + + + Missing collection file. + Manjkajoča datoteka zbirke. + + + Invalid URL '%1'. + Neveljaven URL »%1«. + + + Missing URL. + Manjkajoč URL. + + + Unknown widget: %1 + Neznan gradnik: %1 + + + Missing widget. + Manjkajoč gradnik. + + + The Qt help file '%1' does not exist. + Datoteka s pomočjo za Qt »%1« ne obstaja. + + + Missing help file. + Manjkajoča datoteka s pomočjo. + + + Missing filter argument. + Manjkajoč argument filtra. + + + Error + Napaka + + + Notice + Opomba + + + + ContentWindow + + Open Link + Odpri povezavo + + + Open Link in New Tab + Odpri povezavo v novem zavihku + + + + FilterNameDialogClass + + Add Filter Name + Dodaj ime filtra + + + Filter Name: + Ime filtra: + + + + FindWidget + + Previous + Predhodno + + + Next + Naslednje + + + Case Sensitive + Loči velike in male črke + + + <img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped + <img src=":/trolltech/assistant/images/wrap.png">&nbsp;Iskanje se nadaljuje na drugem koncu + + + + FontPanel + + Font + Pisava + + + &Writing system + S&istem pisanja + + + &Family + &Družina + + + &Style + &Slog + + + &Point size + &Velikost v točkah + + + + HelpViewer + + <title>about:blank</title> + <title>about:blank</title> + + + <title>Error 404...</title><div align="center"><br><br><h1>The page could not be found</h1><br><h3>'%1'</h3></div> + <title>Napaka 404</title><div align="center"><br><br><h1>Strani ni bilo moč najti</h1><br><h3>»%1«</h3></div> + + + Copy &Link Location + Skopiraj &povezavo do lokacije + + + Open Link in New Tab Ctrl+LMB + Odpri povezavo v novem zavihku Ctrl+LGM + + + Open Link in New Tab + Odpri povezavo v novem zavihku + + + + IndexWindow + + &Look for: + &Išči: + + + Open Link + Odpri povezavo + + + Open Link in New Tab + Odpri povezavo v novem zavihku + + + + InstallDialog + + Install Documentation + Namesti dokumentacijo + + + Available Documentation: + Razpoložljiva dokumentacija: + + + Install + Namesti + + + Cancel + Prekliči + + + Close + Zapri + + + Installation Path: + Namestitvena pot: + + + ... + ... + + + Downloading documentation info... + Prejemanje podatkov o dokumentaciji ... + + + Download canceled. + Prejemanje preklicano. + + + Done. + Opravljeno. + + + The file %1 already exists. Do you want to overwrite it? + Datoteka %1 že obstaja. Ali jo želite nadomestiti? + + + Unable to save the file %1: %2. + Datoteke %1 ni moč shraniti: %2. + + + Downloading %1... + Prejemanje %1 ... + + + Download failed: %1. + Prejemanje ni uspelo: %1. + + + Documentation info file is corrupt! + Datoteka s podatki o dokumentaciji je poškodovana. + + + Download failed: Downloaded file is corrupted. + Prejemanje ni uspelo. Prejeta datoteka je poškodovana. + + + Installing documentation %1... + Nameščanje dokumentacije %1 ... + + + Error while installing documentation: +%1 + Napaka pri nameščanju dokumentacije: +%1 + + + + MainWindow + + Index + Kazalo + + + Contents + Vsebina + + + Bookmarks + Zaznamki + + + Qt Assistant + Qt Assistant + + + Looking for Qt Documentation... + iskanje dokumentacije za Qt ... + + + &File + &Datoteka + + + New &Tab + Nov zavi&hek + + + Page Set&up... + Nastavitve stra&ni ... + + + Print Preview... + Ogled tiskanja ... + + + &Print... + Na&tisni ... + + + &Close Tab + &Zapri zavihek + + + &Quit + Konča&j + + + CTRL+Q + Ctrl+Q + + + &Edit + &Urejanje + + + &Copy selected Text + S&kopiraj izbrano besedilo + + + &Find in Text... + &Najdi v besedilu ... + + + &Find + &Najdi + + + Find &Next + Najdi na&slednje + + + Find &Previous + Najdi p&rejšnje + + + Preferences... + Nastavitve ... + + + &View + &Videz + + + Zoom &in + Po&večaj + + + Zoom &out + Z&manjšaj + + + Normal &Size + &Običajna velikost + + + Ctrl+0 + Ctrl+0 + + + ALT+C + Alt+V + + + ALT+I + Alt+K + + + ALT+O + Alt+Z + + + Search + Iskanje + + + ALT+S + Alt+I + + + &Go + &Pojdi + + + &Home + &Domov + + + ALT+Home + Alt+Domov + + + &Back + Na&zaj + + + &Forward + &Naprej + + + Sync with Table of Contents + Uskladi s seznamom vsebine + + + Sync + Uskladi + + + Next Page + Naslednja stran + + + Ctrl+Alt+Right + Ctrl+Alt+Desno + + + Previous Page + Predhodna stran + + + Ctrl+Alt+Left + Ctrl+Alt+Levo + + + &Bookmarks + &Zaznamki + + + &Help + &Pomoč + + + About... + O ... + + + Navigation Toolbar + Orodjarna za krmarjenje + + + &Window + &Okno + + + Zoom + Povečava + + + Minimize + Pomanjšaj + + + Ctrl+M + Ctrl+M + + + Toolbars + Orodjarne + + + Filter Toolbar + Orodjarna filtra + + + Filtered by: + Filtrirano po: + + + Address Toolbar + Naslovna vrstica + + + Address: + Naslov: + + + Could not find the associated content item. + Povezane postavke vsebine ni bilo moč najti. + + + About %1 + O %1 + + + Updating search index + Posodabljanje kazala za iskanje + + + Could not register file '%1': %2 + Datoteke »%1« ni bilo moč registrirati: %2 + + + + PreferencesDialog + + Add Documentation + Dodaj dokumentacijo + + + Qt Compressed Help Files (*.qch) + Stisnjene datoteke s pomočjo za Qt (*.qch) + + + The namespace %1 is already registered! + Imenski prostor %1 je že registriran. + + + The specified file is not a valid Qt Help File! + Navedena datoteka ni veljavna datoteka s pomočjo za Qt. + + + Remove Documentation + Odstrani dokumentacijo + + + Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents. + Nekateri odprti dokumenti se sklicujejo na dokumentacijo, ki jo poskušate odstraniti. Odstranitev dokumentacije bo povzročila zaprtje teh dokumentov. + + + Cancel + Prekliči + + + OK + V redu + + + Use custom settings + Uporabi nastavitve po meri + + + + PreferencesDialogClass + + Preferences + Nastavitve + + + Fonts + Pisave + + + Font settings: + Nastavitve pisav + + + Browser + Brskalnik + + + Application + Program + + + Filters + Filtri + + + Filter: + Filter: + + + Attributes: + Lastnosti: + + + 1 + 1 + + + Add + Dodaj + + + Remove + Odstrani + + + Documentation + Dokumentacija + + + Registered Documentation: + Registrirana dokumentacija + + + Add... + Dodaj ... + + + Options + Možnosti + + + On help start: + Ob zagonu pomoči: + + + Show my home page + Prikaži mojo domačo stran + + + Show a blank page + Prikaži prazno stran + + + Show my tabs from last session + Prikaži moje zavihke iz zadnje seje + + + Homepage + Domača stran + + + Current Page + Trenutna stran + + + Blank Page + Prazna stran + + + Restore to default + Ponastavi na privzeto + + + + RemoteControl + + Debugging Remote Control + Razhroščevanje oddaljenega nadzora + + + Received Command: %1 %2 + Prejet ukaz: %1 %2 + + + + SearchWidget + + &Copy + S&kopiraj + + + Copy &Link Location + Skopiraj &povezavo do lokacije + + + Open Link in New Tab + Odpri povezavo v novem &zavihku + + + Select All + Izberi vse + + + + TopicChooser + + Choose Topic + Izberite temo + + + &Topics + &Teme + + + &Display + &Prikaži + + + &Close + &Zapri + + + Choose a topic for <b>%1</b>: + Izberite temo za <b>%1</b>: + + + diff --git a/translations/designer_sl.ts b/translations/designer_sl.ts index 8d2a161..d925f09 100644 --- a/translations/designer_sl.ts +++ b/translations/designer_sl.ts @@ -1,7 +1,7 @@ - 2010-08-05 02:42+0200 + 2010-08-28 14:05+0200 MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator Lokalize 1.1 Slovenian <lugos-slo@lugos.si> @@ -720,7 +720,7 @@ &Point Size - &Velikost točke + &Velikost v točkah Style @@ -826,7 +826,7 @@ &Point size - &Velikost točke + &Velikost v točkah @@ -2190,7 +2190,7 @@ Empty class name passed to widget factory method Point Size - Velikost točke + Velikost v točkah Bold diff --git a/translations/linguist_sl.ts b/translations/linguist_sl.ts new file mode 100644 index 0000000..0b5b084 --- /dev/null +++ b/translations/linguist_sl.ts @@ -0,0 +1,1596 @@ + + + + 2010-08-28 18:45+0200 + MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator + Lokalize 1.1 + Slovenian <lugos-slo@lugos.si> + + # Jure Repinc <jlp@holodeck1.com>, 2010. + Jure Repinc <jlp@holodeck1.com> + + AboutDialog + + Qt Linguist + Qt Linguist + + + + BatchTranslationDialog + + Qt Linguist - Batch Translation + Qt Linguist – paketno prevajanje + + + Options + Možnosti + + + Set translated entries to finished + Označi prevedene vnose kot zaključene + + + Retranslate entries with existing translation + Znova prevedi vnose z obstoječimi prevodi + + + Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked + Vedite, da bodo spremenjeni vnosi ponastavljeni na nezaključeno, če možnost »Označi prevedene vnose kot zaključene« ni omogočena. + + + Translate also finished entries + Prevedi tudi zaključene vnose + + + Phrase book preference + Prednostni seznam knjig z izrazi + + + Move up + Premakni gor + + + Move down + Premakni dol + + + The batch translator will search through the selected phrase books in the order given above + Paketni prevajalnik bo izbrane knjige z izrazi preiskal v zgoraj navedenem vrstnem redu + + + &Run + &Zaženi + + + Cancel + Prekliči + + + Batch Translation of '%1' - Qt Linguist + Paketno prevajanje »%1« – Qt Linguist + + + Searching, please wait... + Iskanje, prosimo počakajte ... + + + &Cancel + &Prekliči + + + Linguist batch translator + Paketni prevajalnik + + + Batch translated %n entries + + Paketno preveden %n vnos + Paketno prevedena %n vnosa + Paketno prevedeni %n vnosi + Paketno prevedenih %n vnosov + + + + + DataModel + + <qt>Duplicate messages found in '%1': + <qt>V »%1« so bila najdena podvojena sporočila. + + + <p>[more duplicates omitted] + <p>[več izpuščenih podvojitev] + + + <p>* ID: %1 + <p>* ID: %1 + + + <p>* Context: %1<br>* Source: %2 + <p>* Kontekst: %1<br>* Vir: %2 + + + <br>* Comment: %3 + <br>* Komentar: %3 + + + Linguist does not know the plural rules for '%1'. +Will assume a single universal form. + Qt Linguist ne pozna pravil za množinske oblike za »%1«. +Privzeta bo edninska univerzalna oblika. + + + Cannot create '%2': %1 + Ni moč ustvariti »%2«: %1 + + + Universal Form + Univerzalna oblika + + + + ErrorsView + + Accelerator possibly superfluous in translation. + V prevodu je morda odvečen pospeševalnik. + + + Accelerator possibly missing in translation. + V prevodu morda manjka pospeševalnik. + + + Translation does not end with the same punctuation as the source text. + Prevod se ne zaključi z istim ločilom kot izvorno besedilo. + + + A phrase book suggestion for '%1' was ignored. + Predlog za »%1« is knjige izrazov je bil prezrt. + + + Translation does not refer to the same place markers as in the source text. + Prevod ne navaja enakih oznak vsebnikov kot izvorno besedilo. + + + Translation does not contain the necessary %n place marker. + Prevod ne vsebuje potrebne oznake %n za vsebnik. + + + Unknown error + Neznana napaka + + + + FindDialog + + Find + Najdi + + + This window allows you to search for some text in the translation source file. + To okno omogoča iskanje besedila v izvorni datoteki s prevodom. + + + &Find what: + &Najdi: + + + Type in the text to search for. + Vnesite iskano besedilo. + + + Options + Možnosti + + + Source texts are searched when checked. + Ko je omogočeno, se preišče izvorna besedila. + + + &Source texts + &Izvorna besedila + + + Translations are searched when checked. + Ko je omogočeno, se preišče prevode. + + + &Translations + &Prevodi + + + Texts such as 'TeX' and 'tex' are considered as different when checked. + Ko je omogočeno, se razlikuje med besedili kot sta »KDE« in »kde«. + + + &Match case + Ujemanje &velikosti črk + + + Comments and contexts are searched when checked. + Ko je omogočeno, se preišče kontekste in komentarje. + + + &Comments + &Komentarji + + + Ignore &accelerators + Prezri p&ospeševalnike + + + Click here to find the next occurrence of the text you typed in. + Kliknite, da poiščete naslednjo pojavitev vnešenega besedila. + + + Find Next + Najdi naslednje + + + Click here to close this window. + Kliknite, da zaprete to okno. + + + Cancel + Prekliči + + + + FormMultiWidget + + Alt+Delete + translate, but don't change + + Alt+Izbriši + + + Shift+Alt+Insert + translate, but don't change + + Shift+Alt+Vstavi + + + Alt+Insert + translate, but don't change + + Alt+Vstavi + + + Confirmation - Qt Linguist + Potrditev – Qt Linguist + + + Delete non-empty length variant? + Ali izbrišem ne-prazno dolžinsko inačico? + + + + LRelease + + Dropped %n message(s) which had no ID. + + Opustil %n sporočilo, ki ni imelo ID-ja. + Opustil %n sporočili, ki nista imeli ID-ja. + Opustil %n sporočila, ki niso imela ID-ja. + Opustil %n sporočil, ki niso imeli ID-ja. + + + + Excess context/disambiguation dropped from %n message(s). + + Odvečen kontekst/razločitev opuščen iz %n sporočila. + Odvečen kontekst/razločitev opuščen iz %n sporočil. + Odvečen kontekst/razločitev opuščen iz %n sporočil. + Odvečen kontekst/razločitev opuščen iz %n sporočil. + + + + Generated %n translation(s) (%1 finished and %2 unfinished) + + Ustvaril %n prevod (%1 zaključenih in %2 nezaključenih) + Ustvaril %n prevoda (%1 zaključenih in %2 nezaključenih) + Ustvaril %n prevode (%1 zaključenih in %2 nezaključenih) + Ustvaril %n prevodov (%1 zaključenih in %2 nezaključenih) + + + + Ignored %n untranslated source text(s) + + Prezrl %n neprevedeno izvorno besedilo + Prezrl %n neprevedeni izvorni besedili + Prezrl %n neprevedena izvorna besedila + Prezrl %n neprevedenih izvornih besedil + + + + + MainWindow + + MainWindow + GlavnoOkno + + + &Phrases + &Izrazi + + + &Close Phrase Book + &Zapri knjigo izrazov + + + &Edit Phrase Book + &Uredi knjigo izrazov + + + &Print Phrase Book + &Natisni knjigo izrazov + + + V&alidation + P&otrjevanje + + + &View + &Videz + + + Vie&ws + &Prikazi + + + &Toolbars + O&rodjarne + + + &Help + &Pomoč + + + &Translation + P&revajanje + + + &File + &Datoteka + + + Recently Opened &Files + Nedavno odprte &datoteke + + + &Edit + &Urejanje + + + &Open... + &Odpri ... + + + Open a Qt translation source file (TS file) for editing + Odpre izvorno datoteko s prevodi za Qt (*.ts) za urejanje + + + Ctrl+O + Ctrl+O + + + E&xit + Konča&j + + + Close this window and exit. + Zapre to okno in konča. + + + Ctrl+Q + Ctrl+Q + + + Save + Shrani + + + Save changes made to this Qt translation source file + Shrani spremembe te izvorne datoteke s prevodi za Qt + + + Save &As... + Shrani &kot ... + + + Save As... + Shrani kot ... + + + Save changes made to this Qt translation source file into a new file. + Shrani spremembe te izvorne datoteke s prevodi za Qt v novo datoteko. + + + Release + Izdaj + + + Create a Qt message file suitable for released applications from the current message file. + Iz trenutne datoteke s sporočili ustvari datoteko, ki je primerna za izdane programe. + + + &Print... + Na&tisni ... + + + Print a list of all the translation units in the current translation source file. + Natisne seznam vseh prevajalskih enot iz trenutne izvorne datoteke s prevodi. + + + Ctrl+P + Ctrl+P + + + &Undo + &Razveljavi + + + Undo the last editing operation performed on the current translation. + Razveljavi zadnje dejanje urejanja trenutnega prevoda. + + + Ctrl+Z + Ctrl+Z + + + &Redo + &Uveljavi + + + Redo an undone editing operation performed on the translation. + Uveljavi razveljavljeno dejanje urejanja prevoda. + + + Ctrl+Y + Ctrl+Y + + + Cu&t + &Izreži + + + Copy the selected translation text to the clipboard and deletes it. + Skopira izbrano besedilo prevoda na odložišče in ga izbriše. + + + Ctrl+X + Ctrl+X + + + &Copy + S&kopiraj + + + Copy the selected translation text to the clipboard. + Skopira izbrano besedilo prevoda na odložišče. + + + Ctrl+C + Ctrl+C + + + &Paste + Pri&lepi + + + Paste the clipboard text into the translation. + Prilepi besedilo z odložišča v prevod. + + + Ctrl+V + Ctrl+V + + + Select &All + Izberi &vse + + + Select the whole translation text. + Izbere celotno besedilo prevoda. + + + Ctrl+A + Ctrl+A + + + &Find... + &Najdi ... + + + Search for some text in the translation source file. + Poišče dano besedilo v izvorni datoteki s prevodi. + + + Ctrl+F + Ctrl+F + + + Find &Next + Najdi na&slednje + + + Continue the search where it was left. + Nadaljuje z iskanjem od zadnjega mesta. + + + F3 + F3 + + + &Prev Unfinished + &Predhodni nezaključen + + + Previous unfinished item + Predhodni nezaključen prevod + + + Move to the previous unfinished item. + Premakne se na predhodni nezaključen prevod. + + + Ctrl+K + Ctrl+K + + + &Next Unfinished + &Naslednji nezaključen + + + Next unfinished item + Naslednji nezaključen prevod + + + Move to the next unfinished item. + Premakne se na naslednji nezaključen prevod. + + + Ctrl+J + Ctrl+J + + + P&rev + &Predhodni + + + Move to previous item + Predhodni prevod + + + Move to the previous item. + Premakne se na predhodni prevod. + + + Ctrl+Shift+K + Ctrl+Shift+K + + + Ne&xt + N&aslednji + + + Next item + Naslednji prevod + + + Move to the next item. + Premakne se na naslednji prevod. + + + Ctrl+Shift+J + Ctrl+Shift+J + + + &Done and Next + &Zaključi in naslednji + + + Mark item as done and move to the next unfinished item + Označi prevod kot zaključen in na naslednji nezaključen + + + Mark this item as done and move to the next unfinished item. + Označi prevod kot zaključen in se premakni na naslednji nezaključen prevod. + + + Copy from source text + Skopiraj izvorno besedilo + + + Copies the source text into the translation field + Skopira izvorno besedilo v prevod + + + Copies the source text into the translation field. + Skopira izvorno besedilo v polje za vnos prevoda. + + + Ctrl+B + Ctrl+B + + + &Accelerators + &Pospeševalniki + + + Toggle the validity check of accelerators + Preklopi preverjanje pospeševalnikov + + + Toggle the validity check of accelerators, i.e. whether the number of ampersands in the source and translation text is the same. If the check fails, a message is shown in the warnings window. + Preklopi preverjanje pospeševalnikov, t.j. ali je število znakov »&&« v izvornem besedilu enako kot v prevodu. Če preizkus ne uspe, bo v podoknu z opozorili prikazano sporočilo. + + + &Ending Punctuation + &Končna ločila + + + Toggle the validity check of ending punctuation + Preklopi preverjanje končnih ločil + + + Toggle the validity check of ending punctuation. If the check fails, a message is shown in the warnings window. + Preklopi preverjanje končnih ločil. Če preizkus ne uspe, bo v podoknu z opozorili prikazano sporočilo. + + + &Phrase matches + &Ujemanje z izrazi + + + Toggle checking that phrase suggestions are used + Preklopi preverjanje uporabe predlogov izrazov + + + Toggle checking that phrase suggestions are used. If the check fails, a message is shown in the warnings window. + Preklopi preverjanje uporabe predlogov izrazov. Če preizkus ne uspe, bo v podoknu z opozorili prikazano sporočilo. + + + Place &Marker Matches + Ujemanje &oznak vsebnikov + + + Toggle the validity check of place markers + Preklopi preverjanje oznak vsebnikov + + + Toggle the validity check of place markers, i.e. whether %1, %2, ... are used consistently in the source text and translation text. If the check fails, a message is shown in the warnings window. + Preklopi preverjanje oznak vsebnikov, tj. ali so %1, %2, itd. v izvornem besedilu in prevodu konsistenčni. Če preizkus ne uspe, bo v podoknu z opozorili prikazano sporočilo. + + + &New Phrase Book... + &Nova knjiga z izrazi ... + + + Create a new phrase book. + Ustvari novo knjigo izrazov + + + Ctrl+N + Ctrl+N + + + &Open Phrase Book... + &Odpri knjigo izrazov ... + + + Open a phrase book to assist translation. + Odpre knjigo izrazov za pomoč pri prevajanju. + + + Ctrl+H + Ctrl+H + + + &Reset Sorting + &Ponastavi razvrščanje + + + Sort the items back in the same order as in the message file. + Prevajalske enote bodo razvrščene kot v datoteki s sporočili. + + + &Display guesses + Prikaži &ugibanja + + + Set whether or not to display translation guesses. + Ali naj bodo prikazana ugibanja prevodov. + + + &Statistics + &Statistika + + + Display translation statistics. + Prikaže statistiko prevodov. + + + &Manual + &Priročnik + + + F1 + F1 + + + About Qt Linguist + O Qt Linguist + + + About Qt + O Qt + + + Display information about the Qt toolkit by Nokia. + Prikaže podatke o ogrodju Qt. + + + &What's This? + &Kaj je to? + + + What's This? + Kaj je to? + + + Enter What's This? mode. + Vstop v način Kaj je to? + + + Shift+F1 + Shift+F1 + + + &Search And Translate... + &Najdi in prevedi ... + + + Replace the translation on all entries that matches the search source text. + Zamenja prevode vseh enot, kjer se izvorno besedilo ujema z iskanim. + + + &Batch Translation... + &Paketno prevajanje ... + + + Batch translate all entries using the information in the phrase books. + Paketno prevede vse enote in pri tem uporabi podatke iz knjig z izrazi. + + + Release As... + Izdaj kot ... + + + Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the TS file. + Iz trenutne datoteke s sporočili ustvari datoteko, ki je primerna za izdane programe. Ime datoteke bo izbrano sampdejno glede na ime datoteke *.ts. + + + File + Datoteka + + + Edit + Urejanje + + + Translation + Prevajanje + + + Validation + Potrjevanje + + + Help + Pomoč + + + Open/Refresh Form &Preview + Odpri/osveži &ogled obrazca + + + Form Preview Tool + Orodje za ogled obrazca + + + F5 + F5 + + + Translation File &Settings... + &Nastavitve datoteke s prevodi ... + + + &Add to Phrase Book + &Dodaj v knjigo izrazov + + + Ctrl+T + Ctrl+T + + + Open Read-O&nly... + Odpri samo za &branje ... + + + &Save All + &Shrani vse + + + Ctrl+S + Ctrl+S + + + &Release All + &Izdaj vse + + + Close + Zapri + + + &Close All + &Zapri vse + + + Ctrl+W + Ctrl+W + + + Length Variants + Dolžinske inačice + + + Source text + Izvorno besedilo + + + Index + Kazalo + + + Context + Kontekst + + + Items + Postavke + + + This panel lists the source contexts. + To podokno prikazuje seznam kontekstov iz izvorne kode. + + + Strings + Nizi + + + Phrases and guesses + Izrazi in ugibanja + + + Sources and Forms + Izvorna koda in obrazci + + + Warnings + Opozorila + + + MOD + status bar: file(s) modified + SPR + + + Loading... + Nalaganje ... + + + Loading File - Qt Linguist + Nalaganje datoteke – Qt Linguist + + + The file '%1' does not seem to be related to the currently open file(s) '%2'. + +Close the open file(s) first? + Kot kaže datoteka »%1« ni povezana s trenutno odprtimi datotekami »%2«. + +Ali želite najprej zapreti odprte datoteke? + + + The file '%1' does not seem to be related to the file '%2' which is being loaded as well. + +Skip loading the first named file? + Kot kaže datoteka »%1« ni povezana z datoteko »%2«, ki se ravno tako nalaga. + +Ali želite preskočiti nalaganje prve datoteke? + + + %n translation unit(s) loaded. + + Naložena %n prevajalska enota. + Naloženi %n prevajalski enoti. + Naložene %n prevajalske enote. + Naloženih %n prevajalskih enot. + + + + Related files (%1);; + Povezane datoteke (%1);; + + + Open Translation Files + Odpri datoteke za prevajanje + + + File saved. + Datoteka je shranjena. + + + Qt message files for released applications (*.qm) +All files (*) + Datoteke s sporočili za izdane programe (*.qm) +Vse datoteke (*) + + + File created. + Datoteka ustvarjena. + + + Printing... + Tiskanje ... + + + Context: %1 + Kontekst: %1 + + + finished + zaključen + + + unresolved + nerazrešen + + + obsolete + zastarel + + + Printing... (page %1) + Tiskanje (%1. stran) ... + + + Printing completed + Tiskanje zaključeno + + + Printing aborted + Tiskanje preklicano + + + Search wrapped. + Iskanje na drugem koncu + + + Qt Linguist + Qt Linguist + + + Cannot find the string '%1'. + Ni moč najti niza »%1«. + + + Search And Translate in '%1' - Qt Linguist + Najdi in prevedi v »%1« – Qt Linguist + + + Translate - Qt Linguist + Prevajanje – Qt Linguist + + + Translated %n entry(s) + + Prevedel %n vnos + Prevedel %n vnosa + Prevedel %n vnose + Prevedel %n vnosov + + + + No more occurrences of '%1'. Start over? + Pojavitev »%1« ni več. Ali začnem znova? + + + Create New Phrase Book + Ustvari novo knjigo izrazov + + + Qt phrase books (*.qph) +All files (*) + Knjiga z izrazi za Qt (*.qph) +Vse datoteke (*) + + + Phrase book created. + Knjiga izrazov ustvarjena. + + + Open Phrase Book + Odpri knjigo izrazov + + + Qt phrase books (*.qph);;All files (*) + Knjiga z izrazi za Qt (*.qph);;Vse datoteke (*) + + + %n phrase(s) loaded. + + Naložil %n izrazov. + Naložil %n izraz. + Naložil %n izraza. + Naložil %n izraze. + + + + Add to phrase book + Dodaj v knjigo izrazov + + + No appropriate phrasebook found. + Najdene ni bilo nobene ustrezne knjige izrazov. + + + Adding entry to phrasebook %1 + Dodajam vnos v knjigo izrazov %1 + + + Select phrase book to add to + Izberite knjigo izrazov za dodajanje vanjo + + + Unable to launch Qt Assistant (%1) + Ni moč zagnati Qt Assistanta (%1) + + + Version %1 + Različica %1 + + + <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist je orodje za dodajanje prevodov programom Qt..</p><p>Avtorske pravice © 2010 Nokia Corporation in/ali njene podružnice.</p><p>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></p> + + + Do you want to save the modified files? + Ali želite shraniti spremenjene datoteke? + + + Do you want to save '%1'? + Ali želite shraniti »%1«? + + + Qt Linguist[*] + Qt Linguist[*] + + + %1[*] - Qt Linguist + %1[*] – Qt Linguist + + + No untranslated translation units left. + Preostale ni nobene neprevedene prevajalske enote. + + + &Window + &Okno + + + Minimize + Pomanjšaj + + + Ctrl+M + Ctrl+M + + + Display the manual for %1. + Prikaži priročnik za %1. + + + Display information about %1. + Prikaži podatke o %1. + + + &Save '%1' + &Shrani »%1« + + + Save '%1' &As... + Shrani »%1« &kot ... + + + Release '%1' + Izdaj »%1« + + + Release '%1' As... + Izdaj »%1« kot ... + + + &Close '%1' + &Zapri »%1« + + + &Save + &Shrani + + + &Close + &Zapri + + + Save All + Shrani vse + + + Close All + Zapri vse + + + &Release + &Izdaj + + + Translation File &Settings for '%1'... + &Nastavitve datoteke s prevodi za »%1« ... + + + &Batch Translation of '%1'... + &Paketno prevajanje »%1« ... + + + Search And &Translate in '%1'... + &Najdi in prevedi v »%1« ... + + + Search And &Translate... + &Najdi in prevedi ... + + + Cannot read from phrase book '%1'. + Ni moč brati iz knjige izrazov »%1«. + + + Close this phrase book. + Zapri to knjigo izrazov. + + + Enables you to add, modify, or delete entries in this phrase book. + Omogoča dodajanje, spreminjanje in brisanje vnosov v knjigi izrazov. + + + Print the entries in this phrase book. + Natisne vnose iz te knjige izrazov. + + + Cannot create phrase book '%1'. + Ni moč ustvariti knjige izrazov »%1«. + + + Do you want to save phrase book '%1'? + Ali želite shraniti knjigo izrazov »%1«? + + + All + Vse + + + + MessageEditor + + Russian + Ruščina + + + German + Nemščina + + + Japanese + Japonščina + + + French + Francoščina + + + Polish + Poljščina + + + Chinese + Kitajščina + + + This whole panel allows you to view and edit the translation of some source text. + To podokno vam omogoča ogled in urejanje prevoda izvornega besedila. + + + Source text + Izvorno besedilo + + + This area shows the source text. + To področje prikazuje izvorno besedilo. + + + Source text (Plural) + Izvorno besedilo (množina) + + + This area shows the plural form of the source text. + To področje prikazuje množinsko obliko izvornega besedila. + + + Developer comments + Komentarji razvijalcev + + + This area shows a comment that may guide you, and the context in which the text occurs. + To področje prikazuje komentar, ki vas lahko vodi, in kontekst v katerem se besedilo pojavi. + + + Here you can enter comments for your own use. They have no effect on the translated applications. + Sem lahko vnesete komentarje za lastne potrebe. Na prevedene programe ne vplivajo. + + + %1 translation (%2) + %1 prevod (%2) + + + This is where you can enter or modify the translation of the above source text. + Sem lahko vnesete ali pa tu spremenite prevod gornjega izvornega besedila. + + + %1 translation + %1 prevod + + + %1 translator comments + %1 prevajalski komentarji + + + '%1' +Line: %2 + »%1« +Vrstica: %2 + + + + MessageModel + + Completion status for %1 + Stanje za %1 + + + <file header> + <glava datoteke> + + + <context comment> + <komentar konteksta> + + + <unnamed context> + <neimenovan kontekst> + + + + PhraseBookBox + + Edit Phrase Book + Uredi knjigo izrazov + + + This window allows you to add, modify, or delete entries in a phrase book. + To okno omogoča dodajanje, spreminjanje in brisanje vnosov v knjigi izrazov. + + + &Translation: + &Prevod: + + + This is the phrase in the target language corresponding to the source phrase. + To je izraz v ciljnem jeziku, ki ustreza izvornemu izrazu. + + + S&ource phrase: + &Izvorni izraz: + + + This is a definition for the source phrase. + To je definicija za izvorni izraz. + + + This is the phrase in the source language. + To je izraz v izvornem jeziku. + + + &Definition: + &Definicija: + + + Click here to add the phrase to the phrase book. + Kliknite, da dodate izraz v knjigo izrazov. + + + &New Entry + &Nov vnos + + + Click here to remove the entry from the phrase book. + Kliknite, da odstranite vnos iz knjige izrazov. + + + &Remove Entry + &Odstrani vnos + + + Settin&gs... + &Nastavitve ... + + + Click here to save the changes made. + Kliknite za shranitev opravljenih sprememb. + + + &Save + &Shrani + + + Click here to close this window. + Kliknite, da zaprete to okno. + + + Close + Zapri + + + (New Entry) + (Nov vnos) + + + %1[*] - Qt Linguist + %1[*] – Qt Linguist + + + Qt Linguist + Qt Linguist + + + Cannot save phrase book '%1'. + Ni moč shraniti knjige izrazov »%1«. + + + + PhraseModel + + Source phrase + Izvorni izraz + + + Translation + Prevod + + + Definition + Definicija + + + + PhraseView + + Insert + Vstavi + + + Edit + Uredi + + + Guess (%1) + Ugibanje (%1) + + + Guess + Ugibanje + + + + QObject + + Translation files (%1);; + Prevajalske datoteke (%1);; + + + All files (*) + Vse datoteke (*) + + + Qt Linguist + Qt Linguist + + + GNU Gettext localization files + Prevajalske datoteke GNU Gettext + + + GNU Gettext localization template files + Predloge prevajalskih datotek GNU Gettext + + + Compiled Qt translations + Prevedeni prevodi za Qt + + + Qt Linguist 'Phrase Book' + Knjiga izrazov za Qt Linguist + + + Qt translation sources (format 1.1) + Prevajalski viri za Qt (različica 1.1) + + + Qt translation sources (format 2.0) + Prevajalski viri za Qt (različica 2.0) + + + Qt translation sources (latest format) + Prevajalski viri za Qt (najnovejša različica) + + + XLIFF localization files + Prevajalske datoteke XLIFF + + + + SourceCodeView + + <i>Source code not available</i> + <i>Izvorna koda ni na voljo</i> + + + <i>File %1 not available</i> + <i>Datoteka %1 ni na voljo</i> + + + <i>File %1 not readable</i> + <i>Datoteka %1 ni berljiva</i> + + + + Statistics + + Statistics + Statistika + + + Close + Zapri + + + Translation + Prevod + + + Source + Vir + + + 0 + 0 + + + Words: + Besede: + + + Characters: + Znaki: + + + Characters (with spaces): + Znaki (s presledki): + + + + TranslateDialog + + This window allows you to search for some text in the translation source file. + To okno omogoča iskanje besedila v izvorni datoteki s prevodom. + + + Type in the text to search for. + Vnesite iskano besedilo. + + + Find &source text: + Najdi &izvorno besedilo: + + + &Translate to: + &Prevedi v: + + + Search options + Možnosti iskanja + + + Texts such as 'TeX' and 'tex' are considered as different when checked. + Ko je omogočeno, se razlikuje med besedili kot sta »KDE« in »kde«. + + + Match &case + Ujemanje &velikosti črk + + + Mark new translation as &finished + Nove prevode označi kot &zaključene + + + Click here to find the next occurrence of the text you typed in. + Kliknite, da poiščete naslednjo pojavitev vnešenega besedila. + + + Find Next + Najdi naslednje + + + Translate + Prevedi + + + Translate All + Prevedi vse + + + Click here to close this window. + Kliknite, da zaprete to okno. + + + Cancel + Prekliči + + + + TranslationSettingsDialog + + Source language + Izvorni jezik + + + Language + Jezik + + + Country/Region + Država/regija: + + + Target language + Ciljni jezik + + + Settings for '%1' - Qt Linguist + Nastavitve za »%1« – Qt Linguist + + + Any Country + Katerakoli država + + + diff --git a/translations/qt_help_sl.ts b/translations/qt_help_sl.ts new file mode 100644 index 0000000..7d76e58 --- /dev/null +++ b/translations/qt_help_sl.ts @@ -0,0 +1,329 @@ + + + + 2010-08-28 13:32+0200 + MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator + Lokalize 1.1 + Slovenian <lugos-slo@lugos.si> + + # Jure Repinc <jlp@holodeck1.com>, 2010. + Jure Repinc <jlp@holodeck1.com> + + QCLuceneResultWidget + + Search Results + Rezultati iskanja + + + Note: + Opomba: + + + The search results may not be complete since the documentation is still being indexed! + Rezultati iskanja morda niso popolni, saj se dokumentacijo še vedno indeksira. + + + Your search did not match any documents. + Vašemu iskanju ne ustreza noben dokument. + + + (The reason for this might be that the documentation is still being indexed.) + (Razlog je morda to, da se dokumentacijo še vedno indeksira.) + + + + QHelp + + Untitled + Brez naslova + + + + QHelpCollectionHandler + + The collection file '%1' is not set up yet! + Datoteka zbirke »%1« še ni nastavljena. + + + Cannot load sqlite database driver! + Ni moč naložiti gonilnika za podatkovno zbirko SQLite. + + + Cannot open collection file: %1 + Datoteke zbirke ni moč odpreti: %1 + + + Cannot create tables in file %1! + V datoteki %1 ni moč ustvariti tabel. + + + The collection file '%1' already exists! + Datoteka zbirke »%1« že obstaja. + + + Cannot create directory: %1 + Ni moč ustvariti mape: %1 + + + Cannot copy collection file: %1 + Ni moč skopirati datoteke zbirke: %1 + + + Unknown filter '%1'! + Neznan filter »%1«. + + + Cannot register filter %1! + Filtra %1 ni moč registrirati. + + + Cannot open documentation file %1! + Ni moč odpreti datoteke z dokumentacijo %1. + + + Invalid documentation file '%1'! + Neveljavna datoteka z dokumentacijo »%1«. + + + The namespace %1 was not registered! + Imenski prostor %1 ni bil registriran. + + + Namespace %1 already exists! + Imenski prostor %1 že obstaja. + + + Cannot register namespace '%1'! + Imenskega prostora »%1« ni moč registrirati. + + + Cannot open database '%1' to optimize! + Podatkovne zbirke »%1« ni moč odpreti za optimizacijo. + + + + QHelpDBReader + + Cannot open database '%1' '%2': %3 + The placeholders are: %1 - The name of the database which cannot be opened %2 - The unique id for the connection %3 - The actual error string + + Podatkovne zbirke »%1« »%2« ni moč odpreti: %3 + + + + QHelpEngineCore + + Cannot open documentation file %1: %2! + Ni moč odpreti datoteke z dokumentacijo %1: %2. + + + The specified namespace does not exist! + Navedeni imenski prostor ne obstaja. + + + + QHelpGenerator + + Invalid help data! + Neveljavni podatki s pomočjo. + + + No output file name specified! + Navedenega ni nobenega imena izhodne datoteke. + + + The file %1 cannot be overwritten! + Datoteke %1 ni moč nadomestiti. + + + Building up file structure... + Grajenje datotečne strukture ... + + + Cannot open data base file %1! + Datoteke podatkovne zbirke %1 ni moč odpreti. + + + Cannot register namespace %1! + Imenskega prostora %1 ni moč registrirati. + + + Insert custom filters... + Vstavi filtre po meri ... + + + Insert help data for filter section (%1 of %2)... + Vstavljanje podatkov s pomočjo za filtrirni razdelek (%1 od %2) ... + + + Documentation successfully generated. + Dokumentacija je bila uspešno ustvarjena. + + + Some tables already exist! + Nekatere tabele že obstajajo. + + + Cannot create tables! + Tabel ni moč ustvariti. + + + Cannot register virtual folder! + Navidezne mape ni moč registrirati. + + + Insert files... + Vstavi datoteke ... + + + The referenced file %1 must be inside or within a subdirectory of (%2). Skipping it. + Sklicana datoteka %1 se mora nahajti v mapi (%1) ali njeni podmapi. Preskakujem jo. + + + The file %1 does not exist! Skipping it. + Datoteka %1 ne obstaja. Preskakujem jo. + + + Cannot open file %1! Skipping it. + Datoteke %1 ni moč odpreti. Preskakujem jo. + + + The filter %1 is already registered! + Filter %1 je že registriran. + + + Cannot register filter %1! + Filtra %1 ni moč registrirati. + + + Insert indices... + Vstavi kazala ... + + + Insert contents... + Vstavi vsebino ... + + + Cannot insert contents! + Vsebine ni moč vstaviti. + + + Cannot register contents! + Vsebine ni moč registrirati. + + + File '%1' does not exist. + Filter »%1« ne obstaja. + + + File '%1' cannot be opened. + Filtra »%1« ni moč odpreti. + + + File '%1' contains an invalid link to file '%2' + Datoteka »%1« vsebuje neveljavno povezavo na datoteko »%2« + + + Invalid links in HTML files. + Neveljavne povezave v datotekah HTML. + + + + QHelpProject + + Unknown token. + Neznan žeton. + + + Unknown token. Expected "QtHelpProject"! + Neznan žeton. Pričakovan je bil »QtHelpProject«. + + + Error in line %1: %2 + Napaka v vrstici %1: %2 + + + Virtual folder has invalid syntax. + Navidezna mapa ima neveljavno skladnjo. + + + Namespace has invalid syntax. + Imenski prostor ima neveljavno skladnjo. + + + Missing namespace in QtHelpProject. + Manjkajoč imenski prostor v QtHelpProject. + + + Missing virtual folder in QtHelpProject + Manjkajoča navidezna mapa v QtHelpProject. + + + Missing attribute in keyword at line %1. + Manjkajoča lastnost v ključni besedi v vrstici %1. + + + The input file %1 could not be opened! + Vhodne datoteke %1 ni bilo moč odpreti. + + + + QHelpSearchQueryWidget + + Search for: + Išči: + + + Previous search + Predhodno iskanje + + + Next search + Naslednje iskanje + + + Search + Išči + + + Advanced search + Napredno iskanje + + + words <B>similar</B> to: + besede <B>podobne</B>: + + + <B>without</B> the words: + <B>brez</B> besed: + + + with <B>exact phrase</B>: + s <B>točnim izrazom</B>: + + + with <B>all</B> of the words: + z <B>vsemi</B> besedami: + + + with <B>at least one</B> of the words: + z <B>vsaj eno</B> izmed besed: + + + + QHelpSearchResultWidget + + %1 - %2 of %n Hits + + %1 – %2 od %n zadetka + %1 – %2 od %n zadetkov + %1 – %2 od %n zadetkov + %1 – %2 od %n zadetkov + + + + 0 - 0 of 0 Hits + 0 - 0 od 0 zadetkov + + + diff --git a/translations/qt_sl.ts b/translations/qt_sl.ts index e0cee0f..6bc552b 100644 --- a/translations/qt_sl.ts +++ b/translations/qt_sl.ts @@ -1,7 +1,7 @@ - 2010-08-05 12:59+0200 + 2010-08-29 00:26+0200 MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator Lokalize 1.1 Slovenian <lugos-slo@lugos.si> @@ -1328,194 +1328,194 @@ v QDeclarativeAnchors Possible anchor loop detected on fill. - Ob zapolnjevanju je bila zaznana možna zanka sidra. + Ob zapolnjevanju je bila zaznana možna zanka sidra. Possible anchor loop detected on centerIn. - Ob usrediščanju je bila zaznana možna zanka sidra. + Ob usrediščanju je bila zaznana možna zanka sidra. Cannot anchor to an item that isn't a parent or sibling. - Na objekt, ki ni nadrejen ali enakovreden, se ni moč zasidrati. + Na objekt, ki ni nadrejen ali enakovreden, se ni moč zasidrati. Possible anchor loop detected on vertical anchor. - Ob navpičnem sidru je bila zaznana možna zanka sidra. + Ob navpičnem sidru je bila zaznana možna zanka sidra. Possible anchor loop detected on horizontal anchor. - Ob vodoravnem sidru je bila zaznana možna zanka sidra. + Ob vodoravnem sidru je bila zaznana možna zanka sidra. Cannot specify left, right, and hcenter anchors. - Levih, desnih in vodoravno sredinskih sider ni moč določiti. + Levih, desnih in vodoravno sredinskih sider ni moč določiti. Cannot anchor to a null item. - Na ničelni objekt se ni moč zasidrati. + Na neobstoječ objekt se ni moč zasidrati. Cannot anchor a horizontal edge to a vertical edge. - Vodoravnega roba ni moč zasidrati na navpični rob. + Vodoravnega roba ni moč zasidrati na navpični rob. Cannot anchor item to self. - Objekta ni moč zasidrati samega nase. + Objekta ni moč zasidrati samega nase. Cannot specify top, bottom, and vcenter anchors. - Vrhnjih, spodnjih in navpično sredinskih sider ni moč določiti. + Vrhnjih, spodnjih in navpično sredinskih sider ni moč določiti. Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors. - Sidra na osnovnici ni moč uporabiti skupaj z vrhnjimi, spodnjimi ali navpično sredinskimi sidri. + Sidra na osnovnici ni moč uporabiti skupaj z vrhnjimi, spodnjimi ali navpično sredinskimi sidri. Cannot anchor a vertical edge to a horizontal edge. - Navpičnega roba ni moč zasidrati na vodoravni rob. + Navpičnega roba ni moč zasidrati na vodoravni rob. QDeclarativeAnimatedImage Qt was built without support for QMovie - Qt je bil zgrajen brez podpore za QMovie + Qt je bil zgrajen brez podpore za QMovie QDeclarativeBehavior Cannot change the animation assigned to a Behavior. - Animacije, ki je prirejena obnašanju, ni moč spremeniti. + Animacije, ki je prirejena obnašanju, ni moč spremeniti. QDeclarativeBinding Binding loop detected for property "%1" - Za lastnost »%1« je bila zaznana zanka vezave + Za lastnost »%1« je bila zaznana zanka vezave QDeclarativeCompiledBindings Binding loop detected for property "%1" - Za lastnost »%1« je bila zaznana zanka vezave + Za lastnost »%1« je bila zaznana zanka vezave QDeclarativeCompiler Invalid property assignment: "%1" is a read-only property - Neveljavna prireditev lastnosti: »%1« je lastnost, ki je samo za branje + Neveljavna prireditev lastnosti: »%1« je lastnost, ki je samo za branje Invalid property assignment: unknown enumeration - Neveljavna prireditev lastnosti: neznano oštevilčenje + Neveljavna prireditev lastnosti: neznano oštevilčenje Invalid property assignment: string expected - Neveljavna prireditev lastnosti: pričakovan je niz + Neveljavna prireditev lastnosti: pričakovan je niz Invalid property assignment: url expected - Neveljavna prireditev lastnosti: pričakovan je URL + Neveljavna prireditev lastnosti: pričakovan je URL Invalid property assignment: unsigned int expected - Neveljavna prireditev lastnosti: pričakovano je nepredznačeno celo število + Neveljavna prireditev lastnosti: pričakovano je nepredznačeno celo število Invalid property assignment: int expected - Neveljavna prireditev lastnosti: pričakovano je celo število + Neveljavna prireditev lastnosti: pričakovano je celo število Invalid property assignment: number expected - Neveljavna prireditev lastnosti: pričakovano je število + Neveljavna prireditev lastnosti: pričakovano je število Invalid property assignment: color expected - Neveljavna prireditev lastnosti: pričakovana je barva + Neveljavna prireditev lastnosti: pričakovana je barva Invalid property assignment: date expected - Neveljavna prireditev lastnosti: pričakovan je datum + Neveljavna prireditev lastnosti: pričakovan je datum Invalid property assignment: time expected - Neveljavna prireditev lastnosti: pričakovan je čas + Neveljavna prireditev lastnosti: pričakovan je čas Invalid property assignment: datetime expected - Neveljavna prireditev lastnosti: pričakovana sta datum in čas + Neveljavna prireditev lastnosti: pričakovana sta datum in čas Invalid property assignment: point expected - Neveljavna prireditev lastnosti: pričakovana je točka + Neveljavna prireditev lastnosti: pričakovana je točka Invalid property assignment: size expected - Neveljavna prireditev lastnosti: pričakovana je velikost + Neveljavna prireditev lastnosti: pričakovana je velikost Invalid property assignment: rect expected - Neveljavna prireditev lastnosti: pričakovan je pravokotnik + Neveljavna prireditev lastnosti: pričakovan je pravokotnik Invalid property assignment: boolean expected - Neveljavna prireditev lastnosti: pričakovana je logična vrednost + Neveljavna prireditev lastnosti: pričakovana je logična vrednost Invalid property assignment: 3D vector expected - Neveljavna prireditev lastnosti: pričakovan je 3D vektor + Neveljavna prireditev lastnosti: pričakovan je 3D vektor Invalid property assignment: unsupported type "%1" - Neveljavna prireditev lastnosti: nepodprta vrsta »%1« + Neveljavna prireditev lastnosti: nepodprta vrsta »%1« Element is not creatable. - Elementa ni moč ustvariti. + Elementa ni moč ustvariti. Component elements may not contain properties other than id - Elementi komponent ne smejo vsebovati drugih lastnosti kot ID + Elementi komponent ne smejo vsebovati drugih lastnosti kot ID Invalid component id specification - Neveljavno določen ID komponente + Neveljavno določen ID komponente id is not unique - ID ni edinstven + ID ni edinstven Invalid component body specification - Neveljavno določeno telo komponente + Neveljavno določeno telo komponente Component objects cannot declare new properties. - Objekti komponent ne morejo deklarirati novih lastnosti. + Objekti komponent ne morejo deklarirati novih lastnosti. Component objects cannot declare new signals. - Objekti komponent ne morejo deklarirati novih signalov. + Objekti komponent ne morejo deklarirati novih signalov. Component objects cannot declare new functions. - Objekti komponent ne morejo deklarirati novih funkcij. + Objekti komponent ne morejo deklarirati novih funkcij. Cannot create empty component specification - Prazne specifikacije komponente ni moč ustvariti + Prazne specifikacije komponente ni moč ustvariti Incorrectly specified signal assignment - Napačno določena prireditev signalu + Napačno določena prireditev signalu Cannot assign a value to a signal (expecting a script to be run) - Signalu ni moč prirediti vrednosti (pričakovan je skript, ki bo zagnan) + Signalu ni moč prirediti vrednosti (pričakovan je skript, ki bo zagnan) Empty signal assignment @@ -1527,247 +1527,247 @@ v Attached properties cannot be used here - Pripete lastnosti tu ne morejo biti uporabljene + Pripete lastnosti tu ne morejo biti uporabljene Non-existent attached object - Neobstoječ pripet objekt + Neobstoječ pripet objekt Invalid attached object assignment - Neveljavna prireditev pripetega objekta + Neveljavna prireditev pripetega objekta Cannot assign to non-existent default property - Neobstoječi privzeti lastnosti ni moč prirediti + Neobstoječi privzeti lastnosti ni moč prirediti Cannot assign to non-existent property "%1" - Neobstoječi lastnosti »%1« ni moč prirediti + Neobstoječi lastnosti »%1« ni moč prirediti Invalid use of namespace - Napačna raba imenskega prostora + Napačna raba imenskega prostora Not an attached property name - Ni ime pripete lastnosti + Ni ime pripete lastnosti Invalid use of id property - Napačna raba lastnosti ID + Napačna raba lastnosti ID Property has already been assigned a value - Lastnosti je že bila prirejena vrednost + Lastnosti je že bila prirejena vrednost Invalid grouped property access - Neveljaven dostop do skupinske lastnosti + Neveljaven dostop do skupinske lastnosti Cannot assign a value directly to a grouped property - Skupinski lastnosti ni moč neposredno prirediti vrednosti + Skupinski lastnosti ni moč neposredno prirediti vrednosti Invalid property use - Neveljavna raba lastnosti + Neveljavna raba lastnosti Property assignment expected - Pričakovana je prireditev lastnosti + Pričakovana je prireditev lastnosti Single property assignment expected - Pričakovana je enojna prireditev lastnosti + Pričakovana je enojna prireditev lastnosti Unexpected object assignment - Nepričakovana prireditev objekta + Nepričakovana prireditev objekta Cannot assign object to list - Objekta ni moč prirediti seznamu + Objekta ni moč prirediti seznamu Can only assign one binding to lists - Seznamom je moč prirediti le eno vezavo + Seznamom je moč prirediti le eno vezavo Cannot assign primitives to lists - Seznamom ni moč prirediti osnovnih tipov + Seznamom ni moč prirediti osnovnih tipov Cannot assign multiple values to a script property - + Lastnosti »script« ni moč prirediti več vrednosti Invalid property assignment: script expected - Neveljavna prireditev lastnosti: pričakovan je skript + Neveljavna prireditev lastnosti: pričakovan je skript Cannot assign object to property - Objekta ni moč prirediti lastnosti + Objekta ni moč prirediti lastnosti "%1" cannot operate on "%2" - »%1« ne more delovati na »%2« + »%1« ne more delovati na »%2« Duplicate default property - Podvojena privzeta lastnost + Podvojena privzeta lastnost Duplicate property name - Podvojeno ime lastnosti + Podvojeno ime lastnosti Property names cannot begin with an upper case letter - Imena lastnosti se ne smejo začeti z veliko črko + Imena lastnosti se ne smejo začeti z veliko črko Illegal property name - Neveljavno ime lastnosti + Neveljavno ime lastnosti Duplicate signal name - Podvojeno ime signala + Podvojeno ime signala Signal names cannot begin with an upper case letter - Imena signalov se ne smejo začeti z veliko črko + Imena signalov se ne smejo začeti z veliko črko Illegal signal name - Neveljavno ime signala + Neveljavno ime signala Duplicate method name - Podvojeno ime metode + Podvojeno ime metode Method names cannot begin with an upper case letter - Imena metod se ne smejo začeti z veliko črko + Imena metod se ne smejo začeti z veliko črko Illegal method name - Neveljavno ime metode + Neveljavno ime metode Property value set multiple times - Vrednost lastnosti je bila nastavljena večkrat + Vrednost lastnosti je bila nastavljena večkrat Invalid property nesting - Neveljavno gnezdenje lastnosti + Neveljavno gnezdenje lastnosti Cannot override FINAL property - Lastnosti FINAL ni moč povoziti + Lastnosti FINAL ni moč povoziti Invalid property type - Neveljavna vrsta lastnosti + Neveljavna vrsta lastnosti Invalid empty ID - Neveljaven prazen ID + Neveljaven prazen ID IDs cannot start with an uppercase letter - ID-ji se ne smejo začeti z veliko črko + ID-ji se ne smejo začeti z veliko črko IDs must start with a letter or underscore - ID-ji se morajo začeti s črko ali podčrtajem + ID-ji se morajo začeti s črko ali podčrtajem IDs must contain only letters, numbers, and underscores - ID-ji lahko vsebujejo le črke, števke in podčrtaje + ID-ji lahko vsebujejo le črke, števke in podčrtaje ID illegally masks global JavaScript property - ID neveljavno zakriva globalno lastnost JavaScripta + ID neveljavno zakriva globalno lastnost JavaScripta No property alias location - Brez lokacije aliasa lastnosti + Brez lokacije aliasa lastnosti Invalid alias location - Neveljavna lokacija aliasa + Neveljavna lokacija aliasa Invalid alias reference. An alias reference must be specified as <id> or <id>.<property> - Neveljavna referenca aliasa. Referenca aliasa mora biti določena kot <id> ali <id>.<lastnost> + Neveljavna referenca aliasa. Referenca aliasa mora biti določena kot <id> ali <id>.<lastnost> Invalid alias reference. Unable to find id "%1" - Neveljavna referenca aliasa. ID-ja »%1« ni moč najti + Neveljavna referenca aliasa. ID-ja »%1« ni moč najti QDeclarativeComponent Invalid empty URL - Neveljaven prazen URL + Neveljaven prazen URL QDeclarativeCompositeTypeManager Resource %1 unavailable - Vir %1 ni na voljo + Vir %1 ni na voljo Namespace %1 cannot be used as a type - Imenskega prostora %1 ni moč uporabiti kot vrste + Imenskega prostora %1 ni moč uporabiti kot vrste %1 %2 - %1 % {1 %2?} + %1 %2 Type %1 unavailable - Vrsta %1 ni na voljo + Vrsta %1 ni na voljo QDeclarativeConnections Cannot assign to non-existent property "%1" - Neobstoječi lastnosti »%1« ni moč prirediti + Neobstoječi lastnosti »%1« ni moč prirediti Connections: nested objects not allowed - Povezave: gnezdeni objekti niso dovoljeni + Povezave: gnezdeni objekti niso dovoljeni Connections: syntax error - Povezave: napaka v skladnji + Povezave: napaka v skladnji Connections: script expected - Povezave: pričakovan je skript + Povezave: pričakovan je skript QDeclarativeEngine executeSql called outside transaction() - executeSql je bil klican izven transaction() + executeSql je bil klican izven transaction() Read-only Transaction - Transakcija samo za branje + Transakcija samo za branje Version mismatch: expected %1, found %2 - Neujemanje različic: pričakovana %1, najdena %2 + Neujemanje različic: pričakovana %1, najdena %2 SQL transaction failed - Transakcija SQL ni uspela + Transakcija SQL ni uspela transaction: missing callback @@ -1775,408 +1775,408 @@ v SQL: database version mismatch - SQL: neujemanje različice podatkovne zbirke + SQL: neujemanje različice podatkovne zbirke QDeclarativeFlipable front is a write-once property - front je lastnost, ki se jo lahko zapiše samo enkrat + front je lastnost, ki se jo lahko zapiše samo enkrat back is a write-once property - back je lastnost, ki se jo lahko zapiše samo enkrat + back je lastnost, ki se jo lahko zapiše samo enkrat QDeclarativeImportDatabase module "%1" definition "%2" not readable - definicije »%2« modula »%1« ni moč brati + definicije »%2« modula »%1« ni moč brati plugin cannot be loaded for module "%1": %2 - vstavka za modul »%1« ni moč naložiti: %2 + vstavka za modul »%1« ni moč naložiti: %2 module "%1" plugin "%2" not found - vstavek »%2« modula »%1« ni bil najden + vstavek »%2« modula »%1« ni bil najden module "%1" version %2.%3 is not installed - modul »%1« različice %2.%3 ni nameščen + modul »%1« različice %2.%3 ni nameščen module "%1" is not installed - modul »%1« ni nameščen + modul »%1« ni nameščen "%1": no such directory - »%1«: mapa ne obstaja + »%1«: mapa ne obstaja import "%1" has no qmldir and no namespace - + uvoz »%1« nima niti qmldir-a niti imenskega prostora - %1 is not a namespace - – %1 ni imenski prostor + – %1 ni imenski prostor - nested namespaces not allowed - – gnezdeni imenski prostori niso dovoljeni + – gnezdeni imenski prostori niso dovoljeni local directory - krajevna mapa + krajevna mapa is ambiguous. Found in %1 and in %2 - je dvoumno. Najdeno v %1 in %2 + je dvoumno. Najdeno v %1 in %2 is ambiguous. Found in %1 in version %2.%3 and %4.%5 - je dvoumno. Najdeno v %1 v različicah %2.%3 in %4.%5 + je dvoumno. Najdeno v %1 v različicah %2.%3 in %4.%5 is instantiated recursively - je instanciran rekurzivno + je instanciran rekurzivno is not a type - ni vrsta + ni vrsta QDeclarativeKeyNavigationAttached KeyNavigation is only available via attached properties - KeyNavigation je na voljo samo s pripetimi lastnostmi + KeyNavigation je na voljo samo s pripetimi lastnostmi QDeclarativeKeysAttached Keys is only available via attached properties - Keys je na voljo samo s pripetimi lastnostmi + Keys je na voljo samo s pripetimi lastnostmi QDeclarativeListModel remove: index %1 out of range - remove: indeks %1 je izven obsega + remove: indeks %1 je izven obsega insert: value is not an object - insert: vrednost ni objekt + insert: vrednost ni objekt insert: index %1 out of range - insert: indeks %1 je izven obsega + insert: indeks %1 je izven obsega move: out of range - move: izven obsega + move: izven obsega append: value is not an object - append: vrednost ni objekt + append: vrednost ni objekt set: value is not an object - set: vrednost ni objekt + set: vrednost ni objekt set: index %1 out of range - set: indeks %1 je izven obsega + set: indeks %1 je izven obsega ListElement: cannot contain nested elements - + ListElement: ni moč vsebovati gnezdenih elementov ListElement: cannot use reserved "id" property - ListElement: ne more uporabiti rezervirane lastnosti »id« + ListElement: ne more uporabiti rezervirane lastnosti »id« ListElement: cannot use script for property value - ListElement: ne more uporabiti skripta za vrednost lastnosti + ListElement: ne more uporabiti skripta za vrednost lastnosti ListModel: undefined property '%1' - ListModel: nedoločena lastnost »%1« + ListModel: nedoločena lastnost »%1« QDeclarativeLoader Loader does not support loading non-visual elements. - Loader ne podpira nalaganja elementov, ki niso vidni. + Loader ne podpira nalaganja elementov, ki niso vidni. QDeclarativeParentAnimation Unable to preserve appearance under complex transform - + Pod kompleksnim preoblikovanjem ni moč obdržati videza Unable to preserve appearance under non-uniform scale - + Pod ne-enakovrednim povečevanjem ni moč obdržati videza Unable to preserve appearance under scale of 0 - + Pod povečavo 0 ni moč obdržati videza QDeclarativeParentChange Unable to preserve appearance under complex transform - + Pod kompleksnim preoblikovanjem ni moč obdržati videza Unable to preserve appearance under non-uniform scale - + Pod ne-enakovrednim povečevanjem ni moč obdržati videza Unable to preserve appearance under scale of 0 - + Pod povečavo 0 ni moč obdržati videza QDeclarativeParser Illegal unicode escape sequence - Neveljavno ubežno zaporedje Unicode + Neveljavno ubežno zaporedje Unicode Illegal character - Neveljaven znak + Neveljaven znak Unclosed string at end of line - Nezaprt niz na koncu vrstice + Nezaprt niz na koncu vrstice Illegal escape squence - Neveljavno ubežno zaporedje + Neveljavno ubežno zaporedje Unclosed comment at end of file - Nezaprt komentar na koncu datoteke + Nezaprt komentar na koncu datoteke Illegal syntax for exponential number - Neveljavna skladnja za eksponentno število + Neveljavna skladnja za eksponentno število Identifier cannot start with numeric literal - + Identifikator se ne sme začeti s številskim literalom Unterminated regular expression literal - + Nezaključen literal regularnega izraza Invalid regular expression flag '%0' - Neveljavna zastavica »%0« regularnega izraza + Neveljavna zastavica »%0« regularnega izraza Unterminated regular expression backslash sequence - + Nezaključeno zaporedij poševnic nazaj v regularnem izrazu Unterminated regular expression class - + Nezaključen razred regularnega izraza Syntax error - Skladenjska napaka + Skladenjska napaka Unexpected token `%1' - Nepričakovan žeton »%1« + Nepričakovan žeton »%1« Expected token `%1' - Pričakovan žeton »%1« + Pričakovan žeton »%1« Property value set multiple times - Vrednost lastnosti je bila nastavljena večkrat + Vrednost lastnosti je bila nastavljena večkrat Expected type name - + Pričakovano ime vrste Invalid import qualifier ID - + Neveljaven ID kvalifikatorja uvoza Reserved name "Qt" cannot be used as an qualifier - + Rezerviranega imena »Qt« ni moč uporabiti kot kvalifikatorja Script import qualifiers must be unique. - + Kvalifikatorji uvozov skriptov morajo biti edinstveni. Script import requires a qualifier - + Uvozi skriptov potrebujejo kvalifikator Library import requires a version - + Uvozi knjižnic potrebujejo različico Expected parameter type - + Pričakovana vrsta parametra Invalid property type modifier - + Neveljaven modifikator vrste lastnosti Unexpected property type modifier - + Nepričakovan modifikator vrste lastnosti Expected property type - + Pričakovana vrsta lastnosti Readonly not yet supported - + Tisti, ki so samo za branje, še niso podprti JavaScript declaration outside Script element - + Deklaracija JavaScripta izven elementa Script QDeclarativePauseAnimation Cannot set a duration of < 0 - Trajanja, ki je krajše od 0, ni moč nastaviti + Trajanja, ki je krajše od 0, ni moč nastaviti QDeclarativePixmap Error decoding: %1: %2 - + Napaka dekodiranja: %1: %2 Failed to get image from provider: %1 - + Od ponudnika ni bilo moč dobiti slike: %1 Cannot open: %1 - Ni moč odpreti %1: %2 + Ni moč odpreti %1: QDeclarativePropertyAnimation Cannot set a duration of < 0 - Trajanja, ki je krajše od 0, ni moč nastaviti + Trajanja, ki je krajše od 0, ni moč nastaviti QDeclarativePropertyChanges PropertyChanges does not support creating state-specific objects. - + PropertyChanges ne podpira ustvarjanja objektov sprecifičnih za stanje. Cannot assign to non-existent property "%1" - Neobstoječi lastnosti »%1« ni moč prirediti + Neobstoječi lastnosti »%1« ni moč prirediti Cannot assign to read-only property "%1" - + Ni moč prirediti lastnosti »%1«, ki je samo za branje QDeclarativeTextInput Could not load cursor delegate - + Ni bilo moč naložiti delegata za kazalec Could not instantiate cursor delegate - + Ni bilo moč instancirati delegata za kazalec QDeclarativeVME Unable to create object of type %1 - + Ni moč ustvariti objekta vrste %1 Cannot assign value %1 to property %2 - + Lastnosti %2 ni moč prirediti vrednosti %1 Cannot assign object type %1 with no default method - + Ni moč prirediti objekta vrste %1 brez privzete metode Cannot connect mismatched signal/slot %1 %vs. %2 - + Ni moč povezati neujemajočih signalov in rež: %1 in %2 Cannot assign an object to signal property %1 - + Objekta ni moč prirediti lastnosi signala %1 Cannot assign object to list - Objekta ni moč prirediti seznamu + Objekta ni moč prirediti seznamu Cannot assign object to interface property - + Objekta ni moč prirediti lastnosti vmesnika Unable to create attached object - + Ni moč ustvariti pripetega objekta Cannot set properties on %1 as it is null - + Ni moč nastaviti lastnosti za %1, saj ne obstaja QDeclarativeVisualDataModel Delegate component must be Item type. - + Komponenta delegata mora biti vrste Item. QDeclarativeXmlListModel Qt was built without support for xmlpatterns - + Qt je bil zgrajen brez podpore za xmlpatterns QDeclarativeXmlListModelRole An XmlRole query must not start with '/' - + Poizvedba XmlRole se ne sme začeti z »/« QDeclarativeXmlRoleList An XmlListModel query must start with '/' or "//" - + Poizvedba XmlListModel se mora začeti z »/« ali »//« @@ -2593,27 +2593,27 @@ Ali jo kljub temu želite izbrisati? Go back - Vrni se nazaj + Vrni se nazaj Go forward - Napreduj naprej + Napreduj naprej Go to the parent directory - + Pojdi v matično mapo Create a New Folder - + Ustvari novo mapo Change to list view mode - + Preklopi v način prikaza seznama Change to detail view mode - + Preklopi v način prikaza podrobnosti @@ -2678,7 +2678,7 @@ Ali jo kljub temu želite izbrisati? %1 byte(s) - + %1 B @@ -2697,7 +2697,7 @@ Ali jo kljub temu želite izbrisati? Black - Črna + Demi @@ -2849,7 +2849,7 @@ Ali jo kljub temu želite izbrisati? N'Ko - + N'Ko @@ -3004,7 +3004,7 @@ Ali jo kljub temu želite izbrisati? No host name given - Podano ni bilo nobeno ime gostitelja + Podano ni bilo nobeno ime gostitelja @@ -3665,7 +3665,7 @@ Ali jo kljub temu želite izbrisati? <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> - <p>Qt je skupek gradnikov C++ za razvoj programov, ki tečejo na več platformah.</p><p>Qt omogoča isto kodo prenašati med platformami Linux, Mac&nbsp;OS&nbsp;X, Windows in vsemi večjimi variantami UNIX-a. Qt je na voljo tudi za vgrajene naprave in sicer kot Qt for Embedded Linux in Qt for Windows CE.</p><p>Qt je na voljo pod tremi možnimi licenčnimi pogoji, ki ustrezajo različnim željam uporabnikov.</p><p>Qt pod licenco GNU General Public License različice 3.0 (<a href="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3.0</a>) je primeren za razvoj programov Qt, ki so povsem <a href="http://www.gnu.org/philosophy/free-sw.html">prosti in odprto-kodni</a>. S to licenco se uporabnikom programa zagotovijo vse pravice in svoboščine, kot jih je imel izdelovalec programa.</p><p>Qt pod licenco GNU Lesser General Public License različice 2.1 (<a href="http://www.gnu.org/licenses/lgpl-2.1.html">LGPLv2.1</a>) omogoča tudi razvoj programov, ki uporabnikom ne zagotavljajo vseh pravic in svoboščin, kot jih je imel izdelovalec. Omogoča na primer tudi razvoj zaprto-kodnih programov.</p><p>Qt pod posebno komercialno licenco je namenjen razvoju lastniških in zaprto-kodnih programov, kjer izdelovalec z uporabniki noče deliti nič izvorne kode ter pravic in svoboščin, ali pa ne more ustreči pogojem licenc GPLv3.0 ali LGPLv2.1.</p><p>Za pregled licenčnih možnosti si oglejte spletno stran <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>.</p><p>Avtorske pravice © 2009 Nokia Corporation in/ali podružnice ter zunanji prispevajoči.</p><p>Qt je proizvod podjetja Nokia. Za dodatne podatke si oglejte <a href="http://qt.nokia.com/">qt.nokia.com</a>.</p> + <p>Qt je skupek gradnikov C++ za razvoj programov, ki tečejo na več platformah.</p><p>Qt omogoča isto kodo prenašati med platformami Linux, Mac&nbsp;OS&nbsp;X, Windows in vsemi večjimi variantami UNIX-a. Qt je na voljo tudi za vgrajene naprave in sicer kot Qt for Embedded Linux in Qt for Windows CE.</p><p>Qt je na voljo pod tremi možnimi licenčnimi pogoji, ki ustrezajo različnim željam uporabnikov.</p><p>Qt pod licenco GNU General Public License različice 3.0 (<a href="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3.0</a>) je primeren za razvoj programov Qt, ki so povsem <a href="http://www.gnu.org/philosophy/free-sw.html">prosti in odprto-kodni</a>. S to licenco se uporabnikom programa zagotovijo vse pravice in svoboščine, kot jih je imel izdelovalec programa.</p><p>Qt pod licenco GNU Lesser General Public License različice 2.1 (<a href="http://www.gnu.org/licenses/lgpl-2.1.html">LGPLv2.1</a>) omogoča tudi razvoj programov, ki uporabnikom ne zagotavljajo vseh pravic in svoboščin, kot jih je imel izdelovalec. Omogoča na primer tudi razvoj zaprto-kodnih programov.</p><p>Qt pod posebno komercialno licenco je namenjen razvoju lastniških in zaprto-kodnih programov, kjer izdelovalec z uporabniki noče deliti nič izvorne kode ter pravic in svoboščin, ali pa ne more ustreči pogojem licenc GPLv3.0 ali LGPLv2.1.</p><p>Za pregled licenčnih možnosti si oglejte spletno stran <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>.</p><p>Avtorske pravice © 2009 Nokia Corporation in/ali podružnice ter zunanji prispevajoči.</p><p>Qt je proizvod podjetja Nokia. Za dodatne podatke si oglejte <a href="http://qt.nokia.com/">qt.nokia.com</a>.</p><p>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></p> About Qt @@ -3816,11 +3816,11 @@ Ali jo kljub temu želite izbrisati? QNetworkAccessDataBackend Operation not supported on %1 - Dejanje na %1 ni podprto + Dejanje na %1 ni podprto Invalid URI: %1 - Neveljaven URI: %1 + Neveljaven URI: %1 @@ -3831,11 +3831,11 @@ Ali jo kljub temu želite izbrisati? Socket error on %1: %2 - Napaka vtičnice na %1: %2 + Napaka vtičnice na %1: %2 Remote host closed the connection prematurely on %1 - Oddaljen gostitelj je predčasno prekinil povezavo na %1 + Oddaljen gostitelj je predčasno prekinil povezavo na %1 @@ -3895,7 +3895,7 @@ Ali jo kljub temu želite izbrisati? QNetworkAccessManager Network access is disabled. - + Omrežni dostop je onemogočen. @@ -3910,11 +3910,11 @@ Ali jo kljub temu želite izbrisati? Network session error. - + Napaka omrežne seje. Temporary network failure. - + Začasna omrežna napaka. @@ -3928,42 +3928,42 @@ Ali jo kljub temu želite izbrisati? QNetworkSession Invalid configuration. - + Neveljavna nastavitev. QNetworkSessionPrivateImpl Roaming error - + Napaka potovanja Session aborted by user or system - + Sejo je preklical uporabnik ali pa sistem Unidentified Error - + Neznana napaka Unknown session error. - + Neznana napaka seje. The session was aborted by the user or system. - + Sejo je preklical uporabnik ali pa sistem. The requested operation is not supported by the system. - + Sistem ne podpira zahtevanega dejanja. The specified configuration cannot be used. - + Navedenih nastavitev ni moč uporabiti. Roaming was aborted or is not possible. - + Potovanje je bilo preklicano ali pa ni možno. @@ -4095,15 +4095,15 @@ Ali jo kljub temu želite izbrisati? QObject PulseAudio Sound Server - Zvočni strežnik PulseAudio + Zvočni strežnik PulseAudio "%1" duplicates a previous role name and will be disabled. - + »%1« podvaja obstoječe ime vloge in bo onemogočena. invalid query: "%1" - + neveljavna poizvedba: »%1« @@ -4385,7 +4385,7 @@ Ali jo kljub temu želite izbrisati? Print current page - + Natisni trenutno stran OK @@ -4670,7 +4670,7 @@ Izberite drugo ime datoteke. Close - Zapri + Zapri Export to PDF @@ -4776,7 +4776,7 @@ Izberite drugo ime datoteke. Current Page - + Trenutna stran @@ -5444,7 +5444,7 @@ Izberite drugo ime datoteke. Backtab - + Tabulator nazaj Backspace @@ -5602,13 +5602,13 @@ Izberite drugo ime datoteke. Media Pause Media player pause button - + Prekini večpredstavnost Toggle Media Play/Pause Media player button to toggle between playing and paused - + Preklopi predvajanje/prekinitev večpredstavnosti Favorites @@ -5700,111 +5700,111 @@ Izberite drugo ime datoteke. Monitor Brightness Up - Povečaj svetlost zaslon + Povečaj svetlost zaslona Monitor Brightness Down - Zmanjšaj svetlost zaslona + Zmanjšaj svetlost zaslona Keyboard Light On/Off - Vklop/izklop lučk na tipkovnici + Vklop/izklop lučk na tipkovnici Keyboard Brightness Up - + Povečaj svetlost tipkovnice Keyboard Brightness Down - + Zmanjšaj svetlost tipkovnice Power Off - Izklopi + Izklopi Wake Up - Zbudi se + Zbudi Eject - Izvrzi + Izvrzi Screensaver - Ohranjevalnik zaslona + Ohranjevalnik zaslona WWW - WWW + Svetovni splet Sleep - V pripravljenost + V pripravljenost LightBulb - Žarnica + Žarnica Shop - + Trgovina History - Zgodovina + Zgodovina Add Favorite - Dodaj najljubšo + Dodaj priljubljeno Hot Links - Vroče povezave + Vroče povezave Adjust Brightness - Prilagodi svetlost + Prilagodi svetlost Finance - Finance + Finance Community - Skupnost + Skupnost Audio Rewind - Samodejno previj + Previj zvok Back Forward - + Nazaj naprej Application Left - + Program levo Application Right - + Program desno Book - Knjiga + Knjiga CD - CD + CD Calculator - Računalo + Računalo Clear - Počisti + Počisti Clear Grab @@ -5812,15 +5812,15 @@ Izberite drugo ime datoteke. Close - Zapri + Zapri Copy - Kopiraj + Skopiraj Cut - Izreži + Izreži Display @@ -5828,23 +5828,23 @@ Izberite drugo ime datoteke. DOS - DOS + DOS Documents - Dokumenti + Dokumenti Spreadsheet - Preglednica + Preglednica Browser - Brskalnik + Brskalnik Game - Igra + Igra Go @@ -5852,19 +5852,19 @@ Izberite drugo ime datoteke. iTouch - iTouch + iTouch Logoff - Odjava + Odjavi Market - + Trg Meeting - Srečanje + Srečanje Keyboard Menu @@ -5876,39 +5876,39 @@ Izberite drugo ime datoteke. My Sites - Moje strani + Moje strani News - Novice + Novice Home Office - Domača pisarna + Domača pisarna Option - Možnost + Možnost Paste - Prilepi + Prilepi Phone - Telefon + Telefon Reply - Odgovori + Odgovori Reload - Znova naloži + Znova naloži Rotate Windows - Zavrti okna + Zavrti okna Rotation PB @@ -5920,23 +5920,23 @@ Izberite drugo ime datoteke. Save - Shrani + Shrani Send - Pošlji + Pošlji Spellchecker - Črkovalnik + Črkovalnik Split Screen - Razdeli zaslon + Razdeli zaslon Support - Podpora + Podpora Task Panel @@ -5944,23 +5944,23 @@ Izberite drugo ime datoteke. Terminal - Terminal + Konzola Tools - Orodja + Orodja Travel - Potovanje + Potovanje Video - Video + Video Word Processor - Urejevalnik besedila + Urejevalnik besedil XFer @@ -5968,47 +5968,47 @@ Izberite drugo ime datoteke. Zoom In - Približaj + Povečaj Zoom Out - Oddalji + Zmanjšaj Away - Odsoten + Odsoten Messenger - Sporočilnik + Sporočilnik WebCam - Spletna kamera + Spletna kamera Mail Forward - Posreduj sporočilo naprej + Posreduj sporočilo Pictures - Slike + Slike Music - Glasba + Glasba Battery - Baterija + Baterija Bluetooth - Bluetooth + Bluetooth Wireless - Brezžično + Brezžično Ultra Wide Band @@ -6016,19 +6016,19 @@ Izberite drugo ime datoteke. Audio Forward - + Zvok naprej Audio Repeat - + Zvok ponavljanje Audio Random Play - + Zvok naključno Subtitle - Podnaslov + Podnaslov Audio Cycle Track @@ -6036,19 +6036,19 @@ Izberite drugo ime datoteke. Time - Čas + Čas View - Pogled + Prikaz Top Menu - Vrhnji meni + Vrhnji meni Suspend - Ustavi + Ustavi Hibernate @@ -6142,7 +6142,7 @@ Izberite drugo ime datoteke. Toggle Call/Hangup Button that will hang up if we're in call, or make a call if we're not. - + Preklopi pokliči/odloži Flip @@ -6152,13 +6152,13 @@ Izberite drugo ime datoteke. Voice Dial Button to trigger voice dialling - + Glasovni klic Last Number Redial Button to redial the last number called - + Ponovni klic zadnje številke Camera Shutter @@ -6170,11 +6170,11 @@ Izberite drugo ime datoteke. Camera Focus Button to focus the camera - + Fokus fotoaparata Kanji - + Kanji Muhenkan @@ -6190,11 +6190,11 @@ Izberite drugo ime datoteke. Hiragana - Hiragana + Hiragana Katakana - Katakana + Katakana Hiragana Katakana @@ -6238,7 +6238,7 @@ Izberite drugo ime datoteke. Code input - + Vnos kode Multiple Candidate @@ -6266,7 +6266,7 @@ Izberite drugo ime datoteke. Hangul Jamo - Hangul Jamo + Hangul Jamo Hangul Romaja @@ -6492,7 +6492,7 @@ Izberite drugo ime datoteke. Unable to decrypt data: %1 - + Ni moč dešifrirati podatkov: %1 Error while reading: %1 @@ -6512,7 +6512,7 @@ Izberite drugo ime datoteke. Private key does not certify public key, %1 - + Zasebni ključ ne potrjuje javnega ključa: %1 Error creating SSL session, %1 @@ -6536,59 +6536,59 @@ Izberite drugo ime datoteke. No error - Brez napake + Brez napake The issuer certificate could not be found - + Potrdila izdajatelja ni bilo moč najti The certificate signature could not be decrypted - + Podpisa potrdila ni bilo moč dešifrirati The public key in the certificate could not be read - + Javnega ključa iz potrdila ni bilo moč prebrati The signature of the certificate is invalid - + Podpis potrdila ni veljaven The certificate is not yet valid - + Potrdilo še ni veljavno The certificate has expired - Potrdilo je preteklo + Potrdilo je preteklo The certificate's notBefore field contains an invalid time - + Polje notBefore (ne pred) potrdila vsebuje neveljaven čas The certificate's notAfter field contains an invalid time - + Polje notAfter (ne po) potrdila vsebuje neveljaven čas The certificate is self-signed, and untrusted - + Potrdilo je samo-podpisano in nezaupano The root certificate of the certificate chain is self-signed, and untrusted - + Vrhnje potrdilo verige potrdil je samo-podpisano in nezaupano The issuer certificate of a locally looked up certificate could not be found - + Potrdila izdajatelja za krajevno najdeno potrdilo ni bilo moč najti No certificates could be verified - + Preveriti ni bilo moč nobenega potrdila One of the CA certificates is invalid - + Eno izmed potrdil avtoritete za potrdila ni veljavno The basicConstraints path length parameter has been exceeded @@ -6596,15 +6596,15 @@ Izberite drugo ime datoteke. The supplied certificate is unsuitable for this purpose - + Predloženo potrdilo ni primerno za ta namen The root CA certificate is not trusted for this purpose - + Potrdilo vrhovne avtoritete za potrdila ni zaupano za ta namen The root CA certificate is marked to reject the specified purpose - + Potrdilo vrhovne avtoritete za potrdila je označeno za zavrnitev navedenega namena The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate @@ -6616,15 +6616,15 @@ Izberite drugo ime datoteke. The peer did not present any certificate - Vrstnik ni predložil nobenega potrdila + Vrstnik ni predložil nobenega potrdila The host name did not match any of the valid hosts for this certificate - + Ime gostitelja se ne ujema z nobenim izmed veljavnih gostiteljev za to potrdilo Unknown error - Neznana napaka + Neznana napaka @@ -6858,7 +6858,7 @@ Izberite drugo ime datoteke. QWebPage Redirection limit reached - + Dosežena je bila omejitev preusmeritev Bad HTTP request @@ -7082,7 +7082,7 @@ Izberite drugo ime datoteke. Missing Plug-in Label text to be used when a plug-in is missing - + Manjkajoč vstavek Loading... @@ -7779,23 +7779,23 @@ Izberite drugo ime datoteke. QXmlPatternistCLI Warning in %1, at line %2, column %3: %4 - + Opozorilo v %1, vrstica %2, stolpec %3: %4 Warning in %1: %2 - + Opozorilo v %1: %2 Unknown location - Neznana lokacija + Neznana lokacija Error %1 in %2, at line %3, column %4: %5 - + Napaka %1 v %2, vrstica %3, stolpec %4: %5 Error %1 in %2: %3 - Napaka %1 v %2: %3 + Napaka %1 v %2: %3 @@ -7826,7 +7826,7 @@ Izberite drugo ime datoteke. Unexpected character '%1' in public id literal. - + Nepričakovan znak »%1« v javnem literalu ID-ja. Invalid XML version string. @@ -7846,7 +7846,7 @@ Izberite drugo ime datoteke. Standalone accepts only yes or no. - + Samostojni (standalone) sprejema samo da (yes) ali ne (no). Invalid attribute in XML declaration. @@ -7890,7 +7890,7 @@ Izberite drugo ime datoteke. NDATA in parameter entity declaration. - + NDATA v parametru deklaracije entitete. %1 is an invalid processing instruction name. @@ -7938,7 +7938,7 @@ Izberite drugo ime datoteke. %1 is an invalid PUBLIC identifier. - + %1 ni veljaven javni identifikator. @@ -7949,7 +7949,7 @@ Izberite drugo ime datoteke. Element %1 can't be serialized because it appears outside the document element. - + Elementa %1 ni moč serializirati, ker se nahaja zunaj elementa dokumenta. Year %1 is invalid because it begins with %2. @@ -8235,7 +8235,7 @@ Izberite drugo ime datoteke. %1 is not a whole number of minutes. - %1 ni celovito število minut, + %1 ni celovito število minut. Required cardinality is %1; got cardinality %2. @@ -9339,7 +9339,7 @@ Izberite drugo ime datoteke. Component with ID %1 has been defined previously. - Komponenta z ID-jem %1 je že bila definirana. + Komponenta z ID-jem %1 je že bila definirana. Element %1 already defined. diff --git a/translations/qtconfig_sl.ts b/translations/qtconfig_sl.ts new file mode 100644 index 0000000..fa779ff --- /dev/null +++ b/translations/qtconfig_sl.ts @@ -0,0 +1,732 @@ + + + + 2010-08-28 15:58+0200 + MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator + Lokalize 1.1 + Slovenian <lugos-slo@lugos.si> + + # Jure Repinc <jlp@holodeck1.com>, 2010. + Jure Repinc <jlp@holodeck1.com> + + MainWindow + + Desktop Settings (Default) + Nastavitve namizja (privzeto) + + + Choose style and palette based on your desktop settings. + Izberite slog in paleto, ki temeljita na vaših nastavitvah namizja. + + + On The Spot + Na mestu + + + Auto (default) + Samodejno (privzeto) + + + Choose audio output automatically. + Samodejno izbere zvočni izhod. + + + aRts + aRts + + + Experimental aRts support for GStreamer. + Poskusna podpora za aRts za GStreamer. + + + Phonon GStreamer backend not available. + Hrbtenica GStreamer za Phonon ni na voljo. + + + Choose render method automatically + Samodejno izberi način izrisovanja + + + X11 + X11 + + + Use X11 Overlays + Uporabi prekritja X11 + + + OpenGL + OpenGL + + + Use OpenGL if available + Če je na voljo, uporabi OpenGL + + + Software + Programsko + + + Use simple software rendering + Uporabi preprosto programsko izrisovanje + + + No changes to be saved. + Ni sprememb, ki bi jih bilo potrebno shraniti. + + + Saving changes... + Shranjevanje sprememb ... + + + Over The Spot + Prek mesta + + + Off The Spot + Z mesta + + + Root + Koren + + + Select a Directory + Izberite mapo + + + <h3>%1</h3><br/>Version %2<br/><br/>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + <h3>%1</h3><br/>Različica %2<br/><br/>Avtorske pravice © 2010 Nokia Corporation in/ali njene podružnice.<br/><br/>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a> + + + Qt Configuration + Nastavitev Qt + + + Save Changes + Shrani spremembe + + + Save changes to settings? + Ali želite shraniti spremembe nastavitev? + + + &Yes + &Da + + + &No + &Ne + + + &Cancel + &Prekliči + + + + MainWindowBase + + Qt Configuration + Nastavitev Qt + + + Appearance + Videz + + + GUI Style + Slog grafičnega vmesnika + + + Select GUI &Style: + Izberite &slog grafičnega vmesnika: + + + Preview + Ogled + + + Select &Palette: + Izberite &paleto: + + + Active Palette + Paleta za aktivno + + + Inactive Palette + Paleta za neaktivno + + + Disabled Palette + Paleta za onemogočeno + + + Build Palette + Gradnja palete + + + &3-D Effects: + Učinki &3D: + + + Window Back&ground: + &Ozadje okna: + + + &Tune Palette... + &Nastavitev palete ... + + + Please use the KDE Control Center to set the palette. + Za nastavitev palete uporabite KDE-jeve Sistemske nastavitve. + + + Fonts + Pisave + + + Default Font + Privzeta pisava + + + &Style: + &Slog: + + + &Point Size: + &Velikost v točkah: + + + F&amily: + &Družina: + + + Sample Text + Vzorec besedila + + + Font Substitution + Nadomeščanje pisav + + + S&elect or Enter a Family: + I&zberite ali vnesite družino: + + + Current Substitutions: + Trenutni nadomestki: + + + Up + Gor + + + Down + Dol + + + Remove + Odstrani + + + Select s&ubstitute Family: + Izberite &nadomestno družino: + + + Add + Dodaj + + + Interface + Vmesnik + + + Feel Settings + Nastavitve obnašanja + + + ms + ms + + + &Double Click Interval: + Interval &dvojnega klika: + + + No blinking + Brez utripanja + + + &Cursor Flash Time: + &Hitrost utripanja kazalca: + + + lines + vrstic + + + Wheel &Scroll Lines: + &Vrtljaj koleščka: + + + Resolve symlinks in URLs + Razreši simbolične povezave v URL-jih + + + GUI Effects + Učinki grafičnega vmesnika + + + &Enable + &Omogoči + + + Alt+E + Alt+O + + + &Menu Effect: + Učinek &menija: + + + C&omboBox Effect: + Učinek &spustnega seznama: + + + &ToolTip Effect: + Učinek &namiga: + + + Tool&Box Effect: + Učinek o&rodjarne: + + + Disable + Onemogoči + + + Animate + Animiraj + + + Fade + Preidi + + + Global Strut + Globalni razmiki + + + Minimum &Width: + Najmanjša &širina: + + + Minimum Hei&ght: + Najmanjša &višina: + + + pixels + pik + + + Enhanced support for languages written right-to-left + Izboljšana podpora za jezike, ki se pišejo od desne proti levi + + + XIM Input Style: + Način za vnašanje XIM: + + + On The Spot + Na mestu + + + Over The Spot + Prek mesta + + + Off The Spot + Z mesta + + + Root + Vrh + + + Default Input Method: + Privzeti način vnašanja: + + + Printer + Tiskalnik + + + Enable Font embedding + Omogoči vgrajevanje pisav + + + Font Paths + Poti do posav + + + Browse... + Brskanje ... + + + Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list. + Kliknite gumb <b>Brskanje</b> ali pa vnesite mapo in pritisnite vnašalko za dodajanje na seznam. + + + Phonon + Phonon + + + About Phonon + O Phononu + + + Current Version: + Trenutna različica: + + + Not available + Ni na voljo + + + Website: + Spletna stran: + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://phonon.kde.org"><span style=" text-decoration: underline; color:#0000ff;">http://phonon.kde.org</span></a></p></body></html> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://phonon.kde.org"><span style=" text-decoration: underline; color:#0000ff;">http://phonon.kde.org/</span></a></p></body></html> + + + About GStreamer + O GStreamerju + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gstreamer.freedesktop.org/"><span style=" text-decoration: underline; color:#0000ff;">http://gstreamer.freedesktop.org/</span></a></p></body></html> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gstreamer.freedesktop.org/"><span style=" text-decoration: underline; color:#0000ff;">http://gstreamer.freedesktop.org/</span></a></p></body></html> + + + GStreamer backend settings + Nastavitve hrbtenice GStreamer + + + Preferred audio sink: + Prednostni ponor zvoka: + + + Preferred render method: + Prednostni način izrisovanja: + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: changes to these settings may prevent applications from starting up correctly.</span></p></body></html> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Vedite: spremembe teh nastavitev lahko preprečijo pravilen zagon programov.</span></p></body></html> + + + &File + &Datoteka + + + &Help + &Pomoč + + + &Save + &Shrani + + + Save + Shrani + + + Ctrl+S + Ctrl+S + + + E&xit + Konča&j + + + Exit + Končaj + + + &About + &O + + + About + O + + + About &Qt + O &Qt + + + About Qt + O Qt + + + + PaletteEditorAdvancedBase + + Tune Palette + Nastavitev palete + + + <b>Edit Palette</b><p>Change the palette of the current widget or form.</p><p>Use a generated palette or select colors for each color group and each color role.</p><p>The palette can be tested with different widget layouts in the preview section.</p> + <b>Nastavitev palete</b><p>Spremenite paleto za trenutni gradnik ali obrazec.</p><p>Uporabite ustvarjeno paleto ali pa za vsako barvno skupino in vsako barvno vlogo izberite barvo.</p><p>Paleto lahko v razdelku Ogled preizkusite z različnimi slogi gradnikov.</p> + + + Select &Palette: + Izberite &paleto: + + + Active Palette + Paleta za aktivno + + + Inactive Palette + Paleta za neaktivno + + + Disabled Palette + Paleta za onemogočeno + + + Auto + Samodejno + + + Build inactive palette from active + Paleto za neaktivno zgradi iz palete za aktivno + + + Build disabled palette from active + Paleto za onemogočeno zgradi iz palete za aktivno + + + Central color &roles + Osrednje barvne &vloge + + + Choose central color role + Izberite osrednjo barvno vlogo + + + <b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p> + <b>Izberite barvno vlogo</b><p>Razpoložljive osrednje vloge so:<ul><li>Okno – splošna barva ozadja.</li><li>Besedilo okna – splošna barva ospredja</li><li>Osnova – uporabljena kot barva ozadja za npr. vnosne gradnike, običajno bela ali druga svetla barva.</li><li>Besedilo – barva ospredja, ki se uporablja z Osnovo. Običajno je to isto kot Besedilo okna in v tem primeru mora biti v kontrastu z barvama Okno in Osnova.</li><li>Gumb – splošna barva ozadja gumba, če gumb potrebuje ozadje, ki je drugačno od ozadja oken.</li><li>Besedilo gumba – barva ospredja, ki se uporablja z barvo Gumba<li>Poudarek – barva za nakazovanje izbranega ali poudarjenega.</li><li>Poudarjeno besedilo – barva besedila, ki se razlikuje od barve za Poudarek.</li><li>Svetlo besedilo – barva besedila, ki se zelo razlikuje od barve za Besedilo okna in je v kontrastu s črno.</li></ul></p> + + + Window + Okno + + + WindowText + Besedilo okna + + + Button + Gumb + + + Base + Osnova + + + Text + Besedilo + + + BrightText + Svetlo besedilo + + + ButtonText + Besedilo gumba + + + Highlight + Poudarek + + + HighlightedText + Poudarjeno besedilo + + + &Select Color: + &Izberite barvo: + + + Choose a color + Izberite barvo + + + Choose a color for the selected central color role. + Izberite barvo za izbrano osrednjo barvno vlogo. + + + 3-D shadow &effects + &Učinki 3D sence: + + + Build &from button color + &Zgradi iz barve za gumb + + + Generate shadings + Ustvari sence + + + Check to let 3D-effect colors be calculated from button-color. + Izberite, da se barve 3D učinka izračuna iz barve za gumb. + + + Choose 3D-effect color role + Izberite barvno vlogo 3D učinka + + + <b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul> + <b>Izberite barvno vlogo</b><p>Razpoložljive vloge za učinek so:<ul><li>Svetlo – svetlejše od barve za gumb.</li><li>Srednje svetlo – med barvama za gumb in Svetlo.</li><li>Srednje temno – med barvama za gumb in Temno</li><li>Temno – temnejše od barve za gumb.</li><li>Senca – zelo temna barva.</li></ul> + + + Light + Svetlo + + + Midlight + Srednje svetlo + + + Mid + Srednje temno + + + Dark + Temno + + + Shadow + Senca + + + Select Co&lor: + Izberite b&arvo: + + + Choose a color for the selected effect color role. + Izberite barvo za izbrano barvno vlogo učinka. + + + OK + V redu + + + Close dialog and apply all changes. + Zapre pogovorno okno in uveljavi spremembe. + + + Cancel + Prekliči + + + Close dialog and discard all changes. + Zapre pogovorno okno in zavrže spremembe. + + + + PreviewFrame + + Desktop settings will only take effect after an application restart. + Nastavitve namizja bodo stopile v veljavo po ponovnem zagonu programa. + + + + PreviewWidgetBase + + Preview Window + Okno ogleda + + + ButtonGroup + SkupinaGumbov + + + RadioButton1 + IzbirniGumb1 + + + RadioButton2 + IzbirniGumb2 + + + RadioButton3 + IzbirniGumb3 + + + ButtonGroup2 + SkupinaGumbov2 + + + CheckBox1 + PotrditvenoPolje1 + + + CheckBox2 + PotrditvenoPolje2 + + + LineEdit + UrejevalnaVrstica + + + ComboBox + SpustniSeznam + + + PushButton + Gumb + + + <p> +<a href="http://qt.nokia.com">http://qt.nokia.com</a> +</p> +<p> +<a href="http://www.kde.org">http://www.kde.org</a> +</p> + <p> +<a href="http://qt.nokia.com/">qt.nokia.com</a> +</p> +<p> +<a href="http://www.kde.org/">www.kde.org</a> +</p> + + + diff --git a/translations/qvfb_sl.ts b/translations/qvfb_sl.ts new file mode 100644 index 0000000..251ba19 --- /dev/null +++ b/translations/qvfb_sl.ts @@ -0,0 +1,422 @@ + + + + 2010-08-28 16:47+0200 + MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator + Lokalize 1.1 + Slovenian <lugos-slo@lugos.si> + + # Jure Repinc <jlp@holodeck1.com>, 2010. + Jure Repinc <jlp@holodeck1.com> + + AnimationSaveWidget + + Record + Posnemi + + + Reset + Ponastavi + + + Save + Shrani + + + Save in MPEG format (requires netpbm package installed) + Shrani v obliko MPEG (potrebuje nameščen paket netpbm) + + + Click record to begin recording. + Kliknite Posnemi za začetek snemanja. + + + Finished saving. + Shranjevanje zaključeno. + + + Paused. Click record to resume, or save if done. + Premor. Za nadaljevanje kliknite Posnemi, če ste zaključili pa Shrani. + + + Pause + Premor + + + Recording... + Snemanje ... + + + Saving... + Shranjevanje ... + + + Save animation... + Shrani animacijo ... + + + Save canceled. + Shranjevanje preklicano + + + Save failed! + Shranjevanje ni uspelo. + + + + Config + + Configure + Nastavi + + + Size + Velikost + + + 176x220 "SmartPhone" + 176⨯220 (pametni telefon) + + + 240x320 "PDA" + 240⨯320 (dlančnik) + + + 320x240 "TV" / "QVGA" + 320⨯240 (TV/QVGA) + + + 640x480 "VGA" + 640⨯480 (VGA) + + + 800x480 + 800⨯480 + + + 800x600 + 800⨯600 + + + 1024x768 + 1024⨯768 + + + Custom + Po meri + + + Depth + Globina + + + 1 bit monochrome + 1 bit enobarvno + + + 2 bit grayscale + 2 bita sivine + + + 4 bit grayscale + 4 bite sivine + + + 8 bit + 8 bitov + + + 12 (16) bit + 12 (16) bitov + + + 15 bit + 15 bitov + + + 16 bit + 16 bitov + + + 18 bit + 18 bitov + + + 24 bit + 24 bitov + + + 32 bit + 32 bitov + + + 32 bit ARGB + 32-bitov ARGB + + + Swap red and blue channels + Izmenjaj modri in rdeči kanal + + + BGR format + Format BGR + + + Skin + Tema + + + None + Brez + + + Emulate touch screen (no mouse move) + Posnemaj zaslon na dotik (brez premikov miške) + + + Emulate LCD screen (Only with fixed zoom of 3.0 times magnification) + Posnemaj zaslon LCD (samo s stalno 3.0⨯ povećavo) + + + <p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>. + <p>Vedite, da bo ob spremembi velikosti ali globine vsak program, ki uporablja navidezni slikovni medpomnilnik, končan. Gamo lahko prosto spreminjate. + + + Gamma + Gama + + + Blue + Modra + + + 1.0 + 1,0 + + + Green + Zelena + + + All + Vse + + + Red + Rdeča + + + Set all to 1.0 + Nastavi vse na 1,0 + + + &OK + &V redu + + + &Cancel + &Prekliči + + + + DeviceSkin + + The image file '%1' could not be loaded. + Slikovne datoteke »%1« ni bilo moč naložiti. + + + The skin directory '%1' does not contain a configuration file. + Mapa s temo »%1« ne vsebuje nastavitvene datoteke. + + + The skin configuration file '%1' could not be opened. + Nastavitvene datoteke za temo »%1« ni bilo moč odpreti. + + + The skin configuration file '%1' could not be read: %2 + Nastavitvene datoteke za temo »%1« ni bilo moč prebrati: %2 + + + Syntax error: %1 + Skladenjska napaka: %1 + + + The skin "up" image file '%1' does not exist. + Datoteka slike »up« teme »%1« ne obstaja. + + + The skin "down" image file '%1' does not exist. + Datoteka slike »down« teme »%1« ne obstaja. + + + The skin "closed" image file '%1' does not exist. + Datoteka slike »closed« teme »%1« ne obstaja. + + + The skin cursor image file '%1' does not exist. + Slikovna datoteka s kazalcem za temo »%1« ne obstaja. + + + Syntax error in area definition: %1 + Skladenjska napaka pri določitvi območja: %1 + + + Mismatch in number of areas, expected %1, got %2. + Neujemanje v številu območij, pričakovano %1, dobljeno %2. + + + + QVFb + + &File + &Datoteka + + + &Configure... + &Nastavi ... + + + &Save image... + &Shrani sliko ... + + + &Animation... + &Animacija ... + + + &Quit + Konča&j + + + &View + &Videz + + + Show &Cursor + Prikaži &kazalec + + + &Refresh Rate... + &Hitrost osveževanja ... + + + &No rotation + &Brez zasuka + + + &90° rotation + Zasuk za &90° + + + 1&80° rotation + Zasuk za 1&80° + + + 2&70° rotation + Zasuk za 2&70° + + + Zoom scale &0.5 + Povečava &0,5 + + + Zoom scale 0.7&5 + Povečava 0,7&5 + + + Zoom scale &1 + Povečeva &1,0 + + + Zoom scale &2 + Povečava &2,0 + + + Zoom scale &3 + Povečeva &3,0 + + + Zoom scale &4 + Povečava &4,0 + + + Zoom &scale... + &Povečava ... + + + &Help + &Pomoč + + + &About... + &O ... + + + Save Main Screen image + Shrani sliko glavnega zaslona + + + snapshot.png + posnetek.png + + + Portable Network Graphics (*.png) + Portable Network Graphics (*.png) + + + Save Main Screen Image + Shrani sliko glavnega zaslona + + + Save failed. Check that you have permission to write to the target directory. + Shranjevanje ni uspelo. Preverite dovoljenja za pisanje v ciljno mapo. + + + Save Second Screen image + Shrani sliko drugega zaslona + + + Save Second Screen Image + Shrani sliko drugega zaslona + + + About QVFB + O QVFB + + + <h2>The Qt for Embedded Linux Virtual X11 Framebuffer</h2><p>This application runs under Qt for X11, emulating a simple framebuffer, which the Qt for Embedded Linux server and clients can attach to just as if it was a hardware Linux framebuffer. <p>With the aid of this development tool, you can develop Qt for Embedded Linux applications under X11 without having to switch to a virtual console. This means you can comfortably use your other development tools such as GUI profilers and debuggers. + <h2>Qt for Embedded Linux Virtual X11 Framebuffer</h2><p>Ta program teče pod okenskim sistemom X11 in posnema preprost slikovni medpomnilnik, na katerega se lahko strežniki in odjemalci, izdelani s Qt za vgrajeni Linux, priklopijo, kot da bi bil pravi strojni slikovni medpomnilnik Linuxa.<p>S pomočjo tega orodja lahko programe Qt za vgrajeni Linux razvijate pod X11, ne da bi bilo potrebno preklopiti v navidezno konzolo. To pomeni, da lahko še naprej udobno uporabljate druga razvojna orodja, kot so grafični profilirniki in razhroščevalniki. + + + Browse... + Brskanje ... + + + Load Custom Skin... + Naloži temo po meri ... + + + All QVFB Skins (*.skin) + Vse teme za QVFB (*.skin) + + + + QVFbRateDialog + + Target frame rate: + Ciljna hitrost sličic: + + + %1fps + %1 sl./s + + + OK + V redu + + + Cancel + Prekliči + + + -- cgit v0.12 From b4a7eadb28a49ace84994dcff665b1cabae69652 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 30 Aug 2010 10:27:12 +0200 Subject: fix MinGW cross compilation with -debug-and-release Fixed two issues in the configure script that prevented -debug-and-release from working correctly: We now allow dual debug and release mode for MinGW. We follow configure.exe in *not* settting PRECOMPILED_DIR. This gives qmake the freedom to put the debug and release precompiled headers in separate directories. Merge-request: 794 Reviewed-by: Oswald Buddenhagen --- configure | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 1221d62..f564aec 100755 --- a/configure +++ b/configure @@ -2328,7 +2328,7 @@ fi # detect build style if [ "$CFG_DEBUG" = "auto" ]; then - if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then CFG_DEBUG_RELEASE=yes CFG_DEBUG=yes elif [ "$CFG_DEV" = "yes" ]; then @@ -6682,7 +6682,11 @@ if [ "$PLATFORM_QWS" = "yes" ]; then QT_CONFIG="$QT_CONFIG embedded" rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes fi -QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR" +if [ "$XPLATFORM_MINGW" != "yes" ]; then + # Do not set this here for Windows. Let qmake do it so + # debug and release precompiled headers are kept separate. + QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR" +fi QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR" QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR" QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR" -- cgit v0.12 From 794ca0afac9ac77350bf0697ccb9af82cd253cc6 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 30 Aug 2010 14:15:21 +0200 Subject: make qdoc3 boot-strappable again --- tools/qdoc3/qdoc3.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 5bedc29..ae0bf25 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -6,6 +6,7 @@ DEFINES += QT_NO_CAST_TO_ASCII qdoc_bootstrapped { include(../../src/tools/bootstrap/bootstrap.pri) + SOURCES += ../../src/corelib/plugin/quuid.cpp DEFINES -= QT_NO_CAST_FROM_ASCII DEFINES += QT_NO_TRANSLATION } else { -- cgit v0.12 From f6020903ee0caea34b84e6660c3fbd1545e21249 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 26 Aug 2010 10:14:13 +0200 Subject: Reenable the reporting of CPU features. The linking error before was most likely namespace issue --- src/corelib/global/qlibraryinfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index a0779c9..957abbf 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -66,6 +66,8 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE +extern void qDumpCPUFeatures(); // in qsimd.cpp + #ifndef QT_NO_SETTINGS struct QLibrarySettings @@ -500,7 +502,6 @@ QT_END_NAMESPACE extern const char qt_core_interpreter[] __attribute__((section(".interp"))) = ELF_INTERPRETER; -extern void qDumpCPUFeatures(); // in qsimd.cpp extern "C" void qt_core_boilerplate(); void qt_core_boilerplate() { @@ -526,7 +527,7 @@ void qt_core_boilerplate() qt_configure_libraries_path_str + 12, qt_configure_headers_path_str + 12); -// qDumpCPUFeatures(); + QT_PREPEND_NAMESPACE(qDumpCPUFeatures)(); #ifdef QT_EVAL extern void qt_core_eval_init(uint); -- cgit v0.12 From edbc656bfa5069dd40f64ae3123d6370c2d86538 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 30 Aug 2010 15:25:54 +0200 Subject: Fix static build on Windows with MinGW. Q_DECL_IMPORT is still __declspec(dllimport), which is unsuitable for static code. Reviewed-by: Thiago Macieira --- src/svg/qsvghandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index d545440..bf19a88 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE static const char *qt_inherit_text = "inherit"; #define QT_INHERIT QLatin1String(qt_inherit_text) -Q_DECL_IMPORT double qstrtod(const char *s00, char const **se, bool *ok); +Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok); // ======== duplicated from qcolor_p -- cgit v0.12 From 47fe98d194e48ec2bac1f75d8b5bd57820d7f66a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 Aug 2010 15:26:11 +0200 Subject: move the MAGIC_OBSOLETE_REFERENCE hack to the xlf file handler after all, it is pretty much specific to xlf files, even if the problem majorly concerns converted po files. --- tools/linguist/shared/po.cpp | 6 +----- tools/linguist/shared/xliff.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index a692332..620d27b 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -50,8 +50,6 @@ #include -#define MAGIC_OBSOLETE_REFERENCE "Obsolete_PO_entries" - // Uncomment if you wish to hard wrap long lines in .po files. Note that this // affects only msg strings, not comments. //#define HARD_WRAP_LONG_WORDS @@ -562,8 +560,6 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) if (pos != -1) msg.addReference(ref.left(pos), ref.mid(pos + 1).toInt()); } - } else if (isObsolete) { - msg.setFileName(QLatin1String(MAGIC_OBSOLETE_REFERENCE)); } msg.setId(codec->toUnicode(item.id)); msg.setSourceText(codec->toUnicode(item.msgId)); @@ -773,7 +769,7 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) if (!msg.id().isEmpty()) out << QLatin1String("#. ts-id ") << msg.id() << '\n'; - if (!msg.fileName().isEmpty() && msg.fileName() != QLatin1String(MAGIC_OBSOLETE_REFERENCE)) { + if (!msg.fileName().isEmpty()) { QStringList refs; foreach (const TranslatorMessage::Reference &ref, msg.allReferences()) refs.append(QString(QLatin1String("%2:%1")) diff --git a/tools/linguist/shared/xliff.cpp b/tools/linguist/shared/xliff.cpp index 6411426..70724ef 100644 --- a/tools/linguist/shared/xliff.cpp +++ b/tools/linguist/shared/xliff.cpp @@ -53,6 +53,11 @@ #include +// The string value is historical and reflects the main purpose: Keeping +// obsolete entries separate from the magic file message (which both have +// no location information, but typically reside at opposite ends of the file). +#define MAGIC_OBSOLETE_REFERENCE "Obsolete_PO_entries" + QT_BEGIN_NAMESPACE /** @@ -692,6 +697,9 @@ bool XLIFFHandler::finalizeMessage(bool isPlural) m_cd.appendError(QLatin1String("XLIFF syntax error: Message without source string.")); return false; } + if (m_type == TranslatorMessage::Obsolete && m_refs.size() == 1 + && m_refs.at(0).fileName() == QLatin1String(MAGIC_OBSOLETE_REFERENCE)) + m_refs.clear(); TranslatorMessage msg(m_context, m_sources[0], m_comment, QString(), QString(), -1, m_translations, m_type, isPlural); @@ -761,12 +769,15 @@ bool saveXLIFF(const Translator &translator, QIODevice &dev, ConversionData &cd) QHash > contextOrder; QList fileOrder; foreach (const TranslatorMessage &msg, translator.messages()) { - QHash > &file = messageOrder[msg.fileName()]; + QString fn = msg.fileName(); + if (fn.isEmpty() && msg.type() == TranslatorMessage::Obsolete) + fn = QLatin1String(MAGIC_OBSOLETE_REFERENCE); + QHash > &file = messageOrder[fn]; if (file.isEmpty()) - fileOrder.append(msg.fileName()); + fileOrder.append(fn); QList &context = file[msg.context()]; if (context.isEmpty()) - contextOrder[msg.fileName()].append(msg.context()); + contextOrder[fn].append(msg.context()); context.append(msg); } -- cgit v0.12 From e32d8cd49c4e3137889512e3f3a19018b4195970 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 Aug 2010 15:28:11 +0200 Subject: properly parse ts contexts in obsolete messages --- tests/auto/linguist/lconvert/data/test20.ts | 9 +++++++++ tools/linguist/shared/po.cpp | 2 ++ 2 files changed, 11 insertions(+) diff --git a/tests/auto/linguist/lconvert/data/test20.ts b/tests/auto/linguist/lconvert/data/test20.ts index f042edf..0e38b4b 100644 --- a/tests/auto/linguist/lconvert/data/test20.ts +++ b/tests/auto/linguist/lconvert/data/test20.ts @@ -158,5 +158,14 @@ comment with | and ~ and so~ + + just something obsolete + translated obsoletion + + + something else obsolete + comment with | and ~ and so~ + another translated obsoletion + diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index 620d27b..a58a0bf 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -656,6 +656,8 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) item.isPlural = true; } else if (line.startsWith("#~ msgctxt ")) { item.tscomment = slurpEscapedString(lines, l, 11, "#~ ", cd); + if (qtContexts) + splitContext(&item.tscomment, &item.context); } else { cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); -- cgit v0.12 From d686a95ed54b19336affc14c9222de54c9af0e72 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 30 Aug 2010 15:43:01 +0200 Subject: QSslConfiguration: fix crash when accessing null pointer We were accessing the d-pointer of a QSslConfiguration which is initialized lazily. Reviewed-by: Markus Goetz Task-number: QTBUG-13265 --- src/network/ssl/qsslsocket.cpp | 5 +++++ tests/auto/qsslsocket/tst_qsslsocket.cpp | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 91265f3..f18c629 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1966,6 +1966,11 @@ void QSslConfigurationPrivate::deepCopyDefaultConfiguration(QSslConfigurationPri QMutexLocker locker(&globalData()->mutex); const QSslConfigurationPrivate *global = globalData()->config.constData(); + if (!global) { + ptr = 0; + return; + } + ptr->ref = 1; ptr->peerCertificate = global->peerCertificate; ptr->peerCertificateChain = global->peerCertificateChain; diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 6c1dd8f..d6a7a01 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -183,6 +183,7 @@ private slots: void ignoreSslErrorsListWithSlot(); void readFromClosedSocket(); void writeBigChunk(); + void setEmptyDefaultConfiguration(); static void exitLoop() { @@ -1835,6 +1836,21 @@ void tst_QSslSocket::writeBigChunk() socket->close(); } +void tst_QSslSocket::setEmptyDefaultConfiguration() +{ + // used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265 + + if (!QSslSocket::supportsSsl()) + return; + + QSslConfiguration emptyConf; + QSslConfiguration::setDefaultConfiguration(emptyConf); + + QSslSocketPtr socket = newSocket(); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslSocket) -- cgit v0.12 From b247124839db0a25e6200b258e71eb5d7acc033c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 30 Aug 2010 16:25:33 +0200 Subject: qdrawhelper: backport the optimisations in fetchTransformBilinear from master to 4.7 This backport the following commits: e55b6a3 qdrawhelper: remove code duplication 0d7e683 qdrawhelper: optimize fetchTransformedBilinear 29ef46e Fix compilation with RVCT 6601458 qdrawhelper: Use SSE2 in fetchTransformedBilinear (when scalling up) 398ef0ca Fix nasty copy-paste bug in fetchTransformedBilinear() d585ece qdrawhelper: fix assert in fetchTransformedBilinear Reviewed-by: Benjamin Poulain --- src/gui/painting/qdrawhelper.cpp | 395 +++++++++++++++++++++++++-------------- 1 file changed, 257 insertions(+), 138 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index be4275c..89754fa 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -656,6 +656,46 @@ const uint * QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const return buffer; } +/** \internal + interpolate 4 argb pixels with the distx and disty factor. + distx and disty bust be between 0 and 16 + */ +static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, int distx, int disty, int idistx, int idisty) +{ + uint tlrb = ((tl & 0x00ff00ff) * idistx * idisty); + uint tlag = (((tl & 0xff00ff00) >> 8) * idistx * idisty); + uint trrb = ((tr & 0x00ff00ff) * distx * idisty); + uint trag = (((tr & 0xff00ff00) >> 8) * distx * idisty); + uint blrb = ((bl & 0x00ff00ff) * idistx * disty); + uint blag = (((bl & 0xff00ff00) >> 8) * idistx * disty); + uint brrb = ((br & 0x00ff00ff) * distx * disty); + uint brag = (((br & 0xff00ff00) >> 8) * distx * disty); + return (((tlrb + trrb + blrb + brrb) >> 8) & 0x00ff00ff) | ((tlag + trag + blag + brag) & 0xff00ff00); +} + + +template +Q_STATIC_TEMPLATE_FUNCTION inline void fetchTransformedBilinear_pixelBounds(int max, int l1, int l2, int &v1, int &v2) +{ + if (blendType == BlendTransformedBilinearTiled) { + v1 %= max; + if (v1 < 0) v1 += max; + v2 = v1 + 1; + v2 %= max; + } else { + if (v1 < l1) { + v2 = v1 = l1; + } else if (v1 >= l2 - 1) { + v2 = v1 = l2 - 1; + } else { + v2 = v1 + 1; + } + } + + Q_ASSERT(v1 >= 0 && v1 < max); + Q_ASSERT(v2 >= 0 && v2 < max); +} + template /* blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled */ Q_STATIC_TEMPLATE_FUNCTION const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *, const QSpanData *data, @@ -696,64 +736,230 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * fx -= half_point; fy -= half_point; - while (b < end) { - int x1 = (fx >> 16); - int x2; + + if (fdy == 0) { //simple scale, no rotation int y1 = (fy >> 16); int y2; + fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); - if (blendType == BlendTransformedBilinearTiled) { - x1 %= image_width; - if (x1 < 0) x1 += image_width; - x2 = x1 + 1; - x2 %= image_width; - - y1 %= image_height; - if (y1 < 0) y1 += image_height; - y2 = y1 + 1; - y2 %= image_height; - } else { - if (x1 < image_x1) { - x2 = x1 = image_x1; - } else if (x1 >= image_x2 - 1) { - x2 = x1 = image_x2 - 1; + if (fdx <= fixed_scale && fdx > 0) { // scale up on X + int disty = (fy & 0x0000ffff) >> 8; + int idisty = 256 - disty; + int x = fx >> 16; + + // The idea is first to do the interpolation between the row s1 and the row s2 + // into an intermediate buffer, then we interpolate between two pixel of this buffer. + + // intermediate_buffer[0] is a buffer of red-blue component of the pixel, in the form 0x00RR00BB + // intermediate_buffer[1] is the alpha-green component of the pixel, in the form 0x00AA00GG + quint32 intermediate_buffer[2][buffer_size + 2]; + // count is the size used in the intermediate_buffer. + int count = qCeil(length * data->m11) + 2; //+1 for the last pixel to interpolate with, and +1 for rounding errors. + Q_ASSERT(count <= buffer_size + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case + int f = 0; + int lim = count; + if (blendType == BlendTransformedBilinearTiled) { + x %= image_width; + if (x < 0) x += image_width; } else { - x2 = x1 + 1; + lim = qMin(count, image_x2-x); + if (x < image_x1) { + Q_ASSERT(x < image_x2); + uint t = fetch(s1, image_x1, data->texture.colorTable); + uint b = fetch(s2, image_x1, data->texture.colorTable); + quint32 rb = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; + quint32 ag = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; + do { + intermediate_buffer[0][f] = rb; + intermediate_buffer[1][f] = ag; + f++; + x++; + } while (x < image_x1 && f < lim); + } } - if (y1 < image_y1) { - y2 = y1 = image_y1; - } else if (y1 >= image_y2 - 1) { - y2 = y1 = image_y2 - 1; - } else { - y2 = y1 + 1; + +#if defined(QT_ALWAYS_HAVE_SSE2) + if (blendType != BlendTransformedBilinearTiled && + (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)) { + + const __m128i disty_ = _mm_set1_epi16(disty); + const __m128i idisty_ = _mm_set1_epi16(idisty); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + + lim -= 3; + for (; f < lim; x += 4, f += 4) { + // Load 4 pixels from s1, and split the alpha-green and red-blue component + __m128i top = _mm_loadu_si128((__m128i*)((const uint *)(s1)+x)); + __m128i topAG = _mm_srli_epi16(top, 8); + __m128i topRB = _mm_and_si128(top, colorMask); + // Multiplies each colour component by idisty + topAG = _mm_mullo_epi16 (topAG, idisty_); + topRB = _mm_mullo_epi16 (topRB, idisty_); + + // Same for the s2 vector + __m128i bottom = _mm_loadu_si128((__m128i*)((const uint *)(s2)+x)); + __m128i bottomAG = _mm_srli_epi16(bottom, 8); + __m128i bottomRB = _mm_and_si128(bottom, colorMask); + bottomAG = _mm_mullo_epi16 (bottomAG, disty_); + bottomRB = _mm_mullo_epi16 (bottomRB, disty_); + + // Add the values, and shift to only keep 8 significant bits per colors + __m128i rAG =_mm_add_epi16(topAG, bottomAG); + rAG = _mm_srli_epi16(rAG, 8); + _mm_storeu_si128((__m128i*)(&intermediate_buffer[1][f]), rAG); + __m128i rRB =_mm_add_epi16(topRB, bottomRB); + rRB = _mm_srli_epi16(rRB, 8); + _mm_storeu_si128((__m128i*)(&intermediate_buffer[0][f]), rRB); + } + } +#endif + for (; f < count; f++) { // Same as above but without sse2 + if (blendType == BlendTransformedBilinearTiled) { + if (x >= image_width) x -= image_width; + } else { + x = qMin(x, image_x2 - 1); + } + + uint t = fetch(s1, x, data->texture.colorTable); + uint b = fetch(s2, x, data->texture.colorTable); + + intermediate_buffer[0][f] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; + intermediate_buffer[1][f] = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; + x++; + } + // Now interpolate the values from the intermediate_buffer to get the final result. + fx &= fixed_scale - 1; + Q_ASSERT((fx >> 16) == 0); + while (b < end) { + register int x1 = (fx >> 16); + register int x2 = x1 + 1; + Q_ASSERT(x1 >= 0); + Q_ASSERT(x2 < count); + + register int distx = (fx & 0x0000ffff) >> 8; + register int idistx = 256 - distx; + int rb = ((intermediate_buffer[0][x1] * idistx + intermediate_buffer[0][x2] * distx) >> 8) & 0xff00ff; + int ag = (intermediate_buffer[1][x1] * idistx + intermediate_buffer[1][x2] * distx) & 0xff00ff00; + *b = rb | ag; + b++; + fx += fdx; + } + } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x + int y1 = (fy >> 16); + int y2; + fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); + int disty = (fy & 0x0000ffff) >> 8; + int idisty = 256 - disty; + while (b < end) { + int x1 = (fx >> 16); + int x2; + fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); + uint tl = fetch(s1, x1, data->texture.colorTable); + uint tr = fetch(s1, x2, data->texture.colorTable); + uint bl = fetch(s2, x1, data->texture.colorTable); + uint br = fetch(s2, x2, data->texture.colorTable); + + int distx = (fx & 0x0000ffff) >> 8; + int idistx = 256 - distx; + + uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); + uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); + *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); + + fx += fdx; + ++b; + } + } else { //scale down + int y1 = (fy >> 16); + int y2; + fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); + int disty = (fy & 0x0000ffff) >> 12; + int idisty = 16 - disty; + while (b < end) { + int x1 = (fx >> 16); + int x2; + fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); + uint tl = fetch(s1, x1, data->texture.colorTable); + uint tr = fetch(s1, x2, data->texture.colorTable); + uint bl = fetch(s2, x1, data->texture.colorTable); + uint br = fetch(s2, x2, data->texture.colorTable); + int distx = (fx & 0x0000ffff) >> 12; + int idistx = 16 - distx; + *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty, idistx, idisty); + fx += fdx; + ++b; } } + } else { //rotation + if (fabs(data->m11) > 8 || fabs(data->m22) > 8) { + //if we are zooming more than 8 times, we use 8bit precision for the position. + while (b < end) { + int x1 = (fx >> 16); + int x2; + int y1 = (fy >> 16); + int y2; - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); + fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); - const uchar *s1 = data->texture.scanLine(y1); - const uchar *s2 = data->texture.scanLine(y2); + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); - uint tl = fetch(s1, x1, data->texture.colorTable); - uint tr = fetch(s1, x2, data->texture.colorTable); - uint bl = fetch(s2, x1, data->texture.colorTable); - uint br = fetch(s2, x2, data->texture.colorTable); + uint tl = fetch(s1, x1, data->texture.colorTable); + uint tr = fetch(s1, x2, data->texture.colorTable); + uint bl = fetch(s2, x1, data->texture.colorTable); + uint br = fetch(s2, x2, data->texture.colorTable); - int distx = (fx & 0x0000ffff) >> 8; - int disty = (fy & 0x0000ffff) >> 8; - int idistx = 256 - distx; - int idisty = 256 - disty; + int distx = (fx & 0x0000ffff) >> 8; + int disty = (fy & 0x0000ffff) >> 8; + int idistx = 256 - distx; + int idisty = 256 - disty; - uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); - uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); - *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); + uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); + uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); + *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); - fx += fdx; - fy += fdy; - ++b; + fx += fdx; + fy += fdy; + ++b; + } + } else { + //we are zooming less than 8x, use 4bit precision + while (b < end) { + int x1 = (fx >> 16); + int x2; + int y1 = (fy >> 16); + int y2; + + fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); + + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); + + uint tl = fetch(s1, x1, data->texture.colorTable); + uint tr = fetch(s1, x2, data->texture.colorTable); + uint bl = fetch(s2, x1, data->texture.colorTable); + uint br = fetch(s2, x2, data->texture.colorTable); + + int distx = (fx & 0x0000ffff) >> 12; + int disty = (fy & 0x0000ffff) >> 12; + int idistx = 16 - distx; + int idisty = 16 - disty; + + *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty, idistx, idisty); + + fx += fdx; + fy += fdy; + ++b; + } + } } } else { const qreal fdx = data->m11; @@ -779,37 +985,8 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * int idistx = 256 - distx; int idisty = 256 - disty; - if (blendType == BlendTransformedBilinearTiled) { - x1 %= image_width; - if (x1 < 0) x1 += image_width; - x2 = x1 + 1; - x2 %= image_width; - - y1 %= image_height; - if (y1 < 0) y1 += image_height; - y2 = y1 + 1; - y2 %= image_height; - } else { - if (x1 < 0) { - x2 = x1 = 0; - } else if (x1 >= image_width - 1) { - x2 = x1 = image_width - 1; - } else { - x2 = x1 + 1; - } - if (y1 < 0) { - y2 = y1 = 0; - } else if (y1 >= image_height - 1) { - y2 = y1 = image_height - 1; - } else { - y2 = y1 + 1; - } - } - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); + fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); const uchar *s1 = data->texture.scanLine(y1); const uchar *s2 = data->texture.scanLine(y2); @@ -5212,37 +5389,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const int y1 = (y >> 16); int y2; - if (blendType == BlendTransformedBilinearTiled) { - x1 %= image_width; - if (x1 < 0) x1 += image_width; - x2 = x1 + 1; - x2 %= image_width; - - y1 %= image_height; - if (y1 < 0) y1 += image_height; - y2 = y1 + 1; - y2 %= image_height; - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); - } else { - if (x1 < image_x1) { - x2 = x1 = image_x1; - } else if (x1 >= image_x2 - 1) { - x2 = x1 = image_x2 - 1; - } else { - x2 = x1 + 1; - } - if (y1 < image_y1) { - y2 = y1 = image_y1; - } else if (y1 >= image_y2 - 1) { - y2 = y1 = image_y2 - 1; - } else { - y2 = y1 + 1; - } - } + fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); int y1_offset = y1 * scanline_offset; int y2_offset = y2 * scanline_offset; @@ -5322,37 +5470,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const int idistx = 256 - distx; int idisty = 256 - disty; - if (blendType == BlendTransformedBilinearTiled) { - x1 %= image_width; - if (x1 < 0) x1 += image_width; - x2 = x1 + 1; - x2 %= image_width; - - y1 %= image_height; - if (y1 < 0) y1 += image_height; - y2 = y1 + 1; - y2 %= image_height; - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); - } else { - if (x1 < image_x1) { - x2 = x1 = image_x1; - } else if (x1 >= image_x2 - 1) { - x2 = x1 = image_x2 - 1; - } else { - x2 = x1 + 1; - } - if (y1 < image_y1) { - y2 = y1 = image_y1; - } else if (y1 >= image_y2 - 1) { - y2 = y1 = image_y2 - 1; - } else { - y2 = y1 + 1; - } - } + fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); int y1_offset = y1 * scanline_offset; int y2_offset = y2 * scanline_offset; -- cgit v0.12 From d17a1cd32b4577a96245ac9894f678486443a516 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 30 Aug 2010 16:34:52 +0200 Subject: tst_qimage: backport fix of commit 0d7e683 into 4.7 --- tests/auto/qimage/tst_qimage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 49514dc..405eb98 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -1490,9 +1490,9 @@ void tst_QImage::smoothScale3() QRgb cb = b.pixel(x, y); // tolerate a little bit of rounding errors - QVERIFY(compare(qRed(ca), qRed(cb), 3)); - QVERIFY(compare(qGreen(ca), qGreen(cb), 3)); - QVERIFY(compare(qBlue(ca), qBlue(cb), 3)); + QVERIFY(compare(qRed(ca), qRed(cb), 16)); + QVERIFY(compare(qGreen(ca), qGreen(cb), 16)); + QVERIFY(compare(qBlue(ca), qBlue(cb), 16)); } } } -- cgit v0.12 From d0f1f569e27f7f34f3bfc03bd759f28f7b567997 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 30 Aug 2010 17:08:48 +0200 Subject: Fix QStaticText with OpenGL1 engine Like OpenGL2 and OpenVG, the OpenGL1 paint engine also transforms text coordinates itself and does not require QStaticText to use device coordinates. Task-number: QTBUG-13228 Reviewed-by: Samuel --- src/gui/painting/qpainter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index ee590a4..4e10671 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5863,7 +5863,8 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText } bool paintEngineSupportsTransformations = d->extended->type() == QPaintEngine::OpenGL2 - || d->extended->type() == QPaintEngine::OpenVG; + || d->extended->type() == QPaintEngine::OpenVG + || d->extended->type() == QPaintEngine::OpenGL; if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = true; -- cgit v0.12 From d1a588512cec7d5fea8ee53b9c0f102d27d1e687 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 Aug 2010 17:13:46 +0200 Subject: preserve non-standard source references the PO format doc suggests that all references are in filename:linennumber format, but some tools seem to deviate from that. so do our best to preserve such references, even if we can't do anything with them. Task-number: QTBUG-9488 --- tests/auto/linguist/lconvert/data/test-refs.po | 23 +++++++++++++++++++++++ tests/auto/linguist/lconvert/tst_lconvert.cpp | 2 ++ tools/linguist/shared/po.cpp | 24 ++++++++++++++++++++---- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 tests/auto/linguist/lconvert/data/test-refs.po diff --git a/tests/auto/linguist/lconvert/data/test-refs.po b/tests/auto/linguist/lconvert/data/test-refs.po new file mode 100644 index 0000000..e149a38 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-refs.po @@ -0,0 +1,23 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Language: de_DE\n" + +#: themer/kdmlabel.cpp:285 +#, no-c-format +msgctxt "date format" +msgid "%a %d %B" +msgstr "%a %d %B" + +#: foo.bar.baz +#, no-c-format +msgid "full java class name" +msgstr "" + +#: foo.car:123 monks:here file/gar.c:17:19 no:monks:here +#, no-c-format +msgid "some excessive locations" +msgstr "" diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 998f588..a3c29d8 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -317,6 +317,8 @@ void tst_lconvert::roundtrips_data() QTest::newRow("po-xliff-po (plural-2)") << "plural-2.po" << poXlfPo << noArgs; QTest::newRow("po-xliff-po (plural-3)") << "plural-3.po" << poXlfPo << noArgs; + QTest::newRow("po-ts-po (references)") << "test-refs.po" << poTsPo << noArgs; + QTest::newRow("ts20-ts11-ts20 (utf8)") << "codec-utf8.ts" << tsTs11Ts << noArgs; QTest::newRow("ts20-ts11-ts20 (cp1252)") << "codec-cp1252.ts" << tsTs11Ts << noArgs; QTest::newRow("ts20-ts11-ts20 (dual-encoding)") << "dual-encoding.ts" << tsTs11Ts << noArgs; diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index a58a0bf..3fd05ee 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -553,13 +553,26 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) TranslatorMessage msg; msg.setContext(codec->toUnicode(item.context)); if (!item.references.isEmpty()) { + QString xrefs; foreach (const QString &ref, codec->toUnicode(item.references).split( QRegExp(QLatin1String("\\s")), QString::SkipEmptyParts)) { - int pos = ref.lastIndexOf(QLatin1Char(':')); - if (pos != -1) - msg.addReference(ref.left(pos), ref.mid(pos + 1).toInt()); + int pos = ref.indexOf(QLatin1Char(':')); + int lpos = ref.lastIndexOf(QLatin1Char(':')); + if (pos != -1 && pos == lpos) { + bool ok; + int lno = ref.mid(pos + 1).toInt(&ok); + if (ok) { + msg.addReference(ref.left(pos), lno); + continue; + } + } + if (!xrefs.isEmpty()) + xrefs += QLatin1Char(' '); + xrefs += ref; } + if (!xrefs.isEmpty()) + item.extra[QLatin1String("po-references")] = xrefs; } msg.setId(codec->toUnicode(item.id)); msg.setSourceText(codec->toUnicode(item.msgId)); @@ -771,11 +784,14 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) if (!msg.id().isEmpty()) out << QLatin1String("#. ts-id ") << msg.id() << '\n'; - if (!msg.fileName().isEmpty()) { + QString xrefs = msg.extra(QLatin1String("po-references")); + if (!msg.fileName().isEmpty() || !xrefs.isEmpty()) { QStringList refs; foreach (const TranslatorMessage::Reference &ref, msg.allReferences()) refs.append(QString(QLatin1String("%2:%1")) .arg(ref.lineNumber()).arg(ref.fileName())); + if (!xrefs.isEmpty()) + refs << xrefs; out << poWrappedEscapedLines(QLatin1String("#:"), true, refs.join(QLatin1String(" "))); } -- cgit v0.12 From dfd489fd06bc4185f8e54c2b988ff2a1ee182731 Mon Sep 17 00:00:00 2001 From: miniak Date: Mon, 30 Aug 2010 18:12:28 +0200 Subject: Fix #pragma message(), the message must be enclosed in parentheses Merge-request: 796 Reviewed-by: Oswald Buddenhagen --- bin/syncqt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index f63f06a..4acb5b5 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -852,7 +852,7 @@ foreach (@modules_to_sync) { " #if defined(__GNUC__)\n" . " #warning \"$warning_msg\"\n" . " #elif defined(_MSC_VER)\n" . - " #pragma message \"WARNING: $warning_msg\"\n" . + " #pragma message(\"WARNING: $warning_msg\")\n" . " #endif\n". "#endif\n\n"; } -- cgit v0.12 From 23835db2131dfd25287de44419bae8797d128d21 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 31 Aug 2010 09:58:46 +1000 Subject: Add missing license headers Task-number: Reviewed-by: Martin Jones --- .../animation/easing/content/QuitButton.qml | 40 ++++++++++++++++++++++ .../declarative/toys/clocks/content/QuitButton.qml | 40 ++++++++++++++++++++++ .../dialcontrol/content/QuitButton.qml | 40 ++++++++++++++++++++++ 3 files changed, 120 insertions(+) diff --git a/examples/declarative/animation/easing/content/QuitButton.qml b/examples/declarative/animation/easing/content/QuitButton.qml index 70747a8..039694d 100644 --- a/examples/declarative/animation/easing/content/QuitButton.qml +++ b/examples/declarative/animation/easing/content/QuitButton.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + import Qt 4.7 Image { source: "quit.png" diff --git a/examples/declarative/toys/clocks/content/QuitButton.qml b/examples/declarative/toys/clocks/content/QuitButton.qml index 70747a8..039694d 100644 --- a/examples/declarative/toys/clocks/content/QuitButton.qml +++ b/examples/declarative/toys/clocks/content/QuitButton.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + import Qt 4.7 Image { source: "quit.png" diff --git a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml index 70747a8..039694d 100644 --- a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml +++ b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + import Qt 4.7 Image { source: "quit.png" -- cgit v0.12 From d01313b94e1eb8f8b9aa088433118459b588a79f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 31 Aug 2010 12:01:09 +1000 Subject: Improve calling QML functions from C++ docs. --- doc/src/declarative/extending.qdoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 5c4d5e7..6388764 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -965,6 +965,20 @@ Item { } \endcode +This may be connected to via QObject::connect() or called directly from C++ using +QMetaObject::invokeMethod(): + +\code + QDeclarativeEngine engine; + QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile("main.qml")); + QObject *object = component.create(context); + QVariant str("Hello"); + QMetaObject::invokeMethod(object, "say", Q_ARG(QVariant, str)); +\endcode + +Return values of type QVariant are also supported via Q_RETURN_ARG. + \section1 Defining new Components \target components -- cgit v0.12 From cfc3564328c9545a9eed4aca02f99dac5e0e4390 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 31 Aug 2010 12:38:12 +1000 Subject: Ensure Flickable visibleArea is updated when view height changes Task-number: QTBUG-13095 --- .../graphicsitems/qdeclarativeflickable.cpp | 4 ++ .../graphicsitems/qdeclarativelistview.cpp | 10 +++++ .../graphicsitems/qdeclarativelistview_p.h | 1 + .../qdeclarativelistview/data/listviewtest.qml | 6 +++ .../tst_qdeclarativelistview.cpp | 43 ++++++++++++++++++++++ 5 files changed, 64 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index a710190..63a2a77 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1001,12 +1001,16 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry, bool changed = false; if (newGeometry.width() != oldGeometry.width()) { + if (xflick()) + changed = true; if (d->hData.viewSize < 0) { d->contentItem->setWidth(width()); emit contentWidthChanged(); } } if (newGeometry.height() != oldGeometry.height()) { + if (yflick()) + changed = true; if (d->vData.viewSize < 0) { d->contentItem->setHeight(height()); emit contentHeightChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index d3d46f7..ef28ab2 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2454,6 +2454,16 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) QDeclarativeFlickable::keyPressEvent(event); } +void QDeclarativeListView::geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) +{ + Q_D(QDeclarativeListView); + d->maxExtentDirty = true; + d->minExtentDirty = true; + QDeclarativeFlickable::geometryChanged(newGeometry, oldGeometry); +} + + /*! \qmlmethod ListView::incrementCurrentIndex() diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 8fbff49..735b248 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -246,6 +246,7 @@ protected: virtual qreal minXExtent() const; virtual qreal maxXExtent() const; virtual void keyPressEvent(QKeyEvent *); + virtual void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry); virtual void componentComplete(); private Q_SLOTS: diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml index 3b2db5e..d5d3365 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml @@ -4,6 +4,12 @@ Rectangle { width: 240 height: 320 color: "#ffffff" + + property real hr: list.visibleArea.heightRatio + function heightRatio() { + return list.visibleArea.heightRatio + } + function checkProperties() { testObject.error = false; if (list.model != testModel) { diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index bf4754d..377a9e5 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -98,6 +98,7 @@ private slots: void manualHighlight(); void QTBUG_11105(); void footer(); + void resizeView(); private: template void items(); @@ -1591,6 +1592,48 @@ void tst_QDeclarativeListView::footer() QTRY_COMPARE(footer->y(), 0.0); } +void tst_QDeclarativeListView::resizeView() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 40; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // Confirm items positioned correctly + int itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); + } + + QVariant heightRatio; + QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio)); + QCOMPARE(heightRatio.toReal(), 0.4); + + listview->setHeight(200); + + QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio)); + QCOMPARE(heightRatio.toReal(), 0.25); +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); -- cgit v0.12 From 3928cb20ecc63ed21cdb122388b200c9ab8e7cad Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 31 Aug 2010 12:41:52 +1000 Subject: Add 'cached' property to Image. Task-number: QTBUG-7300 Reviewed-by: Aaron Kennedy --- .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 4 +-- .../graphicsitems/qdeclarativeborderimage.cpp | 14 +++++++++-- .../graphicsitems/qdeclarativeimage.cpp | 8 ++++++ .../graphicsitems/qdeclarativeimagebase.cpp | 25 ++++++++++++++++++- .../graphicsitems/qdeclarativeimagebase_p.h | 6 ++++- .../graphicsitems/qdeclarativeimagebase_p_p.h | 4 ++- src/declarative/util/qdeclarativepixmapcache.cpp | 22 ++++++++-------- src/declarative/util/qdeclarativepixmapcache_p.h | 12 +++++++-- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 29 +++++++++++++++------- 9 files changed, 96 insertions(+), 28 deletions(-) diff --git a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml index dadb409..d1f0755 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -88,11 +88,11 @@ Package { } BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } Image { - id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content) + id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cached: false fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height } Image { - id: hqImage; smooth: true; source: ""; visible: false + id: hqImage; smooth: true; source: ""; visible: false; cached: false fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height } Binding { diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index f16770b..7299664 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -211,7 +211,12 @@ void QDeclarativeBorderImage::load() } } else { - d->pix.load(qmlEngine(this), d->url, d->async); + QDeclarativePixmap::Options options; + if (d->async) + options |= QDeclarativePixmap::Asynchronous; + if (d->cached) + options |= QDeclarativePixmap::Cached; + d->pix.load(qmlEngine(this), d->url, options); if (d->pix.isLoading()) { d->pix.connectFinished(this, SLOT(requestFinished())); @@ -328,7 +333,12 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl())); - d->pix.load(qmlEngine(this), d->sciurl, d->async); + QDeclarativePixmap::Options options; + if (d->async) + options |= QDeclarativePixmap::Asynchronous; + if (d->cached) + options |= QDeclarativePixmap::Cached; + d->pix.load(qmlEngine(this), d->sciurl, options); if (d->pix.isLoading()) { static int thisRequestProgress = -1; diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 7a88e78..4ae0887 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -414,6 +414,14 @@ void QDeclarativeImage::geometryChanged(const QRectF &newGeometry, const QRectF are always loaded asynchonously. */ +/*! + \qmlproperty bool Image::cached + + Specifies that the image should be cached. The default value is + true. Setting \a cached to false is useful when dealing with large images, + to make sure that they aren't cached at the expense of small 'ui element' images. +*/ + void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_D(QDeclarativeImage); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index 416604b..2fc935f 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -126,6 +126,24 @@ QSize QDeclarativeImageBase::sourceSize() const return d->sourcesize.isValid() ? d->sourcesize : QSize(implicitWidth(),implicitHeight()); } +bool QDeclarativeImageBase::cached() const +{ + Q_D(const QDeclarativeImageBase); + return d->cached; +} + +void QDeclarativeImageBase::setCached(bool cached) +{ + Q_D(QDeclarativeImageBase); + if (d->cached == cached) + return; + + d->cached = cached; + emit cachedChanged(); + if (isComponentComplete()) + load(); +} + void QDeclarativeImageBase::load() { Q_D(QDeclarativeImageBase); @@ -150,7 +168,12 @@ void QDeclarativeImageBase::load() d->status = Loading; emit statusChanged(d->status); - d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async); + QDeclarativePixmap::Options options; + if (d->async) + options |= QDeclarativePixmap::Asynchronous; + if (d->cached) + options |= QDeclarativePixmap::Cached; + d->pix.load(qmlEngine(this), d->url, d->sourcesize, options); if (d->pix.isLoading()) { diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index f5896b1..b6d2a44 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -58,7 +58,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) - + Q_PROPERTY(bool cached READ cached WRITE setCached NOTIFY cachedChanged) Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) public: @@ -73,6 +73,9 @@ public: bool asynchronous() const; void setAsynchronous(bool); + bool cached() const; + void setCached(bool); + virtual void setSourceSize(const QSize&); QSize sourceSize() const; @@ -82,6 +85,7 @@ Q_SIGNALS: void statusChanged(Status); void progressChanged(qreal progress); void asynchronousChanged(); + void cachedChanged(); protected: virtual void load(); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index aee8b28..ba9f38f 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -69,7 +69,8 @@ public: QDeclarativeImageBasePrivate() : status(QDeclarativeImageBase::Null), progress(0.0), - async(false) + async(false), + cached(true) { QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } @@ -80,6 +81,7 @@ public: qreal progress; QSize sourcesize; bool async : 1; + bool cached : 1; }; QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index de2de21..1177d07 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -956,20 +956,20 @@ QRect QDeclarativePixmap::rect() const void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url) { - load(engine, url, QSize(), false); + load(engine, url, QSize(), QDeclarativePixmap::Cached); } -void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, bool async) +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, QDeclarativePixmap::Options options) { - load(engine, url, QSize(), async); + load(engine, url, QSize(), options); } void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &size) { - load(engine, url, size, false); + load(engine, url, size, QDeclarativePixmap::Cached); } -void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, bool async) +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, QDeclarativePixmap::Options options) { if (d) { d->release(); d = 0; } @@ -979,19 +979,20 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QHash::Iterator iter = store->m_cache.find(key); if (iter == store->m_cache.end()) { - if (async) { + if (options & QDeclarativePixmap::Asynchronous) { // pixmaps can only be loaded synchronously if (url.scheme() == QLatin1String("image") && QDeclarativeEnginePrivate::get(engine)->getImageProviderType(url) == QDeclarativeImageProvider::Pixmap) { - async = false; + options &= ~QDeclarativePixmap::Asynchronous; } } - if (!async) { + if (!(options & QDeclarativePixmap::Asynchronous)) { bool ok = false; d = createPixmapDataSync(engine, url, requestSize, &ok); if (ok) { - d->addToCache(); + if (options & QDeclarativePixmap::Cached) + d->addToCache(); return; } if (d) // loadable, but encountered error while loading @@ -1004,7 +1005,8 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QDeclarativePixmapReader *reader = QDeclarativePixmapReader::instance(engine); d = new QDeclarativePixmapData(url, requestSize); - d->addToCache(); + if (options & QDeclarativePixmap::Cached) + d->addToCache(); d->reply = reader->getImage(d); } else { diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index b4d88bd..2c246c4 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -66,6 +66,12 @@ public: enum Status { Null, Ready, Error, Loading }; + enum Option { + Asynchronous = 0x00000001, + Cached = 0x00000002 + }; + Q_DECLARE_FLAGS(Options, Option) + bool isNull() const; bool isReady() const; bool isError() const; @@ -85,9 +91,9 @@ public: inline operator const QPixmap &() const; void load(QDeclarativeEngine *, const QUrl &); - void load(QDeclarativeEngine *, const QUrl &, bool); + void load(QDeclarativeEngine *, const QUrl &, QDeclarativePixmap::Options options); void load(QDeclarativeEngine *, const QUrl &, const QSize &); - void load(QDeclarativeEngine *, const QUrl &, const QSize &, bool); + void load(QDeclarativeEngine *, const QUrl &, const QSize &, QDeclarativePixmap::Options options); void clear(); void clear(QObject *); @@ -107,6 +113,8 @@ inline QDeclarativePixmap::operator const QPixmap &() const return pixmap(); } +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePixmap::Options) + QT_END_NAMESPACE QT_END_HEADER diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 8cfb487..524736f 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -127,19 +127,21 @@ void tst_qdeclarativeimage::imageSource_data() QTest::addColumn("height"); QTest::addColumn("remote"); QTest::addColumn("async"); + QTest::addColumn("cached"); QTest::addColumn("error"); - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << ""; - QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << ""; + QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << true << ""; + QTest::newRow("local no cache") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << false << ""; + QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << true << ""; QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << 0.0 << 0.0 << false - << false << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString(); + << false << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString(); QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false - << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString(); - QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << ""; - QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << ""; - QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << ""; + << true << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString(); + QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << true << ""; + QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << false << ""; + QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << false << ""; QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true - << false << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; + << false << true << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; } @@ -150,6 +152,7 @@ void tst_qdeclarativeimage::imageSource() QFETCH(double, height); QFETCH(bool, remote); QFETCH(bool, async); + QFETCH(bool, cached); QFETCH(QString, error); TestHTTPServer server(SERVER_PORT); @@ -163,7 +166,8 @@ void tst_qdeclarativeimage::imageSource() QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; asynchronous: " - + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; + + (async ? QLatin1String("true") : QLatin1String("false")) + "; cached: " + + (cached ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -171,6 +175,13 @@ void tst_qdeclarativeimage::imageSource() if (async) QVERIFY(obj->asynchronous() == true); + else + QVERIFY(obj->asynchronous() == false); + + if (cached) + QVERIFY(obj->cached() == true); + else + QVERIFY(obj->cached() == false); if (remote || async) TRY_WAIT(obj->status() == QDeclarativeImage::Loading); -- cgit v0.12 From 33b1332d1b8593f488cf5f926315a6df68eee7df Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 31 Aug 2010 13:23:40 +1000 Subject: Revert "Add 'cached' property to Image." This will have to go in 4.8. This reverts commit 3928cb20ecc63ed21cdb122388b200c9ab8e7cad. --- .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 4 +-- .../graphicsitems/qdeclarativeborderimage.cpp | 14 ++--------- .../graphicsitems/qdeclarativeimage.cpp | 8 ------ .../graphicsitems/qdeclarativeimagebase.cpp | 25 +------------------ .../graphicsitems/qdeclarativeimagebase_p.h | 6 +---- .../graphicsitems/qdeclarativeimagebase_p_p.h | 4 +-- src/declarative/util/qdeclarativepixmapcache.cpp | 22 ++++++++-------- src/declarative/util/qdeclarativepixmapcache_p.h | 12 ++------- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 29 +++++++--------------- 9 files changed, 28 insertions(+), 96 deletions(-) diff --git a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml index d1f0755..dadb409 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -88,11 +88,11 @@ Package { } BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } Image { - id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cached: false + id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content) fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height } Image { - id: hqImage; smooth: true; source: ""; visible: false; cached: false + id: hqImage; smooth: true; source: ""; visible: false fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height } Binding { diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 7299664..f16770b 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -211,12 +211,7 @@ void QDeclarativeBorderImage::load() } } else { - QDeclarativePixmap::Options options; - if (d->async) - options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; - d->pix.load(qmlEngine(this), d->url, options); + d->pix.load(qmlEngine(this), d->url, d->async); if (d->pix.isLoading()) { d->pix.connectFinished(this, SLOT(requestFinished())); @@ -333,12 +328,7 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl())); - QDeclarativePixmap::Options options; - if (d->async) - options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; - d->pix.load(qmlEngine(this), d->sciurl, options); + d->pix.load(qmlEngine(this), d->sciurl, d->async); if (d->pix.isLoading()) { static int thisRequestProgress = -1; diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 4ae0887..7a88e78 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -414,14 +414,6 @@ void QDeclarativeImage::geometryChanged(const QRectF &newGeometry, const QRectF are always loaded asynchonously. */ -/*! - \qmlproperty bool Image::cached - - Specifies that the image should be cached. The default value is - true. Setting \a cached to false is useful when dealing with large images, - to make sure that they aren't cached at the expense of small 'ui element' images. -*/ - void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_D(QDeclarativeImage); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index 2fc935f..416604b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -126,24 +126,6 @@ QSize QDeclarativeImageBase::sourceSize() const return d->sourcesize.isValid() ? d->sourcesize : QSize(implicitWidth(),implicitHeight()); } -bool QDeclarativeImageBase::cached() const -{ - Q_D(const QDeclarativeImageBase); - return d->cached; -} - -void QDeclarativeImageBase::setCached(bool cached) -{ - Q_D(QDeclarativeImageBase); - if (d->cached == cached) - return; - - d->cached = cached; - emit cachedChanged(); - if (isComponentComplete()) - load(); -} - void QDeclarativeImageBase::load() { Q_D(QDeclarativeImageBase); @@ -168,12 +150,7 @@ void QDeclarativeImageBase::load() d->status = Loading; emit statusChanged(d->status); - QDeclarativePixmap::Options options; - if (d->async) - options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; - d->pix.load(qmlEngine(this), d->url, d->sourcesize, options); + d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async); if (d->pix.isLoading()) { diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index b6d2a44..f5896b1 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -58,7 +58,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) - Q_PROPERTY(bool cached READ cached WRITE setCached NOTIFY cachedChanged) + Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) public: @@ -73,9 +73,6 @@ public: bool asynchronous() const; void setAsynchronous(bool); - bool cached() const; - void setCached(bool); - virtual void setSourceSize(const QSize&); QSize sourceSize() const; @@ -85,7 +82,6 @@ Q_SIGNALS: void statusChanged(Status); void progressChanged(qreal progress); void asynchronousChanged(); - void cachedChanged(); protected: virtual void load(); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index ba9f38f..aee8b28 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -69,8 +69,7 @@ public: QDeclarativeImageBasePrivate() : status(QDeclarativeImageBase::Null), progress(0.0), - async(false), - cached(true) + async(false) { QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } @@ -81,7 +80,6 @@ public: qreal progress; QSize sourcesize; bool async : 1; - bool cached : 1; }; QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index 1177d07..de2de21 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -956,20 +956,20 @@ QRect QDeclarativePixmap::rect() const void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url) { - load(engine, url, QSize(), QDeclarativePixmap::Cached); + load(engine, url, QSize(), false); } -void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, QDeclarativePixmap::Options options) +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, bool async) { - load(engine, url, QSize(), options); + load(engine, url, QSize(), async); } void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &size) { - load(engine, url, size, QDeclarativePixmap::Cached); + load(engine, url, size, false); } -void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, QDeclarativePixmap::Options options) +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, bool async) { if (d) { d->release(); d = 0; } @@ -979,20 +979,19 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QHash::Iterator iter = store->m_cache.find(key); if (iter == store->m_cache.end()) { - if (options & QDeclarativePixmap::Asynchronous) { + if (async) { // pixmaps can only be loaded synchronously if (url.scheme() == QLatin1String("image") && QDeclarativeEnginePrivate::get(engine)->getImageProviderType(url) == QDeclarativeImageProvider::Pixmap) { - options &= ~QDeclarativePixmap::Asynchronous; + async = false; } } - if (!(options & QDeclarativePixmap::Asynchronous)) { + if (!async) { bool ok = false; d = createPixmapDataSync(engine, url, requestSize, &ok); if (ok) { - if (options & QDeclarativePixmap::Cached) - d->addToCache(); + d->addToCache(); return; } if (d) // loadable, but encountered error while loading @@ -1005,8 +1004,7 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QDeclarativePixmapReader *reader = QDeclarativePixmapReader::instance(engine); d = new QDeclarativePixmapData(url, requestSize); - if (options & QDeclarativePixmap::Cached) - d->addToCache(); + d->addToCache(); d->reply = reader->getImage(d); } else { diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index 2c246c4..b4d88bd 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -66,12 +66,6 @@ public: enum Status { Null, Ready, Error, Loading }; - enum Option { - Asynchronous = 0x00000001, - Cached = 0x00000002 - }; - Q_DECLARE_FLAGS(Options, Option) - bool isNull() const; bool isReady() const; bool isError() const; @@ -91,9 +85,9 @@ public: inline operator const QPixmap &() const; void load(QDeclarativeEngine *, const QUrl &); - void load(QDeclarativeEngine *, const QUrl &, QDeclarativePixmap::Options options); + void load(QDeclarativeEngine *, const QUrl &, bool); void load(QDeclarativeEngine *, const QUrl &, const QSize &); - void load(QDeclarativeEngine *, const QUrl &, const QSize &, QDeclarativePixmap::Options options); + void load(QDeclarativeEngine *, const QUrl &, const QSize &, bool); void clear(); void clear(QObject *); @@ -113,8 +107,6 @@ inline QDeclarativePixmap::operator const QPixmap &() const return pixmap(); } -Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePixmap::Options) - QT_END_NAMESPACE QT_END_HEADER diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 524736f..8cfb487 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -127,21 +127,19 @@ void tst_qdeclarativeimage::imageSource_data() QTest::addColumn("height"); QTest::addColumn("remote"); QTest::addColumn("async"); - QTest::addColumn("cached"); QTest::addColumn("error"); - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << true << ""; - QTest::newRow("local no cache") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << false << ""; - QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << true << ""; + QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << ""; + QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << ""; QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << 0.0 << 0.0 << false - << false << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString(); + << false << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString(); QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false - << true << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString(); - QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << true << ""; - QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << false << ""; - QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << false << ""; + << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString(); + QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << ""; + QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << ""; + QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << ""; QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true - << false << true << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; + << false << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; } @@ -152,7 +150,6 @@ void tst_qdeclarativeimage::imageSource() QFETCH(double, height); QFETCH(bool, remote); QFETCH(bool, async); - QFETCH(bool, cached); QFETCH(QString, error); TestHTTPServer server(SERVER_PORT); @@ -166,8 +163,7 @@ void tst_qdeclarativeimage::imageSource() QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; asynchronous: " - + (async ? QLatin1String("true") : QLatin1String("false")) + "; cached: " - + (cached ? QLatin1String("true") : QLatin1String("false")) + " }"; + + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -175,13 +171,6 @@ void tst_qdeclarativeimage::imageSource() if (async) QVERIFY(obj->asynchronous() == true); - else - QVERIFY(obj->asynchronous() == false); - - if (cached) - QVERIFY(obj->cached() == true); - else - QVERIFY(obj->cached() == false); if (remote || async) TRY_WAIT(obj->status() == QDeclarativeImage::Loading); -- cgit v0.12 From 4d262c4e96f7bce1e1b4e96ee21949d05df75da1 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 31 Aug 2010 13:52:30 +1000 Subject: Notify QML internal notifiers of item geometry changes before QML signal handlers. Task-number: QTBUG-12303 Reviewed-by: Aaron Kennedy --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 1054898..aca2bb7 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1883,6 +1883,12 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, } } + for(int ii = 0; ii < d->changeListeners.count(); ++ii) { + const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii); + if (change.types & QDeclarativeItemPrivate::Geometry) + change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); + } + if (newGeometry.x() != oldGeometry.x()) emit xChanged(); if (newGeometry.width() != oldGeometry.width()) @@ -1891,12 +1897,6 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, emit yChanged(); if (newGeometry.height() != oldGeometry.height()) emit heightChanged(); - - for(int ii = 0; ii < d->changeListeners.count(); ++ii) { - const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii); - if (change.types & QDeclarativeItemPrivate::Geometry) - change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); - } } void QDeclarativeItemPrivate::removeItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types) -- cgit v0.12 From 0a3d5098320a72853bad643f01b08774af131cb4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 31 Aug 2010 14:59:26 +1000 Subject: Don't double call classBegin() QTBUG-13114 --- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- .../data/DontDoubleCallClassBeginItem.qml | 4 ++++ .../data/dontDoubleCallClassBegin.qml | 5 +++++ .../auto/declarative/qdeclarativelanguage/testtypes.cpp | 1 + tests/auto/declarative/qdeclarativelanguage/testtypes.h | 17 ++++++++++++++++- .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 15 +++++++++++++++ 6 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index a6b0b34..5bfe5b2 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -974,7 +974,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) } // Begin the class - if (obj->parserStatusCast != -1) { + if (tr.type && obj->parserStatusCast != -1) { QDeclarativeInstruction begin; begin.type = QDeclarativeInstruction::BeginObject; begin.begin.castValue = obj->parserStatusCast; diff --git a/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml b/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml new file mode 100644 index 0000000..1f8eac8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml @@ -0,0 +1,4 @@ +import Test 1.0 + +MyParserStatus { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml b/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml new file mode 100644 index 0000000..df048cc --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +Item { + property QtObject object: DontDoubleCallClassBeginItem {} +} diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index 5d87404..20cd976 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -50,6 +50,7 @@ void registerTypes() qmlRegisterType("Test",1,0,"MyDotPropertyObject"); qmlRegisterType("Test",1,0,"MyNamespacedType"); qmlRegisterType("Test",1,0,"MySecondNamespacedType"); + qmlRegisterType("Test",1,0,"MyParserStatus"); qmlRegisterType(); qmlRegisterCustomType("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser); diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index acbe219..19790f1 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -170,7 +170,6 @@ private: QML_DECLARE_TYPE(MyQmlObject) QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) - class MyGroupedObject : public QObject { Q_OBJECT @@ -576,6 +575,22 @@ public: void setCustomData(QObject *, const QByteArray &) {} }; +class MyParserStatus : public QObject, public QDeclarativeParserStatus +{ + Q_OBJECT +public: + MyParserStatus() : m_cbc(0), m_ccc(0) {} + + int classBeginCount() const { return m_cbc; } + int componentCompleteCount() const { return m_ccc; } + + virtual void classBegin() { m_cbc++; } + virtual void componentComplete() { m_ccc++; } +private: + int m_cbc; + int m_ccc; +}; + void registerTypes(); #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index fcdf926..b43fbf4 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -126,6 +126,7 @@ private slots: void scriptString(); void defaultPropertyListOrder(); void declaredPropertyValues(); + void dontDoubleCallClassBegin(); void basicRemote_data(); void basicRemote(); @@ -1192,6 +1193,20 @@ void tst_qdeclarativelanguage::declaredPropertyValues() VERIFY_ERRORS(0); } +void tst_qdeclarativelanguage::dontDoubleCallClassBegin() +{ + QDeclarativeComponent component(&engine, TEST_FILE("dontDoubleCallClassBegin.qml")); + QObject *o = component.create(); + QVERIFY(o); + + MyParserStatus *o2 = qobject_cast(qvariant_cast(o->property("object"))); + QVERIFY(o2); + QCOMPARE(o2->classBeginCount(), 1); + QCOMPARE(o2->componentCompleteCount(), 1); + + delete o; +} + // Check that first child of qml is of given type. Empty type insists on error. void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type, const QString& expectederror) { -- cgit v0.12 From eb0307cac2f6c35094ffcf7de782881cb440cf2f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 31 Aug 2010 17:37:30 +1000 Subject: Ignore non-scriptable properties in QML QTBUG-13043 --- src/declarative/qml/qdeclarativecompiler.cpp | 14 ++++++-- src/declarative/qml/qdeclarativepropertycache.cpp | 38 +++++++++++++++++----- src/declarative/qml/qmetaobjectbuilder.cpp | 4 +-- .../qdeclarativeecmascript/data/nonscriptable.qml | 19 +++++++++++ .../declarative/qdeclarativeecmascript/testtypes.h | 5 +++ .../tst_qdeclarativeecmascript.cpp | 12 +++++++ .../data/invalidAlias.7.errors.txt | 1 + .../qdeclarativelanguage/data/invalidAlias.7.qml | 6 ++++ .../data/nonScriptableProperty.errors.txt | 1 + .../data/nonScriptableProperty.qml | 5 +++ .../declarative/qdeclarativelanguage/testtypes.h | 4 +++ .../tst_qdeclarativelanguage.cpp | 2 ++ .../qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp | 12 +++---- 13 files changed, 104 insertions(+), 19 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 5bfe5b2..7847303 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1362,7 +1362,7 @@ bool QDeclarativeCompiler::doesPropertyExist(QDeclarativeParser::Property *prop, return p.name() != 0; } else { int idx = mo->indexOfProperty(prop->name.constData()); - return idx != -1; + return idx != -1 && mo->property(idx).isScriptable(); } } @@ -1427,6 +1427,11 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, if (prop->index != -1) { p = metaObject->property(prop->index); Q_ASSERT(p.name()); + + if (!p.isScriptable()) { + prop->index = -1; + p = QMetaProperty(); + } } } @@ -1813,6 +1818,8 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, if (idx == -1) COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); QMetaProperty p = type->metaObject()->property(idx); + if (!p.isScriptable()) + COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); prop->index = idx; prop->type = p.userType(); prop->isValueTypeSubProperty = true; @@ -2406,7 +2413,6 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn builder.addSignal(p.name + "Changed()"); QMetaPropertyBuilder propBuilder = builder.addProperty(p.name, type, builder.methodCount() - 1); - propBuilder.setScriptable(true); propBuilder.setWritable(!readonly); } @@ -2572,6 +2578,9 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx); + if (!aliasProperty.isScriptable()) + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + writable = aliasProperty.isWritable(); if (aliasProperty.isEnumType()) @@ -2608,7 +2617,6 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, builder.addSignal(prop.name + "Changed()"); QMetaPropertyBuilder propBuilder = builder.addProperty(prop.name, typeName.constData(), builder.methodCount() - 1); - propBuilder.setScriptable(true); propBuilder.setWritable(writable); return true; } diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 839d79f..1121a8d 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -134,8 +134,9 @@ QDeclarativePropertyCache::~QDeclarativePropertyCache() void QDeclarativePropertyCache::clear() { - for (int ii = 0; ii < indexCache.count(); ++ii) - indexCache.at(ii)->release(); + for (int ii = 0; ii < indexCache.count(); ++ii) { + if (indexCache.at(ii)) indexCache.at(ii)->release(); + } for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter) @@ -156,10 +157,23 @@ QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObj Q_ASSERT(metaObject); QDeclarativePropertyCache::Data rv; - int idx = metaObject->indexOfProperty(property.toUtf8()); - if (idx != -1) { - rv.load(metaObject->property(idx)); - return rv; + { + const QMetaObject *cmo = metaObject; + while (cmo) { + int idx = metaObject->indexOfProperty(property.toUtf8()); + if (idx != -1) { + QMetaProperty p = metaObject->property(idx); + if (p.isScriptable()) { + rv.load(metaObject->property(idx)); + return rv; + } else { + while (cmo && cmo->propertyOffset() >= idx) + cmo = cmo->superClass(); + } + } else { + cmo = 0; + } + } } int methodCount = metaObject->methodCount(); @@ -189,8 +203,9 @@ QDeclarativePropertyCache *QDeclarativePropertyCache::copy() const cache->stringCache = stringCache; cache->identifierCache = identifierCache; - for (int ii = 0; ii < indexCache.count(); ++ii) - indexCache.at(ii)->addref(); + for (int ii = 0; ii < indexCache.count(); ++ii) { + if (indexCache.at(ii)) indexCache.at(ii)->addref(); + } for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter) (*iter)->addref(); for (IdentifierCache::ConstIterator iter = identifierCache.begin(); iter != identifierCache.end(); ++iter) @@ -210,6 +225,9 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb indexCache.resize(propCount); for (int ii = propOffset; ii < propCount; ++ii) { QMetaProperty p = metaObject->property(ii); + if (!p.isScriptable()) + continue; + QString propName = QString::fromUtf8(p.name()); RData *data = new RData; @@ -275,6 +293,10 @@ void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaOb indexCache.resize(propCount); for (int ii = propCount - 1; ii >= 0; --ii) { QMetaProperty p = metaObject->property(ii); + if (!p.isScriptable()) { + indexCache[ii] = 0; + continue; + } QString propName = QString::fromUtf8(p.name()); RData *data = new RData; diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp index 0954248..58f8811 100644 --- a/src/declarative/qml/qmetaobjectbuilder.cpp +++ b/src/declarative/qml/qmetaobjectbuilder.cpp @@ -205,7 +205,7 @@ public: (const QByteArray& _name, const QByteArray& _type, int notifierIdx=-1) : name(_name), type(QMetaObject::normalizedType(_type.constData())), - flags(Readable | Writable), notifySignal(-1) + flags(Readable | Writable | Scriptable), notifySignal(-1) { if (notifierIdx >= 0) { flags |= Notify; @@ -2187,7 +2187,7 @@ bool QMetaPropertyBuilder::isDesignable() const /*! Returns true if the property is scriptable; otherwise returns false. - This default value is false. + This default value is true. \sa setScriptable(), isDesignable(), isStored() */ diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml new file mode 100644 index 0000000..024d82e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml @@ -0,0 +1,19 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + + property bool readOk: false; + property bool writeOk: false + + Component.onCompleted: { + readOk = (root.nonscriptable == undefined); + + try { + root.nonscriptable = 10 + } catch (e) { + writeOk = true; + } + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 37d6dbd..7d7e3d9 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -92,6 +92,7 @@ class MyQmlObject : public QObject Q_PROPERTY(QDeclarativeListProperty objectListProperty READ objectListProperty CONSTANT) Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp) + Q_PROPERTY(int nonscriptable READ nonscriptable WRITE setNonscriptable SCRIPTABLE false); public: MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} @@ -144,6 +145,10 @@ public: void setRegExp(const QRegExp ®Exp) { m_regExp = regExp; } int console() const { return 11; } + + int nonscriptable() const { return 0; } + void setNonscriptable(int) {} + signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index a6d2dac..c01d756 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -157,6 +157,7 @@ private slots: void qtbug_10696(); void qtbug_11606(); void qtbug_11600(); + void nonscriptable(); void include(); @@ -2530,6 +2531,17 @@ void tst_qdeclarativeecmascript::qtbug_11600() delete o; } +// Reading and writing non-scriptable properties should fail +void tst_qdeclarativeecmascript::nonscriptable() +{ + QDeclarativeComponent component(&engine, TEST_FILE("nonscriptable.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("readOk").toBool(), true); + QCOMPARE(o->property("writeOk").toBool(), true); + delete o; +} + QTEST_MAIN(tst_qdeclarativeecmascript) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt new file mode 100644 index 0000000..93652a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml new file mode 100644 index 0000000..2a09648 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.nonScriptable +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt new file mode 100644 index 0000000..cdfa4b2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign to non-existent property "nonScriptable" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml new file mode 100644 index 0000000..bd59bc8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyQmlObject { + nonScriptable: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index 19790f1..ac55bae 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -112,6 +112,7 @@ class MyQmlObject : public QObject, public MyInterface Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType) Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) + Q_PROPERTY(int nonScriptable READ nonScriptable WRITE setNonScriptable SCRIPTABLE false); Q_INTERFACES(MyInterface) public: @@ -150,6 +151,9 @@ public: int propertyWithNotify() const { return m_propertyWithNotify; } void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); } + + int nonScriptable() const { return 0; } + void setNonScriptable(int) {} public slots: void basicSlot() { qWarning("MyQmlObject::basicSlot"); } void basicSlotWithArgs(int v) { qWarning("MyQmlObject::basicSlotWithArgs(%d)", v); } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index b43fbf4..fc78663 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -343,6 +343,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidAlias.4") << "invalidAlias.4.qml" << "invalidAlias.4.errors.txt" << false; QTest::newRow("invalidAlias.5") << "invalidAlias.5.qml" << "invalidAlias.5.errors.txt" << false; QTest::newRow("invalidAlias.6") << "invalidAlias.6.qml" << "invalidAlias.6.errors.txt" << false; + QTest::newRow("invalidAlias.7") << "invalidAlias.7.qml" << "invalidAlias.7.errors.txt" << false; QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false; QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false; @@ -373,6 +374,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("assignToNamespace") << "assignToNamespace.qml" << "assignToNamespace.errors.txt" << false; QTest::newRow("invalidOn") << "invalidOn.qml" << "invalidOn.errors.txt" << false; QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false; + QTest::newRow("nonScriptableProperty") << "nonScriptableProperty.qml" << "nonScriptableProperty.errors.txt" << false; } diff --git a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 8ba9d45..0f6d531 100644 --- a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -558,7 +558,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(prop1.isWritable()); QVERIFY(!prop1.isResettable()); QVERIFY(!prop1.isDesignable()); - QVERIFY(!prop1.isScriptable()); + QVERIFY(prop1.isScriptable()); QVERIFY(!prop1.isStored()); QVERIFY(!prop1.isEditable()); QVERIFY(!prop1.isUser()); @@ -577,7 +577,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(prop2.isWritable()); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); @@ -599,7 +599,7 @@ void tst_QMetaObjectBuilder::property() prop1.setWritable(false); prop1.setResettable(true); prop1.setDesignable(true); - prop1.setScriptable(true); + prop1.setScriptable(false); prop1.setStored(true); prop1.setEditable(true); prop1.setUser(true); @@ -614,7 +614,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(!prop1.isWritable()); QVERIFY(prop1.isResettable()); QVERIFY(prop1.isDesignable()); - QVERIFY(prop1.isScriptable()); + QVERIFY(!prop1.isScriptable()); QVERIFY(prop1.isStored()); QVERIFY(prop1.isEditable()); QVERIFY(prop1.isUser()); @@ -627,7 +627,7 @@ void tst_QMetaObjectBuilder::property() QCOMPARE(prop2.type(), QByteArray("int")); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); @@ -643,7 +643,7 @@ void tst_QMetaObjectBuilder::property() QCOMPARE(prop2.type(), QByteArray("int")); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); -- cgit v0.12 From 07095fe95200112ba14bf728148d03f579940c28 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 31 Aug 2010 17:56:11 +1000 Subject: Prevent calling deleteLater() from QML QTBUG-13045 --- src/declarative/qml/qdeclarativepropertycache.cpp | 4 ++-- .../qdeclarativeecmascript/data/deleteLater.qml | 14 ++++++++++++++ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 10 ++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 1121a8d..08503c2 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -177,7 +177,7 @@ QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObj } int methodCount = metaObject->methodCount(); - for (int ii = methodCount - 1; ii >= 2; --ii) { // >=2 to block the destroyed signal + for (int ii = methodCount - 1; ii >= 3; --ii) { // >=3 to block the destroyed signal and deleteLater() slot QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; @@ -316,7 +316,7 @@ void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaOb } int methodCount = metaObject->methodCount(); - for (int ii = methodCount - 1; ii >= 2; --ii) { // >=2 to block the destroyed signal + for (int ii = methodCount - 1; ii >= 3; --ii) { // >=3 to block the destroyed signal and deleteLater() slot QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml new file mode 100644 index 0000000..6d23e5f7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +QtObject { + id: root + property bool test: false + + Component.onCompleted: { + try { + root.deleteLater() + } catch(e) { + test = true; + } + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index c01d756..496cc05 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -158,6 +158,7 @@ private slots: void qtbug_11606(); void qtbug_11600(); void nonscriptable(); + void deleteLater(); void include(); @@ -2542,6 +2543,15 @@ void tst_qdeclarativeecmascript::nonscriptable() delete o; } +// deleteLater() should not be callable from QML +void tst_qdeclarativeecmascript::deleteLater() +{ + QDeclarativeComponent component(&engine, TEST_FILE("deleteLater.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} QTEST_MAIN(tst_qdeclarativeecmascript) -- cgit v0.12 From 63aa8c467941cf6cb19fc6fcad5c0efde0b53216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 24 Aug 2010 16:22:40 +0200 Subject: Made QT_GL_SWAPBUFFER_PRESERVE=1 with the GL graphics system work. On desktop, we should just do swapBuffers() in swapRegion(). Reviewed-by: Trond --- src/opengl/qgl.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 943a195..c49dba4 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2103,11 +2103,8 @@ void QGLContextPrivate::syncGlState() #ifdef QT_NO_EGL void QGLContextPrivate::swapRegion(const QRegion *) { - static bool firstWarning = true; - if (firstWarning) { - qWarning() << "::swapRegion called but not supported!"; - firstWarning = false; - } + Q_Q(QGLContext); + q->swapBuffers(); } #endif -- cgit v0.12 From 34d0cd1e65644970d890e52bd3c880fc941d99f9 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 27 Aug 2010 09:28:40 +0200 Subject: Clear the QGLWindowSurface in ::beginPaint when needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2462 Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index b86fb78..d602000 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -426,6 +426,20 @@ static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, void QGLWindowSurface::beginPaint(const QRegion &) { + if (! context()) + return; + + int clearFlags = 0; + + if (context()->d_func()->workaround_needsFullClearOnEveryFrame) + clearFlags = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; + else if (context()->format().alpha()) + clearFlags = GL_COLOR_BUFFER_BIT; + + if (clearFlags) { + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(clearFlags); + } } void QGLWindowSurface::endPaint(const QRegion &rgn) -- cgit v0.12 From e9e0d32bb9c37f42740ffaa8145c30dc5da491d4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 31 Aug 2010 18:19:51 +1000 Subject: Center and clip QML startup animation so it looks correct in fullscreen QTBUG-12831 --- tools/qml/startup/startup.qml | 88 +++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml index be67598..ddc7217 100644 --- a/tools/qml/startup/startup.qml +++ b/tools/qml/startup/startup.qml @@ -49,14 +49,53 @@ Rectangle { Component.onCompleted: treatsApp.state = "part1" signal animationFinished - Logo { - id: logo - x: 165 - y: 35 - rotation: -15 - scale: 0.6 - opacity: 0 - onAnimationFinished: treatsApp.animationFinished(); + Item { + width: 800 + height: 480 + anchors.centerIn: parent + clip: true + + Logo { + id: logo + x: 165 + y: 35 + rotation: -15 + scale: 0.6 + opacity: 0 + onAnimationFinished: treatsApp.animationFinished(); + } + + Item { + id: quickblur + x: 800//325 + y: 344 + Image { + id: blurText + source: "quick-blur.png" + } + Image { + id: quickregular + x: -1 + y: 0 + opacity: 0 + source: "quick-regular.png" + } + Image { + id: star + x: -1 + y: 0 + opacity: 0 + source: "white-star.png" + smooth: true + NumberAnimation on rotation { + from: 0 + to: 360 + loops: NumberAnimation.Infinite + running: true + duration: 2000 + } + } + } } states: [ @@ -96,39 +135,6 @@ Rectangle { } ] - - Item { - id: quickblur - x: 800//325 - y: 344 - Image { - id: blurText - source: "quick-blur.png" - } - Image { - id: quickregular - x: -1 - y: 0 - opacity: 0 - source: "quick-regular.png" - } - Image { - id: star - x: -1 - y: 0 - opacity: 0 - source: "white-star.png" - smooth: true - NumberAnimation on rotation { - from: 0 - to: 360 - loops: NumberAnimation.Infinite - running: true - duration: 2000 - } - } - } - transitions: [ Transition { ParallelAnimation { -- cgit v0.12 From 1a72dd3a1c8f66e31ce4102b2d3e7e5cff4817f8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Jun 2010 21:01:36 +0200 Subject: Make tst_image a little bit more tollerent to rounding errors (cherry picked from commit 23306a399c0703eea7420231903c850566bfe2f0) --- tests/auto/qimage/tst_qimage.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 405eb98..ec0ecec 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -1451,11 +1451,6 @@ static inline int rand8() return int(256. * (qrand() / (RAND_MAX + 1.0))); } -static inline bool compare(int a, int b, int tolerance) -{ - return qAbs(a - b) <= tolerance; -} - // compares img.scale against the bilinear filtering used by QPainter void tst_QImage::smoothScale3() { @@ -1483,6 +1478,7 @@ void tst_QImage::smoothScale3() p.scale(scales[i], scales[i]); p.drawImage(0, 0, img); p.end(); + int err = 0; for (int y = 0; y < a.height(); ++y) { for (int x = 0; x < a.width(); ++x) { @@ -1490,11 +1486,15 @@ void tst_QImage::smoothScale3() QRgb cb = b.pixel(x, y); // tolerate a little bit of rounding errors - QVERIFY(compare(qRed(ca), qRed(cb), 16)); - QVERIFY(compare(qGreen(ca), qGreen(cb), 16)); - QVERIFY(compare(qBlue(ca), qBlue(cb), 16)); + bool r = true; + r &= qAbs(qRed(ca) - qRed(cb)) <= 18; + r &= qAbs(qGreen(ca) - qGreen(cb)) <= 18; + r &= qAbs(qBlue(ca) - qBlue(cb)) <= 18; + if (!r) + err++; } } + QCOMPARE(err, 0); } } -- cgit v0.12 From 500e4d4a7faef619354cb92b6bf7df6a639d29e3 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 31 Aug 2010 11:53:27 +0200 Subject: QNetworkAccessManager doc: add since tag for added enum --- src/network/access/qnetworkaccessmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 837cf66..b35c318 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -201,7 +201,7 @@ static void ensureInitialized() deleteResource()) \value CustomOperation custom operation (created with - sendCustomRequest()) + sendCustomRequest()) \since 4.7 \omitvalue UnknownOperation -- cgit v0.12 From 2192d722a0b2af2aae0a8c45741f1ee4fd28269c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 31 Aug 2010 13:44:35 +0200 Subject: Doc: Reviewed updates to the model/view tutorial. --- doc/src/tutorials/modelview.qdoc | 810 +++++++++++++++++---------------------- 1 file changed, 356 insertions(+), 454 deletions(-) diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index 6dc1594..65f6674 100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -29,72 +29,36 @@ \page modelview.html \startpage {index.html}{Qt Reference Documentation} - \nextpage {modelview-part1.html}{Introduction} \title Model/View Contents \brief An introduction to ModelView programming - Every UI developer should know about ModelView programming and the goal of this tutorial is to provide you with an easily understandable introduction to this topic. + Every UI developer should know about ModelView programming and the goal of + this tutorial is to provide you with an easily understandable introduction + to this topic. -\raw HTML -
-\endraw + Table, list and tree widgets are components frequently used in GUIs. There + are 2 different ways how these widgets can access their data. The + traditional way involves widgets which include internal containers for + storing data. This approach is very intuitive, however, in many non-trivial + applications, it leads to data synchronization issues. + The second approach is model/view programming, in + which widgets do not maintain internal data containers. They access external + data through a standardized interface and therefore avoid data duplication. + This may seem complicated at first, but once you take a closer look, it is + not only easy to grasp, but the many benefits of model/view programming also + become clearer. -\raw HTML - - - - - - - -
-\endraw + \image treeview.png -Table, list and tree widgets are components frequently used in GUIs. There are 2 different ways how these widgets can access their data. The traditional way involves widgets which include internal containers for storing data. This approach is very intuitive, however, in many non-trivial applications, it leads to data synchronization issues. The second approach is modelview programming, in which widgets do not maintain internal data containers. They access external data through a standardized interface and therefore avoid data dupplication. This may seem complicated at first, but once you take a closer look, it is not only easy to grasp, but the many benefits of modelview programming also become clearer. - -\raw HTML - -\endraw - -\raw HTML - - -
-\endraw - -\raw HTML -

Contents:

-\endraw - - \list 1 - \o \l{modelview-part1.html}{Introduction} - \o \l{modelview-part2.html}{Developing a Simple Model/View Application} - \o \l{modelview-part3.html}{Intermediate Topics} - \o \l{modelview-part4.html}{Good Sources of Additional Information} - \endlist - -\raw HTML -
-\endraw - - -\raw HTML -
-\endraw - \raw HTML -

- \endraw - \omit - It doesn't cover everything; the emphasis is on teaching the programming - philosophy of Model/View programming, and Qt's features are introduced as - needed. Some commonly used features are never used in this tutorial. - \endomit - - In the process, we will learn about some basic technologies provided by Qt, such as: + In the process, we will learn about some basic technologies provided by Qt, + such as: \list \o The difference between standard and model/view widgets \o Adapters betweeen forms and models \o Developing a simple model/view application - \o Predefined models + \o Predefined models \o Intermediate topics such as: \list \o Tree views @@ -103,65 +67,27 @@ Table, list and tree widgets are components frequently used in GUIs. There are 2 \o Debugging with model test \endlist \endlist - - - \raw HTML -
- \endraw - You will also learn whether your new application can be written easier with ModelView programming or if classic widgets will work just as well. - \raw HTML -
- \endraw - This tutorial includes example code for you to edit and integrate into your project. The tutorial's source code is located in Qt's \c examples/tutorials/modelview directory. - \raw HTML -
- \endraw - For more detailed information you may also want to look at the \l {model-view-programming.html}{reference documentation} + You will also learn whether your new application can be written easier with + model/view programming or if classic widgets will work just as well. + This tutorial includes example code for you to edit and integrate into your + project. The tutorial's source code is located in Qt's + \c examples/tutorials/modelview directory. -\raw HTML -
-\endraw - - \raw HTML -

- \endraw - - + For more detailed information you may also want to look at the + \l{model-view-programming.html}{reference documentation} - \image treeview.png + If you are completely new to Qt, please read \l{How to Learn Qt} if you + have not already done so. -\raw HTML -
-\endraw - - - - \raw HTML -
- \endraw - If you are completely new to Qt, please read \l{How to Learn Qt} if you have not already done so. - - -*/ - -/*! - \page modelview-part1.html - \contentspage {modelview.html}{Model/View Contents} - \previouspage {modelview.html}{Model/View Contents} - \nextpage {modelview-part2.html}{Developing a Simple Model/View Application} - \title An Introduction to Model/View Programming - \raw HTML -
- \endraw \section1 1. Introduction - Model/View is a technology used to separate data from views in widgets that handle data sets. Standard widgets are not designed for separating data from views and this is why Qt 4 has two different types of widgets. Both types of widgets look the same, but they interact with data differently. + Model/View is a technology used to separate data from views in widgets that + handle data sets. Standard widgets are not designed for separating data + from views and this is why Qt 4 has two different types of widgets. Both + types of widgets look the same, but they interact with data differently. \table \row @@ -174,23 +100,45 @@ Table, list and tree widgets are components frequently used in GUIs. There are 2 \section2 1.1 Standard Widgets - Let's have a closer look at a standard table widget. A table widget is a 2D array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. This method is very intuitive and useful in many applications. + Let's have a closer look at a standard table widget. A table widget is a 2D + array of the data elements that the user can change. The table widget can be + integrated into a program flow by reading and writing the data elements that + the table widget provides. This method is very intuitive and useful in many + applications. - Displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the widget; one inside the widget. The developer is responsible for synchronizing both versions. The tight coupling of presentation and data makes it harder to write unit tests. + Displaying and editing a database table with a standard table widget can be + problematic. Two copies of the data have to be coordinated: one outside the + widget; one inside the widget. The developer is responsible for + synchronizing both versions. The tight coupling of presentation and data + makes it harder to write unit tests. \section2 1.2 Model/View to the Rescue - Model/view stepped up to provide a solution that uses a more versatile architecture. Model/view eliminates the data consistency problems that may occur with standard widgets. Model/view also makes it easier to use more than one view of the same data because one model can be passed on to many views. The most important difference is that model/view widgets do not store data behind the table cells. In fact, they operate directly from your data. Since view classes do not know your data's structure, you need to provide a wrapper to make your data conform to the QAbstractItemModel interface. A view uses this interface to read from and write to your data. Any instance of a class that implements QAbstractItemModel is said to be a model. Once the view receives a pointer to a model, it will read and display its content and be its editor. + Model/view stepped up to provide a solution that uses a more versatile + architecture. Model/view eliminates the data consistency problems that may + occur with standard widgets. Model/view also makes it easier to use more + than one view of the same data because one model can be passed on to many + views. The most important difference is that model/view widgets do not store + data behind the table cells. In fact, they operate directly from your data. + Since view classes do not know your data's structure, you need to provide a + wrapper to make your data conform to the QAbstractItemModel interface. A + view uses this interface to read from and write to your data. Any instance + of a class that implements QAbstractItemModel is said to be a model. Once + the view receives a pointer to a model, it will read and display its content + and be its editor. \section2 1.3 Overview of the Model/View Widgets - Here is an overview of the model/view widgets and their corresponding standard widgets. + Here is an overview of the model/view widgets and their corresponding + standard widgets. \table \header \o Widget - \o Standard Widget (an item based convenience class) - \o Model/View View Class (for use with external data) + \o Standard Widget\br + (an item based convenience class) + \o Model/View View Class\br + (for use with external data) \row \o \inlineimage listview.png \o \l QListWidget @@ -217,125 +165,110 @@ Table, list and tree widgets are components frequently used in GUIs. There are 2 Having adapters between forms and models can come in handy. - We can edit data stored in tables directly from within the table itself, but it's much more comfortable to edit data in text fields. There is no direct model/view counterpart that separates data and views for widgets that operate on one value (QLineEdit, QCheckBox ...) instead of a dataset, so we need an adapter in order to connect the form to the source of data. + We can edit data stored in tables directly from within the table itself, but + it's much more comfortable to edit data in text fields. There is no direct + model/view counterpart that separates data and views for widgets that + operate on one value (QLineEdit, QCheckBox ...) instead of a dataset, so we + need an adapter in order to connect the form to the source of data. - \l QDataWidgetMapper is a great solution because it maps form widgets to a table row and makes it very easy to build forms for database tables. + \l QDataWidgetMapper is a great solution because it maps form widgets to a + table row and makes it very easy to build forms for database tables. \image widgetmapper.png - - Another example of an adapter is \l QCompleter. Qt has \l QCompleter for providing auto-completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source. - - \image qcompleter.png - - -\raw HTML -
-
-
-
-
-\endraw -\raw HTML -

-previous page -

-\endraw + Another example of an adapter is \l QCompleter. Qt has \l QCompleter for + providing auto-completions in Qt widgets such as \l QComboBox and, as shown + below, \l QLineEdit. \l QCompleter uses a model as its data source. -\raw HTML -

-next page -

-\endraw + \image qcompleter.png -*/ -/*! - \page modelview-part2-main-cpp.html - \title main.cpp - \quotefile tutorials/modelview/1_readonly/main.cpp -*/ - -/*! - \page modelview-part2.html - \contentspage {modelview-index.html}{Model/View Contents} - \previouspage {modelview-part1.html}{Introduction} - \nextpage {modelview-part3.html}{Intermediate Topics} - \title Model/View Chapter 2 - A Simple Model/View Application - \raw HTML -
- \endraw \section1 2. A Simple Model/View Application If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. - Below are 7 very simple and independent applications that show different sides of model/view programming. The source code can be found inside the \c{examples/tutorials/modelview} directory. + Below are 7 very simple and independent applications that show different + sides of model/view programming. The source code can be found inside the + \c{examples/tutorials/modelview} directory. \section2 2.1 A Read Only Table - We start with an application that uses a QTableView to show data. We will add editing capabilities later. - \raw HTML -
- \endraw - (file source: examples/tutorials/modelview/1_readonly/main.cpp) + + We start with an application that uses a QTableView to show data. We will + add editing capabilities later. + + (file source: examples/tutorials/modelview/1_readonly/main.cpp) \snippet examples/tutorials/modelview/1_readonly/main.cpp Quoting ModelView Tutorial We have the usual \l {modelview-part2-main-cpp.html}{main()} function: - \raw HTML -
- \endraw - - Here is the interesting part: We create an instance of MyModel and use \l{QTableView::setModel()}{tableView.setModel( &myModel );} to pass a pointer of it to to \l {QTableView}{tableView}. \l{QTableView}{tableView} will invoke the methods of the pointer it has received to find out two things: + Here is the interesting part: We create an instance of MyModel and use + \l{QTableView::setModel()}{tableView.setModel(&myModel);} to pass a + pointer of it to to \l{QTableView}{tableView}. \l{QTableView}{tableView} + will invoke the methods of the pointer it has received to find out two + things: \list - \o How many rows and columns should be displayed - \o What content should be printed into each cell. + \o How many rows and columns should be displayed. + \o What content should be printed into each cell. \endlist The model needs some code to respond to this. - We have a table data set, so let's start with QAbstractTableModel since it is easier to use than the more general QAbstractItemModel. - + We have a table data set, so let's start with QAbstractTableModel since it + is easier to use than the more general QAbstractItemModel. - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/1_readonly/mymodel.h) \snippet examples/tutorials/modelview/1_readonly/mymodel.h Quoting ModelView Tutorial QAbstractTableModel requires the implementation of three abstract methods. - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/1_readonly/mymodel.cpp) \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp Quoting ModelView Tutorial - The number of rows and columns is provided by \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. When the view has to know what the cell's text is, it calls the method \l{QAbstractItemModel::data()}{MyModel::data()}. Row and column information is specified with parameter \c index and the role is set to \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. - - This small example demonstrates the passive nature of a model. The model does not know when it will be used or which data is needed. It simply provides data each time the view requests it. - - What happens when the model 's data needs to be changed? How does the view realize that data has changed and needs to be read again? The model has to emit a signal that indicates what range of cells has changed. This will be demonstrated in section 2.3. + The number of rows and columns is provided by + \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and + \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. When the view + has to know what the cell's text is, it calls the method + \l{QAbstractItemModel::data()}{MyModel::data()}. Row and column information + is specified with parameter \c index and the role is set to + \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are covered in the next + section. In our example, the data that should be displayed is generated. In + a real application, \c MyModel would have a member called \c MyData, which + serves as the target for all reading and writing operations. + + This small example demonstrates the passive nature of a model. The model + does not know when it will be used or which data is needed. It simply + provides data each time the view requests it. + + What happens when the model's data needs to be changed? How does the view + realize that data has changed and needs to be read again? The model has to + emit a signal that indicates what range of cells has changed. This will be + demonstrated in section 2.3. \section2 2.2 Extending the Read Only Example with Roles - In addition to controlling what text the view displays, the model also controls the text's appearance. When we slightly change the model, we get the following result: \image readonlytable_role.png - - In fact, nothing except for the \l{QAbstractItemModel::}{data()} method needs to be changed to set fonts, background colour, alignment and a checkbox. Below is the \l{QAbstractItemModel::data()}{data()} method that produces the result shown above. The difference is that this time we use parameter int role to return different pieces of information depending on its value. + In addition to controlling what text the view displays, the model also + controls the text's appearance. When we slightly change the model, we get + the following result: \image readonlytable_role.png + In fact, nothing except for the \l{QAbstractItemModel::}{data()} method + needs to be changed to set fonts, background colour, alignment and a + checkbox. + Below is the \l{QAbstractItemModel::data()}{data()} method that produces the + result shown above. The difference is that this time we use parameter int + role to return different pieces of information depending on its value. - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/2_formatting/mymodel.cpp) \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp Quoting ModelView Tutorial - Each formatting property will be requested from the model with a separate call to the \l{QAbstractItemModel::data()}{data()} method. The \c role parameter is used to let the model know which property is being requested: + Each formatting property will be requested from the model with a separate + call to the \l{QAbstractItemModel::data()}{data()} method. The \c role + parameter is used to let the model know which property is being requested: \table \header \o \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} \o Meaning - \o Type + \o Type \row \o \l{Qt::ItemDataRole}{}Qt::DisplayRole \o text @@ -351,54 +284,60 @@ Table, list and tree widgets are components frequently used in GUIs. There are 2 \row \o \l{Qt::ItemDataRole}{Qt::TextAlignmentRole} \o text alignment - \o \l{Qt::AlignmentFlag-enum}{enum Qt::AlignmentFlag} - \row - \o {1, 3} \l{Qt::ItemDataRole}{Qt::CheckStateRole} - \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()}, - - sets checkboxes with \l{Qt::CheckState-enum}{Qt::Checked} - - or \l{Qt::CheckState-enum}{Qt::Unchecked} - \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} - \endtable + \o \l{Qt::AlignmentFlag}{enum Qt::AlignmentFlag} + \row + \o {1, 3} \l{Qt::ItemDataRole}{Qt::CheckStateRole} + \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()}, + + sets checkboxes with \l{Qt::CheckState}{Qt::Checked} - Refer to the Qt namespace documentation to learn more about the \l{Qt::ItemDataRole}{Qt::ItemDataRole} enum's capabilities. + or \l{Qt::CheckState}{Qt::Unchecked} + \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} + \endtable - Now we need to determine how using a separated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::}{data()} will be called 42 times. - Each time you hover the cursor over the field, \l{QAbstractItemModel::}{data()} will be called again \mdash 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::}{data()} is invoked and expensive lookup operations are cached. + Refer to the Qt namespace documentation to learn more about the + \l{Qt::ItemDataRole}{Qt::ItemDataRole} enum's capabilities. + + Now we need to determine how using a separated model impacts the + application's performance, so let's trace how often the view calls the + \l{QAbstractItemModel::}{data()} method. In order to track how often the + view calls the model, we have put a debug statement in the + \l{QAbstractItemModel::}{data()} method, which logs onto the error output + stream. In our small example, \l{QAbstractItemModel::}{data()} will be + called 42 times. + Each time you hover the cursor over the field, + \l{QAbstractItemModel::}{data()} will be called again \mdash 7 times for + each cell. That's why it is important to make sure that your data is + available when \l{QAbstractItemModel::}{data()} is invoked and expensive + lookup operations are cached. \section2 2.3 A Clock inside a Table Cell \image clock.png - We still have a read only table, but this time the content changes every second because we are showing the current time. - + We still have a read only table, but this time the content changes every + second because we are showing the current time. - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_QVariant - Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and connect its timeout signal. - + Something is missing to make the clock tick. We need to tell the view every + second that the time has changed and that it needs to be read again. We do + this with a timer. In the constructor, we set its interval to 1 second and + connect its timeout signal. - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_a Here is the corresponding slot: - - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_b - We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::}{dataChanged()} signal to the view. This happened automatically when we called \l{QTableView::}{setModel()}. + We ask the view to read the data in the top left cell again by emitting the + \l{QAbstractItemModel::}{dataChanged()} signal. Note that we did not + explicitly connect the \l{QAbstractItemModel::}{dataChanged()} signal to the + view. This happened automatically when we called \l{QTableView::}{setModel()}. \section2 2.4 Setting up Headers for Columns and Rows @@ -408,147 +347,141 @@ Table, list and tree widgets are components frequently used in GUIs. There are 2 The header content, however, is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: - - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/4_headers/mymodel.cpp) \snippet examples/tutorials/modelview/4_headers/mymodel.cpp quoting mymodel_c - Note that method \l{QAbstractItemModel::headerData()}{headerData()} also has a parameter role which has the same meaning as in \l{QAbstractItemModel::data()}{MyModel::data()}. - \section2 2.5 The Minimal Editing Example - - In this example, we are going to build an application that automatically populates a window title with content by repeating values entered into table cells. To be able to access the window title easily we put the QTableView in a QMainWindow. + Note that method \l{QAbstractItemModel::headerData()}{headerData()} also has + a parameter role which has the same meaning as in + \l{QAbstractItemModel::data()}{MyModel::data()}. - The model decides whether editing capabilities are available . We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::}{setData()} and \l{QAbstractItemModel::}{flags()}. + \section2 2.5 The Minimal Editing Example + In this example, we are going to build an application that automatically + populates a window title with content by repeating values entered into table + cells. To be able to access the window title easily we put the QTableView in + a QMainWindow. + The model decides whether editing capabilities are available. We only have + to modify the model in order for the available editing capabilities to be + enabled. This is done by reimplementing the following virtual methods: + \l{QAbstractItemModel::}{setData()} and \l{QAbstractItemModel::}{flags()}. - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/5_edit/mymodel.h) \snippet examples/tutorials/modelview/5_edit/mymodel.h Quoting ModelView Tutorial - We use \c the two-dimensional array QString m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \c editCompleted() signal, which makes it possible to transfer the modified text to the window title. + We use \c the two-dimensional array QString \c m_gridData to store our data. + This makes \c m_gridData the core of \c MyModel. The rest of \c MyModel acts + like a wrapper and adapts \c m_gridData to the QAbstractItemModel + interface. We have also introduced the \c editCompleted() signal, which + makes it possible to transfer the modified text to the window title. - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/5_edit/mymodel.cpp) \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_e - \l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. - + \l{QAbstractItemModel::setData()}{setData()} will be called each time the + user edits a cell. The \c index parameter tells us which field has been + edited and \c value provides the result of the editing process. The role + will always be set to \l Qt::EditRole because our cells only contain text. + If a checkbox were present and user permissions are set to allow the + checkbox to be selected, calls would also be made with the role set to + \l Qt::CheckStateRole. - - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/5_edit/mymodel.cpp) \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_f - Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. - - \raw HTML -

Returning Qt::ItemIsEditable | Qt::ItemIsEnabled is enough to show an editor that a cell has been selected.

- \endraw - If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. - + Various properties of a cell can be adjusted with + \l{QAbstractItemModel::flags()}{flags()}. + Returning \l{Qt::ItemFlag}{Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled} + is enough to show an editor that a cell can be selected. -\raw HTML -
-
-
-
-
-\endraw + If editing one cell modifies more data than the data in that particular + cell, the model must emit a \l{QAbstractItemModel::}{dataChanged()} signal + in order for the data that has been changed to be read. -\raw HTML -

-previous page -

-\endraw -\raw HTML -

-next page -

-\endraw - -*/ - -/*! - \page modelview-part3.html - \contentspage {modelview-index.html}{Model/View Contents} - \previouspage {modelview-part2.html}{Developing a Simple Model/View Application} - \nextpage {modelview-part4.html}{Good Sources of Additional Information} - \title Model/View Chapter 3 - Intermediate Topics -\raw HTML -
-\endraw \section1 3. Intermediate Topics -\raw HTML -
-\endraw + \section2 3.1 TreeView - You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. + You can convert the example above into an application with a tree view. + Simply replace QTableView with QTreeView, which results in a read/write + tree. No changes have to be made to the model. The tree won't have any + hierarchies because there aren't any hierarchies in the model itself. + \image dummy_tree.png + QListView, QTableView and QTreeView all use a model abstraction, which is a + merged list, table and tree. This makes it possible to use several different + types of view classes from the same model. - QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. \image list_table_tree.png - This is how our example model looks so far: - \image example_model.png + \image example_model.png - We want to present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with \l{QStandardItem}{QStandardItems}, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png + We want to present a real tree. We have wrapped our data in the examples + above in order to make a model. This time we use QStandardItemModel, which + is a container for hierarchical data that also implements + QAbstractItemModel. To show a tree, QStandardItemModel must be populated + with \l{QStandardItem}s, which are able to hold all the standard properties + of items like text, fonts, checkboxes or brushes. + \image tree_2_with_algorithm.png - \raw HTML -
- \endraw (file source: examples/tutorials/modelview/6_treeview/mainwindow.cpp) - \snippet examples/tutorials/modelview/6_treeview/mainwindow.cpp Quoting ModelView Tutorial - We simply instantiate a QStandardItemModel and add a couple of \l{QStandardItem}{QStandardItems} to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within the view. + We simply instantiate a QStandardItemModel and add a couple of + \l{QStandardItem}{QStandardItems} to the constructor. We can then make a + hierarchical data structure because a QStandardItem can hold other + \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within + the view. \section2 3.2 Working with Selections We want to access a selected item's content in order to output it into the window title together with the hierarchy level. + \image selection2.png So let's create a couple of items: - - \raw HTML -
-

(file source: examples/tutorials/modelview/7_selections/mainwindow.cpp)

- \endraw + (file source: examples/tutorials/modelview/7_selections/mainwindow.cpp) \snippet examples/tutorials/modelview/7_selections/mainwindow.cpp quoting modelview_a - Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemView::}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemView::}{selectionChanged()} signal. - + Views manage selections within a separate selection model, which can be + retrieved with the \l{QAbstractItemView::}{selectionModel()} method. We + retrieve the selection Model in order to connect a slot to its + \l{QAbstractItemView::}{selectionChanged()} signal. - \raw HTML -
-

(file source: examples/tutorials/modelview/7_selections/mainwindow.cpp)

- \endraw + (file source: examples/tutorials/modelview/7_selections/mainwindow.cpp) \snippet examples/tutorials/modelview/7_selections/mainwindow.cpp quoting modelview_b - We get the model index that corresponds to the selection by calling \l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::}{parent()} method will return a default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the \l{QAbstractItemModel::}{parent()} method to iterate to the top level while counting the steps performed during iteration. - - The selection model (as shown above) can be retrieved, but it can also be set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. To share a selection model between 3 views use \l{QAbstractItemView::}{selectionModel()} and assign the result to the second and third view class with \l{QAbstractItemView::}{setSelectionModel()}. + We get the model index that corresponds to the selection by calling + \l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} + and we get the the field's string by using the model index. Then we just + calculate the item's \c hierarchyLevel. Top level items do not have parents + and the \l{QAbstractItemModel::}{parent()} method will return a default + constructed \l{QModelIndex}{QModelIndex()}. This is why we use the + \l{QAbstractItemModel::}{parent()} method to iterate to the top level while + counting the steps performed during iteration. + + The selection model (as shown above) can be retrieved, but it can also be + set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This + is how it's possible to have 3 view classes with synchronised selections + because only one instance of a selection model is used. To share a selection + model between 3 views use \l{QAbstractItemView::}{selectionModel()} and + assign the result to the second and third view class with + \l{QAbstractItemView::}{setSelectionModel()}. \section2 3.3 Predefined Models - The typical way to use model/view is to wrap specific data to make it usable with view classes. Qt, however, also provides predefined models for common underlying data structures. If one of the available data structures is suitable for your application, a predefined model can be a good choice. + The typical way to use model/view is to wrap specific data to make it usable + with view classes. Qt, however, also provides predefined models for common + underlying data structures. If one of the available data structures is + suitable for your application, a predefined model can be a good choice. \table \row @@ -578,21 +511,30 @@ Table, list and tree widgets are components frequently used in GUIs. There are 2 \section2 3.4 Delegates - In all examples so far, data is presented as text or a checkbox in a cell and is edited as text or a checkbox. The component that provides these presentation and editing services is called a \e delegate. We are only just beginning to work with the delegate because the view uses a default delegate. But imagine that we want to have a different editor.(e.g. a slider or a drop down list) Or imagine that we want to present data as graphics. Let's take a look at an example called \l{Star Delegate Example}{Star Delegate}, in which stars are used to show a rating: - \raw HTML -

- (Star Delegate Example)

- \endraw + In all examples so far, data is presented as text or a checkbox in a cell + and is edited as text or a checkbox. The component that provides these + presentation and editing services is called a \e delegate. We are only just + beginning to work with the delegate because the view uses a default + delegate. But imagine that we want to have a different editor (e.g., a + slider or a drop down list) Or imagine that we want to present data as + graphics. + Let's take a look at an example called \l{Star Delegate Example}{Star + Delegate}, in which stars are used to show a rating: + \image stardelegate.png - The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemView::}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. + The view has a \l{QAbstractItemView::}{setItemDelegate()} method that + replaces the default delegate and installs a custom delegate. + A new delegate can be written by creating a class that inherits from + QStyledItemDelegate. In order to write a delegate that displays stars and + has no input capabilities, we only need to override 2 methods. \code class StarDelegate : public QStyledItemDelegate { Q_OBJECT public: - StarDelegate(QWidget *parent = 0); + StarDelegate(QWidget *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, @@ -600,105 +542,52 @@ Table, list and tree widgets are components frequently used in GUIs. There are 2 }; \endcode - \l{QStyledItemDelegate::}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \l{QModelIndex::data()}{index.data()}. \l{QAbstractItemDelegate::}{sizeHint()} specifies each star's dimensions so the the cell will provide enough height and width to accommodate the stars. + \l{QStyledItemDelegate::}{paint()} draws stars depending on the content of + the underlying data. The data can be looked up by calling + \l{QModelIndex::data()}{index.data()}. The delegate's + \l{QAbstractItemDelegate::}{sizeHint()} method is used to obtain each + star's dimensions, so the the cell will provide enough height and width to + accommodate the stars. - Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you would not use a custom delegate but a custom view class. + Writing custom delegates is the right choice if you want to show your data + with a custom graphical representation inside the grid of the view class. If + you want to leave the grid, you would not use a custom delegate but a custom + view class. -Other references to delegates in Qt Documentation: -\raw HTML -

-Spin Box Delegate Example
-QAbstractItemDelegate Class Reference
-QSqlRelationalDelegate Class Reference
-QStyledItemDelegate Class Reference
-QItemDelegate Class Reference
-

-

-\endraw + Other references to delegates in Qt Documentation: + \list + \o \l{Spin Box Delegate Example} + \o \l{QAbstractItemDelegate}{QAbstractItemDelegate Class Reference} + \o \l{QSqlRelationalDelegate}{QSqlRelationalDelegate Class Reference} + \o \l{QStyledItemDelegate}{QStyledItemDelegate Class Reference} + \o \l{QItemDelegate}{QItemDelegate Class Reference} + \endlist \section2 3.5 Debugging with ModelTest - The passive nature of models provides new challenges for programmers. Inconsistencies in the model can cause the application to crash. Since the model is hit by numerous calls from the view, it is hard to find out which call has crashed the application and which operation has introduced the problem. - - Qt provides software called \l{http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest}{ModelTest}, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical nature leaves many possibilities for subtle inconsistencies. - - Unlike view classes, ModelTest uses out of range indexes to test the model. This means your application may crash with ModelTest even if it runs perfectly without it. So you also need to handle all of the indexes that are out of range when using ModelTest. - - - \section2 3.6 Model/View NG - - \raw HTML - -
- \endraw - - \raw HTML - - \endraw - - Model/View was introduced in Qt 4.0 and is a frequently used technology. Feedback from developers and new development trends have shown that there is a need to further develop the model/view technology. Therefore a research project originated at Nokia is looking into ways to go beyond the current implementation. - \raw HTML -

- \endraw - One limitation of model/view is that view classes are basically all fixed grids. It is possible, but really hard to make a list view with icons placed on a curve; or cells expanding on mouse over events to show additional information. In order to achieve graphically rich view experiences, Model/View NG will use QGraphicsView to render elements. Nodel/View NG also aims to make model/view programming more intuitive. One way to achieve this is to have separate models for lists, tables and trees. The current model abstraction is complex because it is capable of representing a list, a table or a tree. - \raw HTML -

- \endraw - Model/View NG is a research project. You are welcome to checkout the source code, monitor progress and take part in discussions at the following address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} - + The passive nature of models provides new challenges for programmers. + Inconsistencies in the model can cause the application to crash. Since the + model is hit by numerous calls from the view, it is hard to find out which + call has crashed the application and which operation has introduced the + problem. + Qt Labs provides software called + \l{http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest}{ModelTest}, + which checks models while your programming is running. Every time the model + is changed, ModelTest scans the model and reports errors with an assert. + This is especially important for tree models, since their hierarchical + nature leaves many possibilities for subtle inconsistencies. + Unlike view classes, ModelTest uses out of range indexes to test the model. + This means your application may crash with ModelTest even if it runs + perfectly without it. So you also need to handle all of the indexes that are + out of range when using ModelTest. -\raw HTML -

-\endraw - - \raw HTML -
- \endraw - - \image path.png - - \raw HTML -
- \endraw - -\raw HTML -
-
-
-
-\endraw - - -\raw HTML -

-previous page -

-\endraw - -\raw HTML -

-last page -

-\endraw -*/ - -/*! - \page modelview-part4.html - \contentspage {modelview-index.html}{Model/View Contents} - \previouspage {modelview-part3.html}{Intermediate Topics} - \title Model/View Chapter 4 - Good Sources of Additional Information -\raw HTML -
-\endraw \section1 4. Good Sources of Additional Information -\raw HTML -
-\endraw + \section2 4.1 Books Model/View programming is covered quite extensively in the documentation of @@ -716,16 +605,19 @@ Other references to delegates in Qt Documentation: \o \bold{Foundations of Qt Development} / Johan Thelin, \e{Apress}, ISBN 1-59059-831-8. \endlist - More information about these books is available on the \l{Books about Qt Programming}{Qt Web site}. + More information about these books is available on the + \l{Books about Qt Programming}{Qt Web site}. - The following list provides an overview of example programs contained in the books above. Some of them make very good templates for developing similar applications. + The following list provides an overview of example programs contained in the + books above. Some of them make very good templates for developing similar + applications. \table \header - \o example name - \o view class used - \o model used - \o aspects touched + \o Example name + \o View class used + \o Model used + \o Aspects covered \o \row \o Team Leaders @@ -751,26 +643,26 @@ Other references to delegates in Qt Documentation: \o QTableView \o custom model based on QAbstractTableModel - \o read only + \o Read only \o Book 1, Chapter 10, Figure 10.10 \row \o Cities \o QTableView - \o custom model based on + \o Custom model based on QAbstractTableModel - \o read / write + \o Read / write \o Book 1, Chapter 10, Figure 10.12 \row \o Boolean Parser \o QTreeView - \o custom model based on + \o Custom model based on QAbstractItemModel - \o read only + \o Read only \o Book 1, Chapter 10, Figure 10.14 \row \o Track Editor \o {2, 1} QTableWidget - \o custom delegate providing a custom editor + \o Custom delegate providing a custom editor \o Book 1, Chapter 10, Figure 10.15 \row @@ -779,47 +671,47 @@ Other references to delegates in Qt Documentation: QTableView QTreeView \o QDirModel - \o demonstrates the use of multiple views + \o Demonstrates the use of multiple views \o Book2, Chapter 8.2 \row \o Address Book \o QListView QTableView QTreeView - \o custom model based on + \o Custom model based on QAbstractTableModel - \o read / write + \o Read / write \o Book2, Chapter 8.4 \row \o Address Book with sorting \o \o QProxyModel - \o introducing sort and filter capabilities + \o Introducing sort and filter capabilities \o Book2, Chapter 8.5 \row \o Address Book with checkboxes \o \o - \o introducing checkboxes in model/view + \o Introducing checkboxes in model/view \o Book2, Chapter 8.6 \row \o Address Book with transposed grid \o - \o custom proxy Model based on QAbstractProxyModel - \o introducing a custom model + \o Custom proxy Model based on QAbstractProxyModel + \o Introducing a custom model \o Book2, Chapter 8.7 \row \o Address Book with drag and drop \o \o - \o introducing drag and drop support + \o Introducing drag and drop support \o Book2, Chapter 8.8 \row \o Address Book with custom editor \o \o - \o introducing custom delegates + \o Introducing custom delegates \o Book2, Chapter 8.9 \row \o Views @@ -827,51 +719,51 @@ Other references to delegates in Qt Documentation: QTableView QTreeView \o QStandardItemModel - \o read only + \o Read only \o Book 3, Chapter 5, figure 5-3 \row \o Bardelegate \o QTableView \o - \o custom delegate for presentation based on QAbstractItemDelegate + \o Custom delegate for presentation based on QAbstractItemDelegate \o Book 3, Chapter 5, figure 5-5 \row \o Editdelegate \o QTableView \o - \o custom delegate for editing based on QAbstractItemDelegate + \o Custom delegate for editing based on QAbstractItemDelegate \o Book 3, Chapter 5, figure 5-6 \row \o Singleitemview - \o custom view based on QAbstractItemView + \o Custom view based on QAbstractItemView \o - \o custom view + \o Custom view \o Book 3, Chapter 5, figure 5-7 \row \o listmodel \o QTableView - \o custom Model based on QAbstractTableModel - \o read only + \o Custom Model based on QAbstractTableModel + \o Read only \o Book 3, Chapter 5, Figure 5-8 \row \o treemodel \o QTreeView - \o custom Model based on QAbstractItemModel - \o read only + \o Custom Model based on QAbstractItemModel + \o Read only \o Book 3, Chapter 5, Figure 5-10 \row \o edit integers \o QListView - \o custom Model based on QAbstractListModel - \o read / write + \o Custom Model based on QAbstractListModel + \o Read / write \o Book 3, Chapter 5, Listing 5-37, Figure 5-11 \row \o sorting \o QTableView \o QSortFilterProxyModel applied to QStringListModel - \o demonstrates sorting + \o Demonstrates sorting \o Book 3, Chapter 5, Figure 5-12 \endtable @@ -879,19 +771,20 @@ Other references to delegates in Qt Documentation: \section2 4.2 Qt Documentation Qt 4.7 comes with 17 examples and 2 Demonstrations for model/view. - The examples can be found here: \l{Item Views Examples} + The examples can be found on the \l{Item Views Examples} page. + \table \header \o Example name \o View class used \o Model used - \o Aspects touched + \o Aspects covered \row \o Address Book \o QTableView \o QAbstractTableModel QSortFilterProxyModel - \o usage of QSortFilterProxyModel to generate different + \o Usage of QSortFilterProxyModel to generate different subsets from one data pool \row \o Basic Sort/Filter Model @@ -901,41 +794,41 @@ Other references to delegates in Qt Documentation: \o \row \o Chart - \o custom view + \o Custom view \o QStandardItemModel - \o designing custom views that cooperate with selection models + \o Designing custom views that cooperate with selection models \row \o Color Editor Factory \o {2, 1} QTableWidget - \o enhancing the standard delegate with a new custom editor to choose colours + \o Enhancing the standard delegate with a new custom editor to choose colours \row \o Combo Widget Mapper \o QDataWidgetMapper to map QLineEdit, QTextEdit and QComboBox \o QStandardItemModel - \o shows how a QComboBox can serve as a view class + \o Shows how a QComboBox can serve as a view class \row \o Custom Sort/Filter Model \o QTreeView \o QStandardItemModel QSortFilterProxyModel - \o subclass QSortFilterProxyModel for advanced sorting and filtering + \o Subclass QSortFilterProxyModel for advanced sorting and filtering \row \o Dir View \o QTreeView \o QDirModel - \o very small example to demonstrate how to assign a model to a view + \o Very small example to demonstrate how to assign a model to a view \row \o Editable Tree Model \o QTreeView - \o custom tree model - \o comprehensive example for working with trees, demonstrates + \o Custom tree model + \o Comprehensive example for working with trees, demonstrates editing cells and tree structure with an underlying custom model \row \o Fetch More \o QListView - \o custom list model - \o dynamically changing model + \o Custom list model + \o Dynamically changing model \row \o Frozen Column \o QTableView @@ -944,48 +837,57 @@ Other references to delegates in Qt Documentation: \row \o Pixelator \o QTableView - \o custom table model - \o implementation of a custom delegate + \o Custom table model + \o Implementation of a custom delegate \row \o Puzzle \o QListView - \o custom list model - \o model/view with drag and drop + \o Custom list model + \o Model/view with drag and drop \row \o Simple DOM Model \o QTreeView - \o custom tree model - \o read only example for a custom tree model + \o Custom tree model + \o Read only example for a custom tree model \row \o Simple Tree Model \o QTreeView - \o custom tree model - \o read only example for a custom tree model + \o Custom tree model + \o Read only example for a custom tree model \row \o Simple Widget Mapper \o QDataWidgetMapper to map QLineEdit, QTextEdit and QSpinBox \o QStandardItemModel - \o basic QDataWidgetMapper usage + \o Basic QDataWidgetMapper usage \row \o Spin Box Delegate \o QTableView \o QStandardItemModel - \o custom delegate that uses a spin box as a cell editor + \o Custom delegate that uses a spin box as a cell editor \row \o Star Delegate \o {2, 1} QTableWidget - \o comprehensive custom delegate example. + \o Comprehensive custom delegate example. \endtable - \l{Qt Demonstrations}{Demonstrations} are similar to examples except that no walkthrough is provided for the code lines. Demonstrations are also sometimes more feature rich. ( \l demos.html ) + \l{Qt Demonstrations}{Demonstrations} are similar to examples except that no + walkthrough is provided for the code. Demonstrations are typically more + feature rich than examples. \list \o The \bold Interview demonstration shows the same model and selection being shared between three different views. - \o Demonstration \bold Spreadsheet demonstrates the use of a + \o The \bold Spreadsheet demonstration illustrates the use of a table view as a spreadsheet, using custom delegates to render each item according to the type of data it contains. \endlist - A \l{Model/View Programming}{reference document} for model/view technology is also available. + A \l{Model/View Programming}{reference document} for model/view technology + is also available. +*/ + +/*! + \page modelview-part2-main-cpp.html + \title main.cpp + \quotefile tutorials/modelview/1_readonly/main.cpp */ -- cgit v0.12 From 94791e6d5be6859d87862d40233aece16d54932a Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 31 Aug 2010 13:52:14 +0200 Subject: doc: Remove \internal tag from QScriptProgram The class has been there since 4.6 (http://labs.trolltech.com/blogs/2009/11/23/qtscript-in-46/), but we don't see a reason to hide it any longer. Task-number: QTBUG-13229 Reviewed-by: Olivier Goffart --- src/script/api/qscriptengine.cpp | 3 +-- src/script/api/qscriptprogram.cpp | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 8347626..07aced4 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2626,8 +2626,7 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file } /*! - \internal - \since 4.6 + \since 4.7 Evaluates the given \a program and returns the result of the evaluation. diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp index 02beba4..3857b75 100644 --- a/src/script/api/qscriptprogram.cpp +++ b/src/script/api/qscriptprogram.cpp @@ -32,9 +32,7 @@ QT_BEGIN_NAMESPACE /*! - \internal - - \since 4.6 + \since 4.7 \class QScriptProgram \brief The QScriptProgram class encapsulates a Qt Script program. -- cgit v0.12 From 0781e6e539b07872f5d2063594a2057f3e31c9ec Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 31 Aug 2010 14:57:08 +0300 Subject: Fix gcce building of apps using static libraries in symbian-sbsv2 Removed usage of buggy .release_gcce target from symbian-sbsv2 generated makefiles. Now gcce builds like armv5 as it is supposed to when using Raptor. Task-number: QTBUG-13307 Reviewed-by: axis --- bin/createpackage.pl | 17 +++++++++++++++- bin/patch_capabilities.pl | 9 ++++++++- doc/src/platforms/symbian-introduction.qdoc | 1 + mkspecs/features/sis_targets.prf | 10 ++++++++-- mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm | 2 +- mkspecs/symbian-sbsv2/flm/qt/qt.xml | 1 - qmake/generators/symbian/symmake_sbsv2.cpp | 23 +++++++++++++++------- 7 files changed, 50 insertions(+), 13 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index 984c1fd..2569a66 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -81,11 +81,14 @@ Where supported options are as follows: [-o|only-unsigned] = Creates only unsigned package. [-s|stub] = Generates stub sis for ROM. [-n|sisname ] = Specifies the final sis name. + [-g|gcce-is-armv5] = Convert gcce platform to armv5. Where parameters are as follows: templatepkg = Name of .pkg file template target = Either debug or release platform = One of the supported platform winscw | gcce | armv5 | armv6 | armv7 + Note that when packaging binaries built using gcce and symbian-sbsv2 + mkspec, armv5 must be used for platform instead of gcce. certificate = The certificate file used for signing key = The certificate's private key file passphrase = The passphrase of the certificate's private key file @@ -123,6 +126,7 @@ my $preserveUnsigned = ""; my $stub = ""; my $signed_sis_name = ""; my $onlyUnsigned = ""; +my $convertGcce = ""; unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly, @@ -130,7 +134,8 @@ unless (GetOptions('i|install' => \$install, 'u|unsigned' => \$preserveUnsigned, 'o|only-unsigned' => \$onlyUnsigned, 's|stub' => \$stub, - 'n|sisname=s' => \$signed_sis_name,)) { + 'n|sisname=s' => \$signed_sis_name, + 'g|gcce-is-armv5' => \$convertGcce,)) { Usage(); } @@ -146,6 +151,16 @@ $target = $tmpvalues[0] or $target = ""; my $platform; $platform = $tmpvalues[1] or $platform = ""; +if ($platform =~ m/^gcce$/i) { + if (($convertGcce ne "")) { + $platform = "armv5"; + } elsif ($ENV{SBS_HOME}) { + # Print a informative note in case suspected misuse is detected. + print "\nNote: You should use armv5 as platform or specify -g parameter to convert platform\n"; + print " when packaging gcce binaries built using symbian-sbsv2 mkspec.\n\n"; + } +} + # Convert visual target to real target (debug->udeb and release->urel) $target =~ s/debug/udeb/i; $target =~ s/release/urel/i; diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index 7d6f5dc..0c0538c 100755 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -54,7 +54,9 @@ sub Usage() { print("If no capabilities are given, the binaries will be given the\n"); print("capabilities supported by self-signed certificates.\n\n"); print(" *** NOTE: If *_template.pkg file is given and one is using symbian-abld or\n"); - print(" symbian-sbsv2 platform, 'target-platform' is REQUIRED. ***\n"); + print(" symbian-sbsv2 platform, 'target-platform' is REQUIRED. ***\n\n"); + print(" *** NOTE2: When patching gcce binaries built with symbian-sbsv2 toolchain,\n"); + print(" armv5 must be specified as platform.\n"); print("\nUsage: patch_capabilities.pl pkg_filename [target-platform [capability list]]\n"); print("\nE.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"\n"); exit(); @@ -104,6 +106,11 @@ if (@ARGV) # Convert visual target to real target (debug->udeb and release->urel) $target =~ s/debug/udeb/i; $target =~ s/release/urel/i; + + if (($platform =~ m/^gcce$/i) && ($ENV{SBS_HOME})) { + # Print a informative note in case suspected misuse is detected. + print "\nNote: You must use armv5 as platform when packaging gcce binaries built using symbian-sbsv2 mkspec.\n"; + } } # If the specified ".pkg" file exists (and can be read), diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 701707e..fafe007 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -219,6 +219,7 @@ \row \o -o \o Creates only unsigned package. \row \o -s \o Generates stub sis for ROM. \row \o -n \o Specifies the final sis name. + \row \o -g \o Treat gcce platform as armv5. \endtable Execute the \c{createpackage.pl} script without any diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf index abdf2d4..e069ee1 100644 --- a/mkspecs/features/sis_targets.prf +++ b/mkspecs/features/sis_targets.prf @@ -11,6 +11,12 @@ else:!equals(DEPLOYMENT, default_deployment) { equals(GENERATE_SIS_TARGETS, true) { symbian-abld|symbian-sbsv2 { + symbian-sbsv2 { + CONVERT_GCCE_PARAM = -g + } else { + CONVERT_GCCE_PARAM = + } + make_cache_name = .make.cache sis_target.target = sis sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \ @@ -28,7 +34,7 @@ equals(GENERATE_SIS_TARGETS, true) { ) ok_sis_target.target = ok_sis - ok_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $$basename(TARGET)_template.pkg \ + ok_sis_target.commands = createpackage.bat $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) $$basename(TARGET)_template.pkg \ $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) unsigned_sis_target.target = unsigned_sis @@ -47,7 +53,7 @@ equals(GENERATE_SIS_TARGETS, true) { ) ok_unsigned_sis_target.target = ok_unsigned_sis - ok_unsigned_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) -o $$basename(TARGET)_template.pkg $(QT_SIS_TARGET) + ok_unsigned_sis_target.commands = createpackage.bat $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) -o $$basename(TARGET)_template.pkg $(QT_SIS_TARGET) target_sis_target.target = $$basename(TARGET).sis target_sis_target.commands = $(MAKE) -f $(MAKEFILE) sis diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm index 47c3f1e..21638ea 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm @@ -38,7 +38,7 @@ $(STORE_BUILD_TARGET): echo "# make sis target." >> $(CACHE_FILENAME) && \ echo "# Version : " >> $(CACHE_FILENAME) && \ echo "# ==============================================================================" >> $(CACHE_FILENAME) && \ - echo QT_SIS_TARGET ?= $(VISUAL_CFG)-$(VARIANTPLATFORM) >> $(CACHE_FILENAME) + echo QT_SIS_TARGET ?= $(VISUAL_CFG)-$(PLATFORM_PATH) >> $(CACHE_FILENAME) $(call endrule,qmake_store_build) endef diff --git a/mkspecs/symbian-sbsv2/flm/qt/qt.xml b/mkspecs/symbian-sbsv2/flm/qt/qt.xml index 12857a2..0f7db3c 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qt.xml +++ b/mkspecs/symbian-sbsv2/flm/qt/qt.xml @@ -37,6 +37,5 @@ - diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 036eb1d..e794351 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -202,10 +202,18 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo QString genericClause = " -c %1_%2" + testClause; QString winscwClause = " -c winscw_%1.mwccinc" + testClause; QString gcceClause; - if (QString::compare(gcceVersion(), UNDETECTED_GCCE_VERSION) == 0) - allPlatforms.removeAll(PLATFORM_GCCE); - else - gcceClause = " -c arm.v5.%1." + gcceVersion() + ".release_gcce" + testClause; + bool stripArmv5 = false; + + if (allPlatforms.contains(PLATFORM_GCCE)) { + if (QString::compare(gcceVersion(), UNDETECTED_GCCE_VERSION) == 0) { + allPlatforms.removeAll(PLATFORM_GCCE); + } else { + gcceClause = " -c arm.v5.%1." + gcceVersion() + testClause; + // Since gcce building is enabled, do not add armv5 for any sbs command + // that also contains gcce, because those will build same targets. + stripArmv5 = true; + } + } QStringList allClauses; QStringList debugClauses; @@ -216,14 +224,15 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo releasePlatforms.removeAll(PLATFORM_WINSCW); // No release for emulator foreach(QString item, debugPlatforms) { - debugClauses << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); + if (item != PLATFORM_ARMV5 || !stripArmv5) + debugClauses << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); } foreach(QString item, releasePlatforms) { - releaseClauses << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); + if (item != PLATFORM_ARMV5 || !stripArmv5) + releaseClauses << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); } allClauses << debugClauses << releaseClauses; - QTextStream t(&wrapperFile); t << "# ==============================================================================" << endl; -- cgit v0.12 From c9459fed5a3c57fea8705979064b9c028bfdaa72 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 31 Aug 2010 13:18:39 +0200 Subject: Undefined SSE symbols when crosscompiling Qt on PPC. Qt does not build on PowerPC when compiling for both x86 and PPC on Mac. The compiler is invoked only once for both architecture so the defines are there in order to get the optimized path for x86. Those defines needs to be removed from the compilation environment when the target is set to PPC by GCC. Reviewed-by: Kent Hansen --- src/corelib/tools/qsimd_p.h | 7 ++++++- src/gui/painting/qdrawhelper.cpp | 1 - src/gui/painting/qdrawhelper_p.h | 8 +------- src/gui/painting/qdrawhelper_sse2.cpp | 1 - src/gui/painting/qdrawhelper_ssse3.cpp | 3 +-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 2626657..664543b 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -51,8 +51,13 @@ QT_BEGIN_HEADER #if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) // Disable MMX and SSE on Mac/PPC builds, or if the compiler // does not support -Xarch argument passing -#undef QT_HAVE_SSE2 #undef QT_HAVE_SSE +#undef QT_HAVE_SSE2 +#undef QT_HAVE_SSE3 +#undef QT_HAVE_SSSE3 +#undef QT_HAVE_SSE4_1 +#undef QT_HAVE_SSE4_2 +#undef QT_HAVE_AVX #undef QT_HAVE_3DNOW #undef QT_HAVE_MMX #endif diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 89754fa..5223458 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 75f42a0..5747da5 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -62,6 +62,7 @@ #define QT_FT_END_HEADER #endif #include "private/qrasterdefs_p.h" +#include #ifdef Q_WS_QWS #include "QtGui/qscreen_qws.h" @@ -69,13 +70,6 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_MAC) && (defined(__ppc__) || defined(__ppc64__)) -#undef QT_HAVE_MMX -#undef QT_HAVE_SSE -#undef QT_HAVE_SSE2 -#undef QT_HAVE_3DNOW -#endif - #if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL) #define Q_STATIC_TEMPLATE_SPECIALIZATION static #else diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 30454af..5b674b5 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -43,7 +43,6 @@ #ifdef QT_HAVE_SSE2 -#include #include #include diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index 9c02009..4cb4089 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -39,11 +39,10 @@ ** ****************************************************************************/ +#include #ifdef QT_HAVE_SSSE3 -#include -#include #include QT_BEGIN_NAMESPACE -- cgit v0.12 From 9d92e1556b18db068891c0f33ff35c8f05059b73 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 31 Aug 2010 15:13:21 +0200 Subject: Updated Twitter demo in response to the new Twitter oauth requirement Twitter is blocking access to the old authentification method that our demo was using. This breaks the demo completely. To fix this, I changed the demo into only make use of the public search API. You can no longer tweet but you can search for different tweets. At the moment making an oauth capable demo is not desirable due to the problems with handling a secret app token among other issues. Task-number: QTBUG-13181 Reviewed-by: Alan Alpert --- demos/declarative/twitter/TwitterCore/AuthView.qml | 146 ------------------- demos/declarative/twitter/TwitterCore/Button.qml | 2 +- .../twitter/TwitterCore/FatDelegate.qml | 36 ++++- .../twitter/TwitterCore/HomeTitleBar.qml | 161 --------------------- demos/declarative/twitter/TwitterCore/Input.qml | 65 +++++++++ .../twitter/TwitterCore/MultiTitleBar.qml | 7 +- demos/declarative/twitter/TwitterCore/RssModel.qml | 59 ++++---- .../declarative/twitter/TwitterCore/SearchView.qml | 124 ++++++++++++++++ demos/declarative/twitter/TwitterCore/TitleBar.qml | 80 +++++----- demos/declarative/twitter/TwitterCore/ToolBar.qml | 5 +- .../declarative/twitter/TwitterCore/UserModel.qml | 26 ++-- demos/declarative/twitter/TwitterCore/qmldir | 4 +- demos/declarative/twitter/twitter.qml | 74 +++++----- doc/src/examples/qml-twitter.qdoc | 4 +- 14 files changed, 332 insertions(+), 461 deletions(-) delete mode 100644 demos/declarative/twitter/TwitterCore/AuthView.qml delete mode 100644 demos/declarative/twitter/TwitterCore/HomeTitleBar.qml create mode 100644 demos/declarative/twitter/TwitterCore/Input.qml create mode 100644 demos/declarative/twitter/TwitterCore/SearchView.qml diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml deleted file mode 100644 index 0d05deb..0000000 --- a/demos/declarative/twitter/TwitterCore/AuthView.qml +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 - -Item { - id: wrapper - Column { - anchors.centerIn: parent - spacing: 20 - Column{ - spacing: 4 - Text { - text: "Screen name:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Item { - width: 220 - height: 28 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - TextInput{ - id: nameIn - width: parent.width - 8 - anchors.centerIn: parent - maximumLength:21 - font.pixelSize: 16; - font.bold: true - color: "#151515"; selectionColor: "green" - KeyNavigation.tab: passIn - KeyNavigation.backtab: guest - focus: true - } - } - } - Column{ - spacing: 4 - Text { - text: "Password:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Item { - width: 220 - height: 28 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - TextInput{ - id: passIn - width: parent.width - 8 - anchors.centerIn: parent - maximumLength:21 - echoMode: TextInput.Password - font.pixelSize: 16; - font.bold: true - color: "#151515"; selectionColor: "green" - KeyNavigation.tab: login - KeyNavigation.backtab: nameIn - onAccepted: login.doLogin(); - } - } - } - Row{ - spacing: 10 - Button { - width: 100 - height: 32 - id: login - keyUsing: true; - function doLogin(){ - rssModel.authName=nameIn.text; - rssModel.authPass=passIn.text; - rssModel.tags='my timeline'; - screen.focus = true; - } - text: "Log in" - KeyNavigation.right: guest - KeyNavigation.tab: guest - KeyNavigation.backtab: passIn - Keys.onReturnPressed: login.doLogin(); - Keys.onEnterPressed: login.doLogin(); - Keys.onSelectPressed: login.doLogin(); - Keys.onSpacePressed: login.doLogin(); - onClicked: login.doLogin(); - } - Button { - width: 100 - height: 32 - id: guest - keyUsing: true; - function doGuest() - { - rssModel.authName='-'; - screen.focus = true; - screen.setMode(true); - } - text: "Guest" - KeyNavigation.left: login - KeyNavigation.tab: nameIn - KeyNavigation.backtab: login - Keys.onReturnPressed: guest.doGuest(); - Keys.onEnterPressed: guest.doGuest(); - Keys.onSelectPressed: guest.doGuest(); - Keys.onSpacePressed: guest.doGuest(); - onClicked: guest.doGuest(); - } - } - } -} diff --git a/demos/declarative/twitter/TwitterCore/Button.qml b/demos/declarative/twitter/TwitterCore/Button.qml index d326c64..437b013 100644 --- a/demos/declarative/twitter/TwitterCore/Button.qml +++ b/demos/declarative/twitter/TwitterCore/Button.qml @@ -67,7 +67,7 @@ Item { } Text { id: btnText - color: if(container.keyUsing){"#DDDDDD";} else {"#FFFFFF";} + color: if(container.keyUsing){"#D0D0D0";} else {"#FFFFFF";} anchors.centerIn: buttonImage; font.bold: true text: container.text; style: Text.Raised; styleColor: "black" font.pixelSize: 12 diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml index ff03b0b..27dd300 100644 --- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -44,11 +44,10 @@ import Qt 4.7 Component { id: listDelegate Item { - id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4 + id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 60){txt.height+10}else{60} //50+5+5 function handleLink(link){ if(link.slice(0,3) == 'app'){ screen.setUser(link.slice(7)); - screen.setMode(true); }else if(link.slice(0,4) == 'http'){ Qt.openUrlExternally(link); } @@ -58,26 +57,47 @@ Component { var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//surrounds http links with html link tags return ret2; } + + // Strip away paranthesis + function userName(str) { + var user = str.replace(/\([\S|\s]*\)/gi, ""); + return user.trim(); + } + Item { id: moveMe; height: parent.height Rectangle { id: blackRect color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1 } - Rectangle { - id: whiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true + Item { + id: image; x: 6; width: 48; height: 48; smooth: true anchors.verticalCenter: parent.verticalCenter Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != Image.Ready } - Image { id: realImage; source: userImage; x: 1; y: 1; width:48; height:48 } + Image { + id: realImage; + source: userImage; x: 1; y: 1; + width:48; height:48; opacity:0 ; + onStatusChanged: { + if(status==Image.Ready) + image.state="loaded" + } + } + states: State { + name: "loaded"; + PropertyChanges { target: realImage ; opacity:1 } + } + transitions: Transition { NumberAnimation { target: realImage; property: "opacity"; duration: 200 } } + } Text { id:txt; y:4; x: 56 text: '' - + ''+userScreenName + " from " +source - + "
" + wrapper.addTags(statusText) + ""; + + ''+userName(name) + " from " +source + + "
" + statusText + ""; textFormat: Qt.RichText color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap - anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 + anchors.left: image.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 onLinkActivated: wrapper.handleLink(link) } } diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml deleted file mode 100644 index 56f31b1..0000000 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 - -Item { - id: titleBar - - signal update() - onYChanged: state="" //When switching titlebars - - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - Item { - id: container - width: (parent.width * 2) - 55 ; height: parent.height - - function accept() { - if(rssModel.authName == '' || rssModel.authPass == '') - return false;//Can't login like that - - var postData = "status=" + editor.text; - var postman = new XMLHttpRequest(); - postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass); - postman.onreadystatechange = function() { - if (postman.readyState == postman.DONE) { - titleBar.update(); - } - } - postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - postman.send(postData); - - editor.text = "" - titleBar.state = "" - } - - Rectangle { - x: 6; width: 50; height: 50; color: "white"; smooth: true - anchors.verticalCenter: parent.verticalCenter - - UserModel { user: rssModel.authName; id: userModel } - Component { id: imgDelegate; - Item { - Loading { width:48; height:48; visible: realImage.status != Image.Ready } - Image { source: image; width:48; height:48; id: realImage } - } - } - ListView { model: userModel.model; x:1; y:1; delegate: imgDelegate } - } - - Text { - id: categoryText - anchors.left: parent.left; anchors.right: tagButton.left - anchors.leftMargin: 58; anchors.rightMargin: 10 - anchors.verticalCenter: parent.verticalCenter - elide: Text.ElideLeft - text: "Timeline for " + rssModel.authName - font.pixelSize: 12; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - } - - Button { - id: tagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..." - anchors.verticalCenter: parent.verticalCenter; - onClicked: if (titleBar.state == "Posting") container.accept(); else titleBar.state = "Posting" - } - - Text { - id: charsLeftText; anchors.horizontalCenter: tagButton.horizontalCenter; - anchors.top: tagButton.bottom; anchors.topMargin: 2 - text: {140 - editor.text.length;} visible: titleBar.state == "Posting" - font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - } - Item { - id: txtEdit; - anchors.left: tagButton.right; anchors.leftMargin: 5; y: 4 - anchors.right: parent.right; anchors.rightMargin: 40; height: parent.height - 9 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - - Binding {//TODO: Can this be a function, which also resets the cursor? And flashes? - when: editor.text.length > 140 - target: editor - property: "text" - value: editor.text.slice(0,140) - } - TextEdit { - id: editor - anchors.left: parent.left; - anchors.leftMargin: 8; - anchors.bottom: parent.bottom - anchors.bottomMargin: 4; - cursorVisible: true; font.bold: true - width: parent.width - 12 - height: parent.height - 8 - font.pixelSize: 12 - wrapMode: TextEdit.Wrap - color: "#151515"; selectionColor: "green" - } - Keys.forwardTo: [(returnKey), (editor)] - Item { - id: returnKey - Keys.onReturnPressed: container.accept() - Keys.onEnterPressed: container.accept() - Keys.onEscapePressed: titleBar.state = "" - } - } - } - states: [ - State { - name: "Posting" - PropertyChanges { target: container; x: -tagButton.x + 5 } - PropertyChanges { target: titleBar; height: 80 } - PropertyChanges { target: tagButton; text: "OK" } - PropertyChanges { target: tagButton; width: 28 } - PropertyChanges { target: tagButton; height: 24 } - PropertyChanges { target: editor; focus: true } - } - ] - transitions: [ - Transition { - from: "*"; to: "*" - NumberAnimation { properties: "x,y,width,height"; easing.type: Easing.InOutQuad } - } - ] -} diff --git a/demos/declarative/twitter/TwitterCore/Input.qml b/demos/declarative/twitter/TwitterCore/Input.qml new file mode 100644 index 0000000..a33a995 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/Input.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +FocusScope { + id:container + width: 220 + height: 28 + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + signal accepted + property alias text: input.text + property alias item:input + TextInput{ + id: input + width: parent.width - 12 + anchors.centerIn: parent + maximumLength:21 + font.pixelSize: 16; + font.bold: true + color: "#151515"; selectionColor: "mediumseagreen" + focus: true + onAccepted:{container.accepted()} + text: "" + selectByMouse: true + } +} diff --git a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml index 38d6c9c..29b7713 100644 --- a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml @@ -42,10 +42,6 @@ import Qt 4.7 Item { - height: homeBar.height - HomeTitleBar { id: homeBar; width: parent.width; height: 60; - onUpdate: rssModel.reload() - } TitleBar { id: titleBar; width: parent.width; height: 60; y: -80 untaggedString: "Latest tweets from everyone" @@ -53,9 +49,8 @@ Item { } states: [ State { - name: "search"; when: screen.userView + name: "search"; when: screen.state!="search" PropertyChanges { target: titleBar; y: 0 } - PropertyChanges { target: homeBar; y: -80 } } ] transitions: [ diff --git a/demos/declarative/twitter/TwitterCore/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml index bd73200..d03cdb3 100644 --- a/demos/declarative/twitter/TwitterCore/RssModel.qml +++ b/demos/declarative/twitter/TwitterCore/RssModel.qml @@ -43,43 +43,34 @@ import Qt 4.7 Item { id: wrapper property variant model: xmlModel - property string tags : "" - property string authName : "" - property string authPass : "" + property string from : "" + property string to : "" + property string phrase : "" + property string mode : "everyone" property int status: xmlModel.status function reload() { xmlModel.reload(); } -XmlListModel { - id: xmlModel + XmlListModel { + id: xmlModel - source:{ - if (wrapper.authName == ""){ - ""; //Avoid worthless calls to twitter servers - }else if(wrapper.mode == 'user'){ - "https://"+ ((wrapper.authName!="" && wrapper.authPass!="")? (wrapper.authName+":"+wrapper.authPass+"@") : "" )+"twitter.com/statuses/user_timeline.xml?screen_name="+wrapper.tags; - }else if(wrapper.mode == 'self'){ - "https://"+ ((wrapper.authName!="" && wrapper.authPass!="")? (wrapper.authName+":"+wrapper.authPass+"@") : "" )+"twitter.com/statuses/friends_timeline.xml"; - }else{//everyone/public - "http://twitter.com/statuses/public_timeline.xml"; - } - } - query: "/statuses/status" + source: (from=="" && to=="" && phrase=="") ? "" : + 'http://search.twitter.com/search.atom?from='+from+"&to="+to+"&phrase="+phrase - XmlRole { name: "statusText"; query: "text/string()" } - XmlRole { name: "timestamp"; query: "created_at/string()" } - XmlRole { name: "source"; query: "source/string()" } - XmlRole { name: "userName"; query: "user/name/string()" } - XmlRole { name: "userScreenName"; query: "user/screen_name/string()" } - XmlRole { name: "userImage"; query: "user/profile_image_url/string()" } - XmlRole { name: "userLocation"; query: "user/location/string()" } - XmlRole { name: "userDescription"; query: "user/description/string()" } - XmlRole { name: "userFollowers"; query: "user/followers_count/string()" } - XmlRole { name: "userStatuses"; query: "user/statuses_count/string()" } - //TODO: Could also get the user's color scheme, timezone and a few other things -} -Binding { - property: "mode" - target: wrapper - value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} -} + namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom'; " + + "declare namespace twitter=\"http://api.twitter.com/\";"; + + query: "/feed/entry" + + XmlRole { name: "statusText"; query: "content/string()" } + XmlRole { name: "timestamp"; query: "published/string()" } + XmlRole { name: "source"; query: "twitter:source/string()" } + XmlRole { name: "name"; query: "author/name/string()" } + XmlRole { name: "userImage"; query: "link[@rel = 'image']/@href/string()" } + + } + Binding { + property: "mode" + target: wrapper + value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} + } } diff --git a/demos/declarative/twitter/TwitterCore/SearchView.qml b/demos/declarative/twitter/TwitterCore/SearchView.qml new file mode 100644 index 0000000..22df374 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/SearchView.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +FocusScope { + id: wrapper + Column { + anchors.centerIn: parent + spacing: 20 + Column{ + spacing: 4 + Text { + text: "Posted by:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: fromIn + KeyNavigation.backtab: searchbutton + KeyNavigation.tab:toIn + onAccepted:searchbutton.doSearch(); + focus: true + } + Text { + text: "In reply to:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: toIn + KeyNavigation.backtab: fromIn + KeyNavigation.tab:phraseIn + onAccepted:searchbutton.doSearch(); + } + Text { + text: "Search phrase:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: phraseIn + KeyNavigation.backtab: toIn + KeyNavigation.tab:searchbutton + onAccepted:searchbutton.doSearch(); + text: "Qt Quick" + } + } + Button { + width: 100 + height: 32 + id: searchbutton + keyUsing: true; + opacity: 1 + text: "Search" + KeyNavigation.tab: fromIn + Keys.onReturnPressed: searchbutton.doSearch(); + Keys.onEnterPressed: searchbutton.doSearch(); + Keys.onSelectPressed: searchbutton.doSearch(); + Keys.onSpacePressed: searchbutton.doSearch(); + onClicked: searchbutton.doSearch(); + + function doSearch() { + // Search ! allowed + if (wrapper.state=="invalidinput") + return; + + rssModel.from=fromIn.text; + rssModel.to= toIn.text; + rssModel.phrase = phraseIn.text; + screen.focus = true; + screen.state = "" + } + } + } + states: + State { + name: "invalidinput" + when: fromIn.text=="" && toIn.text=="" && phraseIn.text=="" + PropertyChanges { target: searchbutton ; opacity: 0.6 ; } + } + transitions: + Transition { + NumberAnimation { target: searchbutton; property: "opacity"; duration: 200 } + } +} diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml index 479aa20..145c189 100644 --- a/demos/declarative/twitter/TwitterCore/TitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml @@ -58,66 +58,58 @@ Item { rssModel.tags = editor.text } - Image { - id: quitButton - x: 5 + Item { + id:imageBox + x: 6; width: 0; height: 50; smooth: true anchors.verticalCenter: parent.verticalCenter - source: "images/quit.png" - MouseArea { - anchors.fill: parent - onClicked: Qt.quit() + + UserModel { user: rssModel.from; id: userModel } + Component { + id: imgDelegate; + Item { + id:imageitem + visible:true + Loading { width:48; height:48; visible: realImage.status != Image.Ready } + Image { id: realImage; source: image; width:48; height:48; opacity:0; } + states: + State { + name: "loaded" + when: (realImage.status == Image.Ready) + PropertyChanges { target: realImage; opacity:1 } + } + transitions: Transition { + NumberAnimation { target: realImage; property: "opacity"; duration: 200 } + } + } + } + ListView { id:view; model: userModel.model; x:1; y:1; delegate: imgDelegate } + states: + State { + when: !userModel.user=="" + PropertyChanges { target: imageBox; width: 50; } + } + transitions: + Transition { + NumberAnimation { target: imageBox; property: "width"; duration: 200 } } - } + } + Text { id: categoryText anchors { - left: quitButton.right; right: tagButton.left; leftMargin: 5; rightMargin: 10 + left: imageBox.right; right: parent.right; leftMargin: 10; rightMargin: 10 verticalCenter: parent.verticalCenter } elide: Text.ElideLeft - text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) + text: (rssModel.from=="" ? untaggedString : taggedString + rssModel.from) font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" font.pixelSize: 12 } - - Button { - id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." - onClicked: if (titleBar.state == "Tags") container.accept(); else titleBar.state = "Tags" - anchors.verticalCenter: parent.verticalCenter - } - - Item { - id: lineEdit - y: 4; height: parent.height - 9 - anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } - - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - - TextInput { - id: editor - anchors { - left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 - verticalCenter: parent.verticalCenter - } - cursorVisible: true; font.bold: true - color: "#151515"; selectionColor: "Green" - } - - Keys.forwardTo: [ (returnKey), (editor)] - - Item { - id: returnKey - Keys.onReturnPressed: container.accept() - Keys.onEnterPressed: container.accept() - Keys.onEscapePressed: titleBar.state = "" - } - } } states: State { name: "Tags" PropertyChanges { target: container; x: -tagButton.x + 5 } - PropertyChanges { target: tagButton; text: "OK" } PropertyChanges { target: editor; focus: true } } diff --git a/demos/declarative/twitter/TwitterCore/ToolBar.qml b/demos/declarative/twitter/TwitterCore/ToolBar.qml index b9cb915..e18f5c6 100644 --- a/demos/declarative/twitter/TwitterCore/ToolBar.qml +++ b/demos/declarative/twitter/TwitterCore/ToolBar.qml @@ -48,15 +48,14 @@ Item { property alias button2Label: button2.text signal button1Clicked signal button2Clicked - + focus:true BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - Button { id: button1 anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 onClicked: toolbar.button1Clicked() + focus:true } - Button { id: button2 anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 diff --git a/demos/declarative/twitter/TwitterCore/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml index e653836..d8ca804 100644 --- a/demos/declarative/twitter/TwitterCore/UserModel.qml +++ b/demos/declarative/twitter/TwitterCore/UserModel.qml @@ -42,26 +42,24 @@ import Qt 4.7 //This "model" gets the user information about the searched user. Mainly for the icon. -//Copied from RssModel Item { id: wrapper property variant model: xmlModel property string user : "" property int status: xmlModel.status function reload() { xmlModel.reload(); } -XmlListModel { - id: xmlModel + XmlListModel { + id: xmlModel - source: {if(user!="") {"http://twitter.com/users/show.xml?screen_name="+user;}else{"";}} - query: "/user" + source: user!= "" ? "http://twitter.com/users/show.xml?screen_name="+user : "" + query: "/user" - XmlRole { name: "name"; query: "name/string()" } - XmlRole { name: "screenName"; query: "screen_name/string()" } - XmlRole { name: "image"; query: "profile_image_url/string()" } - XmlRole { name: "location"; query: "location/string()" } - XmlRole { name: "description"; query: "description/string()" } - XmlRole { name: "followers"; query: "followers_count/string()" } - //XmlRole { name: "protected"; query: "protected/bool()" } - //TODO: Could also get the user's color scheme, timezone and a few other things -} + XmlRole { name: "name"; query: "name/string()" } + XmlRole { name: "screenName"; query: "screen_name/string()" } + XmlRole { name: "image"; query: "profile_image_url/string()" } + XmlRole { name: "location"; query: "location/string()" } + XmlRole { name: "description"; query: "description/string()" } + XmlRole { name: "followers"; query: "followers_count/string()" } + //TODO: Could also get the user's color scheme, timezone and a few other things + } } diff --git a/demos/declarative/twitter/TwitterCore/qmldir b/demos/declarative/twitter/TwitterCore/qmldir index 8b56c56..84d85c2 100644 --- a/demos/declarative/twitter/TwitterCore/qmldir +++ b/demos/declarative/twitter/TwitterCore/qmldir @@ -1,7 +1,7 @@ -AuthView 1.0 AuthView.qml +SearchView 1.0 SearchView.qml Button 1.0 Button.qml +Input 1.0 Input.qml FatDelegate 1.0 FatDelegate.qml -HomeTitleBar 1.0 HomeTitleBar.qml Loading 1.0 Loading.qml MultiTitleBar 1.0 MultiTitleBar.qml TitleBar 1.0 TitleBar.qml diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 08cecb0..6d224a2 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -46,28 +46,18 @@ Item { id: screen; width: 320; height: 480 property bool userView : false property variant tmpStr - function setMode(m){ - screen.userView = m; - if(m == false){ - rssModel.tags='my timeline'; - rssModel.reload(); - toolBar.button2Label = "View others"; - } else { - toolBar.button2Label = "Return home"; - } - } function setUser(str){hack.running = true; tmpStr = str} - function reallySetUser(){rssModel.tags = tmpStr;} - + function reallySetUser(){rssModel.from = tmpStr;rssModel.to = ""; rssModel.phrase = ""} + state:"searchquery" //Workaround for bug 260266 Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack } - - //TODO: better way to return to the auth screen - Keys.onEscapePressed: rssModel.authName='' + Keys.onEscapePressed: screen.state="searchquery" + Keys.onBacktabPressed: screen.state="searchquery" Rectangle { id: background anchors.fill: parent; color: "#343434"; + state:"searchquery" Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } MouseArea { @@ -90,8 +80,16 @@ Item { y:60 //Below the title bars height: 380 - Twitter.AuthView{ - id: authView + Text { + id:title + text: "Search Twitter" + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 20; font.bold: true; color: "#bbb"; style: Text.Raised; styleColor: "black" + opacity:0 + } + + Twitter.SearchView{ + id: searchView anchors.verticalCenter: parent.verticalCenter width: parent.width; height: parent.height-60; x: -(screen.width * 1.5) @@ -110,31 +108,27 @@ Item { //TODO: Use anchor changes instead of hard coding y: screen.height - 40 width: parent.width; opacity: 0.9 - button1Label: "Update" - button2Label: "View others" - onButton1Clicked: rssModel.reload(); - onButton2Clicked: + button1Label: "New Search" + button2Label: "Update" + onButton1Clicked: { - if(screen.userView == true){ - screen.setMode(false); - }else{ - rssModel.tags=''; - screen.setMode(true); - } + screen.state="searchquery" } + onButton2Clicked: rssModel.reload(); } - - states: [ - State { - name: "unauthed"; when: rssModel.authName=="" - PropertyChanges { target: authView; x: 0 } - PropertyChanges { target: mainView; x: -(parent.width * 1.5) } - PropertyChanges { target: titleBar; y: -80 } - PropertyChanges { target: toolBar; y: screen.height } - } - ] - transitions: [ - Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } } - ] } + states: [ + State { + name: "searchquery"; + PropertyChanges { target: searchView; x: 0; focus:true} + PropertyChanges { target: mainView; x: -(parent.width * 1.5) } + PropertyChanges { target: titleBar; y: -80 } + PropertyChanges { target: toolBar; y: screen.height } + PropertyChanges { target: toolBar } + PropertyChanges { target: title; opacity:1} + } + ] + transitions: [ + Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutQuad } } + ] } diff --git a/doc/src/examples/qml-twitter.qdoc b/doc/src/examples/qml-twitter.qdoc index 8a0de00..c3182a0 100644 --- a/doc/src/examples/qml-twitter.qdoc +++ b/doc/src/examples/qml-twitter.qdoc @@ -29,8 +29,8 @@ \title Twitter Mobile \example demos/declarative/twitter - This demo shows how to write a mobile Twitter client in QML. Use it to - tweet us(@qtbynokia) how much you like our demos! + This demo shows how to write a mobile Twitter search client in QML. Use it to + see what people think about Qt Quick! \image qml-twitter-demo.png */ -- cgit v0.12 From b5bfe694814ff4dccc82cc5ae5c5bee0f7254a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 31 Aug 2010 16:52:33 +0200 Subject: QTextEngine::LayoutData::reallocate musn't corrupt memory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... on re-allocation failure. So, let's actually check the returned pointer and fail, instead of using Q_CHECK_PTR. Task-number: QT-3785 Reviewed-by: Peter Hartmann Reviewed-by: Samuel Rødal --- src/gui/text/qtextengine.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index c30091e..119217a 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2139,8 +2139,11 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs) void **newMem = memory; newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *)); - Q_CHECK_PTR(newMem); - if (memory_on_stack && newMem) + if (!newMem) { + layoutState = LayoutFailed; + return false; + } + if (memory_on_stack) memcpy(newMem, memory, allocated*sizeof(void *)); memory = newMem; memory_on_stack = false; -- cgit v0.12 From bba97ff5e7faecfaf9b3d0cbb0e2d788bdfd5ab9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 31 Aug 2010 16:00:21 +0200 Subject: Update to the NTLM code. Fixes extraction of time from the server, and saves the domain information properly. Patch by subcontractor Reviewed-by: Thiago Macieira --- src/network/kernel/qauthenticator.cpp | 56 +++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index d61c686..18cc14e 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -52,10 +52,13 @@ #include #include +//#define NTLMV1_CLIENT QT_BEGIN_NAMESPACE +#ifdef NTLMV1_CLIENT #include "../../3rdparty/des/des.cpp" +#endif static QByteArray qNtlmPhase1(); static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phase2data); @@ -203,17 +206,29 @@ QString QAuthenticator::user() const void QAuthenticator::setUser(const QString &user) { detach(); - int separatorPosn = 0; - separatorPosn = user.indexOf(QLatin1String("\\")); - if (separatorPosn == -1) { - //No domain name present + switch(d->method) { + case QAuthenticatorPrivate::DigestMd5: + case QAuthenticatorPrivate::Ntlm: + if((separatorPosn = user.indexOf(QLatin1String("\\"))) != -1) + { + //domain name is present + d->realm = user.left(separatorPosn); + d->user = user.mid(separatorPosn + 1); + } else if((separatorPosn = user.indexOf(QLatin1String("@"))) != -1) { + //domain name is present + d->realm = user.mid(separatorPosn + 1); + d->user = user.left(separatorPosn); + } else { + d->user = user; + d->realm.clear(); + } + break; + // For other auth mechanisms, domain name will be part of username + default: d->user = user; - } else { - //domain name is present - d->realm = user.left(separatorPosn); - d->user = user.mid(separatorPosn+1); + break; } } @@ -1178,11 +1193,9 @@ static QByteArray clientChallenge(const QAuthenticatorPrivate *ctx) } // caller has to ensure a valid targetInfoBuff -static bool qExtractServerTime(const QByteArray& targetInfoBuff, - quint64 *serverTime) +static QByteArray qExtractServerTime(const QByteArray& targetInfoBuff) { - Q_ASSERT(serverTime != 0); - bool retValue = false; + QByteArray timeArray; QDataStream ds(targetInfoBuff); ds.setByteOrder(QDataStream::LittleEndian); @@ -1193,19 +1206,16 @@ static bool qExtractServerTime(const QByteArray& targetInfoBuff, ds >> avLen; while(avId != 0) { if(avId == AVTIMESTAMP) { - QByteArray timeArray(avLen, 0); + timeArray.resize(avLen); //avLen size of QByteArray is allocated ds.readRawData(timeArray.data(), avLen); - bool ok; - *serverTime = timeArray.toHex().toLongLong(&ok, 16); - retValue = true; break; } ds.skipRawData(avLen); ds >> avId; ds >> avLen; } - return retValue; + return timeArray; } static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, @@ -1228,9 +1238,17 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, ds.writeRawData(reserved1.constData(), reserved1.size()); quint64 time = 0; + QByteArray timeArray; + + if(ch.targetInfo.len) + { + timeArray = qExtractServerTime(ch.targetInfoBuff); + } //if server sends time, use it instead of current time - if(!(ch.targetInfo.len && qExtractServerTime(ch.targetInfoBuff, &time))) { + if(timeArray.size()) { + ds.writeRawData(timeArray.constData(), timeArray.size()); + } else { QDateTime currentTime(QDate::currentDate(), QTime::currentTime(), Qt::UTC); @@ -1242,8 +1260,8 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, // represented as 100 nano seconds time = Q_UINT64_C(time * 10000000); + ds << time; } - ds << time; //8 byte client challenge QByteArray clientCh = clientChallenge(ctx); -- cgit v0.12 From e3c0b388d92ccb3d06d924b499d90136de25e847 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 31 Aug 2010 12:44:44 +0200 Subject: fix windows build with -prefix passing just a spec name to qmake is bogus, as it will try to find it in the install dir, which of course won't work before it is installed. so either pass nothing at all (when preparing the libraries, as .qmake.cache already contains the right path), or explicitly pass a full path (when building the host tools, as we have to override the spec here). Reviewed-by: mariusSO --- tools/configure/configureapp.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index e1d7275..09da581 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3612,7 +3612,10 @@ void Configure::buildHostTools() // generate Makefile QStringList args; args << QDir::toNativeSeparators(buildPath + "/bin/qmake"); - args << "-spec" << dictionary["QMAKESPEC"] << "-r"; + // override .qmake.cache because we are not cross-building these. + // we need a full path so that a build with -prefix will still find it. + args << "-spec" << QDir::toNativeSeparators(buildPath + "/mkspecs/" + dictionary["QMAKESPEC"]); + args << "-r"; args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile"); QDir().mkpath(toolBuildPath); @@ -3750,8 +3753,7 @@ void Configure::generateMakefiles() printf("Generating Makefiles...\n"); generate = false; // Now Makefiles will be done } - args << "-spec"; - args << spec; + // don't pass -spec - .qmake.cache has it already args << "-r"; args << (sourcePath + "/projects.pro"); args << "-o"; -- cgit v0.12 From a37dfcfdaa8029f25217fdec6dd6ec1a46929af2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 31 Aug 2010 15:02:16 +0200 Subject: fix qt_webkit_version.pri install for in-Qt builds always add the target, even if building inside Qt - as opposed to the headers and libraries, there are no rules for that coming from qbase.pri. Task-number: QTBUG-13306 --- src/3rdparty/webkit/WebCore/WebCore.pro | 34 ++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index ac0c47c..537cdd3 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -2857,6 +2857,25 @@ contains(DEFINES, ENABLE_SYMBIAN_DIALOG_PROVIDERS) { } } +!symbian { + modfile.files = $$moduleFile + modfile.path = $$[QMAKE_MKSPECS]/modules + + INSTALLS += modfile +} else { + # INSTALLS is not implemented in qmake's s60 generators, copy headers manually + + inst_modfile.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} + inst_modfile.input = moduleFile + inst_modfile.output = $$[QMAKE_MKSPECS]/modules + inst_modfile.CONFIG = no_clean + + QMAKE_EXTRA_COMPILERS += inst_modfile + + install.depends += compiler_inst_modfile_make_all + QMAKE_EXTRA_TARGETS += install +} + include($$PWD/../WebKit/qt/Api/headers.pri) HEADERS += $$WEBKIT_API_HEADERS @@ -2873,10 +2892,7 @@ HEADERS += $$WEBKIT_API_HEADERS !isEmpty(INSTALL_LIBS): target.path = $$INSTALL_LIBS else: target.path = $$[QT_INSTALL_LIBS] - modfile.files = $$moduleFile - modfile.path = $$[QMAKE_MKSPECS]/modules - - INSTALLS += target headers modfile + INSTALLS += target headers } else { # INSTALLS is not implemented in qmake's s60 generators, copy headers manually inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} @@ -2888,15 +2904,7 @@ HEADERS += $$WEBKIT_API_HEADERS QMAKE_EXTRA_COMPILERS += inst_headers - inst_modfile.commands = $$inst_headers.commands - inst_modfile.input = moduleFile - inst_modfile.output = $$[QMAKE_MKSPECS]/modules - inst_modfile.CONFIG = no_clean - - QMAKE_EXTRA_COMPILERS += inst_modfile - - install.depends += compiler_inst_headers_make_all compiler_inst_modfile_make_all - QMAKE_EXTRA_TARGETS += install + install.depends += compiler_inst_headers_make_all } win32-*|wince* { -- cgit v0.12 From f9ddd4e138606ed03f4bb585a9e518e39a5fe611 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 31 Aug 2010 17:32:02 +0200 Subject: make various POST_LINK steps nicer put each step into a separate make command. that makes for cleaner output and less troubles with command separators. Reviewed-by: mariusSO --- mkspecs/features/symbian/symbian_building.prf | 13 ++----------- mkspecs/features/unix/separate_debug_info.prf | 3 ++- mkspecs/features/vxworks.prf | 11 ++++++----- mkspecs/features/win32/embed_manifest_dll.prf | 5 ++--- mkspecs/features/win32/embed_manifest_exe.prf | 5 ++--- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 374fe21..414b081 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -114,14 +114,9 @@ isEmpty(capability): capability = "None" capability = "--capability=$$capability" contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { - !isEmpty(QMAKE_POST_LINK) { - # No way to honor the '@' :-( - QMAKE_POST_LINK = $$replace(QMAKE_POST_LINK, "^@", "") - QMAKE_POST_LINK = && $$QMAKE_POST_LINK - } - contains(CONFIG, plugin):QMAKE_ELF2E32_FLAGS += --definput=plugin_commonu.def + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget}.dll $$symbianDestdir/$${baseTarget}.sym \ && $$QMAKE_ELF2E32_WRAPPER --version=$$decVersion \ --sid=$$TARGET.SID \ @@ -166,11 +161,7 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { } contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { - !isEmpty(QMAKE_POST_LINK) { - # No way to honor the '@' :-( - QMAKE_POST_LINK = $$replace(QMAKE_POST_LINK, "^@", "") - QMAKE_POST_LINK = && $$QMAKE_POST_LINK - } + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget} $$symbianDestdir/$${baseTarget}.sym \ && $$QMAKE_ELF2E32_WRAPPER --version $$decVersion \ --sid=$$TARGET.SID \ diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf index 40d52cb..8843c6d 100644 --- a/mkspecs/features/unix/separate_debug_info.prf +++ b/mkspecs/features/unix/separate_debug_info.prf @@ -1,8 +1,9 @@ !separate_debug_info_nocopy:!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) { - QMAKE_SEPARATE_DEBUG_INFO = (test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.debug\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.debug\" \"\$\$targ\" && chmod -x \"\$\$targ.debug\" ) ; + QMAKE_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.debug\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.debug\" \"\$\$targ\" && chmod -x \"\$\$targ.debug\" QMAKE_INSTALL_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; $(INSTALL_FILE) `basename $(TARGET)`.debug $(INSTALL_ROOT)/\$\$target_path/ + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK QMAKE_POST_LINK = $$QMAKE_SEPARATE_DEBUG_INFO $$QMAKE_POST_LINK silent:QMAKE_POST_LINK = @echo creating $@.debug && $$QMAKE_POST_LINK diff --git a/mkspecs/features/vxworks.prf b/mkspecs/features/vxworks.prf index a910c69..e257cd7 100644 --- a/mkspecs/features/vxworks.prf +++ b/mkspecs/features/vxworks.prf @@ -22,20 +22,20 @@ isEmpty(VXWORKS_MUNCH_TOOL):VXWORKS_MUNCH_TOOL = $(WIND_BASE)/host/resource/huti shared|!staticlib:!lib { *-dcc { - VXWORKS_MUNCH_CMD = (targ=`basename $(TARGET)`; \ + VXWORKS_MUNCH_CMD = targ=`basename $(TARGET)`; \ ddump -Ng \"$(TARGET)\" | tclsh $$VXWORKS_MUNCH_TOOL -c $$VXWORKS_ARCH_MUNCH >\"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" && \ $$QMAKE_CC -c $$QMAKE_CFLAGS \"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" -o \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" && \ $$QMAKE_LINK $$QMAKE_LFLAGS -X -r5 -r4 \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" \"$(TARGET)\" -o \"$(TARGET).munched\" && \ mv \"$(TARGET).munched\" \"$(TARGET)\" && \ - chmod +x \"$(TARGET)\") + chmod +x \"$(TARGET)\" } *-g++ { - VXWORKS_MUNCH_CMD = (targ=`basename $(TARGET)`; \ + VXWORKS_MUNCH_CMD = targ=`basename $(TARGET)`; \ nm \"$(DESTDIR)$(TARGET)\" | tclsh $$VXWORKS_MUNCH_TOOL -c $$VXWORKS_ARCH_MUNCH >\"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" && \ $$QMAKE_CC -c $$QMAKE_CFLAGS -fdollars-in-identifiers \"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" -o \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" && \ $$QMAKE_LINK $$QMAKE_LFLAGS -nostdlib -Wl,-X -T $(WIND_BASE)/target/h/tool/gnu/ldscripts/link.OUT \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" \"$(DESTDIR)$(TARGET)\" -o \"$(DESTDIR)$(TARGET).munched\" && \ mv \"$(DESTDIR)$(TARGET).munched\" \"$(DESTDIR)$(TARGET)\" && \ - chmod +x \"$(DESTDIR)$(TARGET)\") + chmod +x \"$(DESTDIR)$(TARGET)\" } # We need to create a dummy lib.a in case someone links against this lib. @@ -48,7 +48,8 @@ shared|!staticlib:!lib { VXWORKS_MUNCH_CMD += (atarg=`basename $(TARGET) .so.$${VERSION}`.a ; touch \"$(DESTDIR)\$\${atarg}\") } - QMAKE_POST_LINK = $$VXWORKS_MUNCH_CMD $$QMAKE_POST_LINK + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK + QMAKE_POST_LINK = $$VXWORKS_MUNCH_CMD$$QMAKE_POST_LINK silent:QMAKE_POST_LINK = @echo creating $@.$$VXWORKS_MUNCH_EXT && $$QMAKE_POST_LINK isEmpty(DESTDIR) { diff --git a/mkspecs/features/win32/embed_manifest_dll.prf b/mkspecs/features/win32/embed_manifest_dll.prf index 7305c04..e8711da 100644 --- a/mkspecs/features/win32/embed_manifest_dll.prf +++ b/mkspecs/features/win32/embed_manifest_dll.prf @@ -6,8 +6,7 @@ isEmpty(MANIFEST_DIR):MANIFEST_DIR = . NOPATH_TARGET ~= s,\\\\,/,g # Change to single type separators NOPATH_TARGET ~= s,^(.*/)+,, # Remove all paths QMAKE_LFLAGS += /MANIFEST $$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\") - QMAKE_PREV_POST_LINK = $$QMAKE_POST_LINK - QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);2$$escape_expand(\\n\\t)) - QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK + QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);2$$escape_expand(\\n\\t))$$QMAKE_POST_LINK QMAKE_CLEAN += \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" } diff --git a/mkspecs/features/win32/embed_manifest_exe.prf b/mkspecs/features/win32/embed_manifest_exe.prf index 5b37a6d..2d1c09b 100644 --- a/mkspecs/features/win32/embed_manifest_exe.prf +++ b/mkspecs/features/win32/embed_manifest_exe.prf @@ -6,8 +6,7 @@ if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):!equals(TEMPLATE_PREFIX, "vc NOPATH_TARGET ~= s,\\\\,/,g # Change to single type separators NOPATH_TARGET ~= s,^(.*/)+,, # Remove all paths QMAKE_LFLAGS += /MANIFEST $$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\") - QMAKE_PREV_POST_LINK = $$QMAKE_POST_LINK - QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\\n\\t)) - QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK + QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\\n\\t))$$QMAKE_POST_LINK QMAKE_CLEAN += \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" } -- cgit v0.12 From 31e4efaf2178b81552e875eb5a1d5a894310e561 Mon Sep 17 00:00:00 2001 From: Victor Ostashevsky Date: Tue, 31 Aug 2010 19:45:53 +0200 Subject: Remove unused source files in designer Merge-request: 2463 Reviewed-by: Oswald Buddenhagen --- .../src/components/propertyeditor/defs.cpp | 107 --------------------- .../designer/src/components/propertyeditor/defs.h | 60 ------------ .../components/propertyeditor/propertyeditor.pri | 4 +- 3 files changed, 1 insertion(+), 170 deletions(-) delete mode 100644 tools/designer/src/components/propertyeditor/defs.cpp delete mode 100644 tools/designer/src/components/propertyeditor/defs.h diff --git a/tools/designer/src/components/propertyeditor/defs.cpp b/tools/designer/src/components/propertyeditor/defs.cpp deleted file mode 100644 index 54dec74..0000000 --- a/tools/designer/src/components/propertyeditor/defs.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "defs.h" - -QT_BEGIN_NAMESPACE - -namespace qdesigner_internal { - -int size_type_to_int( QSizePolicy::Policy t ) -{ - if ( t == QSizePolicy::Fixed ) - return 0; - if ( t == QSizePolicy::Minimum ) - return 1; - if ( t == QSizePolicy::Maximum ) - return 2; - if ( t == QSizePolicy::Preferred ) - return 3; - if ( t == QSizePolicy::MinimumExpanding ) - return 4; - if ( t == QSizePolicy::Expanding ) - return 5; - if ( t == QSizePolicy::Ignored ) - return 6; - return 0; -} - -QString size_type_to_string( QSizePolicy::Policy t ) -{ - if ( t == QSizePolicy::Fixed ) - return QString::fromUtf8("Fixed"); - if ( t == QSizePolicy::Minimum ) - return QString::fromUtf8("Minimum"); - if ( t == QSizePolicy::Maximum ) - return QString::fromUtf8("Maximum"); - if ( t == QSizePolicy::Preferred ) - return QString::fromUtf8("Preferred"); - if ( t == QSizePolicy::MinimumExpanding ) - return QString::fromUtf8("MinimumExpanding"); - if ( t == QSizePolicy::Expanding ) - return QString::fromUtf8("Expanding"); - if ( t == QSizePolicy::Ignored ) - return QString::fromUtf8("Ignored"); - return QString(); -} - -QSizePolicy::Policy int_to_size_type( int i ) -{ - if ( i == 0 ) - return QSizePolicy::Fixed; - if ( i == 1 ) - return QSizePolicy::Minimum; - if ( i == 2 ) - return QSizePolicy::Maximum; - if ( i == 3 ) - return QSizePolicy::Preferred; - if ( i == 4 ) - return QSizePolicy::MinimumExpanding; - if ( i == 5 ) - return QSizePolicy::Expanding; - if ( i == 6 ) - return QSizePolicy::Ignored; - return QSizePolicy::Preferred; -} - -} // namespace qdesigner_internal - -QT_END_NAMESPACE diff --git a/tools/designer/src/components/propertyeditor/defs.h b/tools/designer/src/components/propertyeditor/defs.h deleted file mode 100644 index 28e39fc..0000000 --- a/tools/designer/src/components/propertyeditor/defs.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DEFS_H -#define DEFS_H - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace qdesigner_internal { - -int size_type_to_int(QSizePolicy::Policy t); -QString size_type_to_string(QSizePolicy::Policy t); -QSizePolicy::Policy int_to_size_type(int i); - -} // namespace qdesigner_internal - -QT_END_NAMESPACE - -#endif // DEFS_H diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.pri b/tools/designer/src/components/propertyeditor/propertyeditor.pri index 7d2e7cb..bb1afdb 100644 --- a/tools/designer/src/components/propertyeditor/propertyeditor.pri +++ b/tools/designer/src/components/propertyeditor/propertyeditor.pri @@ -45,10 +45,8 @@ SOURCES += $$PWD/propertyeditor.cpp \ HEADERS += \ $$PWD/propertyeditor_global.h \ - $$PWD/defs.h \ $$PWD/qlonglongvalidator.h -SOURCES += $$PWD/defs.cpp \ - $$PWD/qlonglongvalidator.cpp +SOURCES += $$PWD/qlonglongvalidator.cpp RESOURCES += $$PWD/propertyeditor.qrc -- cgit v0.12 From bc0c6e9bb53f935c659dda90c7968d7738705f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 1 Sep 2010 08:57:36 +0200 Subject: Use NEON and preloading for 16 bit small / medium sized image blits. This gives a nice speedup for blitting of small and medium sized images by using preloading and avoiding function call overhead to memcpy for each scanline. For larger image widths memcpy becomes more efficient. Speedups of up to 40 % for 64 pixel wide images were measured. For image widths between 2 and 16 the speedup ranges between 12 % and 28 %. Task-number: QT-3401 Reviewed-by: Benjamin Poulain --- src/gui/painting/qblendfunctions.cpp | 8 +-- src/gui/painting/qdrawhelper.cpp | 1 + src/gui/painting/qdrawhelper_neon.cpp | 98 +++++++++++++++++++++++++++++++++++ src/gui/painting/qdrawhelper_neon_p.h | 5 ++ 4 files changed, 108 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 24908ce..0edf256 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -254,10 +254,10 @@ void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl, } } -static void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl, - const uchar *src, int sbpl, - int w, int h, - int const_alpha) +void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl, + const uchar *src, int sbpl, + int w, int h, + int const_alpha) { #ifdef QT_DEBUG_DRAW printf("qt_blend_rgb16_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n", diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5223458..5e1509d 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -8014,6 +8014,7 @@ void qInitDrawhelperAsm() qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index ed15c5c..0afd077 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -167,6 +167,14 @@ pixman_composite_scanline_over_asm_neon (int32_t w, const uint32_t *dst, const uint32_t *src); +extern "C" void +pixman_composite_src_0565_0565_asm_neon (int32_t w, + int32_t h, + uint16_t *dst, + int32_t dst_stride, + uint16_t *src, + int32_t src_stride); + // qblendfunctions.cpp void qt_blend_argb32_on_rgb16_const_alpha(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, @@ -200,6 +208,96 @@ void qt_blend_rgb16_on_argb32_neon(uchar *destPixels, int dbpl, pixman_composite_src_0565_8888_asm_neon(w, h, dst, dbpl, src, sbpl); } +// qblendfunctions.cpp +void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl, + const uchar *src, int sbpl, + int w, int h, + int const_alpha); + +template +static inline void scanLineBlit16(quint16 *dst, quint16 *src, int dstride) +{ + if (N >= 2) { + ((quint32 *)dst)[0] = ((quint32 *)src)[0]; + __builtin_prefetch(dst + dstride, 1, 0); + } + for (int i = 1; i < N/2; ++i) + ((quint32 *)dst)[i] = ((quint32 *)src)[i]; + if (N & 1) + dst[N-1] = src[N-1]; +} + +template +static inline void blockBlit16(quint16 *dst, quint16 *src, int dstride, int sstride, int h) +{ + union { + quintptr address; + quint16 *pointer; + } u; + + u.pointer = dst; + + if (u.address & 2) { + while (h--) { + // align dst + dst[0] = src[0]; + if (Width > 1) + scanLineBlit16(dst + 1, src + 1, dstride); + dst += dstride; + src += sstride; + } + } else { + while (h--) { + scanLineBlit16(dst, src, dstride); + + dst += dstride; + src += sstride; + } + } +} + +void qt_blend_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + // testing show that the default memcpy is faster for widths 150 and up + if (const_alpha != 256 || w >= 150) { + qt_blend_rgb16_on_rgb16(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + return; + } + + int dstride = dbpl / 2; + int sstride = sbpl / 2; + + quint16 *dst = (quint16 *) destPixels; + quint16 *src = (quint16 *) srcPixels; + + switch (w) { +#define BLOCKBLIT(n) case n: blockBlit16(dst, src, dstride, sstride, h); return; + BLOCKBLIT(1); + BLOCKBLIT(2); + BLOCKBLIT(3); + BLOCKBLIT(4); + BLOCKBLIT(5); + BLOCKBLIT(6); + BLOCKBLIT(7); + BLOCKBLIT(8); + BLOCKBLIT(9); + BLOCKBLIT(10); + BLOCKBLIT(11); + BLOCKBLIT(12); + BLOCKBLIT(13); + BLOCKBLIT(14); + BLOCKBLIT(15); +#undef BLOCKBLIT + default: + break; + } + + pixman_composite_src_0565_0565_asm_neon (w, h, dst, dstride, src, sstride); +} + extern "C" void blend_8_pixels_argb32_on_rgb16_neon(quint16 *dst, const quint32 *src, int const_alpha); void qt_blend_argb32_on_rgb16_neon(uchar *destPixels, int dbpl, diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index 451edbc..d25b7ec 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -84,6 +84,11 @@ void qt_blend_rgb16_on_argb32_neon(uchar *destPixels, int dbpl, int w, int h, int const_alpha); +void qt_blend_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha); + void qt_alphamapblit_quint16_neon(QRasterBuffer *rasterBuffer, int x, int y, quint32 color, const uchar *bitmap, -- cgit v0.12 From dcb98430f6add24c9d54253bd35d35010cc75c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 1 Sep 2010 12:33:55 +0200 Subject: Fix a crash when passing a null pixmap to QPainter::drawPixmapFragments(). Task-number: QTBUG-13331 Reviewed-by: Samuel --- src/gui/painting/qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 4e10671..c6046ac 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -9028,7 +9028,7 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment { Q_D(QPainter); - if (!d->engine) + if (!d->engine || pixmap.isNull()) return; #ifndef QT_NO_DEBUG -- cgit v0.12