提交 ccbe53e6 编写于 作者: 之一Yo's avatar 之一Yo

添加多行编辑框

上级 0d738670
......@@ -12,7 +12,7 @@ Examples are available at https://github.com/zhiyiYo/PyQt-Fluent-Widgets/tree/ma
:license: GPLv3, see LICENSE for more details.
"""
__version__ = "0.5.5"
__version__ = "0.5.6"
from .components import *
from .common import *
......
LineEdit, TextEdit {
LineEdit, TextEdit, PlainTextEdit {
background-color: rgb(55, 55, 55);
border: 1px solid rgb(58, 58, 58);
border-bottom: 1px solid rgb(159, 159, 159);
......@@ -10,25 +10,25 @@ LineEdit, TextEdit {
selection-color: black;
}
TextEdit {
TextEdit, PlainTextEdit {
padding: 0px 0px 0px 10px;
}
LineEdit:hover, TextEdit:hover {
LineEdit:hover, TextEdit:hover, PlainTextEdit:hover {
background-color: rgb(60, 60, 60);
}
LineEdit:!focus, TextEdit:!focus {
LineEdit:!focus, TextEdit:!focus, PlainTextEdit:!focus {
background-color: rgb(55, 55, 55);
border-bottom: 1px solid rgb(159, 159, 159);
}
LineEdit:focus, TextEdit:focus {
LineEdit:focus, TextEdit:focus, PlainTextEdit:focus {
border-bottom: 1px solid --ThemeColorPrimary;
background-color: rgb(34, 34, 34);
}
LineEdit:disabled, TextEdit:disabled {
LineEdit:disabled, TextEdit:disabled, PlainTextEdit:disabled {
color: rgba(255, 255, 255, 150);
background-color: rgb(59, 59, 59);
border: 1px solid rgb(73, 73, 73);
......
LineEdit, TextEdit {
LineEdit, TextEdit, PlainTextEdit {
color: black;
background-color: white;
border: 1px solid rgba(0, 0, 0, 13);
......@@ -9,27 +9,30 @@ LineEdit, TextEdit {
selection-background-color: --ThemeColorLight1;
}
TextEdit {
TextEdit,
PlainTextEdit {
padding: 0px 0px 0px 10px;
}
LineEdit:hover, TextEdit:hover {
LineEdit:hover, TextEdit:hover, PlainTextEdit:hover {
background-color: rgb(252, 252, 252);
border: 1px solid rgba(0, 0, 0, 13);
border-bottom: 1px solid rgba(0, 0, 0, 100);
}
LineEdit:!focus, TextEdit:!focus {
LineEdit:!focus, TextEdit:!focus, PlainTextEdit:!focus {
background-color: white;
border-bottom: 1px solid rgba(0, 0, 0, 100);
}
LineEdit:focus, TextEdit:focus {
LineEdit:focus, TextEdit:focus,
PlainTextEdit:focus {
border-bottom: 1px solid --ThemeColorPrimary;
background-color: white;
}
LineEdit:disabled, TextEdit:disabled {
LineEdit:disabled, TextEdit:disabled,
PlainTextEdit:disabled {
color: rgba(0, 0, 0, 150);
background-color: rgb(252, 252, 252);
border: 1px solid rgb(237, 237, 237);
......
此差异已折叠。
from .button import PrimaryPushButton, PushButton, RadioButton, HyperlinkButton, ToolButton
from .check_box import CheckBox
from .combo_box import ComboBox
from .line_edit import LineEdit, TextEdit
from .line_edit import LineEdit, TextEdit, PlainTextEdit
from .icon_widget import IconWidget
from .label import PixmapLabel
from .menu import DWMMenu, LineEditMenu, RoundMenu
......
# coding: utf-8
from PyQt5.QtCore import QSize, Qt, QRectF, QEvent
from PyQt5.QtGui import QPainter, QPainterPath
from PyQt5.QtWidgets import QLineEdit, QToolButton, QTextEdit
from PyQt5.QtWidgets import QLineEdit, QToolButton, QTextEdit, QPlainTextEdit
from ...common.style_sheet import setStyleSheet, themeColor
from ...common.icon import writeSvg, isDarkTheme, drawSvgIcon
......@@ -118,3 +118,23 @@ class TextEdit(QTextEdit):
else:
self.horizonSmoothScroll.wheelEvent(e)
class PlainTextEdit(QPlainTextEdit):
""" Plain text edit """
def __init__(self, parent=None):
super().__init__(parent=parent)
self.verticalSmoothScroll = SmoothScroll(self, Qt.Vertical)
self.horizonSmoothScroll = SmoothScroll(self, Qt.Horizontal)
setStyleSheet(self, 'line_edit')
def contextMenuEvent(self, e):
menu = TextEditMenu(self)
menu.exec_(e.globalPos())
def wheelEvent(self, e):
if e.modifiers() == Qt.NoModifier:
self.verticalSmoothScroll.wheelEvent(e)
else:
self.horizonSmoothScroll.wheelEvent(e)
......@@ -721,7 +721,6 @@ class TextEditMenu(EditMenu):
def _parentSelectedText(self):
return self.parent().textCursor().selectedText()
def _onItemClicked(self, item):
if self.selectionStart >= 0:
cursor = self.parent().textCursor()
......
......@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f:
setuptools.setup(
name="PyQt-Fluent-Widgets",
version="0.5.5",
version="0.5.6",
keywords="pyqt fluent widgets",
author="zhiyiYo",
author_email="shokokawaii@outlook.com",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册