diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-05-06 17:03:45 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-05-06 19:25:12 +0000 |
commit | 1b8a1e04efb4ea71803edf8c122db2837fe23af9 (patch) | |
tree | 82b680d3597b1e5163d194c143006d48eff4ec67 | |
parent | b922c97c9c65ce28f4ea18106f384adf1bbf605a (diff) |
Fix heading level in style combobox in TextEdit example
Amends 0df30ff22e50aa301791fc72f106ab15ce385a6a: when adding the
checked and unchecked styles to the combobox, it changed the offsets
for the heading styles; so the combobox stopped changing to the correct
index when clicking on a heading, and also changed the heading
two sizes smaller than it should when attempting to select a different
heading level.
Change-Id: Ib3f61987c786e34f32a81bf7b3ebc5ca730f40df
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
-rw-r--r-- | examples/widgets/richtext/textedit/textedit.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp index ced77a62ce..996bb8e0a4 100644 --- a/examples/widgets/richtext/textedit/textedit.cpp +++ b/examples/widgets/richtext/textedit/textedit.cpp @@ -691,7 +691,7 @@ void TextEdit::textStyle(int styleIndex) if (style == QTextListFormat::ListStyleUndefined) { blockFmt.setObjectIndex(-1); - int headingLevel = styleIndex >= 9 ? styleIndex - 9 + 1 : 0; // H1 to H6, or Standard + int headingLevel = styleIndex >= 11 ? styleIndex - 11 + 1 : 0; // H1 to H6, or Standard blockFmt.setHeadingLevel(headingLevel); cursor.setBlockFormat(blockFmt); @@ -837,7 +837,7 @@ void TextEdit::cursorPositionChanged() } } else { int headingLevel = textEdit->textCursor().blockFormat().headingLevel(); - comboStyle->setCurrentIndex(headingLevel ? headingLevel + 8 : 0); + comboStyle->setCurrentIndex(headingLevel ? headingLevel + 10 : 0); } } |