#!/usr/bin/env python
import sys

import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui

class TableModel(QtCore.QAbstractTableModel):
    def __init__(self):
        QtCore.QAbstractTableModel.__init__(self)
        row = (0, 1, 2, 3, 4)
        self.dataset = []
        for r in range(0, 100):
            self.dataset.append(row)


    def rowCount(self, index):
        return 100


    def columnCount(self, index):
        return 5


    def data(self, index, role):
        if role == QtCore.Qt.DisplayRole:
            return QtCore.QVariant(self.dataset[index.row()][index.column()])
        else:
            return QtCore.QVariant()


class TableView(QtGui.QTableView):
    def __init__(self, parent=None):
        QtGui.QTableView.__init__(self, parent)
        
        self.vscrollbar = self.verticalScrollBar()
        second_vscrollbar = QtGui.QScrollBar(self.vscrollbar.parent())
        self.vscrollbar.parent().layout().addWidget(second_vscrollbar)
        self.connect(self.vscrollbar, QtCore.SIGNAL("actionTriggered(int)"), self.repeatAction)
        self.connect(second_vscrollbar, QtCore.SIGNAL("actionTriggered(int)"), self.chainAction)


    def repeatAction(self, action):
        print "Triggered action is %s" % action


    def chainAction(self, action):
        self.vscrollbar.triggerAction(action)


if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    model = TableModel()
    table = TableView()
    table.setModel(model)
    table.show()
    app.exec_()
