设置QTextEdit的Tab跳过的空格数为4个空格

This commit is contained in:
sonichy 2018-07-13 15:49:47 +08:00
parent 63f83d276e
commit 8084372f00
3 changed files with 6 additions and 3 deletions

BIN
HTYEdit

Binary file not shown.

View File

@ -12,6 +12,9 @@
MdiChild::MdiChild() MdiChild::MdiChild()
{ {
QFontMetrics FM(font());
int ts = 4;
setTabStopWidth(ts * FM.boundingRect("*").width());
connect(document(),SIGNAL(contentsChanged()),this,SLOT(onContentsChanged())); connect(document(),SIGNAL(contentsChanged()),this,SLOT(onContentsChanged()));
} }