Commit Graph

52 Commits

Author SHA1 Message Date
Robbe De Greef
ae215724dd fix: Spreadsheet applies content/alias even when focus lost (#9836)
* fix: Spreadsheet applies alias even when focus lost

The original stylesheet behavior was that the alias or content fields
could be edited, but only after enter was pressed the field would
actually update. This change makes the field apply when focus is lost
on top of when enter is pressed. This makes it easier to enter the
alias of a lot of fields at once.
2023-07-19 09:15:54 -05:00
wmayer
3818dec66a Spreadsheet: move to new style connect() 2023-01-13 20:02:46 +01:00
flachyjoe
cba90dd97c [Spreadsheet] Fix alias setting for empty cells
Fix #7841
2022-11-27 18:54:56 -06:00
Uwe
57044db084 [Spread] Gui: remove unused includes
- also sort includes
2022-10-10 01:04:07 +02:00
berniev
b796a0d376 Mod: use empty 2022-08-06 19:30:13 +02:00
wmayer
469e4f1655 Spreadsheet: fix several memory leaks 2022-07-27 07:37:23 +02:00
wmayer
6ad47111ab Spreadsheet: [skip ci] Fix several clazy issues:
* Mixing iterators with const_iterators [-Wclazy-strict-iterators]
* Q_PROPERTY should have either NOTIFY or CONSTANT [-Wclazy-qproperty-without-notify]
* Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference]
* Missing emit keyword on signal call SpreadsheetGui::SheetViewHeader::resizeFinished [-Wclazy-incorrect-emit]
* Missing emit keyword on signal call QAbstractItemModel::dataChanged [-Wclazy-incorrect-emit]
* c++11 range-loop might detach Qt container (QStringList) [-Wclazy-range-loop-detach]
2022-07-25 11:23:27 +02:00
mosfet80
620c273c4e Boost version <=1.60 is never used in freecad 0.20 (#7038)
* Boost version 1.60 is never used in freecad 0.20
2022-06-24 02:20:26 +02:00
0penBrain
384f56fe65 Sheet: enable Split action only if only one merged cell is selected
Both main menu and context menu
 Partially fixes #6744
2022-04-15 12:14:55 -05:00
Chris Hennes
4098c88171 [Spreadsheet] Use stylesheet for alias color
When setting the text color for an invalid alias, use the Qt stylesheeet
mechanism rather than QPalette, so that it works correctly with
an applied QSS stylesheeet. Also attempt to detect a darkmode stylesheet
and use lighter shade of red so that the alias is more legible. Finally,
instead of explicitly setting the text color to black when it's valid,
reset to the original stylesheet (usually an empty string). This ensures
that in a dark stylesheet the text color is legible.

Fixes #0004803.
2021-12-29 21:49:00 -06:00
Mateusz Skowroński
a2b6f55d17 Fix Qt deprecation warning. QPrinter::setOrientation() is obsolete. 2021-12-11 18:46:29 +01:00
wmayer
67f8a4c61c Spreadsheet: fix format of table cells when used for printing, by default use landscape orientation 2021-12-05 12:16:54 +01:00
wmayer
d3a0bf018f Spreadsheet: issue 0002957: spreadsheet direct printing 2021-12-04 23:36:11 +01:00
wmayer
9bfab4262f Mod: change error text of Python wrapper when trying to access deleted view 2021-11-21 19:57:21 +01:00
wmayer
2c701c0985 Spreadsheet: [skip ci] return Py::None() instead of Py::Object() 2021-11-20 14:40:12 +01:00
Chris Hennes
79a0c6b54c Spreadsheet: Implement Python SheetView functions
Add the following functions to the Python interface of SheetView:
* selectedRanges()
* selectedCells()
* select(cell, flags)
* select(upperLeft, lowerRight, flags)
* currentIndex()
* setCurrentIndex(cell)
2021-11-20 14:40:12 +01:00
wmayer
8eb099d4e1 Gui: add MDIViewPy.cast_to_base and implement in Python wrappers for sub-classes of MDIView 2021-11-19 15:44:23 +01:00
wmayer
5f7b8214e5 Spreadsheet: implement SheetViewPy that acts as sub-class of MDIViewPy 2021-11-13 20:40:32 +01:00
Chris Hennes
093f15dce5 Spreadsheet: Expose currentIndex to Python 2021-11-12 22:54:24 -06:00
Chris Hennes
37dbcf7f66 Spreadsheet: Add programmatic selection of cells
Implement modifying the current selection programmatically via the
ViewProvider object in both C++ and Python. This enables unit testing of
GUI tasks that require a selection, and improves scriptability of
Spreadsheet.
2021-11-12 17:33:39 -06:00
Chris Hennes
123b5b5da1 Spreadsheet: Remove double-set of value on enter 2021-11-02 23:12:31 -05:00
Chris Hennes
0d511a6dd2 Spreadsheet: Fix bug in content and alias lineedits
The two line edit widgets above the spreadsheet, one for exiting the
cell contents and one for editing the alias, were set to use the same
editing widget as the individual spreadsheet cells. Once that widget was
refactored to handle tab/enter behavior it was no longer the correct
widget for those elements. This commit changes them to
Gui::ExpressionLineEdit widgets instead, so that the Enter key works
correctly for them again.
2021-11-02 10:15:19 -05:00
Chris Hennes
8fceac1762 [Spreadsheet] Clean up compilation warnings 2021-10-12 11:53:48 -05:00
Chris Hennes
403a569315 [Spreadsheet] Refactor keyboard handling
LineEdit no longer actually handles motion, it simply indicates which
action was taken to cause it to lose focus (e.g. which key was pressed).
It's up to the client code to determine what this means. This allows
significant consolidation of keyboard-handling logic, and the
implementation of more extensive keyboard navigation features.

New keyboard shortcuts include a tab counter to implement auto-return,
plus Ctrl->Arrow, End, Home, Ctrl-End, and Ctrl-Home, matching the
behavior of OpenOffice, LibreOffice, etc.

Block selection via keyboard has also been added by holding down the
shift key during navigation with the arrow keys (this also works in
combination with the Ctrl modifier for region navigation).
2021-10-08 14:55:39 -05:00
0penBrain
6e7136284f [Spreadsheet] Expose SpreadsheetView::getSheet to Python 2021-06-07 21:18:26 +02:00
Benjamin Nauck
dc444b1f09 Spreadsheet: Fix coverity warning
There are no reason to check the return values for these functions
as the string passed as an argument will be set to an empty string
if it false. An empty string is a valid option in these instances.

Coverity warnings fixed:

CID 316520 (1 of 1): Unchecked return value (CHECKED_RETURN)
3. check_return: Calling getAlias without checking return value (as is done elsewhere 8 out of 10 times).

CID 316557 (1 of 1): Unchecked return value (CHECKED_RETURN)
8. check_return: Calling getAlias without checking return value (as is done elsewhere 8 out of 10 times).
2021-02-19 15:47:27 +01:00
luz paz
7b6af35e6c Spreadsheet: Issue #0004473: Expose openCommand() to translation
Continuing the work to expose the undo/redo functionality to translation. This commit does so for the Spreadsheet Wb.  
Ticket: https://tracker.freecadweb.org/view.php?id=4473
2020-12-01 14:53:35 +01:00
wmayer
421f6c52cb Coverity: Dereference after null check 2020-07-20 17:34:25 +02:00
donovaly
ca13b24673 [Spreadsheet] add visible alias check
as discussed in https://forum.freecadweb.org/viewtopic.php?p=408992#p408981
visible feedback is missing for the Alias field. This PR add it and also adapts the UI label style.
2020-06-19 12:17:04 +02:00
wmayer
f3b460e42e boost: fix for boost < 1.60 2020-06-15 19:38:39 +02:00
wmayer
4ec45b545e boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated 2020-06-12 17:51:33 +02:00
mwganson
40f50736f7 [Spreadsheet] [skip ci] fix bug where aliases renamed in the spreadsheet were not getting renamed in sketcher constraints 2020-03-22 15:20:53 +01:00
mwganson
1ee2c4d835 [Spreadsheet] fix minor bug where failure to set alias message appears erroneously. Fixes #4287 2020-03-13 15:40:30 +01:00
mwganson
520b5cc0aa [Spreadsheet] fix bug where duplicate / bad aliases were being allowed. 2020-03-12 15:47:54 +01:00
mwganson
c337cfeec2 [Spreadsheet] add alias line edit next to contents line edit -- add back in some inadvertently removed code 2020-03-12 15:47:54 +01:00
mwganson
de1cc43b0b [Spreadsheet] add alias line edit next to contents line edit 2020-03-12 15:47:54 +01:00
wmayer
1bfe0f3bea fixes #0004125: MDIViews not accessible correctly 2019-09-15 18:15:44 +02:00
Zheng, Lei
e911b69769 Spreadsheet changes
Various changes to support in-place editing, and more.
2019-08-17 15:15:47 +02:00
wmayer
632f9cf250 fixes 0003515: Changing Name of Spreadsheet in History Tree Does Not Trigger Name Update in Tab at Bottom of 3D Window 2019-01-14 00:21:56 +01:00
wmayer
6178c79581 implement Cut, Copy, Paste messages in SheetView 2018-10-10 08:25:34 +02:00
wmayer
ac66048b8b fixes #0002833: [Spreadsheet] Keyboard events are sent to the wrong viewprovider 2018-09-12 17:40:57 +02:00
wmayer
6cf82fbe62 fix -Wextra & -Wdeprecated in Spreadsheet 2016-09-22 16:35:05 +02:00
Eivind Kvedalen
8fe0d42450 Spreadsheet: Fixed undo/redo (issue #2483). 2016-04-04 19:58:19 +02:00
Eivind Kvedalen
a21571a652 Spreadsheet: Removed own expression parser and instead use the one in App. 2016-04-02 12:01:04 +02:00
Eivind Kvedalen
a760487ad2 Spreadsheet: Don't update line edit on top unless we have to. 2016-01-08 23:09:00 +01:00
Eivind Kvedalen
160d88c883 Spreadsheet: Clear line edit on top when current cell is cleared. 2016-01-08 23:09:00 +01:00
Mateusz Skowroński
cd2db00f22 QString::fromAscii() is obsolete in Qt5. Replace it with fromLatin1().
This change is Qt4/Qt5 neutral.
2016-01-05 16:07:25 +01:00
Eivind Kvedalen
87c6af3547 Spreadsheet: Removed setPosition() function. 2015-11-28 12:56:28 +01:00
Eivind Kvedalen
b7480210fd Spreadsheet: Issue #2301: Handle enter/return and tab keys the same as e.g OpenOffice and Excel. 2015-11-28 12:56:27 +01:00
Eivind Kvedalen
310a684251 Spreadsheet: Added auto completer. 2015-09-21 14:51:11 +02:00