本文整理汇总了Python中PyQt4.QtGui.QListView.setMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.setMinimumWidth方法的具体用法?Python QListView.setMinimumWidth怎么用?Python QListView.setMinimumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QListView
的用法示例。
在下文中一共展示了QListView.setMinimumWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setMinimumWidth [as 别名]
class MainWindow(QMainWindow):
"""
class MainWindow for the gui of dokueddy
"""
def __init__(self, config, parent=None):
"""
Constructor for class MainWindow
@param config: dokueddy configuration
"""
QMainWindow.__init__(self)
self.config = config
self.setGeometry(
self.config.settings['app_x'],
self.config.settings['app_y'],
self.config.settings['app_w'],
self.config.settings['app_h']
)
self.setWindowTitle(
self.config.settings['appname'] +
' - Version: ' +
self.config.settings['appversion']
)
globalFont = QFont(
self.config.settings['fontfamily'],
self.config.settings['pointsize']
)
self.statusbar = self.statusBar()
self.center()
self.exit = QAction('Quit Dokueddy', self)
self.menubar = QMenuBar(None)
self.file = self.menubar.addMenu('&File')
self.file.addAction(self.exit)
self.setMenuBar(self.menubar)
self.save = QAction(QIcon('../resources/icons/save_edit.gif'), 'Save current page', self)
self.save.setShortcut('Ctrl+S')
self.save.setDisabled(True)
self.fontBold = QAction(QIcon('../resources/icons/tag_bold.png'), 'Bold text', self)
self.fontItalic = QAction(QIcon('../resources/icons/tag_i.png'), 'Italic text', self)
self.fontH1 = QAction(QIcon('../resources/icons/tag_h1.png'), 'Heading 1', self)
self.fontH2 = QAction(QIcon('../resources/icons/tag_h2.png'), 'Heading 2', self)
self.fontH3 = QAction(QIcon('../resources/icons/tag_h3.png'), 'Heading 3', self)
self.fontH4 = QAction(QIcon('../resources/icons/tag_h4.png'), 'Heading 4', self)
self.fontH5 = QAction(QIcon('../resources/icons/tag_h5.png'), 'Heading 5', self)
self.search = QAction(QIcon('../resources/icons/magnify.png'), 'Search for', self)
self.toolbar = self.addToolBar('Toolbar')
self.toolbar.addAction(self.save)
self.toolbar.addSeparator()
self.toolbar.addAction(self.fontBold)
self.toolbar.addAction(self.fontItalic)
self.toolbar.addAction(self.fontH1)
self.toolbar.addAction(self.fontH2)
self.toolbar.addAction(self.fontH3)
self.toolbar.addAction(self.fontH4)
self.toolbar.addAction(self.fontH5)
self.toolbar.addAction(self.search)
self.toolbar.setMaximumHeight(24)
self.serverLabel = QLabel()
self.serverLabel.setText('Serveraddress:')
self.userLabel = QLabel()
self.userLabel.setText('Username:')
self.passwdLabel = QLabel()
self.passwdLabel.setText('Password:')
self.serverLineEdit = QLineEdit()
self.serverLineEdit.setMinimumWidth(160)
self.serverLineEdit.setMaximumSize(250, 35)
self.serverLineEdit.setText(self.config.settings['serverAddress'])
self.userLineEdit = QLineEdit()
self.userLineEdit.setMaximumSize(150, 35)
self.userLineEdit.setText(self.config.settings['user'])
self.passwdLineEdit = QLineEdit()
self.passwdLineEdit.setMaximumSize(150, 35)
self.passwdLineEdit.setEchoMode(QLineEdit.Password)
self.connectButton = QPushButton('Connect', self)
self.connectButton.setMaximumSize(100, 35)
self.quitButton = QPushButton('Quit', self)
self.quitButton.setMaximumSize(100, 35)
self.listView = QListView(self)
self.listView.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.listView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.listView.setMinimumWidth(200)
self.listView.setMaximumWidth(400)
self.listView.setFont(globalFont)
self.textEdit = QTextEdit(self)
self.textEdit.setMinimumWidth(400)
self.textEdit.setFont(globalFont)
self.textEdit.setLineWrapMode(QTextEdit.NoWrap)
self.editLayout = QGridLayout()
self.editLayout.addWidget(self.serverLabel, 0, 0, Qt.AlignLeft)
self.editLayout.addWidget(self.serverLineEdit, 0, 1)
self.editLayout.addWidget(self.userLabel, 0, 2, Qt.AlignLeft)
self.editLayout.addWidget(self.userLineEdit, 0, 3)
#.........这里部分代码省略.........