summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
Commit message (Collapse)AuthorAgeFilesLines
* Don't crash with invalid QModelIndex or when QTreeWidgetItem is NULL in ↵Maks Naumov2015-02-061-1/+11
| | | | | | | mimeData() Change-Id: I0a9abaa05cf136eadf222d3e7d102930719b84ff Reviewed-by: David Faure <david.faure@kdab.com>
* QHeaderView: check that length is correct and fix restoring Qt4 state.Arnaud Bienner2015-02-031-23/+54
| | | | | | | | | When multiple sections were grouped together, sectionItem.size was the total size of grouped sections, not the size of one section. Length is supposed to be equal to the section items length, but the state saved might be corrupted. Task-number: QTBUG-40462 Change-Id: I401a1583dd30880ccf5b4c105a237d6563f212e8 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* Enter/Return should cause an edit inside an itemview on OS XAndy Shaw2015-01-231-2/+2
| | | | | | | | | | This was available before but was protected with the wrong define for OS X, so this is changed to the right define. Task-number: QTBUG-23696 QTBUG-23703 Change-Id: I669a6cf2ff7c01020693adff9f04a4b8b9404d02 Reviewed-by: David Faure <david.faure@kdab.com>
* Doc: remove wrong note in QTreeWidget::itemWidget.David Faure2015-01-221-2/+0
| | | | | | | | | The note is already in setItemWidget where it makes sense. This looks like a copy/paste error; this method doesn't change anything in terms of ownership, it's a getter. Change-Id: Idc963787b81f53fb37bbe59e9bf35f47d3441b34 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
* Accessibility: Fix selection change notifications on LinuxFrederik Gladhorn2015-01-213-3/+3
| | | | | | | | | The selection update is not implemented on other platforms (if needed at all). Task-number: QTBUG-39440 Change-Id: I8eb8c4eb1c23ba2d246bc95f1c77dc9da9e22495 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* Propagate the source of mouse eventsAlexander Volkov2014-12-111-0/+2
| | | | | | | | | Set the source for mouse events which were caused by other mouse events. Change-Id: Ifca1648883ef2b94bb317ed9340759475d350146 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* QHeaderView: take the sort indicator into account when eliding textGiuseppe D'Angelo2014-12-091-2/+9
| | | | | | | | | | | | By adding PM_HeaderMarkSize to the margins if the section is showing a sort indicator. Turns out that that particular enum was actually unused in QtWidgets (!), so tune the value to match reality. Task-number: QTBUG-629 Change-Id: I8bc70451656d634a064c8b5014e449977c55aa9d Reviewed-by: Cristian Oneț <onet.cristian@gmail.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* QColumnView: don't set an invalid index as the current oneGiuseppe D'Angelo2014-12-051-2/+5
| | | | | | | | | | | | | | | | | | | | | When any item in a QColumnView gets selected, the next column gets normally set to show the children of that index. When we are on a leaf of a tree model, the next column will have an invalid root index, yet we set that root index as the "current index" for the current column. Due to the special handling for invalid indexes in QAbstractItemView::setCurrentIndex, this ends up breaking the current item AND the current selection in that column. Further clicks inside the column for instance trigger the entire column (up to the clicked index) to get selected, because of that broken first setCurrentIndex. The simple fix is to stop doing that when the next column has an invalid root index. Task-number: QTBUG-2329 Change-Id: Icd10c0b958e25cd868536e1315561787977b68bd Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Respect the size hint signal for the column and row delegatesAndy Shaw2014-12-031-0/+6
| | | | | | | | | | | | | | The sizeHintChanged() signal from the column and row delegates need to be connected to the doItemsLayout() slot so that the view is updated when the size hint changes. Additionally doDelayedItemsLayout() is called to ensure that this is up-to-date as the size hints may have changed when the new delegate was set on the row or column. Change-Id: I458293f05ce9ef40a03bdbcab1a6e7a10f648c89 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
* QAbstractItemView: rename private canDecode to canDrop.David Faure2014-11-243-7/+7
| | | | | Change-Id: I9b1b3ead0bea35a75e20c5c18e288251de7ad7fe Reviewed-by: Stephen Kelly <steveire@gmail.com>
* QAbstractItemView: call canDropMimeData, as one would expect.David Faure2014-11-241-7/+9
| | | | | | | | | | | | | | | | The virtual method was added for 5.0 but never called. The old code (only checking mimetypes) is now the default implementation for canDropMimeData. Model subclasses can now refine this by having index-specific logic instead, or in order to inspect the dropped data (e.g. to accept files and refuse directories, which are all text/uri-list). [ChangeLog][QtWidgets][QAbstractItemView] now calls canDropMimeData in order to decide whether or not to accept the drop. Task-number: QTBUG-30534 Change-Id: Ied3aa964b4025bae6a1a26df89a681bfe61c3faa Reviewed-by: Stephen Kelly <steveire@gmail.com>
* Item view: Update item positions when delegate changesEskil Abrahamsen Blomfeldt2014-10-241-0/+1
| | | | | | | | | | | | | | | | | | | | | In QComboBox, when you set editable to true on the QComboBox, the delegates will change from QComboBoxMenuDelegate to QComboBoxDelegate. In some styles, such as Fusion, the size of the delegates will be different. So when the delegate is updated, we need to redo the list view layout, otherwise the items will be positioned based on the size of the old delegates, but the popup for the combo box will be sized for the new. This caused the popup to be too small for its items and display a scroll bar. [ChangeLog][QComboBox] Fixed positions of items when QComboBox is set as editable in Fusion style. Change-Id: Ia43ef96efbeee4d6d596c0674bf3898ef94f89a1 Task-number: QTBUG-33537 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-10-141-3/+2
|\ | | | | | | Change-Id: Ic01820f2390e419a5b286643e7351e85ae032473
| * QAbstractItemView: fix CTRL+A select all behaviorMaximilian Hrabowski2014-10-131-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for Qt::Key_A to handle selectAll was changed to directly compare to QKeySequence::SelectAll as this will only match Ctrl. The former implementation also triggered when e.g. Shift was pressed. Added a check that selectAll is only called when selection is not disabled, i.e. selectionMode=NoSelection. Added a unit test for selectAll(). Task-number: QTBUG-26687 Change-Id: I721e7ab590b55d7d754b3b74ef01756fa5aa1315 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Gabriel de Dietrich2014-09-291-0/+3
|\| | | | | | | | | | | | | | | Conflicts: src/network/socket/qnativesocketengine_unix.cpp src/widgets/kernel/qwidget_qpa.cpp Change-Id: I6f1aa320d5ca66cd92d601a95885aeaab0abb191
| * Document non-intuitive behavior of QTreeWidgetItem::setHidden().Christian Kandeler2014-09-221-0/+3
| | | | | | | | | | | | Task-number: QTBUG-30366 Change-Id: I02e098fbf0e3a44794ed0e1b1bf533c1c9ad5632 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | Widgets: remove references to QStyleOptionFrameV<n>Marc Mutz2014-09-261-1/+1
| | | | | | | | | | | | | | They're gone since Qt 5.0 and only exist as typedefs for QStyleOptionFrame. Change-Id: Icff45cbd3a47db8618a7f7a80f7252651969237c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | Update license headers and add new license filesMatti Paaso2014-09-2451-967/+559
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* | Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4Frederik Gladhorn2014-09-242-0/+14
|\ \
| * | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-232-0/+14
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| | * Improved documentation for QStyledItemDelegate::eventFilterAki Koskinen2014-09-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Added the notion that enter and return keys are not handled if editor is of type QTextEdit or QPlainTextEdit. Change-Id: I9d5cb529bf154c687fab1949fccf37e9da096c85 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
| | * Add missing private headers warningSamuel Gaist2014-09-041-0/+11
| | | | | | | | | | | | | | | Change-Id: I7a4dd22ea3bcebf4c3ec3ad731628fd8f3c247e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Fix the drawing of elided text in QHeaderView.Cristian Oneț2014-09-231-1/+2
|/ / | | | | | | | | | | | | | | | | | | The text was not drawn properly because when eliding the text a fixed value '4' was substracted from the rect to compute the available width instead of the actual value of the header margin. Change-Id: I1e110f1a6490679730ddf5815d3ff7b679dc1a47 Task-number: QTBUG-24772 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* | Correct information about all headers being movable.Mitch Curtis2014-09-221-3/+0
| | | | | | | | | | | | | | | | | | This only applies to QTreeView. 8eb3d724a92b8eeb1e96362bd6997fcee178af89 introduced this error. Change-Id: Ia8a2c387afbd19e4d98ea6f81e5ce6409d79bcd9 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* | Add missing period to QHeaderView documentation.Mitch Curtis2014-09-181-1/+1
| | | | | | | | | | Change-Id: Ibf3fdb4e1c149b2dbee7bf3043cec9d3e167381d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Improve documentation regarding moving item view columns.Mitch Curtis2014-09-182-0/+7
| | | | | | | | | | | | | | | | | | The only way I was able to find information on this was through bug reports. Change-Id: Iac59a82fab9c216495860ad3b1efad1125130002 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Make the default value of QTreeView::indentation() be style dependentAlexander Volkov2014-09-153-4/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a new PM_TreeViewIndentaion enum value to QStyle and get the corresponding pixel metric in QTreeView. [ChangeLog][QtWidgets][QTreeView] Indentation is now style-dependent by default. [ChangeLog][QtWidgets][QTreeView] Added resetIndentation(). Change-Id: Ifad7987b8f3c6cd32987b89d95390f33043d8f19 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Adam Majer <adamm@zombino.com>
* | QListView: Catch stack overflow on mutual scrollbar calculation.Christoph Schleifenbaum2014-08-291-2/+32
| | | | | | | | | | | | Task-number: QTBUG-39902 Change-Id: Ie850371098070e8ce485d5cb122aa89c18d97359 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QDataWidgetMapper: micro-optimize clearMapping()Marc Mutz2014-08-261-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QList<WidgetMapper>::takeLast() is a needlessly expensive operation (involves copying a QPersistentModelIndex and a QPointer). Instead of looping over takeLast() until empty, reverse-iterate over the list and call removeEventFilter(), then clear the whole list. We reverse-iterate to preserve existing behavior. Also, since the original code popped the WidgetMapper instance before calling removeEventFilter(), we move the whole list into a local copy before iterating. There's little chance that a removeEventFilter() call will cause reentrancy into QDataWidgetMapper, but better safe than sorry. This and the previous change together save 448 bytes of text size in libQt5Widgets. Change-Id: I1bfe907751659f31e618aa05bbb7b840f0aa61f4 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | QDataWidgetMapper: micro-optimize handling of the widget mapMarc Mutz2014-08-261-17/+17
| | | | | | | | | | | | | | Don't use index-based iteration, but use iterators. Change-Id: I57c9582aed644fc58ced1a1af940dcd20d11d970 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-121-9/+9
|\| | | | | | | | | | | | | | | | | | | | | | | Manually included changes from 3a347a4e70e5a10ee92dd2578316c926a399e894 in src/opengl/qgl.cpp. Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/android/androidjnimain.cpp Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929
| * Fix build with QT_NO_DRAGANDDROPSérgio Martins2014-08-111-9/+9
| | | | | | | | | | | | | | viewportSizeHint() should be defined outside the QT_NO_DRAGANDDROP ifndef Change-Id: I7c23c820ea58b3614eb030dc5b0f290ad891ccb1 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QHeaderView::restoreState(): Add sanity check.Friedemann Kleint2014-08-061-9/+26
| | | | | | | | | | | | | | | | Read data into local variables and apply only after a check. Task-number: QTBUG-40462 Change-Id: Id06060d0d5b0eafc2d303526a86d552ff5747a72 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-101-1/+8
|\| | | | | | | Change-Id: Ia12ffdb27ecdf25c2a2bdb0eed1945387502108a
| * Improve QListWidget documentation.Mitch Curtis2014-07-041-1/+8
| | | | | | | | | | | | | | | | | | Mention that removeItemWidget() isn't sufficient to remove a row. List related functions so that it's easy to see the relation between them. Change-Id: Ia1d467390f00976e2276d50df35dd555f7992a9a Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* | Use QDropEvent::acceptProposedAction() in drop handlers of QAbstractItemView.Friedemann Kleint2014-07-081-10/+13
| | | | | | | | | | | | | | | | | | Fix updating of the drop cursor when the user presses/releases the shift key while dragging. Task-number: QTBUG-39822 Change-Id: I1d9d3a80d349f7e405db24f8f7dc372428c34f52 Reviewed-by: David Faure <david.faure@kdab.com>
* | Fix crash when inserting the same instance widget more than onceJorgen Lind2014-06-261-0/+2
| | | | | | | | | | | | | | Task-number: QTBUG-39324 Change-Id: Ib1e0e107cd411311344aa5d85c3ca4c34211448b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵J-P Nurmi2014-06-071-9/+3
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/stable' into devJ-P Nurmi2014-06-051-9/+3
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt.prf src/plugins/platforms/xcb/qxcbwindow.h src/tools/qdoc/qdocindexfiles.cpp src/widgets/kernel/qwidget_qpa.cpp Change-Id: I214f57b03bc2ff86cf3b7dfe2966168af93a5a67
| | * Account for the sort indicator being placed above the text on VistaAndy Shaw2014-05-261-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In WindowsVista style and later the sort indicator is placed above the text as opposed to alongside it. Therefore the extra space given is moved to the common style allowing styles that have it placed differently to easily ensure it is not included. Task-number: QTBUG-19915 Change-Id: Ic21fcc1d95f4c3cc2eb9c465e1c8afb9b805389a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | | Fix key navigation through cells with spans in QTableView.Mitch Curtis2014-06-061-1/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When navigating with the directional keys or tab/backtab, there are certain situations where the cell that is edited is incorrect. For example, consider the table below. '^' represents the starting cell and the direction of navigation. 'c' represents the index that is arrived at as the currentIndex prior to this patch as reported by view.selectionModel()->currentIndex(). 'x' is the cell that should be edited: +---+---+---+---+ | | | e | | +---+---+---+---+ | | x | | +---+ +---+ | | c | | +---+---+---+---+ | | | ^ | | +---+---+---+---+ Before this patch, the cell that will actually be edited is c, rather than x, so after editing the cell and pressing enter, the previous contents of the cell will still be shown. With this patch, currentIndex() will be changed after every call to cursorMove(). Navigation into and out of cells is not affected because the visualCursor member in the QTableViewPrivate tracks the keyboard navigation entry point. If after the up navigation into the span, the user presses up, the cell entered is 'e', not the cell above 'x'. Task-number: QTBUG-29239 [ChangeLog][QtWidgets][QTableView][QTableWidget] currentIndex() now reflects the top left cell when in a span. Change-Id: I3dc3db46ebba340102860fc4ad98fcaf91484983 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* / Fix internationalization of "txt File" in QFileDialogLasse Liehu2014-06-031-2/+4
|/ | | | | | | | Some languages (for example Finnish) need to customize punctuation and capitalization in this case. Change-Id: I9720626263f061adc7972bff18bcb59f2f2b382f Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Fix visual index lookup in QTreeViewPrivate::adjustViewOptionsForIndex().Friedemann Kleint2014-05-061-10/+3
| | | | | | | | | Determine the visual index by looking up the column of the QModelIndex in the logicalIndices array instead of looping. Task-number: QTBUG-37813 Change-Id: I5c3c73c67537877b03cdc2c36a52041d99f7f49d Reviewed-by: David Faure <david.faure@kdab.com>
* Fix typo in QListWidget documentation.Mitch Curtis2014-05-051-1/+1
| | | | | Change-Id: Ieefb664a49bb578efc70ea1ab1a09fb4c8507568 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Item views: respect selection mode when closing an editorJ-P Nurmi2014-04-011-2/+3
| | | | | | Task-number: QTBUG-31411 Change-Id: I1a52eb739e0bc2afa7227f006461916df8ecaf48 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* Item views: respect focus policy when closing an editorJ-P Nurmi2014-04-013-11/+9
| | | | | | Task-number: QTBUG-31411 Change-Id: Ib0a72755c35a553653ea014672d59979a550b7ae Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* Make QTreeView::expand/collapse check for ineffectual invocationsAdam Reichold2014-02-281-0/+4
| | | | | | | | | | | Added checks if item is already expanded/collapsed to QTreeView::expand/collapse since the following computations can be quite expensive. (This is useful when saving/restoring a lot of item expansion state e.g. after a model reset.) Task-number: QTBUG-35939 Change-Id: I82c4489f9fe0b8ac61994652a60312e34c46f628 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QHeaderView - do simple section move/rotate in moveSectionThorbjørn Martsum2014-02-181-42/+19
| | | | | | | | It is in nearly all cases much faster (in our benchmark it is about a factor 8) - and it also makes the code more readable. Change-Id: I075e1d1a96756e5e9a2bf53b5479094f7d87883d Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-121-1/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/gui/image/qimage.cpp src/gui/text/qtextengine.cpp src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp src/printsupport/kernel/qprintengine_win.cpp Change-Id: I09ce991a57f39bc7b1ad6978d0e0d858df0cd444
| * Doc: corrected description of QTableWidget::clear()Nico Vertriest2014-02-061-1/+3
| | | | | | | | | | | | Task-number: QTBUG-36329 Change-Id: I3a78311bcb076b414ecf1ecf866e4ed60c391126 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>