Commit Graph

26422 Commits

Author SHA1 Message Date
Juergen Spitzmueller
5bc66b5f45 Fix tablefootnote loading order (#11841) 2020-04-17 09:12:51 +02:00
Richard Kimberly Heck
86a4c79dc4 Make it nicer, thanks to JMarc 2020-04-16 21:05:38 -04:00
Richard Kimberly Heck
46f1f6f1cb Fix bug #11635 2020-04-16 17:16:26 -04:00
Jean-Marc Lasgouttes
bb0117d182 Simplify code for bidi icons
Most of the RtL icons that we provide are simply mirrors of the LtR ones.
Therefore let the code do that by default if no +rtl icon is found.

The only RtL icon left for now is for "layout Enumerate" (notice the
numbers in it).

Also remove useless getPixmap wrapper and several old bidi_xxx icons
that were forgotten in previous patch.
2020-04-16 20:54:53 +02:00
Jean-Marc Lasgouttes
43eda5ad73 Reimplement properly bidi icons
When the cursor in RTL text, icons for "depth-increment" or
"layout-toggle Enumerate" look wrong.

Instead of relying on the clumsy "bidi" lfun of 2898c335, this new
version relies on a new Toobar tag BidiItem that inserts an action
which can have two icons, depending on the direction of the paragraph
containing the caret (or of the direction of the UI when no file is
open).

The alternative icon has the same name as the original one, with a
"+rtl" string appended to the lfun string. The alternative icon is
only active if the file is found. The icon themes `default', `oxygen'
and `classic' have been updated accordingly.

Fixes bug #4451.
2020-04-14 22:47:56 +02:00
Jean-Marc Lasgouttes
ce0538e372 Revert "Add mechanism to change icons in RTL mode"
This is really too clumsy. Revert in preparation for a better
mechanism.

This reverts commit 2898c335be.
2020-04-14 22:47:50 +02:00
Jean-Marc Lasgouttes
543038e64e Fixup 294969c6: do not forget to update metrics 2020-04-14 17:57:49 +02:00
Kornel Benko
4b052dec77 Amend ef42541d26: Missed to commit these 2020-04-13 13:39:33 +02:00
Kornel Benko
ef42541d26 Prepend dir containing created dtl executables to PATH
This should work on Windows, but needs test.
The changes (namely the installation directory for the dtl executables)
for automake are not yet done. (JMarc?)

It may fix bug #11325 if cmake configured with '-DLYX_EXTERNAL_DTL=OFF'
2020-04-13 12:51:04 +02:00
Jean-Marc Lasgouttes
b5d6caac41 Fix embarassing crash caused by debug message
After commit 6a936d63, the helpful debug message tries to display
non-existing elements and crashes the program :(

Fix by radical simplification of the message.

Part of bug #11777.
2020-04-13 12:02:26 +02:00
Richard Kimberly Heck
eea4ef9b6e Debug output for paragraph params. 2020-04-08 17:21:43 -04:00
Richard Kimberly Heck
f7065fa22e Fix bug #11817.
Preserve line spacing when breaking a paragraph at the beginning.
2020-04-08 17:21:43 -04:00
Kornel Benko
80cd116805 Fix indentation 2020-04-07 11:47:08 +02:00
Juergen Spitzmueller
2748e33be5 Fix indentation 2020-04-06 16:29:34 +02:00
Juergen Spitzmueller
c0adb03a7a Fix quotation marks in PDF TOC 2020-04-06 08:53:29 +02:00
Juergen Spitzmueller
f9999039ac Strip polyglossia options from pdf string
Fixes #11813
2020-04-05 15:23:22 +02:00
Jean-Marc Lasgouttes
5202d44ef5 Do not compute caret geometry when we are not ready to do so.
This avoid crashes with invalid cache.

Fixes bug #11763.
2020-04-04 18:11:07 +02:00
Juergen Spitzmueller
ed137ee435 Disable append-column with gathered
Fixes #11812
2020-04-04 09:27:24 +02:00
Juergen Spitzmueller
fe09ddf1b9 Implement buffer-write force 2020-03-31 08:01:17 +02:00
Juergen Spitzmueller
1e34871d38 Prevent wrong reference to duplicated (but deleted) label
Fixes #11803
2020-03-29 17:47:59 +02:00
Richard Kimberly Heck
2d0ad7d308 Remove code disabled since 2005.
No one knew then what it was supposed to do.
2020-03-28 23:52:55 -04:00
Richard Kimberly Heck
38c2cde0d8 Remove obsolete (and false) comment. 2020-03-28 23:23:52 -04:00
Scott Kostyshak
b67ff925e5 PreviewLoader: start fake pids after PID_MAX_LIMIT 2020-03-28 19:18:21 -04:00
Scott Kostyshak
8f3c95f757 Use << for raising 2 to power instead of ^
The ^ is interpretted as bitwise XOR, so 2^(20) evaluated to 22.

Thanks to Riki for the << trick. This way, we do not have to use
pow() and include the <cmath> header for this one expression.
2020-03-28 19:18:21 -04:00
Richard Kimberly Heck
104fdcc9be Fix crash after 24926b2e23.
The matched element may not have a parent. I guess the old version of
setExpanded too care of that. Now we have to do so.
2020-03-28 15:23:13 -04:00
Richard Kimberly Heck
c5c1683024 Remove newlines from shortcut LFUNs. 2020-03-28 15:15:36 -04:00
Scott Kostyshak
a1169188c7 Fix assertion from setCursor() in outline-down/up
The function outline() itself can change the cursor position in some
cases so we need to store the old position before calling outline().

Spotted by Kornel. For an example file that triggered the assertion,
see:

  https://www.mail-archive.com/search?l=mid&q=20200326183314.09ad4c7c%40admin1-desktop

This commit amends adb7283b.
2020-03-26 19:00:37 -04:00
Juergen Spitzmueller
5db8b65e46 Fix typo. 2020-03-26 16:32:13 +01:00
Pavel Sanda
426ca3a5d6 Let hyperlink insets to be longer if name is given.
Thanks to Oystein Senneset Haaland.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg210882.html
2020-03-25 07:40:27 +01:00
Jean-Marc Lasgouttes
eb92f74d1f Avoid bleeding of inset background outside of inset
As a consequence of fix e64ea357 to ticket #10797, we draw a bit too
much of the inset background outside of the inset (visible for insets
with colored background). #10797 is a ticket that triggers when the
cursor has a width larger than 1.

This patch limits the problems in two respects

* nothing is done on the left, since the cursor width only expands on
  the right.

* on the right, the extra width is limited to cursor width.

Fixes bug #11786.
2020-03-24 12:13:36 +01:00
Juergen Spitzmueller
52cd43dfdc Paste some special chars as insets
See #11790
2020-03-23 12:07:47 +01:00
Juergen Spitzmueller
7b3404fcab Don't omit ZERO WIDTH NON-JOINER on clipboard paste
Fixes #11790
2020-03-22 11:07:57 +01:00
Juergen Spitzmueller
3f364864d4 Fix indentation 2020-03-22 10:10:36 +01:00
Juergen Spitzmueller
1e409a1a75 Properly resolve tracked changes when pasting multiple tabular cells
Fixes #11791
2020-03-21 15:54:37 +01:00
Scott Kostyshak
0d2773ff5e Restore XLFD code for Qt 4
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.
2020-03-20 20:51:44 -04:00
Richard Kimberly Heck
9d36f720a5 Revert "Fix bug reported by Kornel."
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.
2020-03-20 17:19:19 -04:00
Richard Kimberly Heck
438f15da21 Fix bug reported by Kornel.
The old code was actually wrong. Obviously, this should be set only
if we actually do issue the title command.
2020-03-20 15:25:47 -04:00
Scott Kostyshak
35bb9cb4a6 Change a couple instances of QFontMetrics::width()
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.
2020-03-20 10:53:30 -04:00
Scott Kostyshak
f8e40f8ab8 Remove redundant font loader code
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.
2020-03-20 09:18:09 -04:00
Scott Kostyshak
d255339a4c Remove remnants regarding old XLFD font handling
These fonts are no longer supported by Qt 5 and our code no longer
uses the "xlfd" member of the struct modified in this commit. See
d4ff3a2959.
2020-03-19 12:39:16 -04:00
Scott Kostyshak
d4ff3a2959 Fix Qt dep warn and remove XLFD font workaround
This commit fixes a few warnings from Qt 5.14 regarding
QFont::setRawName() and QFont::rawName() like the following one:

  error: ‘void QFont::setRawName(const QString&)’ is deprecated [-Werror=deprecated-declarations]

These methods were deprecated in Qt 5.3. [1]

This commit removes code from 2002 (539ce478) that worked around a
problem in Qt's handling of XLFD fonts that no longer seems relevant
since XLFD is no longer supported in Qt 5 [2]. Even if the problem
were relevant, setRawName() would not fix anything since it is now
an empty method. [3]

I tested that compilation with Qt 4.8.7 works without error.

[1] https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.3.0/?h=v5.14.0
[2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3a8d7b0b9a4db91415b7bda2582a59a76b3754dc
[3] https://codereview.qt-project.org/c/qt/qtbase/+/100292/
2020-03-19 12:30:27 -04:00
Scott Kostyshak
8583410617 Fix Qt deprecation warns for setTextColor()
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
2020-03-19 10:16:47 -04:00
Scott Kostyshak
1d015ee9f3 Fix commented out code 2020-03-19 10:16:47 -04:00
Scott Kostyshak
27ba830b8e Fix Qt deprecation warns for setAutoCompletion()
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
2020-03-18 23:17:44 -04:00
Richard Kimberly Heck
861c6167ca Track whether we have warned about mixing layouts across e.g. branches. 2020-03-17 01:54:47 -04:00
Richard Kimberly Heck
b536759c07 Track whether title has been issued via OutputParams.
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.
2020-03-17 01:50:28 -04:00
Richard Kimberly Heck
7af6575cf6 Fix bug #11787.
Make sure we are actually at the end of the document before issuing
\maketitle because we are at the end of the document.
2020-03-17 01:39:07 -04:00
Richard Kimberly Heck
771940d5d7 Remove unused function 2020-03-16 02:18:19 -04:00
Richard Kimberly Heck
cf14e81412 Fix some warnings 2020-03-16 02:12:16 -04:00
Richard Kimberly Heck
4732da8dc2 Nullptr warnings 2020-03-16 02:09:39 -04:00
Richard Kimberly Heck
ada09a2cda Fix warning about 'requires' being a keyword. 2020-03-16 01:31:30 -04:00
Richard Kimberly Heck
7c7ea3113f Use ranges and fix nullptr warnings. 2020-03-16 01:31:30 -04:00
Scott Kostyshak
24e0bd3afe Fix Qt deprecation warns for QTime
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
2020-03-15 22:47:08 -04:00
Juergen Spitzmueller
9a31c1b90b update tex2lyx tests 2020-03-15 17:19:23 +01:00
Juergen Spitzmueller
4d7f4762a1 Outliner: Add filter combo for non-output items
Addresses #11442, #10786
2020-03-15 10:46:35 +01:00
Richard Kimberly Heck
f044d3a359 Fix bug #11780.
The preamble snippets are for LaTeX and do not need to be output
with HTML.
2020-03-14 18:31:25 -04:00
Richard Kimberly Heck
5333998570 Use a reference 2020-03-14 18:06:18 -04:00
Juergen Spitzmueller
b96ce9a9c1 Outliner: distinguish non-active refs from broken refs
See #11782
2020-03-14 16:29:53 +01:00
Juergen Spitzmueller
0f9ef6877c Add active refs to non-active labels to brokenrefs toc 2020-03-14 15:35:47 +01:00
Juergen Spitzmueller
a1da60642c Add outliner section for broken refs and citations 2020-03-14 15:18:28 +01:00
Juergen Spitzmueller
4ddc9e2501 Color broken citations, xrefs, and includes
Fixes #11503
2020-03-14 14:17:30 +01:00
Juergen Spitzmueller
bb277747d2 Support log parsing for multi-line warnings wrt undefined references 2020-03-14 11:16:12 +01:00
Juergen Spitzmueller
037b1e1478 thinko 2020-03-14 09:51:07 +01:00
Juergen Spitzmueller
02d2e4aa32 Do not break on undefined references that are part of the family.
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.
2020-03-14 09:43:57 +01:00
Juergen Spitzmueller
38a46b43c7 Improve error message 2020-03-14 09:43:16 +01:00
Juergen Spitzmueller
59e3ff27ff Fixup tooltips 2020-03-13 16:24:51 +01:00
Jean-Marc Lasgouttes
7d54d78691 Revert "Do not display caret when we're not ready"
I did not mean to push this.

This reverts commit 9bc255dc89.
2020-03-13 16:23:01 +01:00
Jean-Marc Lasgouttes
65e0aa767d remove constructs and comments about old compilers 2020-03-13 16:15:41 +01:00
Jean-Marc Lasgouttes
9bc255dc89 Do not display caret when we're not ready
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).
2020-03-13 16:02:36 +01:00
Juergen Spitzmueller
f4af191403 Introduce maintain unincluded children "mostly"
This is a mode for includeonly handling that is effective and still outputs
at least mostly correct counters and references. This is intended for non-
final editing work.

File format change.
2020-03-13 15:46:35 +01:00
Scott Kostyshak
36208d488e Fix preview check box for include insets
GuiInclude::initialiseParams() calls InsetCommand::string2params()
which calls InsetCommandParams::clear(), however this last function
did not reset the special "preview_" parameter. Now this parameter
is reset to false as part of clear().

The ParamData class documents (see InsetCommandParams.h) the
following:

  // No parameter may be named "preview", because that is a required
  // flag for all commands.

Thus, we must handle preview_ separately from the other parameters.

This commit fixes #11779.
2020-03-13 10:16:24 -04:00
Juergen Spitzmueller
6c889209a7 Improve performance of includeonly with "maintain counters and references"
First, we do not need to run bibtex/biber on the maintenance run, as
the necessary references will be generated on the includeonly run.

Second, exclude the master from DepTable in maintenance run, as the
master is re-checked in any case in the includeonly run, and as it will
always be detected as changed due to the \includeonly statement, which
will trigger a complete build.

More improvements to follow.
2020-03-13 11:49:07 +01:00
Scott Kostyshak
2b86751057 Fix correction with continuous spellcheck
This commit amends 8d26ae57ba.
2020-03-12 22:22:40 -04:00
Juergen Spitzmueller
b568a49593 Fix UI quirk in IncludeOnly settings
Fixes #11564
2020-03-12 10:37:56 +01:00
Scott Kostyshak
adb7283b69 outline-up/down: preserve cursor's position
There is no need to change the cursor's position to the beginning of
the line.

This change does not affect the behavior of using the buttons in the
Outliner pane, but is useful for using the keyboard shortcuts.
2020-03-11 14:19:05 -04:00
Scott Kostyshak
2cfcd706ab Fix Qt deprecation warns for setting tab
Fix warnings coming from deprecations of QTextEdit::tabStopWidth()
and QFontMetrics::width(). Regarding tabStopWidth(), the ChangeLog
states the following [1]:

  Introduced tabStopDistance property in QTextOption, QTextEdit and
  QPlainTextEdit as replacement for the inconsistently named tabStop and
  tabStopWidth properties. QTextOption::tabStop, QTextEdit::tabStopWidth and
  QPlainTextEdit::tabStopWidth are now deprecated.

Note that QFontMetrics::horizontalAdvance() is what we want here, as
opposed to QFontMetrics::boundingRect(), because we want to know
where to draw the next character after the tab.

[1] https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.10.0/?h=v5.10.0
2020-03-08 11:48:54 -04:00
Stephan Witt
0885098bd3 #11747 follow-up of change d94b708a0f to fix a compiler warning 2020-03-08 13:33:30 +01:00
Scott Kostyshak
2ee5d3c3d5 Revert "Do not display caret when we're not ready"
This reverts commit e99436b529.

Kornel discovered a regression due to this commit. See:

  https://www.mail-archive.com/search?l=mid&q=20200307121525.56be047b%40admin1-desktop
2020-03-07 16:50:59 -05:00
Richard Kimberly Heck
c32e37b702 Revert b7509419.
There are double updates of dialogs in some cases, but this isn't why.
2020-03-07 16:04:01 -05:00
Juergen Spitzmueller
3bd03709fd Consider CT underlining pref in captions markup 2020-03-07 07:28:37 +01:00
Scott Kostyshak
c6f4682b75 Fix Qt deprecation warn for QPixmapCache::find()
Fix the following warning from Qt 5.14.1:

  error: ‘static bool QPixmapCache::find(const QString&, QPixmap&)’ is deprecated: Use bool find(const QString &, QPixmap*) instead [-Werror=deprecated-declarations]
2020-03-06 22:46:18 -05:00
Scott Kostyshak
690c671b1d Fix Qt deprecation warn for QList::fromSet()
Fix the following warning from Qt 5.14.1:

  error: ‘static QList<T> QList<T>::fromSet(const QSet<T>&) [with T = QString]’ is deprecated: Use QList<T>(set.begin(), set.end()) instead. [-Werror=deprecated-declarations]

Regarding QList::fromSet(), the documentation now states the
following [1]:

  Since Qt 5.14, range constructors are available for Qt's generic
  container classes and should be used in place of this method.

[1] https://doc.qt.io/qt-5/qlist.html
2020-03-06 22:36:12 -05:00
Juergen Spitzmueller
5e21a8fbf7 Markup changed captions in workarea by underline and strikeout, resp. 2020-03-06 18:58:25 +01:00
Juergen Spitzmueller
f5a2d770b8 Footnote: (re-)add a fallback dummy counter 2020-03-06 18:21:18 +01:00
Juergen Spitzmueller
b8cac52759 Use real counter in deleted footnotes 2020-03-06 18:16:34 +01:00
Scott Kostyshak
1045020e05 Fix Qt deprecation warn for setConfirmOverwrite()
Fix the following warning:

  error: ‘void QFileDialog::setConfirmOverwrite(bool)’ is deprecated: Use setOption(DontConfirmOverwrite, !enabled) instead [-Werror=deprecated-declarations]

Note in the change that "false" changes to "true" because the option
is *Dont*ConfirmOverwrite.

QFileDialog::setConfirmOverwrite() is obsolete at least since 4.8
and QFileDialog::setOption() is available since 4.5 [1].

[1] https://doc.qt.io/archives/qt-4.8/qfiledialog-obsolete.html
[2] https://doc.qt.io/qt-5/qfiledialog.html#setOption
2020-03-06 09:56:01 -05:00
Scott Kostyshak
1c78b563ff Fix Qt deprecation warn for getContentsMargins()
Fixes the following warning:

  error: ‘void QWidget::getContentsMargins(int*, int*, int*, int*) const’ is deprecated: use contentsMargins() [-Werror=deprecated-declarations]

The new code also has advantages in that 'l' can be set to const and
it is more readable because it is clear that only 'l' is used.

QWidget::getContentsMargins() was deprecated in 5.14.0 [1]. and
QWidget::contentsMargins() is available since 4.6 [2].

[1] https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.14.0/?h=v5.14.0
[2] https://doc.qt.io/archives/qt-4.8/qlayout.html#contentsMargins
2020-03-06 09:37:43 -05:00
Juergen Spitzmueller
339424ce00 Handle deleted BibTeX/Biblatex bibliographies
Since we cannot strike-out these, we output a placeholder when
show changes in output is active.

Fixes #11762
2020-03-06 13:49:10 +01:00
Juergen Spitzmueller
d94b708a0f Tell updateBuffer whether an inset is deleted.
Fixes #11747
2020-03-06 13:23:01 +01:00
Juergen Spitzmueller
e6105275af Consider change tracking in setBeginOfBody()
Fixes #11749
2020-03-06 11:49:32 +01:00
Juergen Spitzmueller
21567a260c Use range-based loop 2020-03-06 11:20:46 +01:00
Juergen Spitzmueller
228d738868 Account for changes in insets when checking changes in selection
This is not ideal, see FIXME.

Fixes #11774
2020-03-06 10:53:54 +01:00
Scott Kostyshak
b38a452efb Fix Qt deprecation warning for isItemSelected()
These methods are related to the deprecated setItemSelected() and
setItemHidden() methods that were converted at 24926b2e.
2020-03-05 20:38:31 -05:00
Scott Kostyshak
273af8803d Fix Qt deprecation warning for setItemHidden()
Consistent with commit 24926b2e.
2020-03-05 20:38:31 -05:00
Scott Kostyshak
27ca2bd950 Rename a var "sort" to not mask std::sort()
This allows us to use sort() without the "std" prefix.
2020-03-05 12:46:48 -05:00
Scott Kostyshak
14f369b47f Fix deprecation warnings from use of qSort()
This commit replaces qSort with std::sort to fix warnings from compiling with
Qt 5.14.1. Below is one of the warnings:

  error: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = QList<lyx::ColorCode>::iterator; LessT$
  an = bool (*)(lyx::ColorCode, lyx::ColorCode)]’ is deprecated: Use std::sort [-Werror=deprecated-declarations]

qSort() has been deprecated since Qt 5.2. Quoting from the ChangeLog [1]:

  With STL no longer being optional for building and using Qt, a number of
  parts of QtAlgorithms no longer make sense, and have therefore been
  deprecated. Replacements are available in the STL, and generally have
  much better performance

There are some cases that require more than just a trivial substitution, but
our code does not appear to use any of those cases.

For some discussion on the differences in speed of std::sort() and
qSort(), see the following:

  https://phabricator.kde.org/D10857

These are just warnings now, but will likely be errors with Qt 6:

  https://bugreports.qt.io/browse/QTBUG-73048

I tested that LyX can still be built against Qt 4.8.7 with this commit.

This commit follows 24926b2e, which also fixes some deprecation warnings.

[1]
https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.2.0/?h=v5.2.0
2020-03-05 12:44:39 -05:00
Scott Kostyshak
24926b2e23 Fix a few deprecation warnings in Qt 5.14.1
These changes fix a few instances of the following type of warning:

  error: ‘void QListWidget::setItemSelected(const QListWidgetItem*, bool)’ is deprecated: Use QListWidgetItem::setSelected() instead [-Werror=deprecated-declarations]

as well as similar warnings for setItemHidden() and
setItemExpanded(). These are just warnings now, but it is planned to
remove the methods for Qt 6:

  https://bugreports.qt.io/browse/QTBUG-73048

I tested that LyX can still be built against Qt 4.8.7 with this
commit. Indeed, these methods have been deprecated for a while (it
is just that QT_DEPRECATED_WARNINGS was only turned on by default
starting with 5.13.0). See, e.g.,

  https://doc.qt.io/archives/qt-4.7/qlistwidget-obsolete.html
2020-03-05 11:12:31 -05:00
Richard Kimberly Heck
e5b6be0712 Fix bug #10316.
By sending the request through the usual dispatch machinery, we
make sure the cursor is valid when we're done.
2020-03-03 23:17:09 -05:00
Richard Kimberly Heck
15659fed53 Andr'e points out this is wrong. Of course it is, since that is not a pointer. 2020-03-03 14:27:03 -05:00
Jean-Marc Lasgouttes
e99436b529 Do not display caret when we're not ready
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).
2020-03-03 12:30:27 +01:00