summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-05-06 17:03:45 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-05-06 19:25:12 +0000
commit1b8a1e04efb4ea71803edf8c122db2837fe23af9 (patch)
tree82b680d3597b1e5163d194c143006d48eff4ec67 /examples/widgets
parentb922c97c9c65ce28f4ea18106f384adf1bbf605a (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>
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/richtext/textedit/textedit.cpp4
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);
}
}