* [Spreadsheet] Enable zoom in Spreadsheet
Closes#6094. This commit also fixes page tab order of Spreadsheet
settings in Preferences.
* Spreadsheet: apply clang-format
---------
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
Convenience helpers function Tools::toStdString and Tools::fromStdString
were implemented for Qt4 or older to perform utf8 aware conversion as
QString::toStdString/QString::fromStdString were using toAscii/fromAscii
internally (see https://dreamswork.github.io/qt4/classQString.html).
Since Qt5 QString uses toUtf8/fromUTf8, which makes the helper functions
obsolete (see https://doc.qt.io/qt-5/qstring.html#fromStdString).
The recent migration from boost::bind to std::bind [1] broke the build
on Mac (Apple clang version 13.0.0 (clang-1300.0.29.30) on macOS-11.7.8).
In all other cases the `boost::bind` was replaced by `std::bind` (among
with the place holders) but in these two spread sheet files
src/Mod/Spreadsheet/Gui/SheetModel.cpp
src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp
the original code only referenced `bind`, which used to get resolved to
`boost::bind` but now raises this error:
> /Users/jonas/src/FreeCAD/FreeCAD-git/src/Mod/Spreadsheet/Gui/SheetModel.cpp:50:36: error: use of undeclared identifier 'bind'; did you mean 'boost::bind'?
> sheet->cellUpdated.connect(bind(&SheetModel::cellUpdated, this, sp::_1));
> ^~~~
> boost::bind
This commit changes this to `std::bind` expicitly, just like it's done in
the other files. This works on my system/compiler.
[1]: 4ffe0c3218
* 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.
* 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]
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.
Add the following functions to the Python interface of SheetView:
* selectedRanges()
* selectedCells()
* select(cell, flags)
* select(upperLeft, lowerRight, flags)
* currentIndex()
* setCurrentIndex(cell)
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.
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.
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).
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).