Skip to content
Permalink
Browse files

[processing] use another icon for clear button and add confirmation

  • Loading branch information
alexbruy authored and nyalldawson committed May 7, 2018
1 parent 3ec2dfa commit bb0feccec4a5587d8e1f208ee42e7a19bb5606f2
@@ -30,6 +30,7 @@
from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem
from qgis.PyQt.QtWidgets import QMessageBox

from qgis.core import QgsApplication

@@ -46,7 +47,7 @@ def __init__(self, parent=None):

self.btnAdd.setIcon(QgsApplication.getThemeIcon('/symbologyAdd.svg'))
self.btnRemove.setIcon(QgsApplication.getThemeIcon('/symbologyRemove.svg'))
self.btnClear.setIcon(QgsApplication.getThemeIcon('/mIconClearText.svg'))
self.btnClear.setIcon(QgsApplication.getThemeIcon('console/iconClearConsole.svg'))

self.btnAdd.clicked.connect(self.addItem)
self.btnRemove.clicked.connect(lambda: self.removeItems())
@@ -87,7 +88,9 @@ def addItem(self):

def removeItems(self, removeAll=False):
if removeAll:
self.lstItems.model().clear()
res = QMessageBox.question(self, self.tr('Clear?'), self.tr('Are you sure you want to delete all items?'))
if res == QMessageBox.Yes:
self.lstItems.model().clear()
else:
self.lstItems.setUpdatesEnabled(False)
indexes = sorted(self.lstItems.selectionModel().selectedIndexes())
@@ -30,7 +30,7 @@
from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem
from qgis.PyQt.QtWidgets import QInputDialog
from qgis.PyQt.QtWidgets import QInputDialog, QMessageBox

from qgis.core import QgsApplication

@@ -49,7 +49,7 @@ def __init__(self, parent=None):
self.btnRemoveColumn.setIcon(QgsApplication.getThemeIcon('/mActionDeleteAttribute.svg'))
self.btnAddRow.setIcon(QgsApplication.getThemeIcon('/symbologyAdd.svg'))
self.btnRemoveRow.setIcon(QgsApplication.getThemeIcon('/symbologyRemove.svg'))
self.btnClear.setIcon(QgsApplication.getThemeIcon('/mIconClearText.svg'))
self.btnClear.setIcon(QgsApplication.getThemeIcon('console/iconClearConsole.svg'))

self.btnAddColumn.clicked.connect(self.addColumn)
self.btnRemoveColumn.clicked.connect(self.removeColumns)
@@ -86,7 +86,9 @@ def removeRows(self):
self.tblView.setUpdatesEnabled(True)

def clearTable(self, removeAll=False):
self.tblView.model().clear()
res = QMessageBox.question(self, self.tr('Clear?'), self.tr('Are you sure you want to clear table?'))
if res == QMessageBox.Yes:
self.tblView.model().clear()

def changeHeader(self, index):
txt, ok = QInputDialog.getText(self, self.tr("Enter column name"), self.tr("Column name"))

0 comments on commit bb0fecc

Please sign in to comment.
You can’t perform that action at this time.