There is a chance that this code is still useful for Qt 4. We keep
it around just in case.
For the case of Qt 4, this commit restores the code changed in
f8e40f8a, d255339a, and d4ff3a29.
This reverts commit 438f15da21.
Revert "Track whether we have warned about mixing layouts across e.g. branches."
This reverts commit 861c6167ca.
Revert "Track whether title has been issued via OutputParams."
This reverts commit b536759c07.
There are massive complications here, and I don't have time to fix them all
right now.
Use QFontMetrics::boundingRect() instead. QFontMetrics::width() does
not actually calculate the width of the bounding box and is mostly
useful for knowing where to draw text after a string, taking into
account bearings. Indeed, it has been renamed to
QFontMetrics::horizontalAdvance().
For the code touched in this commit, we want to center a string.
Either method would likely be fine, but it is more easy to
understand exactly what QFontMetrics::boundingRect() does.
This commit does change functionality, although it should not be
noticeable.
This commit fixes the following warning:
DeprecationWarning: 'U' mode is deprecated
Removing 'U' has no effect with Python 3 [1]:
There is an additional mode character permitted, 'U', which no
longer has any effect, and is considered deprecated. It previously
enabled universal newlines in text mode, which became the default
behaviour in Python 3.0.
[1] https://docs.python.org/3/library/functions.html?highlight=open#open
Setting the family to "family" is already attempted above. A
different case was adapted to be this duplicate case at d4ff3a29,
but it should have just been removed.
Spotted by Enrico.
This commit fixes the following warning from Qt 5.14:
error: ‘void QTreeWidgetItem::setTextColor(int, const QColor&)’ is deprecated: Use QTreeWidgetItem::setForeground() instead [-Werror=deprecated-declarations]
setForeground was introduced in Qt 4.2 [1].
We have a couple of commented out uses of a setTextColor() method in
GuiDocument.cpp, but the QTextEdit::setTextColor() is not deprecated so no
change is needed.
[1] https://doc.qt.io/archives/qt-4.8/qtreewidgetitem.html#setForeground
This commit fixes a few warnings from Qt 5.14 like the following
one:
error: ‘void QComboBox::setAutoCompletion(bool)’ is deprecated: Use setCompleter() instead. [-Werror=deprecated-declarations]
We only generated setAutoCompletion() from setting the property in
the .ui files. There does not seem to be a .ui file property that
generates setCompleter(). However, the default in both Qt5 [1] and
Qt4 [2] is to enable case-insensitive autocompletion, which seems to
be the same type of autocompletion as when we were relying on
setAutoCompletion(true). Thus, we can remove the properties that set
autocomplete to true. There is only one file, SearchUi.ui, where we
were turning off the autocompletion; we now do so using
setCompleter(0) in GuiSearch::GuiSearch().
[1] https://doc.qt.io/qt-5/qcombobox.html#setCompleter
[2] https://doc.qt.io/archives/qt-4.8/qcombobox.html#setCompleter
When branches are used in the title, we may need to track whether
we've issued the title across branch insets. So we put the relevant
variables into OutputParams.
This commit fixes a couple of warnings from Qt 5.14 like the
following one:
error: ‘int QTime::restart()’ is deprecated: Use QElapsedTimer instead [-Werror=deprecated-declarations]
This commit changes two uses of QTime to QElapsedTimer, one used
only when the "files" debug flag is set, and the other for timing
whether a script (e.g., knitr) takes longer than a certain amount of
time to run.
QElapsedTimer is superior for these two use cases in that it uses a
monotonic clock if possible, and is thus more robust to certain
changes (e.g., daylight savings changes) [1]. Similarly, the commit
in Qt Base that makes this deprecation [2] mentions the following in
the commit message:
QElapsedTimer does the job better and without the DST kludges.
Note that QElapsedTimer class was introduced in Qt 4.7, so no
conditioning on Qt version is necessary.
Not all methods of QTime are deprecated and we still use some of
the non-deprecated methods in our code (e.g., to get the current
wall clock time in GuiProgress::currentTime()).
[1] https://doc.qt.io/qt-5/qelapsedtimer.html
[2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=ed99a591a83a399458f12341d0a1c0b3152f247a
The log file generated by latex can contain strings encoded in
whatever supported encoding. Instead of guessing the encoding,
it is better to open it in binary mode and then performing the
necessary comparisons as "bytes". In order to do this, the
strings are encoded in utf8, so that, for example, b"pythön" is
encoded as "pyth\xc3\xb6n" (7 bytes). Of course, this means that
we can only successfully perform comparisons with ascii strings.
However, this is what we actually do, as we only search for
ascii strings in the log file.
Thus a document can be viewed if it contains references to
its master, children or siblings that are being excluded via includeonly,
or viewed standalone if it contains references to its master or siblings.
Using a dialog may trigger a redraw at times where the metrics caches
have not been updated yet. To fix this, do as in paintEvent() and
abort caret blinking if there is an open undo group.
Move the decision to skip the caret painting to showCaret(), closer to
where real work happens. hideCaret () is now an alias for
showCaret(false), which allows some code refactoring.
See also commit c7496a11b2.
Fixes bug #11763 (although it does not trigger on master).