当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QLineEdit方法代码示例

本文整理汇总了Python中Qt.QtWidgets.QLineEdit方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QLineEdit方法的具体用法?Python QtWidgets.QLineEdit怎么用?Python QtWidgets.QLineEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Qt.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QLineEdit方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: replaceAll

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def replaceAll(self):
        """ Replace all occurrences of the search text.
        """
        count = 0
        
        with self.overrideCursor():
            findText = self.getFindText()
            replaceText = self.getReplaceText()
            found = self.findAndReplace(findText, replaceText)
            while found:
                count += 1
                found = self.findAndReplace(findText, replaceText, startPos=3)
        
        if count > 0:
            self.findDlg.setStyleSheet("QLineEdit#findLineEdit{background:none}")
            self.findDlg.statusBar.showMessage("{} occurrence{} replaced.".format(count, '' if count == 1 else 's'))
        else:
            self.findDlg.statusBar.showMessage("Phrase not found. 0 occurrences replaced.") 
开发者ID:dreamworksanimation,项目名称:usdmanager,代码行数:20,代码来源:__init__.py

示例2: validateFindBar

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def validateFindBar(self, text):
        """ Update widgets on the Find bar as the search text changes.
        
        :Parameters:
            text : `str`
                Current text in the find bar.
        """
        if text != "":
            self.buttonFindPrev.setEnabled(True)
            self.buttonFindNext.setEnabled(True)
            self.actionFindPrev.setEnabled(True)
            self.actionFindNext.setEnabled(True)
            self.buttonHighlightAll.setEnabled(True)
            self.find(startPos=2)  # Find as user types.
        else:
            self.buttonFindPrev.setEnabled(False)
            self.buttonFindNext.setEnabled(False)
            self.actionFindPrev.setEnabled(False)
            self.actionFindNext.setEnabled(False)
            self.buttonHighlightAll.setEnabled(False)
            if self.buttonHighlightAll.isChecked():
                self.findHighlightAll()
            self.findBar.setStyleSheet("QLineEdit{{background:{}}}".format("inherit" if self.isDarkTheme() else "none"))
            self.labelFindPixmap.setVisible(False)
            self.labelFindStatus.setVisible(False) 
开发者ID:dreamworksanimation,项目名称:usdmanager,代码行数:27,代码来源:__init__.py

示例3: __init__

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def __init__(self, parent=None,validPins=None):
        super(SelectPinDialog, self).__init__(None)
        self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
        self.setWindowTitle("Select pin")
        self.setWindowIcon(QtGui.QIcon(":/pin.png"))
        self.resize(QtCore.QSize(400, 300))

        self.mainLayout = QtWidgets.QVBoxLayout(self)
        self.mainLayout.setContentsMargins(2, 2, 2, 2)
        self.searchBox = QtWidgets.QLineEdit()
        self.searchBox.setPlaceholderText("search...")
        self.searchBox.textChanged.connect(self.filterContent)
        self.mainLayout.addWidget(self.searchBox)
        if not validPins:
            validPins = [pin.__name__ for pin in getAllPinClasses()]
        self.content = _PinsListWidget(validPins=validPins)
        self.mainLayout.addWidget(self.content)
        self.content.itemClicked.connect(self.onItemClicked)
        self.content.returnPressed.connect(self.onReturnPressed)

        self._result = None 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:23,代码来源:SelectPinDialog.py

示例4: setupUi

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def setupUi(self, QSpectrumAnalyzerBaseline):
        QSpectrumAnalyzerBaseline.setObjectName("QSpectrumAnalyzerBaseline")
        QSpectrumAnalyzerBaseline.resize(500, 100)
        self.verticalLayout = QtWidgets.QVBoxLayout(QSpectrumAnalyzerBaseline)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.label = QtWidgets.QLabel(QSpectrumAnalyzerBaseline)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.baselineFileEdit = QtWidgets.QLineEdit(QSpectrumAnalyzerBaseline)
        self.baselineFileEdit.setObjectName("baselineFileEdit")
        self.horizontalLayout.addWidget(self.baselineFileEdit)
        self.baselineFileButton = QtWidgets.QToolButton(QSpectrumAnalyzerBaseline)
        self.baselineFileButton.setMinimumSize(QtCore.QSize(50, 0))
        self.baselineFileButton.setObjectName("baselineFileButton")
        self.horizontalLayout.addWidget(self.baselineFileButton)
        self.formLayout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout)
        self.verticalLayout.addLayout(self.formLayout)
        spacerItem = QtWidgets.QSpacerItem(20, 1, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(QSpectrumAnalyzerBaseline)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)
        self.label.setBuddy(self.baselineFileEdit)

        self.retranslateUi(QSpectrumAnalyzerBaseline)
        self.buttonBox.accepted.connect(QSpectrumAnalyzerBaseline.accept)
        self.buttonBox.rejected.connect(QSpectrumAnalyzerBaseline.reject)
        QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerBaseline)
        QSpectrumAnalyzerBaseline.setTabOrder(self.baselineFileEdit, self.baselineFileButton) 
