2019년 7월 18일 목요일

QT4 Messagebox

https://pythonspot.com/qt4-messagebox/

Qlist selection mode

enum QAbstractItemView::SelectionMode

This enum indicates how the view responds to user selections:
ConstantValueDescription
QAbstractItemView::SingleSelection1When the user selects an item, any already-selected item becomes unselected, and the user cannot unselect the selected item by clicking on it.
QAbstractItemView::ContiguousSelection4When the user selects an item in the usual way, the selection is cleared and the new item selected. However, if the user presses the Shift key while clicking on an item, all items between the current item and the clicked item are selected or unselected, depending on the state of the clicked item.
QAbstractItemView::ExtendedSelection3When the user selects an item in the usual way, the selection is cleared and the new item selected. However, if the user presses the Ctrl key when clicking on an item, the clicked item gets toggled and all other items are left untouched. If the user presses the Shift key while clicking on an item, all items between the current item and the clicked item are selected or unselected, depending on the state of the clicked item. Multiple items can be selected by dragging the mouse over them.
QAbstractItemView::MultiSelection2When the user selects an item in the usual way, the selection status of that item is toggled and the other items are left alone. Multiple items can be toggled by dragging the mouse over them.
QAbstractItemView::NoSelection0Items cannot be selected.
The most commonly used modes are SingleSelection and ExtendedSelection.

2019년 7월 14일 일요일

Remove selected item from the list

def removeSel(self):
    listItems=self.listA.selectedItems()
    if not listItems: return        
    for item in listItems:
       self.listA.takeItem(self.listA.row(item))

2019년 7월 9일 화요일

PyQt UI로 디렉토리, 파일 경로 얻기

QtGui.QFileDialog.getExistingDirectory(self, 'Open Folder', 'c:/')

QtGui.QFileDialog.getOpenFileName(self, 'Open File', 'c:/')