本文整理匯總了Python中PySide.QtGui.QListWidget.currentRow方法的典型用法代碼示例。如果您正苦於以下問題:Python QListWidget.currentRow方法的具體用法?Python QListWidget.currentRow怎麽用?Python QListWidget.currentRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide.QtGui.QListWidget
的用法示例。
在下文中一共展示了QListWidget.currentRow方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: UiMain
# 需要導入模塊: from PySide.QtGui import QListWidget [as 別名]
# 或者: from PySide.QtGui.QListWidget import currentRow [as 別名]
#.........這裏部分代碼省略.........
self.switch_active_item_button_off.setFont(QFont('SansSerif', 17))
self.switch_active_item_button_off.setGeometry(175, 55, 40, 30)
# on button
self.switch_active_item_button_on = QPushButton(self.options)
self.switch_active_item_button_on.setText('<-'.decode('utf-8'))
# makes <- readable and clear
self.switch_active_item_button_on.setFont(QFont('SansSerif', 17))
self.switch_active_item_button_on.setGeometry(175, 90, 40, 30)
QObject.connect(self.switch_active_item_button_on, SIGNAL
("clicked()"), self.switch_item_on)
QObject.connect(self.switch_active_item_button_off, SIGNAL
("clicked()"), self.switch_item_off)
# A button to toggle the split output in half option. It's a temporary
# fix for the Foobar double output problem.
self.switch_output_split_btn = QCheckBox(self.options)
self.switch_output_split_btn.setCheckState(Qt.CheckState.Unchecked)
self.switch_output_split_btn.setGeometry(10, 140, 40, 30)
self.switch_output_split_btn.stateChanged.connect(self.toggle_split)
# The label for the split toggle
self.switch_output_split_lbl = QLabel(self.options)
self.switch_output_split_lbl.setText(
"Split the output text in half (don't use this if you don't need it)")
self.switch_output_split_lbl.setGeometry(30, 140, 300, 30)
def switch_item_on(self):
""" Switches items (musicapps) on """
try:
# If an item from the active box is selected
# Remove it and place it inside the inactive box
item_taken = self.inactive_items_list.takeItem(
self.inactive_items_list.currentRow())
self.active_items_list.addItem(item_taken)
active_items = {}
inactive_items = {}
for i in range(self.active_items_list.count()):
active_items[self.active_items_list.item(i).text()] =\
ITEMS[self.active_items_list.item(i).text()
.encode('utf-8')]
for i in range(self.inactive_items_list.count()):
inactive_items[self.inactive_items_list.item(i).text()] =\
ITEMS[self.inactive_items_list.item(i).text()
.encode('utf-8')]
Constants.ACTIVE_ITEMS = active_items
Constants.INACTIVE_ITEMS = inactive_items
# clear the selection combobox
self.app_select_box.clear()
# Repopulate the combobox
self.app_select_box.addItem(None)
for item in active_items:
self.app_select_box.addItem(item)
Constants.CONFIG.set('active', item_taken.text(),
ITEMS[item_taken.text()])
Constants.CONFIG.remove_option('inactive', item_taken.text())
# Updates the config file to be up to date with activeItems
Constants.CONFIG.update()
except:
raise
def switch_item_off(self):
""" Switches items (musicapps) off """
try:
# If an item from the inactive box is selected.
# Remove it and place it inside the active box