QTableWidgetItem uses additional enum flag ItemIsHeaderItem which has
the same numerical value as ItemFlag ItemNeverHasChildren.
This causes conflict since the user can set the latter flag using
the setFlags, while the ItemIsHeaderItem is only used internally
to mark header items.
Remove the additional flag and use boolean instead to fix the conflict.
Pick-to: 6.2 6.5 6.5.1
Fixes: QTBUG-113209
Change-Id: Icff549c7e452d9f84575a524361719204817274e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
- when there is no intersection between the current selection and the
spans collection, get ranges for all cells, just as if no span exists
- when there is an intersection between the current selection and the
spans collection, get separate ranges for each cell (as before)
This fixes the regular case of selecting multiple non-spanned cells
after some cells are merged (get a single range for all cells instead of
separate range for each cell). However, when selecting together a group
of spanned and non-spanned cells, you still get a separate range for
each cell. But this is normal behavior in similar applications; for
example in LibreOffice, you cannot select and merge spanned and
non-spanned cells: an error dialog tells you that it's not allowed.
Done-with: Christos Kokkinidis
Pick-to: 6.2
Fixes: QTBUG-255
Change-Id: Ic38f9a064a1f499825e7f750668013fc2dc564ba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add operators as hidden friends, add test case to make sure that
basic value-type operations are possible with this type.
Task-number: QTBUG-255
Change-Id: I7fbf453aa16084c0b2a0079487cacb4e092ff664
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
layoutAboutToBeChanged must be called before
persistentIndexList as the user might create persistent indexes
as a response to the signal
Fixes: QTBUG-93466
Pick-to: 6.2 5.15
Change-Id: I73c24501f536ef9b6092c3374821497f0a8f0de4
Reviewed-by: David Faure <david.faure@kdab.com>
Remove the qmake project files for most of Qt.
Leave the qmake project files for examples, because we still test those
in the CI to ensure qmake does not regress.
Also leave the qmake project files for utils and other minor parts that
lack CMake project files.
Task-number: QTBUG-88742
Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
It's unnecessary, and copying QEvents is a bad practice since it's a
polymorphic class.
Change-Id: Ieb6de106084f838c5e6c8a0643c54fd3c7f4a7a8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Modify special case locations to use the new API as well.
Clean up some stale .prev files that are not needed anymore.
Clean up some project files that are not used anymore.
Task-number: QTBUG-86815
Change-Id: I9947da921f98686023c6bb053dfcc101851276b5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Use pro2cmake with '--api-version 2' to force regenerate
projects to use the new prefixed qt_foo APIs.
Change-Id: I055c4837860319e93aaa6b09d646dda4fc2a4069
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The convenience functions setBackground(), setForeground() and
setSizeHint() a default constructed value as 'reset'. This means a
default constructed QBrush or QSize is returned in the data() function
which leads to an unexpected background or forground color or size hint.
Therefore check if the passed value is a default constructed value and
set an empty QVariant instead which.
[ChangeLog][QtWidgets][ItemViews] The convenience views
QList/Table/TreeWidgetItem now treat a default constructed QBrush or
QSize as an empty QVariant which allows to reset the values set to it's
default values.
Task-number: QTBUG-76423
Change-Id: I840570bbad3e5fd8c5b4b58903b4fd0066dbdeb7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Cleanup QTableWidget autotest:
- use range-based for loops where possible
- use nullptr
- use member initialization
- use new signal/slot syntax
- remove a lot of C-style casts
- use static invocations
- use override
- instantiate objects on stack instead of heap to avoid memleaks
Change-Id: I99ed144caab88d648d5ab987ce0963fbc6f1197d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The keyboard search in QAbstractItemView did not handled Key_Space
because this is also an edit trigger. It was also consumed if no edit
was started.
This patch changes this behavior and triggers the keybaord search when
the editing was not started.
Fixes: QTBUG-48505
Change-Id: I58e0d283f863c9b12ac5d2f6171f15522bd7c30a
Reviewed-by: David Faure <david.faure@kdab.com>
QTableWidget::isItemSelected/setItemSelected() are deprecated for a
long time but not marked as such. Therefore explicitly mark them as
deprecated so they can get removed with Qt6.
Change-Id: I77fffe2786751306115c3f5da0ef98ff84e35b1a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QTableWidget::takeItem() emitted cellChanged with row and column set to
-1. The internal functions searched for item after it was reset to
nullptr and therefore it was not found.
Since the modified cell is known because it's passed to the takeItem
function, the correct row/column can be retrieved from there.
Task-number: QTBUG-70478
Change-Id: I5ff5991c49f3200efe95fde4c7d0d28e19be7ebf
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QTable/QTreeView did not follow the documentation and returned
their needed size with scrollbars within viewportSizeHint().
Then sizeHint() also took the size of the scrollbars into account
when the policy was set to ScrollBarAlwaysOn.
This lead to different results when the widget was shown/hidden and/or
the scrollbar was visible or not.
Fix it by only adding the additional size when the scrollbars are
really visible. Also use header->isHidden() instead of isVisible() in
QTreeView the same way it is done in QTableView.
[ChangeLog][QtWidgets][QAbstractScrollArea] QTableView/QTreeView are
now reporting their viewportSizeHint() correctly taking into account
its scroll bars visibility and visibilityPolicy.
Task-number: QTBUG-69120
Change-Id: If50959a9f7429275e3e33122644c978fb64972ba
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
A virtual method clearItemData was added to QAIM for Qt6.
This patch implements that method to all Qt concrete models for which
it makes sense.
Task-number: QTBUG-69616
Change-Id: If980fcfc36f723128bc56ec4587c5c3a338dbbcc
Reviewed-by: David Faure <david.faure@kdab.com>
QTableView::doItemsLayout() updated the scroll offset for the vertical
header after layouting was done. Since the scroll offset affects the
viewport of the editors, the adjustment was done too late.
Therefore we update the scroll offset right after the scrollbars are
set inside QTableView::updateGeometries()
[ChangeLog][QtWidgets][QTableView] Fixed calculating geometries
for editors
Task-number: QTBUG-48244
Task-number: QTBUG-49548
Change-Id: I3b057764cf99d42d861928a1c73277d34b440f9a
Reviewed-by: David Faure <david.faure@kdab.com>
QTableModel::setItemData() did not treat Qt::EditRole and
Qt::DisplayRole as the same. This lead to inconsistencies between
setItemData() and QTableWidgetItem::setData()
[ChangeLog][QtWidgets][QTableWidget] Fix handling of Qt::EditRole and
Qt::DisplayRole in setItemData().
Change-Id: I456f4c8e654de701dcd579236162b8aaa8ba1e53
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QAbstractItemModel::dataChanged() gained an optional role parameter
with Qt5 which was not filled within QTableWidgetItem setData() function
Task-number: QTBUG-48295
Change-Id: I82289b6db78eeef09d586da267046032984952da
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
.. instead of manually casted 0s.
QCOMPARE(., nullptr) was added for Qt 5.8. Make use of the new API.
In tst_qwidget.cpp, as a drive-by, change
qApp->focusWidget() -> QApplication::focusWidget()
Change-Id: I1331b8916b026d48e01534d1ed0b3d72f3f3d50c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
GCC warned:
tst_qtablewidget.cpp:30:
tst_qtablewidget.cpp: In member function ‘void tst_QTableWidget::mimeData()’:
qtestcase.h:66:52: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
^
tst_qtablewidget.cpp:1523:5: note: in expansion of macro ‘QVERIFY’
QVERIFY(data = table.mimeData(tableWidgetItemList));
^~~~~~~
Fix by adding the extra parentheses, as usual.
Change-Id: I2826d7a865b4113b468d5a958ede06e03aa0e278
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)
Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Move some code (like registrations of meta types) from init() to
initTestCase() in the process.
Change-Id: I57db5156647cfadab554fbed853b2e68b2815f3b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Use QByteArray/QString addition instead in loops and for
test row names.
Change-Id: Ia067cd966bf13506e6ca19925eae3158da027b83
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
OldPersistentIndexes store selected items during sort operation. They
were wrongly taken from static list of indexes. This change takes them
from parent (QTableWidget) who maintains the list of selected segments.
Task-number: QTBUG-48408
Change-Id: Ie1bc4071a275dd76d113d883ab30ccd4cb1fa625
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The keyword no longer has a meaning for the new CI.
Change-Id: Ibcea4c7a82fb7f982cf4569fdff19f82066543d1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
- Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer).
- Replace Q[TRY]_VERIFY(smartPointer == 0) by
Q[TRY]_VERIFY(smartPointer.isNull()).
- Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and
add casts where necessary. The values will then be logged
should a test fail.
Change-Id: Ie29640451dddeb58342038a8cd5fac152cce39e5
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
ItemIsTristate only makes sense in tree widgets, where it triggers the
auto-tristate behavior between parents and children.
Change-Id: Idfa8bb5d0b9c63fe450115fb58d088929e11c7ff
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.
Outdated header.LGPL removed (use header.LGPL21 instead)
Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)
Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination
Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
For some reasons lost in history, those methods simply ignore
the list of items passed to them, and always return NULL.
Of course, that's totally broken. Fix that by doing the same thing
that the respective (hidden) models did when calling mimeData().
Surprisingly enough, QTreeWidget has a proper implementation.
Task-number: QTBUG-25900
Change-Id: I99ca7b4d4f87f096fd9ff0b0cb4e58282aa9c26e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>