]> git.lyx.org Git - features.git/commit
Improve implementation of TabWorkArea::posIsTab()
authorScott Kostyshak <skostysh@lyx.org>
Fri, 29 Jul 2016 17:06:49 +0000 (13:06 -0400)
committerScott Kostyshak <skostysh@lyx.org>
Fri, 29 Jul 2016 17:09:48 +0000 (13:09 -0400)
commitbadb0bb96cc22c64210d140643fae521a78c6fdc
tree3cd7da98396581df2dfa7f0281b521347186c4bd
parent9c3ddbf7a042007e349f9dbec22f098ec76dc420
Improve implementation of TabWorkArea::posIsTab()

The Qt documentation states that tabAt() returns -1 if the position
is not over a tab. This behavior has been consistent since Qt 4.3
[1]. This commit's improvement likely makes the code faster in two
ways:

(1) we do not need to loop through potentially all tabs
(2) we only need to look up the tab index corresponding with one
position

posIsTab() is not currently used intensively so no practical gain in
speed is achieved, but it protects against future use.

[1] https://doc.qt.io/archives/4.3/qtabbar.html#tabAt
src/frontends/qt4/GuiWorkArea.cpp