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>
This commit is contained in:
parent
b922c97c9c
commit
1b8a1e04ef
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user