当前位置: 首页 > news >正文

wordpress 中介网站wordpress 个人写作

wordpress 中介网站,wordpress 个人写作,折扣网站怎么做,河北省建设厅管网站Pyside6 QTextEdit QTextEdit使用QTextEdit常用函数文本编辑类函数文本框格式设置函数设置文字颜色设置文字背景颜色设置文字格式设置文本框样式程序设置界面设置 QTextEdit信号textChanged信号 完整程序界面程序主程序 QTextEdit类提供了一个用于编辑和显示纯文本和富文本的组… Pyside6 QTextEdit QTextEdit使用QTextEdit常用函数文本编辑类函数文本框格式设置函数设置文字颜色设置文字背景颜色设置文字格式设置文本框样式程序设置界面设置 QTextEdit信号textChanged信号 完整程序界面程序主程序 QTextEdit类提供了一个用于编辑和显示纯文本和富文本的组件更多关于QTextEdit的使用可以参考下面的文档 https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QTextEdit.html QTextEdit使用 QTextEdit常用函数 函数作用文本编辑类函数append在文本框的最后添加新内容clear清空文本框copy复制文本框内容cut剪切文本框内容paste粘贴文本框内容redo撤销文本框操作setText设置纯文本内容内容或html格式的字符串(该函数会覆盖原内容)setPlainText设置纯文本内容内容(该函数会覆盖原内容)toPlainText获取文本框内容文本框格式设置函数setTextColor设置字体颜色setTextBackgroundColor设置字体背景颜色setFont设置字体格式setStyleSheet设置文本框样式信号 textChanged文本框内容改变时触发 文本编辑类函数 self.ui.pushButton_2.clicked.connect(self.textedit_copy) self.ui.pushButton_4.clicked.connect(self.textedit_paste) self.ui.pushButton_5.clicked.connect(self.textedit_cut) self.ui.pushButton_3.clicked.connect(self.textedit_undo) self.ui.pushButton.clicked.connect(self.textedit_clear)self.ui.textEdit.setText(font colorblue size50Hello World/font) # 往文本框写入内容 self.ui.textEdit.append(ABCDEFGHJIK) # 往文本框后新增内容def textedit_selectionChanged(self):print(self.ui.textEdit_3.toPlainText())def textedit_textChanged(self):print(self.ui.textEdit_3.toPlainText())def textedit_copy(self):self.ui.textEdit.copy() # 复制文本框内容def textedit_paste(self):self.ui.textEdit.paste() # 粘贴内容def textedit_cut(self):self.ui.textEdit.cut() # 剪切内容def textedit_undo(self):self.ui.textEdit.undo() # 撤销操作def textedit_clear(self):self.ui.textEdit.clear() # 清除文本框内容文本框格式设置函数 设置文字颜色 调用setTextColor设置文字颜色其参数为RGB888的颜色格式 self.ui.textEdit_2.setTextColor(QColor(255,0,0)) # 设置文本框字体颜色为红色设置文字背景颜色 调用setTextBackgroundColor设置文字背景颜色其参数也是为RGB888的颜色格式 self.ui.textEdit_2.setTextBackgroundColor(QColor(0,0,255)) # 设置字体背景颜色为蓝色设置文字格式 QTextEdit支持文字的大小设置、下划线设置、加粗设置和倾斜设置。 font QFont() font.setPointSize(20) # 设置字体大小 font.setUnderline(True) # 添加字体下划线 font.setBold(True) # 设置字体为粗体 font.setItalic(True) # 设置字体为斜体 self.ui.textEdit_2.setFont(font) # 设置字体格式设置文本框样式 文本框样式设置可以通过代码设置和界面设置本人比较推荐通过界面设置因为程序设置比较复杂。 程序设置 设置文本框背景颜色为绿色 self.ui.textEdit_2.setStyleSheet(background-color:#00FF00) # 设置文本框背景颜色为绿色界面设置 找到TextEdit控件的属性栏找到styleSheet选项点击右边的小方块进入样式设置对话框。在颜色对话框就可以设置背景颜色字体格式等操作。在这里插入代码片 font QFont() font.setPointSize(20) # 设置字体大小 font.setUnderline(True) # 添加字体下划线 font.setBold(True) # 设置字体为粗体 font.setItalic(True) # 设置字体为斜体 self.ui.textEdit_2.setFont(font) # 设置字体格式self.ui.textEdit_2.setStyleSheet(background-color:#00FF00) # 设置文本框背景颜色为绿色self.ui.textEdit_2.setTextColor(QColor(255,0,0)) # 设置文本框字体颜色为红色 self.ui.textEdit_2.setTextBackgroundColor(QColor(0,0,255)) # 设置字体背景颜色为蓝色 self.ui.textEdit_2.append(0123456789) # 往文本框写入内容self.ui.textEdit_2.setTextColor(QColor(0,0,255)) # 设置文本框字体颜色为蓝色 self.ui.textEdit_2.setTextBackgroundColor(QColor(255,0,0)) # 设置字体背景颜色为红色 self.ui.textEdit_2.append(ABCDEFGHJIK) # 往文本框写入内容QTextEdit信号 textChanged信号 textChanged信号是文本框内容改变的时候触发注意如果在界面初始化时调用setText或者setPlainText设置文本时不会触发textChanged信号。 self.ui.textEdit_3.textChanged.connect(self.textedit_textChanged) # 绑定textChanged信号 def textedit_textChanged(self):print(self.ui.textEdit_3.toPlainText())完整程序 界面程序 ?xml version1.0 encodingUTF-8? ui version4.0classMainWindow/classwidget classQMainWindow nameMainWindowproperty namegeometryrectx0/xy0/ywidth778/widthheight577/height/rect/propertyproperty namefontfontpointsize11/pointsize/font/propertyproperty namewindowTitlestringMainWindow/string/propertywidget classQWidget namecentralwidgetlayout classQVBoxLayout nameverticalLayoutitemwidget classQTabWidget nametabWidgetproperty namefontfontpointsize11/pointsizeitalicfalse/italicboldfalse/bold/font/propertyproperty namecurrentIndexnumber0/number/propertywidget classQWidget nametabattribute nametitlestring文本编辑操作/string/attributelayout classQHBoxLayout namehorizontalLayoutitemwidget classQTextEdit nametextEditproperty namefontfontpointsize11/pointsizeitalicfalse/italicboldfalse/bold/font/propertyproperty namecursor stdset0cursorShapeArrowCursor/cursorShape/propertyproperty namehtmlstringlt;!DOCTYPE HTML PUBLIC quot;-//W3C//DTD HTML 4.0//ENquot; quot;http://www.w3.org/TR/REC-html40/strict.dtdquot;gt; lt;htmlgt;lt;headgt;lt;meta namequot;qrichtextquot; contentquot;1quot; /gt;lt;meta charsetquot;utf-8quot; /gt;lt;style typequot;text/cssquot;gt; p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: quot;\2610quot;; } li.checked::marker { content: quot;\2612quot;; } lt;/stylegt;lt;/headgt;lt;body stylequot; font-family:Microsoft YaHei UI; font-size:11pt; font-weight:400; font-style:normal;quot;gt; lt;p stylequot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;quot;gt;lt;br /gt;lt;/pgt;lt;/bodygt;lt;/htmlgt;/string/property/widget/itemitemlayout classQVBoxLayout nameverticalLayout_2itemwidget classQPushButton namepushButton_2property nametextstring复制/string/property/widget/itemitemwidget classQPushButton namepushButton_4property nametextstring粘贴/string/property/widget/itemitemwidget classQPushButton namepushButton_5property nametextstring剪切/string/property/widget/itemitemwidget classQPushButton namepushButton_3property nametextstring撤销/string/property/widget/itemitemwidget classQPushButton namepushButtonproperty nametextstring清除/string/property/widget/item/layout/item/layout/widgetwidget classQWidget nametab_2attribute nametitlestring文本框格式设置/string/attributelayout classQVBoxLayout nameverticalLayout_3itemwidget classQTextEdit nametextEdit_2property namefontfontpointsize11/pointsizeitalicfalse/italicboldfalse/bold/font/propertyproperty namestyleSheetstring notrtrue//propertyproperty namehtmlstringlt;!DOCTYPE HTML PUBLIC quot;-//W3C//DTD HTML 4.0//ENquot; quot;http://www.w3.org/TR/REC-html40/strict.dtdquot;gt; lt;htmlgt;lt;headgt;lt;meta namequot;qrichtextquot; contentquot;1quot; /gt;lt;meta charsetquot;utf-8quot; /gt;lt;style typequot;text/cssquot;gt; p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } li.unchecked::marker { content: quot;\2610quot;; } li.checked::marker { content: quot;\2612quot;; } lt;/stylegt;lt;/headgt;lt;body stylequot; font-family:Microsoft YaHei UI; font-size:11pt; font-weight:400; font-style:normal;quot;gt; lt;p stylequot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;quot;gt;lt;br /gt;lt;/pgt;lt;/bodygt;lt;/htmlgt;/string/property/widget/item/layout/widgetwidget classQWidget nametab_3attribute nametitlestring信号/string/attributelayout classQVBoxLayout nameverticalLayout_4itemwidget classQTextEdit nametextEdit_3//item/layout/widget/widget/item/layout/widgetwidget classQMenuBar namemenubarproperty namegeometryrectx0/xy0/ywidth778/widthheight26/height/rect/property/widgetwidget classQStatusBar namestatusbar//widgetresources/connections/ /ui 主程序 # Import Qt libraries from PySide6.QtWidgets import * from PySide6.QtCore import QFile,QByteArray from PySide6.QtGui import QFont,QColor,Qt,QTextCursor # Import UI developed in Qt Creator from qtextedit_ui import Ui_MainWindow # 导入界面 # Import PseudoSensor # Import system tools and datetime import sys import statistics import time from datetime import datetime# Create and start the Qt application class MainWindow(QMainWindow):def __init__(self):super(MainWindow, self).__init__()# 设置界面为用户设计的界面self.ui Ui_MainWindow() self.ui.setupUi(self) self.ui.pushButton_2.clicked.connect(self.textedit_copy)self.ui.pushButton_4.clicked.connect(self.textedit_paste)self.ui.pushButton_5.clicked.connect(self.textedit_cut)self.ui.pushButton_3.clicked.connect(self.textedit_undo)self.ui.pushButton.clicked.connect(self.textedit_clear)self.ui.textEdit.setText(font colorblue size50Hello World/font) # 往文本框写入内容self.ui.textEdit.append(ABCDEFGHJIK) # 往文本框后新增内容font QFont()font.setPointSize(20) # 设置字体大小font.setUnderline(True) # 添加字体下划线font.setBold(True) # 设置字体为粗体font.setItalic(True) # 设置字体为斜体self.ui.textEdit_2.setFont(font) # 设置字体格式self.ui.textEdit_2.setStyleSheet(background-color:#00FF00) # 设置文本框背景颜色为绿色self.ui.textEdit_2.setTextColor(QColor(255,0,0)) # 设置文本框字体颜色为红色self.ui.textEdit_2.setTextBackgroundColor(QColor(0,0,255)) # 设置字体背景颜色为蓝色self.ui.textEdit_2.append(0123456789) # 往文本框写入内容self.ui.textEdit_2.setTextColor(QColor(0,0,255)) # 设置文本框字体颜色为蓝色self.ui.textEdit_2.setTextBackgroundColor(QColor(255,0,0)) # 设置字体背景颜色为红色self.ui.textEdit_2.append(ABCDEFGHJIK) # 往文本框写入内容self.ui.textEdit_3.textChanged.connect(self.textedit_textChanged) # 绑定textChanged信号def textedit_textChanged(self):print(self.ui.textEdit_3.toPlainText())def textedit_copy(self):self.ui.textEdit.copy() # 复制文本框内容def textedit_paste(self):self.ui.textEdit.paste() # 粘贴内容def textedit_cut(self):self.ui.textEdit.cut() # 剪切内容def textedit_undo(self):self.ui.textEdit.undo() # 撤销操作def textedit_clear(self):self.ui.textEdit.clear() # 清除文本框内容def closeAndExit(self):sys.exit()if __name__ __main__:app QApplication(sys.argv) # 初始化QApplication# 初始化界面并显示界面window MainWindow() window.show() window.setFixedSize(window.width(), window.height())sys.exit(app.exec())
http://www.w-s-a.com/news/824624/

