Commit c56820ad authored by Dan Pascu's avatar Dan Pascu

Reset chat input text formatting between messages

parent bd5fc473
...@@ -12,7 +12,7 @@ import re ...@@ -12,7 +12,7 @@ import re
from PyQt4 import uic from PyQt4 import uic
from PyQt4.QtCore import Qt, QBuffer, QEasingCurve, QEvent, QPoint, QPointF, QPropertyAnimation, QRect, QRectF, QSettings, QSize, QSizeF, QTimer, QUrl, pyqtSignal from PyQt4.QtCore import Qt, QBuffer, QEasingCurve, QEvent, QPoint, QPointF, QPropertyAnimation, QRect, QRectF, QSettings, QSize, QSizeF, QTimer, QUrl, pyqtSignal
from PyQt4.QtGui import QAction, QBrush, QColor, QIcon, QLabel, QLinearGradient, QListView, QMenu, QPainter, QPalette, QPen, QPixmap, QPolygonF, QTextCursor, QTextDocument, QTextEdit, QToolButton from PyQt4.QtGui import QAction, QBrush, QColor, QIcon, QLabel, QLinearGradient, QListView, QMenu, QPainter, QPalette, QPen, QPixmap, QPolygonF, QTextCursor, QTextDocument, QTextEdit, QToolButton
from PyQt4.QtGui import QApplication, QDesktopServices, QImageReader, QKeyEvent from PyQt4.QtGui import QApplication, QDesktopServices, QImageReader, QKeyEvent, QTextCharFormat
from PyQt4.QtWebKit import QWebPage, QWebSettings, QWebView from PyQt4.QtWebKit import QWebPage, QWebSettings, QWebView
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
...@@ -463,6 +463,10 @@ class ChatTextInput(QTextEdit): ...@@ -463,6 +463,10 @@ class ChatTextInput(QTextEdit):
def _SH_DocumentLayoutSizeChanged(self, new_size): def _SH_DocumentLayoutSizeChanged(self, new_size):
self.setFixedHeight(min(new_size.height()+self.contentsMargins().top()+self.contentsMargins().bottom(), self.parent().height()/2)) self.setFixedHeight(min(new_size.height()+self.contentsMargins().top()+self.contentsMargins().bottom(), self.parent().height()/2))
def clear(self):
super(ChatTextInput, self).clear()
self.setCurrentCharFormat(QTextCharFormat()) # clear() doesn't clear the text formatting, only the content
def setHtml(self, text): def setHtml(self, text):
super(ChatTextInput, self).setHtml(text) super(ChatTextInput, self).setHtml(text)
cursor = self.textCursor() cursor = self.textCursor()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment