diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-06-23 10:32:42 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-06-23 10:32:42 (GMT) |
commit | e1eceedaa635d0180eb798b00c3da93156d7af63 (patch) | |
tree | 04325155309fd225d68a4cf118be34c2378cb26a | |
parent | 2c96aeb45320ade7e2c074433560185f16631374 (diff) | |
parent | 71be46c61c582d2f4635a1e420e44d57ddb5857a (diff) | |
download | Qt-e1eceedaa635d0180eb798b00c3da93156d7af63.zip Qt-e1eceedaa635d0180eb798b00c3da93156d7af63.tar.gz Qt-e1eceedaa635d0180eb798b00c3da93156d7af63.tar.bz2 |
Merge commit 'origin/4.5'
Conflicts:
src/sql/drivers/psql/qsql_psql.cpp
52 files changed, 1002 insertions, 92 deletions
@@ -309,8 +309,6 @@ sub syncHeader { $header =~ s=\\=/=g; return copyFile($iheader, $header) if($copy); - my $iheader_no_basedir = $iheader; - $iheader_no_basedir =~ s,^$basedir/?,,; unless(-e "$header") { my $header_dir = dirname($header); mkpath $header_dir, 0777; @@ -800,10 +798,9 @@ foreach (@modules_to_sync) { my $class = $_; if ($class =~ m/::/) { $class =~ s,::,/,g; - $class = "../" . $class; } $class_lib_map_contents .= "QT_CLASS_LIB($_, $lib, $header_base)\n"; - $header_copies++ if(syncHeader("$out_basedir/include/$lib/$class", $header, 0)); + $header_copies++ if(syncHeader("$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0)); } } else { @headers = ( "$out_basedir/include/$lib/private/$header" ); @@ -825,7 +822,6 @@ foreach (@modules_to_sync) { my $class = $_; if ($class =~ m/::/) { $class =~ s,::,/,g; - $class = "../" . $class; } my $class_header = fixPaths("$out_basedir/include/$lib/$class", $current_dir) . " "; @@ -846,25 +842,27 @@ foreach (@modules_to_sync) { $master_contents .= "#endif\n"; unless($showonly) { - #generate the "master" include file - my $master_include = "$out_basedir/include/$lib/$lib"; - $pri_install_files .= fixPaths($master_include, "$modules{$lib}") . " "; #get the master file installed too - if(-e "$master_include") { - open MASTERINCLUDE, "<$master_include"; - local $/; - binmode MASTERINCLUDE; - my $oldmaster = <MASTERINCLUDE>; - close MASTERINCLUDE; - $oldmaster =~ s/\r//g; # remove \r's , so comparison is ok on all platforms - $master_include = 0 if($oldmaster eq $master_contents); - } - if($master_include && $master_contents) { - my $master_dir = dirname($master_include); - mkpath $master_dir, 0777; - print "header (master) created for $lib\n"; - open MASTERINCLUDE, ">$master_include"; - print MASTERINCLUDE "$master_contents"; - close MASTERINCLUDE; + unless ($lib eq "phonon") { + #generate the "master" include file + my $master_include = "$out_basedir/include/$lib/$lib"; + $pri_install_files .= fixPaths($master_include, "$modules{$lib}") . " "; #get the master file installed too + if($master_include && -e "$master_include") { + open MASTERINCLUDE, "<$master_include"; + local $/; + binmode MASTERINCLUDE; + my $oldmaster = <MASTERINCLUDE>; + close MASTERINCLUDE; + $oldmaster =~ s/\r//g; # remove \r's , so comparison is ok on all platforms + $master_include = 0 if($oldmaster eq $master_contents); + } + if($master_include && $master_contents) { + my $master_dir = dirname($master_include); + mkpath $master_dir, 0777; + print "header (master) created for $lib\n"; + open MASTERINCLUDE, ">$master_include"; + print MASTERINCLUDE "$master_contents"; + close MASTERINCLUDE; + } } #handle the headers.pri for each module diff --git a/doc/src/diagrams/frozencolumn/tableview-overlay.svg b/doc/src/diagrams/frozencolumn/tableview-overlay.svg new file mode 100644 index 0000000..fafdc23 --- /dev/null +++ b/doc/src/diagrams/frozencolumn/tableview-overlay.svg @@ -0,0 +1,240 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.46" + sodipodi:docname="table.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective10" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.98994949" + inkscape:cx="388.18807" + inkscape:cy="731.8625" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1125" + inkscape:window-x="-4" + inkscape:window-y="-4" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="fill:#f2f2f2;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + id="rect2385" + width="517.14294" + height="358.57147" + x="97.142853" + y="190.93361" + ry="2.5253813" /> + <rect + style="opacity:1;fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + id="rect2387" + width="51.42857" + height="355.71429" + x="98.571426" + y="193.79076" /> + <rect + style="opacity:1;fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + id="rect3159" + width="515.71429" + height="12.857142" + x="98.571426" + y="192.36218" /> + <rect + style="opacity:1;fill:#b3b3b3;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + id="rect3161" + width="464.28571" + height="10" + x="150" + y="538.07648" /> + <rect + style="opacity:1;fill:#b3b3b3;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + id="rect3163" + width="10.00007" + height="330.00003" + x="603.57141" + y="206.6479" /> + <rect + style="opacity:1;fill:#99ff55;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.10637689px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + id="rect3167" + width="84.8367" + height="344.89362" + x="150.47162" + y="192.41537" + ry="3.0295234" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 340.92648,197.77313 L 377.79705,175.0447 L 405.07117,175.0447" + id="path3193" /> + <text + xml:space="preserve" + style="font-size:20px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="407.09146" + y="177.57007" + id="text3195"><tspan + sodipodi:role="line" + x="407.09146" + y="177.57007" + id="tspan3199">horizontal header</tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 320.72343,426.0676 L 232.84016,619.51182 L 209.10158,620.01689" + id="path3205" /> + <text + xml:space="preserve" + style="font-size:20px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="117.1777" + y="622.5423" + id="text3207"><tspan + sodipodi:role="line" + id="tspan3209" + x="117.1777" + y="622.5423">viewport</tspan></text> + <path + sodipodi:type="arc" + style="fill:#000000;fill-opacity:1" + id="path3215" + sodipodi:cx="320.78656" + sodipodi:cy="426.0676" + sodipodi:rx="1.8309015" + sodipodi:ry="1.8940361" + d="M 322.61746,426.0676 A 1.8309015,1.8940361 0 1 1 318.95566,426.0676 A 1.8309015,1.8940361 0 1 1 322.61746,426.0676 z" /> + <path + sodipodi:type="arc" + style="fill:#000000;fill-opacity:1" + id="path3217" + sodipodi:cx="341.24216" + sodipodi:cy="197.64687" + sodipodi:rx="1.1995561" + sodipodi:ry="1.1364216" + d="M 342.44171,197.64687 A 1.1995561,1.1364216 0 1 1 340.0426,197.64687 A 1.1995561,1.1364216 0 1 1 342.44171,197.64687 z" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 109.09647,228.07771 L 137.38075,156.35687 L 176.7767,156.35687" + id="path3219" /> + <text + xml:space="preserve" + style="font-size:20px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="177.94707" + y="158.76218" + id="text3221"><tspan + sodipodi:role="line" + x="177.94707" + y="158.76218" + id="tspan3229">vertical header</tspan></text> + <path + sodipodi:type="arc" + style="fill:#000000;fill-opacity:1" + id="path3233" + sodipodi:cx="109.03334" + sodipodi:cy="228.26711" + sodipodi:rx="1.4520943" + sodipodi:ry="1.3258252" + d="M 110.48543,228.26711 A 1.4520943,1.3258252 0 1 1 107.58125,228.26711 A 1.4520943,1.3258252 0 1 1 110.48543,228.26711 z" /> + <path + sodipodi:type="arc" + id="path3239" + style="fill:#000000;stroke:none" + sodipodi:cx="608.61688" + sodipodi:cy="466.47372" + sodipodi:rx="1.5" + sodipodi:ry="1.5" + d="M 610.11688,466.47372 A 1.5,1.5 0 1 1 607.11688,466.47372 A 1.5,1.5 0 1 1 610.11688,466.47372 z" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 608.61691,466.47371 C 679.32759,523.04225 576.29203,608.40014 576.29203,608.40014 C 576.29203,608.40014 594.00783,590.22921 587.58437,566.25655 C 581.16091,542.28388 564.87674,543.54891 564.87674,543.54891 L 565.68543,542.74022" + id="path3241" /> + <path + sodipodi:type="arc" + id="path3243" + style="fill:#000000;stroke:none" + sodipodi:cx="565.18036" + sodipodi:cy="543.49786" + sodipodi:rx="1.5" + sodipodi:ry="1.5" + d="M 566.68036,543.49786 A 1.5,1.5 0 1 1 563.68036,543.49786 A 1.5,1.5 0 1 1 566.68036,543.49786 z" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 576.78572,607.8979 C 576.78572,607.8979 585.44643,599.23718 576.78572,607.8979 z" + id="path3247" /> + <text + xml:space="preserve" + style="font-size:20px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="435.89288" + y="615.66577" + id="text3251"><tspan + sodipodi:role="line" + id="tspan3253" + x="435.89288" + y="615.66577">scrollbars</tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 536.70668,615.02926 L 559.18257,614.96613 C 559.18257,614.96613 569.50507,615.1871 576.48143,608.21073" + id="path3257" /> + <path + sodipodi:type="arc" + id="path3261" + style="fill:#000000;stroke:none" + sodipodi:cx="198.74751" + sodipodi:cy="310.65768" + sodipodi:rx="1.5" + sodipodi:ry="1.5" + d="M 200.24751,310.65768 A 1.5,1.5 0 1 1 197.24751,310.65768 A 1.5,1.5 0 1 1 200.24751,310.65768 z" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 198.74751,310.65768 C 301.278,280.60564 301.278,280.60564 301.278,280.60564 L 333.85542,280.60564" + id="path3263" /> + <text + xml:space="preserve" + style="font-size:20px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="337.64349" + y="281.36328" + id="text3265"><tspan + sodipodi:role="line" + id="tspan3267" + x="337.64349" + y="281.36328">second QTableView</tspan></text> + </g> +</svg> diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 184ac27..1f20b91 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -172,6 +172,7 @@ \o \l{itemviews/dirview}{Dir View} \o \l{itemviews/editabletreemodel}{Editable Tree Model}\raisedaster \o \l{itemviews/fetchmore}{Fetch More}\raisedaster + \o \l{itemviews/frozencolumn}{Frozen Column}\raisedaster \o \l{itemviews/pixelator}{Pixelator}\raisedaster \o \l{itemviews/puzzle}{Puzzle} \o \l{itemviews/simpledommodel}{Simple DOM Model}\raisedaster diff --git a/doc/src/examples/frozencolumn.qdoc b/doc/src/examples/frozencolumn.qdoc new file mode 100644 index 0000000..e5a3b59 --- /dev/null +++ b/doc/src/examples/frozencolumn.qdoc @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example itemviews/frozencolumn + \title Frozen Column Example + + This example demonstrates how to freeze a column within a QTableView. + + \image frozencolumn-example.png "Screenshot of the example" + + We use Qt's model/view framework to implement a table with its first + column frozen. This technique can be aplied to several columns or rows, + as long as they are on the edge of the table. + + The model/view framework allows for one model to be displayed in different + ways using multiple views. For this example, we use two views on the same + model - two \l {QTableView}{table views} sharing one model. The frozen + column is a child of the main tableview, and we provide the desired visual + effect using an overlay technique which will be described step by step in + the coming sections. + + \image frozencolumn-tableview.png + + + \section1 FreezeTableWidget Class Definition + + The \c FreezeTableWidget class has a constructor and a destructor. Also, it + has two private members: the table view that we will use as an overlay, and + the shared model for both table views. Two slots are added to help keep the + section sizes in sync, as well as a function to readjust the frozen + column's geometry. In addition, we reimplement two functions: + \l{QAbstractItemView::}{resizeEvent()} and \l{QTableView::}{moveCursor()}. + + \snippet examples/itemviews/frozencolumn/freezetablewidget.h Widget definition + + \note QAbstractItemView is \l{QTableView}'s ancestor. + + + \section1 FreezeTableWidget Class Implementation + + The constructor takes \a model as an argument and creates a table view that + we will use to display the frozen column. Then, within the constructor, we + invoke the \c init() function to set up the frozen column. Finally, we + connect the \l{QHeaderView::sectionResized()} signals (for horizontal and + vertical headers) to the appropriate slots. This ensures that our frozen + column's sections are in sync with the headers. We also connect the + vertical scrollbars together so that the frozen column scrolls vertically + with the rest of our table. + + \snippet examples/itemviews/frozencolumn/freezetablewidget.cpp constructor + + + In the \c init() function, we ensure that the overlay table view + responsible for displaying the frozen column, is set up properly. This + means that this table view, \c frozenTableView, has to have the same model + as the main table view. However, the difference here is: \c frozenTableView's + only visible column is its first column; we hide the others using + \l{QTableView::}{setColumnHidden()} + + \snippet examples/itemviews/frozencolumn/freezetablewidget.cpp init part1 + + + In terms of the frozen column's z-order, we stack it on top of the + viewport. This is achieved by calling \l{QWidget::}{stackUnder()} on the + viewport. For appearance's sake, we prevent the column from stealing focus + from the main tableview. Also, we make sure that both views share the same + selection model, so only one cell can be selected at a time. A few other + tweaks are done to make our application look good and behave consistently + with the main tableview. Note that we called \c updateFrozenTableGeometry() + to make the column occupy the correct spot. + + \snippet examples/itemviews/frozencolumn/freezetablewidget.cpp init part2 + + When you resize the frozen column, the same column on the main table view + must resize accordingly, to provide seamless integration. This is + accomplished by getting the new size of the column from the \c newSize + value from the \l{QHeaderView::}{sectionResized()} signal, emitted by both + the horizontal and vertical header. + + \snippet examples/itemviews/frozencolumn/freezetablewidget.cpp sections + + Since the width of the frozen column is modified, we adjust the geometry of + the widget accordingly by invoking \c updateFrozenTableGeometry(). This + function is further explained below. + + In our reimplementation of QTableView::resizeEvent(), we call + \c updateFrozenTableGeometry() after invoking the base class + implementation. + + \snippet examples/itemviews/frozencolumn/freezetablewidget.cpp resize + + When navigating around the table with the keyboard, we need to ensure that + the current selection does not disappear behind the frozen column. To + synchronize this, we reimplement QTableView::moveCursor() and adjust the + scrollbar positions if needed, after calling the base class implementation. + + \snippet examples/itemviews/frozencolumn/freezetablewidget.cpp navigate + + The frozen column's geometry calculation is based on the geometry of the + table underneath, so it always appears in the right place. Using the + QFrame::frameWidth() function helps to calculate this geometry correctly, + no matter which style is used. We rely on the geometry of the viewport and + headers to set the boundaries for the frozen column. + + \snippet examples/itemviews/frozencolumn/freezetablewidget.cpp geometry + +*/ + diff --git a/doc/src/images/frozencolumn-example.png b/doc/src/images/frozencolumn-example.png Binary files differnew file mode 100644 index 0000000..66b5c10 --- /dev/null +++ b/doc/src/images/frozencolumn-example.png diff --git a/doc/src/images/frozencolumn-tableview.png b/doc/src/images/frozencolumn-tableview.png Binary files differnew file mode 100644 index 0000000..d829ff5 --- /dev/null +++ b/doc/src/images/frozencolumn-tableview.png diff --git a/doc/src/snippets/code/src_gui_painting_qpen.cpp b/doc/src/snippets/code/src_gui_painting_qpen.cpp index 538fa09..b5995f7 100644 --- a/doc/src/snippets/code/src_gui_painting_qpen.cpp +++ b/doc/src/snippets/code/src_gui_painting_qpen.cpp @@ -25,7 +25,7 @@ QVector<qreal> dashes; qreal space = 4; dashes << 1 << space << 3 << space << 9 << space - << 27 << space << 9; + << 27 << space << 9 << space; pen.setDashPattern(dashes); //! [2] @@ -36,6 +36,6 @@ QPen pen; QVector<qreal> dashes; qreal space = 4; dashes << 1 << space << 3 << space << 9 << space - << 27 << space << 9; + << 27 << space << 9 << space; pen.setDashPattern(dashes); //! [3] diff --git a/examples/itemviews/frozencolumn/freezetablewidget.cpp b/examples/itemviews/frozencolumn/freezetablewidget.cpp new file mode 100644 index 0000000..7a9a8df --- /dev/null +++ b/examples/itemviews/frozencolumn/freezetablewidget.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "freezetablewidget.h" + +//! [constructor] +FreezeTableWidget::FreezeTableWidget(QAbstractItemModel * model) +{ + setModel(model); + frozenTableView = new QTableView(this); + + init(); + + //connect the headers and scrollbars of both tableviews together + connect(horizontalHeader(),SIGNAL(sectionResized ( int ,int,int )), this, + SLOT(updateSectionWidth(int, int, int))); + connect(verticalHeader(),SIGNAL(sectionResized ( int ,int,int )), this, + SLOT(updateSectionHeight(int, int, int))); + + connect(frozenTableView->verticalScrollBar(), SIGNAL(valueChanged(int)), + verticalScrollBar(), SLOT(setValue(int))); + connect(verticalScrollBar(), SIGNAL(valueChanged(int)), + frozenTableView->verticalScrollBar(), SLOT(setValue(int))); + + +} +//! [constructor] + +FreezeTableWidget::~FreezeTableWidget() +{ + delete frozenTableView; +} + +//! [init part1] +void FreezeTableWidget::init() +{ + frozenTableView->setModel(model()); + frozenTableView->setFocusPolicy(Qt::NoFocus); + frozenTableView->verticalHeader()->hide(); + frozenTableView->horizontalHeader()->setResizeMode(QHeaderView::Fixed); + + viewport()->stackUnder(frozenTableView); +//! [init part1] + +//! [init part2] + frozenTableView->setStyleSheet("QTableView { border: none;" + "background-color: #8EDE21;}"); //for demo purposes + frozenTableView->setSelectionModel(selectionModel()); + for(int col=1; col<model()->columnCount(); col++) + frozenTableView->setColumnHidden(col, true); + + frozenTableView->setColumnWidth(0, columnWidth(0) ); + + frozenTableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + frozenTableView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + frozenTableView->show(); + + updateFrozenTableGeometry(); + + setHorizontalScrollMode(ScrollPerPixel); + setVerticalScrollMode(ScrollPerPixel); + frozenTableView->setVerticalScrollMode(ScrollPerPixel); +} +//! [init part2] + + +//! [sections] +void FreezeTableWidget::updateSectionWidth(int logicalIndex, int, int newSize) +{ + if(logicalIndex==0){ + frozenTableView->setColumnWidth(0,newSize); + updateFrozenTableGeometry(); + } +} + +void FreezeTableWidget::updateSectionHeight(int logicalIndex, int, int newSize) +{ + frozenTableView->setRowHeight(logicalIndex, newSize); +} +//! [sections] + + +//! [resize] +void FreezeTableWidget::resizeEvent(QResizeEvent * event) +{ + QTableView::resizeEvent(event); + updateFrozenTableGeometry(); + } +//! [resize] + + +//! [navigate] +QModelIndex FreezeTableWidget::moveCursor(CursorAction cursorAction, + Qt::KeyboardModifiers modifiers) +{ + QModelIndex current = QTableView::moveCursor(cursorAction, modifiers); + + if(cursorAction == MoveLeft && current.column()>0 + && visualRect(current).topLeft().x() < frozenTableView->columnWidth(0) ){ + + const int newValue = horizontalScrollBar()->value() + visualRect(current).topLeft().x() + - frozenTableView->columnWidth(0); + horizontalScrollBar()->setValue(newValue); + } + return current; +} +//! [navigate] + + +//! [geometry] +void FreezeTableWidget::updateFrozenTableGeometry() +{ + frozenTableView->setGeometry( verticalHeader()->width()+frameWidth(), + frameWidth(), columnWidth(0), + viewport()->height()+horizontalHeader()->height()); +} +//! [geometry] + + diff --git a/examples/itemviews/frozencolumn/freezetablewidget.h b/examples/itemviews/frozencolumn/freezetablewidget.h new file mode 100644 index 0000000..2abae47 --- /dev/null +++ b/examples/itemviews/frozencolumn/freezetablewidget.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef FREEZETABLEWIDGET_H +#define FREEZETABLEWIDGET_H + +#include <QTableView> + +//! [Widget definition] +class FreezeTableWidget : public QTableView { + Q_OBJECT + +public: + FreezeTableWidget(QAbstractItemModel * model); + ~FreezeTableWidget(); + + +protected: + virtual void resizeEvent(QResizeEvent *event); + virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + +private: + QTableView *frozenTableView; + void init(); + void updateFrozenTableGeometry(); + + +private slots: + void updateSectionWidth(int logicalIndex,int, int newSize); + void updateSectionHeight(int logicalIndex, int, int newSize); + +}; +//! [Widget definition] +#endif diff --git a/examples/itemviews/frozencolumn/frozencolumn.pro b/examples/itemviews/frozencolumn/frozencolumn.pro new file mode 100644 index 0000000..361de5b --- /dev/null +++ b/examples/itemviews/frozencolumn/frozencolumn.pro @@ -0,0 +1,9 @@ +HEADERS += freezetablewidget.h +SOURCES += main.cpp freezetablewidget.cpp +RESOURCES += grades.qrc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/itemviews/frozencolumn +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/itemviews/frozencolumn +INSTALLS += target sources diff --git a/examples/itemviews/frozencolumn/grades.qrc b/examples/itemviews/frozencolumn/grades.qrc new file mode 100644 index 0000000..5f16d56 --- /dev/null +++ b/examples/itemviews/frozencolumn/grades.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/" > + <file>grades.txt</file> + </qresource> +</RCC> diff --git a/examples/itemviews/frozencolumn/grades.txt b/examples/itemviews/frozencolumn/grades.txt new file mode 100644 index 0000000..4b55b473 --- /dev/null +++ b/examples/itemviews/frozencolumn/grades.txt @@ -0,0 +1,35 @@ + France , Norway , YDS , UK(tech.), UK(adj.) , UIAA , Ger , Australia , Finland , Brazil + +1, , 5.2, , , I , I , , , Isup +2, , 5.3, , , II , II , 11, , II +3, 3, 5.4, , , III , III , 12, , IIsup +4, 4, 5.5, 4a , VD , IV , IV , 12, , III +5a , 5-, 5.6, , S , V- , V , 13, 5-, IIIsup +5b , 5, 5.7, 4b , HS , V , VI , 14, 5, IV + , , , 4c , , V+ , , 15, , +5c , 5+, 5.8, , VS , VI- , VIIa , 16, 5, IVsup +6a , 6-, 5.9, 5a , HVS , VI , VIIb , 17, , V +6a+ , 6-/6 , 5.10a , , E1 , VI+ , VIIc , 18, 6-, VI +6b , , 5.10b , 5b , , , , 19, , VI/VI+ +6b+ , 6, 5.10c , , E2 , VII- , VIIIa , 20, 6, VIsup/VI+ +6c , 6+, 5.10d , 5c , , VII , VIIIb , 21, , VIsup +6c+ , 7-, 5.11a , , E3 , VII+ , VIIIc , 22, 6, 7a +6c+ , 7, 5.11b , , , , , 23, , 7b +7a , 7+, 5.11c , 6a , E4 , VIII- , IXa , 24, 7-, 7c +7a , 7+/8- , 5.11d , , , VIII , IXb , , , 7c +7a+ , 8-, 5.12a , , E5 , VIII+ , IXc , 25, 7, 8a +7b , 8, 5.12b , 6b , , , , 26, 8-, 8b +7b+ , 8/8+ , 5.12c , , E6 , IX- , Xa , 27, 8, 8c +7c , 8+, 5.12d , 6c , , IX , Xb , 28, 8, 9a +7c+ , 9-, 5.13a , , E7 , IX+ , Xc , 29, 9-, 9b +8a , , 5.13b , , , , , , 9, 9c +8a+ , 9-/9 , 5.13c , 7a , , X- , , 30, 9, 10a +8b , 9, 5.13d , , E8 , X , , 31, 10-, 10b +8b+ , 9/9+ , 5.14a , , , X+ , , 32, 10, 10c +8c , 9+, 5.14b , 7b , , , , 33, 10, 11a +8c+ , 10-, 5.14c , , E9 , XI- , , 34, 11-, 11b +9a , 10, 5.14d , 7c , , XI , , 35, 11, 11c +9a+ , , 5.15a , , , XI+ , , , , 12a +9b , , 5.15b , , , , , , , 12b + +# Wikipedia contributors. Grade (climbing). Wikipedia, The Free Encyclopedia. May 15, 2009, 20:42 UTC. Available at: http://en.wikipedia.org/w/index.php?title=Grade_(climbing)&oldid=290165724. Accessed May 28, 2009. diff --git a/examples/itemviews/frozencolumn/main.cpp b/examples/itemviews/frozencolumn/main.cpp new file mode 100644 index 0000000..fdefd73 --- /dev/null +++ b/examples/itemviews/frozencolumn/main.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QApplication> +#include <QStandardItemModel> +#include <QFile> + +#include "freezetablewidget.h" + +int main( int argc, char** argv ) +{ + + Q_INIT_RESOURCE(grades); + + + QApplication app( argc, argv ); + QStandardItemModel *model=new QStandardItemModel(); + + + QFile file(":/grades.txt"); + QString line; + QStringList list; + if (file.open(QFile::ReadOnly)) { + line = file.readLine(200); + list= line.simplified().split(","); + model->setHorizontalHeaderLabels(list); + + int row=0; + QStandardItem *newItem=0; + while(file.canReadLine()){ + line = file.readLine(200); + if(!line.startsWith("#") && line.contains(",")){ + list= line.simplified().split(","); + for(int col=0; col<list.length(); col++){ + newItem = new QStandardItem(list.at(col)); + model->setItem(row ,col, newItem); + } + row++; + } + } + } + file.close(); + + FreezeTableWidget *tableView = new FreezeTableWidget(model); + + tableView->setWindowTitle(QObject::tr("Frozen Column Example")); + tableView->resize(560,680); + tableView->show(); + return app.exec(); +} + diff --git a/examples/itemviews/itemviews.pro b/examples/itemviews/itemviews.pro index 6202bbc..7dcf0f6 100644 --- a/examples/itemviews/itemviews.pro +++ b/examples/itemviews/itemviews.pro @@ -8,6 +8,7 @@ SUBDIRS = addressbook \ dirview \ editabletreemodel \ fetchmore \ + frozencolumn \ pixelator \ puzzle \ simpledommodel \ diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp index c80d73b..896e3b8 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp @@ -36,7 +36,10 @@ #include <QMetaEnum> #include <QUrl> #include <QEvent> -#include <phonon> + +#include <Phonon/AudioOutput> +#include <Phonon/MediaObject> +#include <Phonon/VideoWidget> using namespace Phonon; diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index 2c1c2e3..a2dfa52 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -560,6 +560,7 @@ public: void enableUpdates(); void _q_emitCustomButtonClicked(); void _q_updateButtonStates(); + void _q_handleFieldObjectDestroyed(QObject *); void setStyle(QStyle *style); #ifdef Q_WS_MAC static QPixmap findDefaultBackgroundPixmap(); @@ -731,6 +732,8 @@ void QWizardPrivate::cleanupPagesNotInHistory() void QWizardPrivate::addField(const QWizardField &field) { + Q_Q(QWizard); + QWizardField myField = field; myField.resolve(defaultPropertyTable); @@ -744,15 +747,23 @@ void QWizardPrivate::addField(const QWizardField &field) if (myField.mandatory && !myField.changedSignal.isEmpty()) QObject::connect(myField.object, myField.changedSignal, myField.page, SLOT(_q_maybeEmitCompleteChanged())); + QObject::connect( + myField.object, SIGNAL(destroyed(QObject *)), q, + SLOT(_q_handleFieldObjectDestroyed(QObject *))); } void QWizardPrivate::removeFieldAt(int index) { + Q_Q(QWizard); + const QWizardField &field = fields.at(index); fieldIndexMap.remove(field.name); if (field.mandatory && !field.changedSignal.isEmpty()) QObject::disconnect(field.object, field.changedSignal, field.page, SLOT(_q_maybeEmitCompleteChanged())); + QObject::disconnect( + field.object, SIGNAL(destroyed(QObject *)), q, + SLOT(_q_handleFieldObjectDestroyed(QObject *))); fields.remove(index); } @@ -1595,6 +1606,20 @@ void QWizardPrivate::_q_updateButtonStates() enableUpdates(); } +void QWizardPrivate::_q_handleFieldObjectDestroyed(QObject *object) +{ + QVector<QWizardField>::iterator it = fields.begin(); + while (it != fields.end()) { + const QWizardField &field = *it; + if (field.object == object) { + fieldIndexMap.remove(field.name); + it = fields.erase(it); + } else { + ++it; + } + } +} + void QWizardPrivate::setStyle(QStyle *style) { for (int i = 0; i < QWizard::NButtons; i++) diff --git a/src/gui/dialogs/qwizard.h b/src/gui/dialogs/qwizard.h index 1d1a9b5..d1f9cf7 100644 --- a/src/gui/dialogs/qwizard.h +++ b/src/gui/dialogs/qwizard.h @@ -197,6 +197,7 @@ private: Q_DECLARE_PRIVATE(QWizard) Q_PRIVATE_SLOT(d_func(), void _q_emitCustomButtonClicked()) Q_PRIVATE_SLOT(d_func(), void _q_updateButtonStates()) + Q_PRIVATE_SLOT(d_func(), void _q_handleFieldObjectDestroyed(QObject *)) friend class QWizardPage; }; diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 57269ce..07ebb8c 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -839,7 +839,7 @@ bool QGraphicsProxyWidget::event(QEvent *event) // ### Qt 4.5: this code must also go into a reimplementation // of inputMethodEvent(). QWidget *focusWidget = d->widget->focusWidget(); - if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) + if (focusWidget && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) QApplication::sendEvent(focusWidget, event); break; } diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index f1b0d19..4652b91 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -2238,7 +2238,7 @@ QListViewItem QStaticListViewBase::indexToListViewItem(const QModelIndex &index) { if (flowPositions.isEmpty() || segmentPositions.isEmpty() - || index.row() > flowPositions.count()) + || index.row() >= flowPositions.count()) return QListViewItem(); const int segment = qBinarySearch<int>(segmentStartRows, index.row(), diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index d3b4157..34bc578 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -258,7 +258,10 @@ void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn) bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *widget) { const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft())); - return windowSurface->scroll(QRect(pos, rect.size()), dx, dy); + const QRect tlwRect(QRect(pos, rect.size())); + if (dirty.intersects(tlwRect)) + return false; // We don't want to scroll junk. + return windowSurface->scroll(tlwRect, dx, dy); } void QWidgetBackingStore::releaseBuffer() diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 37f7b6d..37a88a3 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1322,6 +1322,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) delete s->clip; s->clip = clip; + s->clip->enabled = true; s->flags.has_clip_ownership = true; } else { // intersect clip with current clip @@ -1338,6 +1339,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) s->clip->setClipRect(base->clipRect & clipRect); else s->clip->setClipRegion(base->clipRegion & clipRect); + s->clip->enabled = true; } else { QPaintEngineEx::clip(rect, op); return; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 6953e04..34305c2 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2545,6 +2545,9 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op) Q_D(QPainter); if (d->extended) { + if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) + op = Qt::ReplaceClip; + if (!d->engine) { qWarning("QPainter::setClipRect: Painter not active"); return; @@ -2598,6 +2601,9 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) return; } + if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) + op = Qt::ReplaceClip; + if (d->extended) { d->state->clipEnabled = true; d->extended->clip(rect, op); @@ -2606,9 +2612,6 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) return; } - if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) - op = Qt::ReplaceClip; - d->state->clipRegion = rect; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -2651,6 +2654,9 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) return; } + if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) + op = Qt::ReplaceClip; + if (d->extended) { d->state->clipEnabled = true; d->extended->clip(r, op); @@ -2659,9 +2665,6 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) return; } - if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) - op = Qt::ReplaceClip; - d->state->clipRegion = r; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -3048,6 +3051,9 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) return; } + if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) + op = Qt::ReplaceClip; + if (d->extended) { d->state->clipEnabled = true; d->extended->clip(path, op); @@ -3056,11 +3062,6 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) return; } - - - if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) - op = Qt::ReplaceClip; - d->state->clipPath = path; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index b80e52d..a545148 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -1019,11 +1019,6 @@ bool QFontEngineMacMulti::stringToCMapInternal(const QChar *str, int len, QGlyph | kATSLineDisableAllJustification ; - if (!(flags & QTextEngine::DesignMetrics)) { - layopts |= kATSLineFractDisable | kATSLineUseDeviceMetrics - | kATSLineDisableAutoAdjustDisplayPos; - } - if (fontDef.styleStrategy & QFont::NoAntialias) layopts |= kATSLineNoAntiAliasing; diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index e173a8d..638bfb3 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -768,7 +768,7 @@ public: bool isFastRect(const QRectF &r); void drawImageAsPath(const QRectF &r, const QImage &img, const QRectF &sr); - void drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy); + void drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy, const QPointF &offset); void drawOffscreenPath(const QPainterPath &path); @@ -4222,13 +4222,15 @@ void QOpenGLPaintEnginePrivate::drawImageAsPath(const QRectF &r, const QImage &i brush_origin = old_brush_origin; } -void QOpenGLPaintEnginePrivate::drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy) +void QOpenGLPaintEnginePrivate::drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy, + const QPointF &offset) { QBrush old_brush = cbrush; QPointF old_brush_origin = brush_origin; QTransform brush_matrix = QTransform::fromTranslate(r.left(), r.top()); brush_matrix.scale(sx, sy); + brush_matrix.translate(-offset.x(), -offset.y()); cbrush = QBrush(img); cbrush.setTransform(brush_matrix); @@ -4305,7 +4307,7 @@ void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QR } } -void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &) +void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &offset) { Q_D(QOpenGLPaintEngine); @@ -4315,7 +4317,7 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con int rw = qCeil(r.width()); int rh = qCeil(r.height()); if (rw < pm.width() && rh < pm.height()) { - drawTiledPixmap(r, pm.copy(0, 0, rw, rh), QPointF()); + drawTiledPixmap(r, pm.copy(0, 0, rw, rh), offset); return; } @@ -4324,11 +4326,11 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con if (d->composition_mode > QPainter::CompositionMode_Plus || (d->high_quality_antialiasing && !d->isFastRect(r))) { if (scaled.isNull()) - d->drawTiledImageAsPath(r, pm.toImage(), 1, 1); + d->drawTiledImageAsPath(r, pm.toImage(), 1, 1, offset); else { const qreal sx = pm.width() / qreal(scaled.width()); const qreal sy = pm.height() / qreal(scaled.height()); - d->drawTiledImageAsPath(r, scaled, sx, sy); + d->drawTiledImageAsPath(r, scaled, sx, sy, offset); } } else { d->flushDrawQueue(); @@ -4359,8 +4361,12 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con q_vertexType vertexArray[4*2]; q_vertexType texCoordArray[4*2]; + double offset_x = offset.x() / pm.width(); + double offset_y = offset.y() / pm.height(); + qt_add_rect_to_array(r, vertexArray); - qt_add_texcoords_to_array(0, 0, tc_w, tc_h, texCoordArray); + qt_add_texcoords_to_array(offset_x, offset_y, + tc_w + offset_x, tc_h + offset_y, texCoordArray); glVertexPointer(2, q_vertexTypeEnum, 0, vertexArray); glTexCoordPointer(2, q_vertexTypeEnum, 0, texCoordArray); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 2e18b48..1b499b6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -686,8 +686,11 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) if (!d->unsupportedCompositionMode && d->dfbCanHandleClip(rect) && !d->matrixRotShear) { switch (brush.style()) { case Qt::SolidPattern: { + const QColor color = brush.color(); + if (!color.isValid()) + return; d->unlock(); - d->setDFBColor(brush.color()); + d->setDFBColor(color); const QRect r = d->transform.mapRect(rect).toRect(); d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()); @@ -711,6 +714,8 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) { + if (!color.isValid()) + return; Q_D(QDirectFBPaintEngine); d->updateClip(); if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear) { @@ -892,7 +897,6 @@ void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device) setCompositionMode(q->state()->compositionMode()); dirtyClip = true; setPen(q->state()->pen); - setDFBColor(pen.color()); } void QDirectFBPaintEnginePrivate::end() diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 62fef5b..76064ad 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -725,7 +725,7 @@ void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args) const QStringList flips = flipRegexp.cap(1).split(QLatin1Char(','), QString::SkipEmptyParts); flipFlags = DSFLIP_NONE; - foreach (QString flip, flips) { + foreach(const QString &flip, flips) { if (flip == QLatin1String("wait")) flipFlags = DFBSurfaceFlipFlags(flipFlags | DSFLIP_WAIT); else if (flip == QLatin1String("blit")) diff --git a/src/qt_install.pri b/src/qt_install.pri index 6dd2074..ebeac8d 100644 --- a/src/qt_install.pri +++ b/src/qt_install.pri @@ -15,11 +15,19 @@ qt_install_headers { $$QT_SOURCE_TREE/src/corelib/arch/$$QT_ARCH/arch } - flat_headers.files = $$INSTALL_HEADERS - flat_headers.path = $$[QT_INSTALL_HEADERS]/Qt - INSTALLS += flat_headers + equals(TARGET, phonon) { + class_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET/Phonon + } else { + flat_headers.files = $$INSTALL_HEADERS + flat_headers.path = $$[QT_INSTALL_HEADERS]/Qt + INSTALLS += flat_headers - targ_headers.files = $$INSTALL_HEADERS $$SYNCQT.HEADER_CLASSES + class_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET + } + class_headers.files = $$SYNCQT.HEADER_CLASSES + INSTALLS += class_headers + + targ_headers.files = $$INSTALL_HEADERS targ_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET INSTALLS += targ_headers } diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index b70868d..7bda969 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -91,7 +91,6 @@ public: : hEnv(0), hDbc(0), useSchema(false), disconnectCount(0), isMySqlServer(false), isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false) { - sql_char_type = sql_varchar_type = sql_longvarchar_type = QVariant::ByteArray; unicode = false; } @@ -100,9 +99,6 @@ public: uint unicode :1; uint useSchema :1; - QVariant::Type sql_char_type; - QVariant::Type sql_varchar_type; - QVariant::Type sql_longvarchar_type; int disconnectCount; bool isMySqlServer; bool isMSSqlServer; @@ -129,7 +125,6 @@ public: QODBCPrivate() : hEnv(0), hDbc(0), hStmt(0), useSchema(false), hasSQLFetchScroll(true) { - sql_char_type = sql_varchar_type = sql_longvarchar_type = QVariant::ByteArray; unicode = false; } @@ -142,9 +137,6 @@ public: uint unicode :1; uint useSchema :1; - QVariant::Type sql_char_type; - QVariant::Type sql_varchar_type; - QVariant::Type sql_longvarchar_type; QSqlRecord rInf; QVector<QVariant> fieldCache; @@ -294,14 +286,10 @@ static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, const T* p, bool isSi break; #endif case SQL_CHAR: - type = p->sql_char_type; - break; case SQL_VARCHAR: case SQL_GUID: - type = p->sql_varchar_type; - break; case SQL_LONGVARCHAR: - type = p->sql_longvarchar_type; + type = QVariant::String; break; default: type = QVariant::ByteArray; @@ -818,9 +806,6 @@ QODBCResult::QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p) d->hDbc = p->hDbc; d->unicode = p->unicode; d->useSchema = p->useSchema; - d->sql_char_type = p->sql_char_type; - d->sql_varchar_type = p->sql_varchar_type; - d->sql_longvarchar_type = p->sql_longvarchar_type; d->disconnectCount = p->disconnectCount; d->hasSQLFetchScroll = p->hasSQLFetchScroll; } @@ -1875,7 +1860,6 @@ void QODBCDriverPrivate::checkUnicode() sizeof(fFunc), NULL); if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WCHAR)) { - sql_char_type = QVariant::String; unicode = true; } @@ -1885,7 +1869,6 @@ void QODBCDriverPrivate::checkUnicode() sizeof(fFunc), NULL); if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WVARCHAR)) { - sql_varchar_type = QVariant::String; unicode = true; } @@ -1895,7 +1878,6 @@ void QODBCDriverPrivate::checkUnicode() sizeof(fFunc), NULL); if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (fFunc & SQL_CVT_WLONGVARCHAR)) { - sql_longvarchar_type = QVariant::String; unicode = true; } } diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 1ab8214..d197388 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -531,7 +531,7 @@ bool QPSQLResult::prepare(const QString &query) { if (!d->preparedQueriesEnabled) return QSqlResult::prepare(query); - + cleanup(); if (!d->preparedStmtId.isEmpty()) @@ -821,7 +821,20 @@ bool QPSQLDriver::commitTransaction() return false; } PGresult* res = PQexec(d->connection, "COMMIT"); - if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) { + + bool transaction_failed = false; + + // XXX + // This hack is used to tell if the transaction has succeeded for the protocol versions of + // PostgreSQL below. For 7.x and other protocol versions we are left in the dark. + // This hack can dissapear once there is an API to query this sort of information. + if (d->pro == QPSQLDriver::Version8 || + d->pro == QPSQLDriver::Version81 || + d->pro == QPSQLDriver::Version82) { + transaction_failed = QByteArray(PQcmdStatus(res)) == QByteArray("ROLLBACK")?true:false; + } + + if (!res || PQresultStatus(res) != PGRES_COMMAND_OK || transaction_failed) { PQclear(res); setLastError(qMakeError(tr("Could not commit transaction"), QSqlError::TransactionError, d)); @@ -1189,12 +1202,12 @@ bool QPSQLDriver::subscribeToNotificationImplementation(const QString &name) qPrintable(name)); return false; } - + int socket = PQsocket(d->connection); if (socket) { QString query = QLatin1String("LISTEN ") + escapeIdentifier(name, QSqlDriver::TableName); - if (PQresultStatus(PQexec(d->connection, - d->isUtf8 ? query.toUtf8().constData() + if (PQresultStatus(PQexec(d->connection, + d->isUtf8 ? query.toUtf8().constData() : query.toLocal8Bit().constData()) ) != PGRES_COMMAND_OK) { setLastError(qMakeError(tr("Unable to subscribe"), QSqlError::StatementError, d)); @@ -1225,8 +1238,8 @@ bool QPSQLDriver::unsubscribeFromNotificationImplementation(const QString &name) } QString query = QLatin1String("UNLISTEN ") + escapeIdentifier(name, QSqlDriver::TableName); - if (PQresultStatus(PQexec(d->connection, - d->isUtf8 ? query.toUtf8().constData() + if (PQresultStatus(PQexec(d->connection, + d->isUtf8 ? query.toUtf8().constData() : query.toLocal8Bit().constData()) ) != PGRES_COMMAND_OK) { setLastError(qMakeError(tr("Unable to unsubscribe"), QSqlError::StatementError, d)); @@ -1259,7 +1272,7 @@ void QPSQLDriver::_q_handleNotification(int) if (d->seid.contains(name)) emit notification(name); else - qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.", + qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.", qPrintable(name)); qPQfreemem(notify); diff --git a/tests/arthur/data/qps/clipping_state.qps b/tests/arthur/data/qps/clipping_state.qps index fd9a80a..3a66122 100644 --- a/tests/arthur/data/qps/clipping_state.qps +++ b/tests/arthur/data/qps/clipping_state.qps @@ -55,3 +55,18 @@ setClipping true setBrush #6300ff00 drawRect 25 25 50 50 + +# disable clipping followed by setClipRect +translate 150 0 + +setClipRect 0 0 50 50 ReplaceClip + +setClipping false + +setBrush #630000ff +drawRect 0 0 100 100 + +setClipRect 25 25 75 75 IntersectClip + +setBrush #6300ff00 +drawRect 25 25 50 50 diff --git a/tests/arthur/data/qps/clipping_state_qps.png b/tests/arthur/data/qps/clipping_state_qps.png Binary files differindex 9b3dee2..28bee46 100644 --- a/tests/arthur/data/qps/clipping_state_qps.png +++ b/tests/arthur/data/qps/clipping_state_qps.png diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 6727b05..dd9a3e0 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -252,6 +252,7 @@ private slots: void moveChild_data(); void moveChild(); + void showAndMoveChild(); void subtractOpaqueSiblings(); @@ -5318,6 +5319,33 @@ void tst_QWidget::moveChild() parent.color); } +void tst_QWidget::showAndMoveChild() +{ + QWidget parent(0, Qt::FramelessWindowHint); + parent.resize(300, 300); + parent.setPalette(Qt::red); + parent.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&parent); +#endif + QTest::qWait(200); + + const QPoint tlwOffset = parent.geometry().topLeft(); + QWidget child(&parent); + child.resize(100, 100); + child.setPalette(Qt::blue); + child.setAutoFillBackground(true); + + // Ensure that the child is repainted correctly when moved right after show. + // NB! Do NOT processEvents() (or qWait()) in between show() and move(). + child.show(); + child.move(150, 150); + qApp->processEvents(); + + VERIFY_COLOR(child.geometry().translated(tlwOffset), Qt::blue); + VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red); +} + void tst_QWidget::subtractOpaqueSiblings() { #ifdef QT_MAC_USE_COCOA diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index 71e1c3e..e5074b3 100644 --- a/tests/auto/qwizard/tst_qwizard.cpp +++ b/tests/auto/qwizard/tst_qwizard.cpp @@ -112,6 +112,7 @@ private slots: void task161658_alignments(); void task177022_setFixedSize(); void task248107_backButton(); + void task255350_fieldObjectDestroyed(); /* Things that could be added: @@ -2517,5 +2518,26 @@ void tst_QWizard::task248107_backButton() QCOMPARE(wizard.currentPage(), &page1); } +class WizardPage_task255350 : public QWizardPage +{ +public: + QLineEdit *lineEdit; + WizardPage_task255350() + : lineEdit(new QLineEdit) + { + registerField("dummy*", lineEdit); + } +}; + +void tst_QWizard::task255350_fieldObjectDestroyed() +{ + QWizard wizard; + WizardPage_task255350 *page = new WizardPage_task255350; + int id = wizard.addPage(page); + delete page->lineEdit; + wizard.removePage(id); // don't crash! + delete page; +} + QTEST_MAIN(tst_QWizard) #include "tst_qwizard.moc" diff --git a/tools/assistant/lib/fulltextsearch/qanalyzer.cpp b/tools/assistant/lib/fulltextsearch/qanalyzer.cpp index 9c380ae..ed018bf 100644 --- a/tools/assistant/lib/fulltextsearch/qanalyzer.cpp +++ b/tools/assistant/lib/fulltextsearch/qanalyzer.cpp @@ -27,6 +27,7 @@ QCLuceneAnalyzerPrivate::QCLuceneAnalyzerPrivate(const QCLuceneAnalyzerPrivate & : QSharedData() { analyzer = _CL_POINTER(other.analyzer); + deleteCLuceneAnalyzer = other.deleteCLuceneAnalyzer; } QCLuceneAnalyzerPrivate::~QCLuceneAnalyzerPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qdocument.cpp b/tools/assistant/lib/fulltextsearch/qdocument.cpp index c2aae98..bad8ea9 100644 --- a/tools/assistant/lib/fulltextsearch/qdocument.cpp +++ b/tools/assistant/lib/fulltextsearch/qdocument.cpp @@ -29,6 +29,7 @@ QCLuceneDocumentPrivate::QCLuceneDocumentPrivate(const QCLuceneDocumentPrivate & : QSharedData() { document = _CL_POINTER(other.document); + deleteCLuceneDocument = other.deleteCLuceneDocument; } QCLuceneDocumentPrivate::~QCLuceneDocumentPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qfield.cpp b/tools/assistant/lib/fulltextsearch/qfield.cpp index 496622d..dc878f3 100644 --- a/tools/assistant/lib/fulltextsearch/qfield.cpp +++ b/tools/assistant/lib/fulltextsearch/qfield.cpp @@ -28,6 +28,7 @@ QCLuceneFieldPrivate::QCLuceneFieldPrivate(const QCLuceneFieldPrivate &other) : QSharedData() { field = _CL_POINTER(other.field); + deleteCLuceneField = other.deleteCLuceneField; } QCLuceneFieldPrivate::~QCLuceneFieldPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qfilter.cpp b/tools/assistant/lib/fulltextsearch/qfilter.cpp index 60a2a1d..837f590 100644 --- a/tools/assistant/lib/fulltextsearch/qfilter.cpp +++ b/tools/assistant/lib/fulltextsearch/qfilter.cpp @@ -26,6 +26,7 @@ QCLuceneFilterPrivate::QCLuceneFilterPrivate(const QCLuceneFilterPrivate &other) : QSharedData() { filter = _CL_POINTER(other.filter); + deleteCLuceneFilter = other.deleteCLuceneFilter; } QCLuceneFilterPrivate::~QCLuceneFilterPrivate () diff --git a/tools/assistant/lib/fulltextsearch/qhits.cpp b/tools/assistant/lib/fulltextsearch/qhits.cpp index 003db17..c2fbf1b 100644 --- a/tools/assistant/lib/fulltextsearch/qhits.cpp +++ b/tools/assistant/lib/fulltextsearch/qhits.cpp @@ -27,6 +27,7 @@ QCLuceneHitsPrivate::QCLuceneHitsPrivate(const QCLuceneHitsPrivate &other) : QSharedData() { hits = _CL_POINTER(other.hits); + deleteCLuceneHits = other.deleteCLuceneHits; } QCLuceneHitsPrivate::~QCLuceneHitsPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qindexreader.cpp b/tools/assistant/lib/fulltextsearch/qindexreader.cpp index a755eae..fc1a3bb 100644 --- a/tools/assistant/lib/fulltextsearch/qindexreader.cpp +++ b/tools/assistant/lib/fulltextsearch/qindexreader.cpp @@ -27,6 +27,7 @@ QCLuceneIndexReaderPrivate::QCLuceneIndexReaderPrivate(const QCLuceneIndexReader : QSharedData() { reader = _CL_POINTER(other.reader); + deleteCLuceneIndexReader = other.deleteCLuceneIndexReader; } QCLuceneIndexReaderPrivate::~QCLuceneIndexReaderPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qindexwriter.cpp b/tools/assistant/lib/fulltextsearch/qindexwriter.cpp index af5a7bb..93e23e7 100644 --- a/tools/assistant/lib/fulltextsearch/qindexwriter.cpp +++ b/tools/assistant/lib/fulltextsearch/qindexwriter.cpp @@ -27,6 +27,7 @@ QCLuceneIndexWriterPrivate::QCLuceneIndexWriterPrivate(const QCLuceneIndexWriter : QSharedData() { writer = _CL_POINTER(other.writer); + deleteCLuceneIndexWriter = other.deleteCLuceneIndexWriter; } QCLuceneIndexWriterPrivate::~QCLuceneIndexWriterPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qquery.cpp b/tools/assistant/lib/fulltextsearch/qquery.cpp index 8bc9607..1760b05 100644 --- a/tools/assistant/lib/fulltextsearch/qquery.cpp +++ b/tools/assistant/lib/fulltextsearch/qquery.cpp @@ -28,6 +28,7 @@ QCLuceneQueryPrivate::QCLuceneQueryPrivate(const QCLuceneQueryPrivate &other) : QSharedData() { query = _CL_POINTER(other.query); + deleteCLuceneQuery = other.deleteCLuceneQuery; } QCLuceneQueryPrivate::~QCLuceneQueryPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qqueryparser.cpp b/tools/assistant/lib/fulltextsearch/qqueryparser.cpp index cbe0147..6f546be 100644 --- a/tools/assistant/lib/fulltextsearch/qqueryparser.cpp +++ b/tools/assistant/lib/fulltextsearch/qqueryparser.cpp @@ -28,6 +28,7 @@ QCLuceneQueryParserPrivate::QCLuceneQueryParserPrivate(const QCLuceneQueryParser : QSharedData() { queryParser = _CL_POINTER(other.queryParser); + deleteCLuceneQueryParser = other.deleteCLuceneQueryParser; } QCLuceneQueryParserPrivate::~QCLuceneQueryParserPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qreader.cpp b/tools/assistant/lib/fulltextsearch/qreader.cpp index fe079a9..3b2d6f5 100644 --- a/tools/assistant/lib/fulltextsearch/qreader.cpp +++ b/tools/assistant/lib/fulltextsearch/qreader.cpp @@ -25,8 +25,9 @@ QCLuceneReaderPrivate::QCLuceneReaderPrivate() QCLuceneReaderPrivate::QCLuceneReaderPrivate(const QCLuceneReaderPrivate &other) : QSharedData() -{ +{ reader = _CL_POINTER(other.reader); + deleteCLuceneReader = other.deleteCLuceneReader; } QCLuceneReaderPrivate::~QCLuceneReaderPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qsearchable.cpp b/tools/assistant/lib/fulltextsearch/qsearchable.cpp index c26868c..70cae91 100644 --- a/tools/assistant/lib/fulltextsearch/qsearchable.cpp +++ b/tools/assistant/lib/fulltextsearch/qsearchable.cpp @@ -26,6 +26,7 @@ QCLuceneSearchablePrivate::QCLuceneSearchablePrivate(const QCLuceneSearchablePri : QSharedData() { searchable = _CL_POINTER(other.searchable); + deleteCLuceneSearchable = other.deleteCLuceneSearchable; } QCLuceneSearchablePrivate::~QCLuceneSearchablePrivate() diff --git a/tools/assistant/lib/fulltextsearch/qsort.cpp b/tools/assistant/lib/fulltextsearch/qsort.cpp index 9c1e902..97ed128 100644 --- a/tools/assistant/lib/fulltextsearch/qsort.cpp +++ b/tools/assistant/lib/fulltextsearch/qsort.cpp @@ -27,6 +27,7 @@ QCLuceneSortPrivate::QCLuceneSortPrivate (const QCLuceneSortPrivate &other) : QSharedData() { sort = _CL_POINTER(other.sort); + deleteCLuceneSort = other.deleteCLuceneSort; } QCLuceneSortPrivate::~QCLuceneSortPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qterm.cpp b/tools/assistant/lib/fulltextsearch/qterm.cpp index 58d5c4d..10a2f3a 100644 --- a/tools/assistant/lib/fulltextsearch/qterm.cpp +++ b/tools/assistant/lib/fulltextsearch/qterm.cpp @@ -27,6 +27,7 @@ QCLuceneTermPrivate::QCLuceneTermPrivate(const QCLuceneTermPrivate &other) : QSharedData() { term = _CL_POINTER(other.term); + deleteCLuceneTerm = other.deleteCLuceneTerm; } QCLuceneTermPrivate::~QCLuceneTermPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qtoken.cpp b/tools/assistant/lib/fulltextsearch/qtoken.cpp index cc5296a..9056a7c 100644 --- a/tools/assistant/lib/fulltextsearch/qtoken.cpp +++ b/tools/assistant/lib/fulltextsearch/qtoken.cpp @@ -27,6 +27,7 @@ QCLuceneTokenPrivate::QCLuceneTokenPrivate(const QCLuceneTokenPrivate &other) : QSharedData() { token = _CL_POINTER(other.token); + deleteCLuceneToken = other.deleteCLuceneToken; } QCLuceneTokenPrivate::~QCLuceneTokenPrivate() diff --git a/tools/assistant/lib/fulltextsearch/qtokenstream.cpp b/tools/assistant/lib/fulltextsearch/qtokenstream.cpp index 8a98c08..0f4ab95 100644 --- a/tools/assistant/lib/fulltextsearch/qtokenstream.cpp +++ b/tools/assistant/lib/fulltextsearch/qtokenstream.cpp @@ -26,6 +26,7 @@ QCLuceneTokenStreamPrivate::QCLuceneTokenStreamPrivate(const QCLuceneTokenStream : QSharedData() { tokenStream = _CL_POINTER(other.tokenStream); + deleteCLuceneTokenStream = other.deleteCLuceneTokenStream; } QCLuceneTokenStreamPrivate::~QCLuceneTokenStreamPrivate() diff --git a/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp index 99dfb9c..38e3501 100644 --- a/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp +++ b/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp @@ -664,6 +664,9 @@ WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList() void WidgetBoxTreeWidget::adjustSubListSize(QTreeWidgetItem *cat_item) { QTreeWidgetItem *embedItem = cat_item->child(0); + if (embedItem == 0) + return; + WidgetBoxCategoryListView *list_widget = static_cast<WidgetBoxCategoryListView*>(itemWidget(embedItem, 0)); list_widget->setFixedWidth(header()->width()); list_widget->doItemsLayout(); diff --git a/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h b/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h index 0887a7c..8c54492 100644 --- a/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h +++ b/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h @@ -47,7 +47,8 @@ #include <QtDesigner/QDesignerTaskMenuExtension> #include <QtDesigner/private/extensionfactory_p.h> -#include <phonon> +#include <Phonon/BackendCapabilities> +#include <Phonon/VideoPlayer> QT_BEGIN_NAMESPACE diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 8ecdbc2..534bc11 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -80,6 +80,9 @@ static int usage(const QStringList &args) " -of <outformat>\n" " --output-format <outformat>\n" " Specify output format. See -if.\n\n" + " --input-codec <codec>\n" + " Specify encoding for .qm input files. Default is 'Latin1'.\n" + " UTF-8 is always tried as well, corresponding to the trUtf8() function.\n\n" " --drop-tags <regexp>\n" " Drop named extra tags when writing 'ts' or 'xlf' files.\n" " May be specified repeatedly.\n\n" @@ -138,6 +141,7 @@ int main(int argc, char *argv[]) Translator::LocationsType locations = Translator::DefaultLocations; ConversionData cd; + cd.m_codecForSource = "Latin1"; Translator tr; for (int i = 1; i < args.size(); ++i) { @@ -166,6 +170,10 @@ int main(int argc, char *argv[]) if (++i >= args.size()) return usage(args); inFormat = args[i]; + } else if (args[i] == QLatin1String("-input-codec")) { + if (++i >= args.size()) + return usage(args); + cd.m_codecForSource = args[i].toLatin1(); } else if (args[i] == QLatin1String("-drop-tag")) { if (++i >= args.size()) return usage(args); diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 14f4c2c..323bd29 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -545,12 +545,20 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) size_t numItems = offsetLength / (2 * sizeof(quint32)); //qDebug() << "NUMITEMS: " << numItems; - // FIXME: that's just a guess, the original locale data is lost... - QTextCodec *codec = QTextCodec::codecForLocale(); + QTextCodec *codec = QTextCodec::codecForName(cd.m_codecForSource); QTextCodec *utf8Codec = 0; if (codec->name() != "UTF-8") utf8Codec = QTextCodec::codecForName("UTF-8"); + QString strProN = QLatin1String("%n"); + QLocale::Language l; + QLocale::Country c; + Translator::languageAndCountry(translator.languageCode(), &l, &c); + QStringList numerusForms; + bool guessPlurals = true; + if (getNumerusInfo(l, c, 0, &numerusForms)) + guessPlurals = (numerusForms.count() == 1); + QString context, contextUtf8; bool contextIsSystem, contextIsUtf8, contextNeeds8Bit; QString sourcetext, sourcetextUtf8; @@ -635,6 +643,15 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) end:; TranslatorMessage msg; msg.setType(TranslatorMessage::Finished); + if (translations.count() > 1) { + // If guessPlurals is not false here, plural form discard messages + // will be spewn out later. + msg.setPlural(true); + } else if (guessPlurals) { + // This might cause false positives, so it is a fallback only. + if (sourcetext.contains(strProN)) + msg.setPlural(true); + } msg.setTranslations(translations); translations.clear(); if (contextNeeds8Bit || sourcetextNeeds8Bit || commentNeeds8Bit) { @@ -649,7 +666,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) } if (!(contextIsSystem && sourcetextIsSystem && commentIsSystem)) { cd.appendError(QLatin1String( - "Cannot read file with current system character codec")); + "Cannot read file with specified input codec")); return false; } // The message is 8-bit in the file's encoding (utf-8 or not). |