Add line wrap indentation

This commit is contained in:
cuissedemouche 2022-12-26 19:17:00 +00:00
parent 6fac08414b
commit b1814e967c
3 changed files with 10 additions and 5 deletions

View File

@ -91,9 +91,6 @@ font: 11pt &quot;UbuntuMono NF&quot;;</string>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>

View File

@ -1,6 +1,6 @@
from PySide6.QtWidgets import QWidget from PySide6.QtWidgets import QWidget
from PySide6.QtCore import QSize from PySide6.QtCore import QSize
from PySide6.QtGui import QTextCharFormat, QTextCursor, QColor from PySide6.QtGui import QTextCharFormat, QTextCursor, QColor, QTextBlockFormat
from ui_main_window import Ui_MainWindow from ui_main_window import Ui_MainWindow
from file_cmds import FileCmds from file_cmds import FileCmds
@ -62,8 +62,17 @@ class MainWindow(QWidget, Ui_MainWindow):
self.content = self.file_cmds.tabs_content[item_selected[0].text()] self.content = self.file_cmds.tabs_content[item_selected[0].text()]
self.detail_text_edit.setPlainText(self.content) self.detail_text_edit.setPlainText(self.content)
self.search() self.search()
self.wrap_line_indent()
def wrap_line_indent(self):
cursor = QTextCursor(self.detail_text_edit.document())
cursor.select(QTextCursor.Document)
fmt = QTextBlockFormat()
fmt.setLeftMargin(100)
fmt.setTextIndent(-100)
cursor.mergeBlockFormat(fmt)
def search(self): def search(self):
to_search = self.search_line_edit.text() to_search = self.search_line_edit.text()

View File

@ -65,7 +65,6 @@ class Ui_MainWindow(object):
self.detail_text_edit.setObjectName(u"detail_text_edit") self.detail_text_edit.setObjectName(u"detail_text_edit")
self.detail_text_edit.setStyleSheet(u"background-color: rgb(42, 42, 42);") self.detail_text_edit.setStyleSheet(u"background-color: rgb(42, 42, 42);")
self.detail_text_edit.setFrameShape(QFrame.NoFrame) self.detail_text_edit.setFrameShape(QFrame.NoFrame)
self.detail_text_edit.setLineWrapMode(QTextEdit.NoWrap)
self.detail_text_edit.setReadOnly(True) self.detail_text_edit.setReadOnly(True)
self.splitter.addWidget(self.detail_text_edit) self.splitter.addWidget(self.detail_text_edit)