相关文章:

  • 建材网站建设案例淄博网站建设培训
  • 纯代码添加wordpress网站底部导航宝塔自助建站源码
  • 网站设计技术有哪些?青岛网站建设工作室
  • 网站怎样建设才叫人性化宣传
  • 济南网站制作方案做淘客网站备案
  • h5企业网站只做做php门户网站那个系统好
  • 长春阿凡达网站建设建网站如果不买域名别人能不能访问
  • 佛山网站建设策划东莞建设工程交易网
  • 制作公众号网站开发濮阳建网站
  • 屏南网站建设兼职旅游网站建设方案两百字
  • 最牛的网站建设网站建设的规模设想
  • 马云之前做的网站企业形象策划
  • ie9网站后台编辑器代发qq群发广告推广
  • 百度怎样建立一个网站嘉兴高端网站定制
  • 国外设计网站怎么进入电子网站建设前台设计
  • 中方建设局网站济南网站建设公司电子商务网站
  • 如何做网站编辑 沒技术济南企业做网站推广网站
  • 网站模板 百科北京中高风险地区最新名单最新
  • 高校网站建设前言做公众号的公司是什么公司
  • 网站备案怎么登陆短视频培训学校
  • 百度图片点击变网站是怎么做的北京市建设工程质量监督站网站
  • 在线建站模板重庆网站建设大概需要多少钱
  • 建设网站公司电话号码wordpress 即时通讯
  • 网站设计用的技术拓者吧室内设计网app
  • 河北seo优化_网络建设营销_网站推广服务 - 河北邢台seo网站建设运行情况报告
  • 建设银行内部网站6画册设计是什么
  • 网站建设什么价格网站下拉菜单怎么做
  • flash型网站微信公众号运营策划
  • 想建设个网站怎么赚钱国外学校网站设计
  • 网站设计网页设计系统没有安装wordpress