开发者ID:xmikos,项目名称:qspectrumanalyzer,代码行数:37,代码来源:ui_qspectrumanalyzer_baseline.py

示例5: replaceAllInOpenFiles

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def replaceAllInOpenFiles(self):
        """ Iterate through all the writable tabs, finding and replacing the search text.
        """
        count = files = 0
        
        with self.overrideCursor():
            findText = self.getFindText()
            replaceText = self.getReplaceText()
            origTab = self.tabWidget.currentIndex()

            for i in range(self.tabWidget.count()):
                self.tabWidget.setCurrentIndex(i)
                status = self.currTab.getFileStatus()
                if not status.writable:
                    continue
                if not self.currTab.inEditMode:
                    self.toggleEdit()
                fileChanged = False
                found = self.findAndReplace(findText, replaceText)
                while found:
                    fileChanged = True
                    count += 1
                    found = self.findAndReplace(findText, replaceText, startPos=3)
                if fileChanged:
                    files += 1
            
            # End on the original tab.
            if self.tabWidget.currentIndex() != origTab:
                self.tabWidget.setCurrentIndex(origTab)
        
        if count > 0:
            self.findDlg.setStyleSheet("QLineEdit#findLineEdit{background:none}")
            self.findDlg.statusBar.showMessage("{} occurrence{} replaced in {} file{}.".format(
                count, '' if count == 1 else 's', files, '' if files == 1 else 's'))
        else:
            self.findDlg.statusBar.showMessage("Phrase not found. 0 occurrences replaced.") 
开发者ID:dreamworksanimation,项目名称:usdmanager,代码行数:38,代码来源:__init__.py

示例6: launchProgramOfChoice

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def launchProgramOfChoice(self, path=None):
        """ Open a file with a program given by the user.
        
        :Parameters:
            path : `str`
                File to open. If None, use currently open file.
        """
        if path is None:
            path = self.currTab.getCurrentPath()
        
        # Get program of choice from user.
        prog, ok = QtWidgets.QInputDialog.getText(
                    self, "Open with...",
                    "Please enter the program you would like to open this file with.\n\nYou may include command line "
                    "options as well, and the file path will be appended to the end of the command.\n\n"
                    "Example:\n    usdview --unloaded\n    rm\n",
                    QtWidgets.QLineEdit.Normal, self.preferences['lastOpenWithStr'])
        # Return if cancel was pressed or nothing entered.
        if not ok or not prog:
            return
        
        # Store command for future convenience.
        self.updatePreference('lastOpenWithStr', prog)
        
        # Launch program.
        args = shlex.split(prog) + [path]
        self.launchProcess(args) 
开发者ID:dreamworksanimation,项目名称:usdmanager,代码行数:29,代码来源:__init__.py

示例7: setupUi

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def setupUi(self, findReplace):
        findReplace.setObjectName("findReplace")
        findReplace.resize(246, 101)
        self.verticalLayout = QtWidgets.QVBoxLayout(findReplace)
        self.verticalLayout.setObjectName("verticalLayout")
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.replace_le = QtWidgets.QLineEdit(findReplace)
        self.replace_le.setObjectName("replace_le")
        self.gridLayout.addWidget(self.replace_le, 1, 0, 1, 1)
        self.find_le = QtWidgets.QLineEdit(findReplace)
        self.find_le.setObjectName("find_le")
        self.gridLayout.addWidget(self.find_le, 0, 0, 1, 1)
        self.find_btn = QtWidgets.QPushButton(findReplace)
        self.find_btn.setObjectName("find_btn")
        self.gridLayout.addWidget(self.find_btn, 0, 1, 1, 1)
        self.replace_btn = QtWidgets.QPushButton(findReplace)
        self.replace_btn.setObjectName("replace_btn")
        self.gridLayout.addWidget(self.replace_btn, 1, 1, 1, 1)
        self.replaceAll_btn = QtWidgets.QPushButton(findReplace)
        self.replaceAll_btn.setObjectName("replaceAll_btn")
        self.gridLayout.addWidget(self.replaceAll_btn, 2, 1, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)

        self.retranslateUi(findReplace)
        QtCore.QMetaObject.connectSlotsByName(findReplace)
        findReplace.setTabOrder(self.find_le, self.replace_le)
        findReplace.setTabOrder(self.replace_le, self.find_btn)
        findReplace.setTabOrder(self.find_btn, self.replace_btn)
        findReplace.setTabOrder(self.replace_btn, self.replaceAll_btn) 
