本文整理汇总了Python中PyQt5.QtCore.Qt.DescendingOrder方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.DescendingOrder方法的具体用法?Python Qt.DescendingOrder怎么用?Python Qt.DescendingOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.DescendingOrder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupUi
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def setupUi(self):
try:
ui_find_coll_tx_dlg.Ui_ListCollateralTxsDlg.setupUi(self, self)
self.setWindowTitle('Find collateral transaction')
self.collaterals_table_model.set_view(self.collsTableView)
self.collsTableView.setSortingEnabled(True)
self.collsTableView.setItemDelegate(wnd_utils.ReadOnlyTableCellDelegate(self.collsTableView))
self.collsTableView.verticalHeader().setDefaultSectionSize(
self.collsTableView.verticalHeader().fontMetrics().height() + 4)
self.collsTableView.horizontalHeader().setSortIndicator(
self.collaterals_table_model.col_index_by_name('time_stamp'), Qt.DescendingOrder)
self.collsTableView.selectionModel().selectionChanged.connect(self.on_collsTableView_selectionChanged)
for idx, col in enumerate(self.collaterals_table_model.columns()):
if col.name != 'txid':
self.collsTableView.resizeColumnToContents(idx)
self.updateUi()
self.display_title()
except:
logging.exception('Exception occurred')
raise
示例2: onTableHeadingClicked
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def onTableHeadingClicked(self, logical_index):
header = self.bluetoothTable.horizontalHeader()
order = Qt.DescendingOrder
# order = Qt.DescendingOrder
if not header.isSortIndicatorShown():
header.setSortIndicatorShown( True )
elif header.sortIndicatorSection()==logical_index:
# apparently, the sort order on the header is already switched
# when the section was clicked, so there is no need to reverse it
order = header.sortIndicatorOrder()
header.setSortIndicator( logical_index, order )
self.btTableSortOrder = order
self.btTableSortIndex = logical_index
self.bluetoothTable.sortItems(logical_index, order )
# ------------------ Agent Configuration ------------------------------
示例3: lessThan
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def lessThan(self, source_left, source_right):
if not source_left.isValid() or not source_right.isValid():
return False
# 获取数据
leftData = self.sourceModel().data(source_left)
rightData = self.sourceModel().data(source_right)
if self.sortOrder() == Qt.DescendingOrder:
# 按照时间倒序排序
leftData = leftData.split('-')[-1]
rightData = rightData.split('-')[-1]
return leftData < rightData
# elif self.sortOrder() == Qt.AscendingOrder:
# #按照名字升序排序
# leftData = leftData.split('-')[0]
# rightData = rightData.split('-')[0]
# return leftData < rightData
return super(SortFilterProxyModel, self).lessThan(source_left, source_right)
示例4: onTableHeadingClicked
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def onTableHeadingClicked(self, logical_index):
header = self.networkTable.horizontalHeader()
order = Qt.DescendingOrder
# order = Qt.DescendingOrder
if not header.isSortIndicatorShown():
header.setSortIndicatorShown( True )
elif header.sortIndicatorSection()==logical_index:
# apparently, the sort order on the header is already switched
# when the section was clicked, so there is no need to reverse it
order = header.sortIndicatorOrder()
header.setSortIndicator( logical_index, order )
self.networkTableSortOrder = order
self.networkTableSortIndex = logical_index
self.networkTable.sortItems(logical_index, order )
示例5: onTableHeadingClicked
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def onTableHeadingClicked(self, logical_index):
header = self.locationTable.horizontalHeader()
order = Qt.DescendingOrder
# order = Qt.DescendingOrder
if not header.isSortIndicatorShown():
header.setSortIndicatorShown( True )
elif header.sortIndicatorSection()==logical_index:
# apparently, the sort order on the header is already switched
# when the section was clicked, so there is no need to reverse it
order = header.sortIndicatorOrder()
header.setSortIndicator( logical_index, order )
self.locationTable.sortItems(logical_index, order )
示例6: sort
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def sort(self, col, order):
self.mylist = self.get_mylist()
"""sort table by given column number col"""
# print(">>> sort() col = ", col)
if col != 0:
self.layoutAboutToBeChanged.emit()
self.mylist = sorted(self.mylist, key=lambda x: x[col])
if order == Qt.DescendingOrder:
self.mylist = sorted(self.mylist, reverse=True, key=lambda x: x[col])
self.layoutChanged.emit()
示例7: sort
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def sort(self, col, order):
self.layoutAboutToBeChanged.emit()
self.my_data = sorted(self.my_data, key=operator.itemgetter(col + 1))
if order == Qt.DescendingOrder:
self.my_data.reverse()
self.layoutChanged.emit()
示例8: sortByTime
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def sortByTime(self):
# 按照时间倒序排序
self.fmodel.sort(0, Qt.DescendingOrder)
示例9: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def __init__(self, mainWin, agentIP, agentPort, parent = None):
super(RemoteFilesDialog, self).__init__(parent)
self.visibility.connect(self.onVisibilityChanged)
self.mainWin = mainWin
self.remoteAgentIP = agentIP
self.remoteAgentPort = agentPort
self.lblMsg = QLabel("Remote Files", self)
self.lblMsg.move(10, 20)
self.btnRefresh = QPushButton("&Refresh", self)
self.btnRefresh.setShortcut('Ctrl+R')
self.btnRefresh.clicked.connect(self.onRefreshFiles)
# self.btnRefresh.setStyleSheet("background-color: rgba(0,128,192,255); border: none;")
# self.btnRefresh.move(90, 30)
self.btnCopy = QPushButton("&Copy", self)
self.btnCopy.clicked.connect(self.onCopyFiles)
self.btnDelete = QPushButton("&Delete", self)
self.btnDelete.clicked.connect(self.onDeleteFiles)
self.fileTable = QTableWidget(self)
self.fileTable.setColumnCount(3)
self.fileTable.setShowGrid(True)
self.fileTable.setHorizontalHeaderLabels(['Filename','Size','Last Modified'])
#self.fileTable.setGeometry(10, 30, 100, 30)
self.fileTable.resizeColumnsToContents()
self.fileTable.setRowCount(0)
self.fileTable.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
self.fileTable.horizontalHeader().sectionClicked.connect(self.onTableHeadingClicked)
self.fileTableSortOrder = Qt.DescendingOrder
self.fileTableSortIndex = -1
self.ntRightClickMenu = QMenu(self)
newAct = QAction('Copy', self)
newAct.setStatusTip('Copy data to clipboard')
newAct.triggered.connect(self.onCopy)
self.ntRightClickMenu.addAction(newAct)
# Attach it to the table
self.fileTable.setContextMenuPolicy(Qt.CustomContextMenu)
self.fileTable.customContextMenuRequested.connect(self.showNTContextMenu)
self.setBlackoutColors()
self.setGeometry(self.geometry().x(), self.geometry().y(), 650,400)
self.setWindowTitle("Remote Files: " + self.remoteAgentIP + ':' + str(self.remoteAgentPort))
self.center()
self.onRefreshFiles()
示例10: addTableData
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DescendingOrder [as 别名]
def addTableData(self, curDevice):
if self.paused:
return
# rowPosition = self.locationTable.rowCount()
# Always insert at row(0)
rowPosition = 0
self.locationTable.insertRow(rowPosition)
#if (addedFirstRow):
# self.locationTable.setRowCount(1)
# ['macAddr','name', 'rssi','tx power','est range (m)', 'Timestamp','GPS', 'Latitude', 'Longitude', 'Altitude']
self.locationTable.setItem(rowPosition, 0, QTableWidgetItem(curDevice.macAddress))
self.locationTable.setItem(rowPosition, 1, QTableWidgetItem(curDevice.name))
self.locationTable.setItem(rowPosition, 2, IntTableWidgetItem(str(curDevice.rssi)))
if curDevice.txPowerValid:
self.locationTable.setItem(rowPosition, 3, IntTableWidgetItem(str(curDevice.txPower)))
else:
self.locationTable.setItem(rowPosition, 3, IntTableWidgetItem('Unknown'))
if curDevice.iBeaconRange != -1 and curDevice.txPowerValid:
self.locationTable.setItem(rowPosition, 4, IntTableWidgetItem(str(curDevice.iBeaconRange)))
else:
self.locationTable.setItem(rowPosition, 4, IntTableWidgetItem(str('Unknown')))
self.locationTable.setItem(rowPosition, 5, DateTableWidgetItem(curDevice.lastSeen.strftime("%m/%d/%Y %H:%M:%S")))
if curDevice.gps.isValid:
self.locationTable.setItem(rowPosition, 6, QTableWidgetItem('Yes'))
else:
self.locationTable.setItem(rowPosition, 6, QTableWidgetItem('No'))
self.locationTable.setItem(rowPosition, 7, FloatTableWidgetItem(str(curDevice.gps.latitude)))
self.locationTable.setItem(rowPosition, 8, FloatTableWidgetItem(str(curDevice.gps.longitude)))
self.locationTable.setItem(rowPosition, 9, FloatTableWidgetItem(str(curDevice.gps.altitude)))
#order = Qt.DescendingOrder
#self.locationTable.sortItems(3, order )
# If we're in streaming mode, write the data out to disk as well
if self.streamingFile:
self.streamingFile.write(self.locationTable.item(rowPosition, 0).text() + ',"' + self.locationTable.item(rowPosition, 1).text() + '",' + self.locationTable.item(rowPosition, 2).text() + ',' +
self.locationTable.item(rowPosition, 3).text() + ',' + self.locationTable.item(rowPosition, 4).text()+ ',' + self.locationTable.item(rowPosition, 5).text()+ ',' +
self.locationTable.item(rowPosition, 6).text()+ ',' + self.locationTable.item(rowPosition, 7).text() +
+ ',' + self.locationTable.item(rowPosition, 8).text()+ ',' + self.locationTable.item(rowPosition, 9).text() + '\n')
if (self.currentLine > self.linesBeforeFlush):
self.streamingFile.flush()
self.currentLine += 1
numRows = self.locationTable.rowCount()
if numRows > 1:
self.locationTable.scrollToItem(self.locationTable.item(0, 0))
# ------- Main Routine For Debugging-------------------------