4

箇条書きのある html リストで、format.setFontPointSize() を介してフォントサイズを変更すると、箇条書きがエディタから追い出されます。padding-left を 1em に設定すると、fontsize-change で箇条書きが同じ位置にとどまることがわかりました (これを html エディターで試しました)。Qtのリストエントリでこれを達成するにはどうすればよいですか? 要素値ではなく、ピクセル値のみに設定できますか?

        fmt=cur.charFormat()
        charSize=fmt.fontPointSize()
        if charSize==0.0:
            charSize=14
        if direction=="up":
            fmt.setFontPointSize(charSize+1)
            if textList:
                    blockFormat=cur.blockFormat()
                    #blockFormat.setLeftMargin(blockFormat.leftMargin()+0.4)
                    blockFormat.setLeftMargin(1em)
                    cur.mergeBlockFormat(blockFormat)
        else:
            fmt.setFontPointSize(charSize-1)
            if textList:
                    blockFormat=cur.blockFormat()
                    #blockFormat.setLeftMargin(blockFormat.leftMargin()-0.4)
                    blockFormat.setLeftMargin(1em)
                    cur.mergeBlockFormat(blockFormat)
        cur.mergeCharFormat(fmt)
4

1 に答える 1