本文整理汇总了Python中PyQt4.QtGui.QGraphicsGridLayout.setColumnSpacing方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsGridLayout.setColumnSpacing方法的具体用法?Python QGraphicsGridLayout.setColumnSpacing怎么用?Python QGraphicsGridLayout.setColumnSpacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsGridLayout
的用法示例。
在下文中一共展示了QGraphicsGridLayout.setColumnSpacing方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KTorrentView
# 需要导入模块: from PyQt4.QtGui import QGraphicsGridLayout [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsGridLayout import setColumnSpacing [as 别名]
class KTorrentView(plasmascript.Applet):
def __init__(self,parent,args=None):
plasmascript.Applet.__init__(self,parent)
def init(self):
self.setHasConfigurationInterface(False)
self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
self.settings = self.config()
self.theme = Plasma.Svg(self)
self.theme.setImagePath("widgets/background")
self.setBackgroundHints(Plasma.Applet.DefaultBackground)
self.layout = QGraphicsGridLayout(self.applet)
self.layout.setColumnSpacing(0,5.0)
self.setLayout(self.layout)
self.resize(500,200)
示例2: TaskCoachApplet
# 需要导入模块: from PyQt4.QtGui import QGraphicsGridLayout [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsGridLayout import setColumnSpacing [as 别名]
class TaskCoachApplet(plasmascript.Applet):
def __init__(self,parent,args=None):
plasmascript.Applet.__init__(self,parent)
def init(self):
self.setHasConfigurationInterface(False)
self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
self.settings = self.config()
self.theme = Plasma.Svg(self)
self.theme.setImagePath("widgets/background")
self.setBackgroundHints(Plasma.Applet.DefaultBackground)
self.layout = QGraphicsGridLayout(self.applet)
self.layout.setColumnSpacing(0,5.0)
# using the predefined KGuiItem objects save us a lot of work
self.btnOpen = Plasma.PushButton(self.applet)
self.btnOpen.nativeWidget().setGuiItem(KStandardGuiItem.Open)
self.btnReset = Plasma.PushButton(self.applet)
self.btnReset.nativeWidget().setGuiItem(KStandardGuiItem.Reset)
self.btnSave = Plasma.PushButton(self.applet)
self.btnSave.nativeWidget().setGuiItem(KStandardGuiItem.Save)
self.btnSaveAs = Plasma.PushButton(self.applet)
self.btnSaveAs.nativeWidget().setGuiItem(KStandardGuiItem.SaveAs)
self.layout.addItem(self.btnOpen,0,0)
self.layout.addItem(self.btnReset,0,1)
self.layout.addItem(self.btnSave,2,1)
self.layout.addItem(self.btnSaveAs,2,0)
self.model = None
self.filePath = None
self.treeView = Plasma.TreeView(self.applet)
self.treeView.setVisible(False)
header = self.treeView.nativeWidget().header()
header.setDefaultAlignment(Qt.AlignCenter)
fontColor = self.theme.theme().color(Plasma.Theme.TextColor)
header.setStyleSheet("""
QHeaderView {
color: %s;
font: bold italic;
};
""" % fontColor.name() )
self.treeView.setStyleSheet("""
QTreeView { background-color: transparent; color: %s;};
""" % fontColor.name() )
self.treeView.setModel(self.model)
self.layout.addItem(self.treeView,1,0,1,2)
self.setLayout(self.layout)
self.resize(350,500)
self.btnOpen.clicked.connect(self.openFile)
self.btnReset.clicked.connect(self.resetFile)
self.btnSave.clicked.connect(self.saveFile)
self.btnSaveAs.clicked.connect(self.saveFileAs)
# FIXME: doesn't work
QObject.connect(self.treeView.nativeWidget(),
SIGNAL("dataChanged(QModelIndex,QModelIndex)"),
self.onDataChanged)
self.treeView.nativeWidget().setItemDelegate(
ProgressDelegate(
self.treeView.nativeWidget()))
self.treeView.nativeWidget().header().setResizeMode(
QHeaderView.Interactive)
self.treeView.nativeWidget().setEditTriggers(QTreeView.AllEditTriggers)
def _open(self,filePath):
if not filePath.isEmpty():
self.model = TaskListModel(str(filePath))
self.treeView.setModel(self.model)
self.treeView.nativeWidget().expandAll()
self.treeView.nativeWidget().header().resizeSection(0,
self.treeView.nativeWidget().width() * 0.8)
self.treeView.nativeWidget().header().resizeSection(1,
self.treeView.nativeWidget().width() * 0.1)
self.filePath = filePath
self.treeView.setVisible(True)
@pyqtSlot()
def openFile(self,*args):
fPath = QFileDialog.getOpenFileName(None,
"Select TaskCoach file",
expanduser("~"),
"TaskCoach files (*.tsk);;All Files(*.*)")
#.........这里部分代码省略.........
示例3: GSBApplet
# 需要导入模块: from PyQt4.QtGui import QGraphicsGridLayout [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsGridLayout import setColumnSpacing [as 别名]
class GSBApplet(plasmascript.Applet):
def __init__(self,parent,args=None):
plasmascript.Applet.__init__(self,parent)
def init(self):
self.setHasConfigurationInterface(True)
self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
self.settings = self.config()
self.theme = Plasma.Svg(self)
self.theme.setImagePath("widgets/background")
self.setBackgroundHints(Plasma.Applet.DefaultBackground)
self.layout = QGraphicsGridLayout(self.applet)
self.layout.setColumnSpacing(0,5.0)
self.lblTitle = Plasma.Label(self.applet)
self.lblTitle.nativeWidget().setText(
ki18n("Stuff to get back").toString())
self.lblTitle.setAlignment(Qt.AlignHCenter)
self.lblTitle.setStyleSheet("""QLabel {
text-align:center;
font-style: italic;
font-weight: bold;}""")
self.layout.addItem(self.lblTitle,0,0,1,3)
self.btnAdd = Plasma.PushButton(self.applet)
self.btnAdd.nativeWidget().setGuiItem(KStandardGuiItem.Add)
self.layout.addItem(self.btnAdd,1,0)
self.btnRemove = Plasma.PushButton(self.applet)
self.btnRemove.nativeWidget().setGuiItem(KStandardGuiItem.Remove)
self.layout.addItem(self.btnRemove,1,2)
self.db = GSBDbModel()
self.view = Plasma.TreeView(self.applet)
self.view.setModel(self.db)
self.view.nativeWidget().setColumnHidden(self.db.IDCOL,True)
self.view.nativeWidget().setRootIsDecorated(False)
self.view.nativeWidget().setExpandsOnDoubleClick(False)
self.view.nativeWidget().setItemsExpandable(False)
self.view.setStyleSheet("""
QTreeView {
background-color: transparent;
}
QTreeView::item { padding-top:10px; padding-bottom: 10px; }
""")
self.view.nativeWidget().header().resizeSections(
QHeaderView.ResizeToContents)
self.view.nativeWidget().setItemDelegate(
LoanDelegate(
self.applet,
self.view.nativeWidget()))
self.layout.addItem(self.view,2,0,1,3)
self.setLayout(self.layout)
self.btnAdd.clicked.connect(self.add_loan)
self.btnRemove.clicked.connect(self.remove_loan)
def createConfigurationInterface(self, parent):
self.configDlg = ConfigDlg(parent, self.applet)
page = parent.addPage(self.configDlg,
ki18n("GetStuffBack Options").toString())
page.setIcon(KIcon("user-desktop"))
parent.okClicked.connect(self.configAccepted)
def showConfigurationInterface(self):
dialog = KPageDialog()
dialog.setFaceType(KPageDialog.List)
dialog.setButtons( KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel) )
self.createConfigurationInterface(dialog)
dialog.exec_()
@pyqtSlot()
def configAccepted(self):
grace_period = self.configDlg.spinGrace.value()
colour = self.configDlg.btnColour.color()
options = self.settings.group("general")
options.writeEntry("grace",grace_period)
options.writeEntry("overdue_colour",colour.name())
@pyqtSlot()
def add_loan(self,*args):
addDlg = AddDlg(self)
result = addDlg.exec_()
if result == False: return False
ln = Loan()
ln.item_description = unicode(addDlg.lineItemDescription.toPlainText())
ln.person = unicode(addDlg.linePerson.text())
ln.date = addDlg.dteDate.dateTime().toPyDateTime()
ln.expected_date = addDlg.dteExpectedDate.dateTime().toPyDateTime()
#.........这里部分代码省略.........