开发者ID:weijer,项目名称:NukeToolSet,代码行数:32,代码来源:findWidget_UIs.py

示例8: __init__

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def __init__(self, parent=None):
        super(ReplacePath, self).__init__(parent)
        self.resize(500, 100)
        self.setWindowTitle('Replace Read Node Path')
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint)
        main_layout = QtGui.QVBoxLayout(self)
        main_layout.setSpacing(15)

        source_label = QtGui.QLabel('Source Path')
        self.source_le = QtGui.QLineEdit()
        target_label = QtGui.QLabel('Target Path')
        self.target_le = QtGui.QLineEdit()
        self.replace_btn = QtGui.QPushButton('Replace')
        self.replace_btn.clicked.connect(self.do_replace)

        source_layout = QtGui.QHBoxLayout()
        source_layout.addWidget(source_label)
        source_layout.addWidget(self.source_le)

        target_layout = QtGui.QHBoxLayout()
        target_layout.addWidget(target_label)
        target_layout.addWidget(self.target_le)

        main_layout.addLayout(source_layout)
        main_layout.addLayout(target_layout)
        main_layout.addWidget(self.replace_btn) 
开发者ID:weijer,项目名称:NukeToolSet,代码行数:28,代码来源:replace_read_node_path.py

示例9: CreateWidget

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def CreateWidget(info):
        name, label, parm_type, default = info

        if parm_type is medic.Types.Null or\
           parm_type is medic.Types.BoolArray or\
           parm_type is medic.Types.IntArray or\
           parm_type is medic.Types.FloatArray or\
           parm_type is medic.Types.StringArray:
            print("This type parameter is not supported yet : %s" % parm_type)
            return None, None

        widget = None
        function = None

        if parm_type == medic.Types.Bool:
            widget = QtWidgets.QCheckBox()
            widget.setChecked(default)
            function = ParameterFunctions.SetBool

        elif parm_type == medic.Types.Int:
            widget = NumericLine.CreateIntLine()
            widget.setText(str(default))
            function = ParameterFunctions.SetInt

        elif parm_type == medic.Types.Float:
            widget = NumericLine.CreateFloatLine()
            widget.setText(str(default))
            function = ParameterFunctions.SetFloat

        elif parm_type == medic.Types.String:
            widget = QtWidgets.QLineEdit()
            widget.setText(default)
            function = ParameterFunctions.SetString

        widget.setObjectName("parameter_widget")

        return widget, function 
开发者ID:sol-ansano-kim,项目名称:medic,代码行数:39,代码来源:widgets.py

示例10: __init__

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def __init__(self, parent=None, searchByHeaders=False):
        super(PropertiesWidget, self).__init__(parent)
        self.setWindowTitle("Properties view")
        self.mainLayout = QtWidgets.QVBoxLayout(self)
        self.mainLayout.setObjectName("propertiesMainLayout")
        self.mainLayout.setContentsMargins(2, 2, 2, 2)
        self.searchBox = QtWidgets.QLineEdit(self)
        self.searchBox.setObjectName("lineEdit")
        self.searchBox.setPlaceholderText(str("search..."))
        self.searchBox.textChanged.connect(self.filterByHeaders if searchByHeaders else self.filterByHeadersAndFields)
        self.searchBoxWidget = QtWidgets.QWidget()
        self.searchBoxLayout = QtWidgets.QHBoxLayout(self.searchBoxWidget)
        self.searchBoxLayout.setContentsMargins(1, 1, 1, 1)
        self.searchBoxLayout.addWidget(self.searchBox)

        # self.settingsButton = QtWidgets.QToolButton()
        # self.settingsButton.setIcon(QtGui.QIcon(":/settings.png"))
        # self.settingsMenu = QtWidgets.QMenu()
        # self.editPropertiesAction = QtWidgets.QAction("Edit Parameter Interface", None)
        # self.settingsMenu.addAction(self.editPropertiesAction)
        # self.settingsButton.setMenu(self.settingsMenu)
        # self.editPropertiesAction.triggered.connect(self.showPropertyEditor)
        #self.settingsButton.clicked.connect(self.spawnDuplicate.emit)
        # self.settingsButton.setPopupMode(QtWidgets.QToolButton.InstantPopup)

        self.lockCheckBox = QtWidgets.QToolButton()
        self.lockCheckBox.setCheckable(True)
        self.lockCheckBox.setIcon(QtGui.QIcon(':/unlocked.png'))
        self.lockCheckBox.toggled.connect(self.changeLockIcon)
        self.searchBoxLayout.addWidget(self.lockCheckBox)
        self.tearOffCopy = QtWidgets.QToolButton()
        self.tearOffCopy.setIcon(QtGui.QIcon(":/tear_off_copy_bw.png"))
        self.tearOffCopy.clicked.connect(self.spawnDuplicate.emit)
        self.searchBoxLayout.addWidget(self.tearOffCopy)
        self.mainLayout.addWidget(self.searchBoxWidget)
        self.searchBoxWidget.hide()
        self.contentLayout = QtWidgets.QVBoxLayout()
        self.contentLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
        self.mainLayout.addLayout(self.contentLayout)
        self.spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.mainLayout.addItem(self.spacerItem)
        self.mainLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:45,代码来源:PropertiesFramework.py

