eric7/EricWidgets/EricTextEditSearchWidget.py

branch
eric7
changeset 8858
a70a980e7d4f
parent 8857
8191d15b8974
child 8859
64252c7bfb87
equal deleted inserted replaced
8857:8191d15b8974 8858:a70a980e7d4f
8 """ 8 """
9 9
10 import enum 10 import enum
11 11
12 from PyQt6.QtCore import pyqtSlot, pyqtSignal, Qt, QMetaObject, QSize 12 from PyQt6.QtCore import pyqtSlot, pyqtSignal, Qt, QMetaObject, QSize
13 from PyQt6.QtGui import QPalette, QBrush, QColor, QTextDocument, QTextCursor 13 from PyQt6.QtGui import QPalette, QTextDocument, QTextCursor
14 from PyQt6.QtWidgets import ( 14 from PyQt6.QtWidgets import (
15 QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QCheckBox, 15 QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox, QCheckBox,
16 QToolButton, QSizePolicy 16 QToolButton, QSizePolicy
17 ) 17 )
18 18
56 56
57 self.__textedit = None 57 self.__textedit = None
58 self.__texteditType = EricTextEditType.UNKNOWN 58 self.__texteditType = EricTextEditType.UNKNOWN
59 self.__findBackwards = False 59 self.__findBackwards = False
60 60
61 # TODO: change to use style sheets
62 # get style sheet or create one from palette
63 self.__defaultBaseColor = ( 61 self.__defaultBaseColor = (
64 self.findtextCombo.lineEdit().palette().color( 62 self.findtextCombo.lineEdit().palette().color(
65 QPalette.ColorRole.Base) 63 QPalette.ColorRole.Base)
66 ) 64 )
67 self.__defaultTextColor = ( 65 self.__defaultTextColor = (
458 errors. 456 errors.
459 457
460 @param error flag indicating an error condition 458 @param error flag indicating an error condition
461 @type bool 459 @type bool
462 """ 460 """
463 le = self.findtextCombo.lineEdit()
464 p = le.palette()
465 # TODO: change to use style sheets
466 if error: 461 if error:
467 p.setBrush(QPalette.ColorRole.Base, QBrush(QColor("#FF6666"))) 462 styleSheet = "color: #000000; background-color: #ff6666"
468 p.setBrush(QPalette.ColorRole.Text, QBrush(QColor("#000000"))) 463 else:
469 else: 464 styleSheet = (
470 p.setBrush(QPalette.ColorRole.Base, self.__defaultBaseColor) 465 f"color: {self.__defaultTextColor};"
471 p.setBrush(QPalette.ColorRole.Text, self.__defaultTextColor) 466 f" background-color: {self.__defaultBaseColor}"
472 le.setPalette(p) 467 )
473 le.update() 468 self.findtextCombo.setStyleSheet(styleSheet)
474 469
475 def __findTextFinished(self, result): 470 def __findTextFinished(self, result):
476 """ 471 """
477 Private slot handling the findTextFinished signal of the web page. 472 Private slot handling the findTextFinished signal of the web page.
478 473

eric ide

mercurial