Created
June 26, 2011 18:25
-
-
Save wez/1047826 to your computer and use it in GitHub Desktop.
tweaks for qcachegrind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: libviews/treemap.cpp | |
=================================================================== | |
--- libviews/treemap.cpp (revision 1238414) | |
+++ libviews/treemap.cpp (working copy) | |
@@ -368,9 +368,12 @@ | |
while(qAbs(maxWidth - usedWidth) > 3 * fm->maxWidth()) { | |
int halfPos = (bottomPos + breakPos)/2; | |
int halfWidth = fm->width(text, halfPos); | |
- if (halfWidth < maxWidth) | |
+ if (halfWidth < maxWidth) { | |
bottomPos = halfPos; | |
- else { | |
+ if (usedWidth > maxWidth) { | |
+ usedWidth--; | |
+ } | |
+ } else { | |
breakPos = halfPos; | |
usedWidth = halfWidth; | |
} |
Tracking this as a bug in the main project: https://sourceforge.net/tracker/?func=detail&aid=3335058&group_id=64331&atid=507103
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The binary search algorithm in treemap.cpp doesn't make progress in the case where the computed width is larger than the available width; this simple patch slowly brings this back to within bounds.
There may be better ways to do this; I am not a qt developer.