示例11: __init__

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def __init__(self, dockWidget, renamable=False):
        super(DockTitleBar, self).__init__(dockWidget)
        self.renamable = renamable
        self.setLayout(QtWidgets.QHBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 1)
        self.buttonsLay = QtWidgets.QHBoxLayout()
        self.buttonsLay.setSpacing(1)
        self.buttonsLay.setMargin(1)
        self.box = QtWidgets.QGroupBox("")
        self.box.setLayout(self.buttonsLay)
        self.box.setObjectName("Docked")
        self.layout().addWidget(self.box)

        self.box.mouseDoubleClickEvent = self.mouseDoubleClickEvent
        self.box.mousePressEvent = self.mousePressEvent
        self.box.mouseMoveEvent = self.mouseMoveEvent
        self.box.mouseReleaseEvent = self.mouseReleaseEvent

        self.titleLabel = QtWidgets.QLabel(self)
        self.titleLabel.setStyleSheet("background:transparent")
        self.titleEdit = QtWidgets.QLineEdit(self)
        self.titleEdit.hide()
        self.titleEdit.editingFinished.connect(self.finishEdit)

        self.buttonSize = QtCore.QSize(14, 14)

        self.dockButton = QtWidgets.QToolButton(self)
        self.dockButton.setIcon(QtGui.QIcon(':/split_window.png'))
        self.dockButton.setMaximumSize(self.buttonSize)
        self.dockButton.setAutoRaise(True)
        self.dockButton.clicked.connect(self.toggleFloating)

        self.closeButton = QtWidgets.QToolButton(self)
        self.closeButton.setMaximumSize(self.buttonSize)
        self.closeButton.setAutoRaise(True)
        self.closeButton.setIcon(QtGui.QIcon(':/close_window.png'))
        self.closeButton.clicked.connect(self.closeParent)

        self.buttonsLay.addSpacing(2)
        self.buttonsLay.addWidget(self.titleLabel)
        self.buttonsLay.addWidget(self.titleEdit)
        self.buttonsLay.addStretch()
        self.buttonsLay.addSpacing(5)
        self.buttonsLay.addWidget(self.dockButton)
        self.buttonsLay.addWidget(self.closeButton)

        dockWidget.featuresChanged.connect(self.onFeaturesChanged)

        self.onFeaturesChanged(dockWidget.features())
        self.setTitle(dockWidget.windowTitle())
        dockWidget.installEventFilter(self)
        dockWidget.topLevelChanged.connect(self.ChangeFloatingStyle) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:54,代码来源:Tool.py

示例12: setupUi

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QLineEdit [as 别名]
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(168, 75)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        self.verticalLayout = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSpacing(7)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.lePinName = QtWidgets.QLineEdit(Form)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lePinName.sizePolicy().hasHeightForWidth())
        self.lePinName.setSizePolicy(sizePolicy)
        self.lePinName.setMinimumSize(QtCore.QSize(0, 0))
        self.lePinName.setMaximumSize(QtCore.QSize(60, 16777215))
        self.lePinName.setObjectName("lePinName")
        self.horizontalLayout.addWidget(self.lePinName)
        self.cbType = QtWidgets.QComboBox(Form)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cbType.sizePolicy().hasHeightForWidth())
        self.cbType.setSizePolicy(sizePolicy)
        self.cbType.setObjectName("cbType")
        self.horizontalLayout.addWidget(self.cbType)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.cbHideLabel = QtWidgets.QCheckBox(Form)
        self.cbHideLabel.setObjectName("cbHideLabel")
        self.horizontalLayout_2.addWidget(self.cbHideLabel)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:46,代码来源:PinWidget_ui.py


注:本文中的Qt.QtWidgets.QLineEdit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。