Nope, my box must provide API for reading history of choices, user doesn't need to get it. I'll show, how it looks now (it's Python + PyQt though):
"""Extended combo box, that holds information about the history
of the user's choices."""
def __init__(self, parent = None):
self.__history = deque()
self.__current = 0
self.connect(self, SIGNAL('currentIndexChanged(int)'), self.signal)
def signal(self, index):
self.__history.appendleft(self.__current)
self.__current = index
self.emit(SIGNAL('changed'), index)
def getPrevious(self):
return self.__history[0]
def undo(self):
self.__current = self.__history.popleft()
self.setCurrentIndex(self.__current)
class QComboBoxExt(QComboBox):
"""Extended combo box, that holds information about the history
of the user's choices."""
def __init__(self, parent = None):
QComboBox.__init__(self, parent)
self.__history = deque()
self.__current = 0
self.connect(self, SIGNAL('currentIndexChanged(int)'), self.signal)
def signal(self, index):
self.__history.appendleft(self.__current)
self.__current = index
self.emit(SIGNAL('changed'), index)
def getPrevious(self):
return self.__history[0]
def undo(self):
self.__current = self.__history.popleft()
self.setCurrentIndex(self.__current)
To copy to clipboard, switch view to plain text mode
Bookmarks