'Create a new page based on the contents of an index
(:class:`QModeIndex`) item.'

def createPage(self, index):

    page = MenuPage(self)
    page.setModel(index.model())
    page.setRootIndex(index)
    view = page.view()
    if (sys.platform == 'darwin'):
        view.verticalScrollBar().setAttribute(Qt.WA_MacMiniSize, True)
        view.setAttribute(Qt.WA_MacShowFocusRect, False)
    name = str(index.data(Qt.DisplayRole))
    page.setTitle(name)
    icon = index.data(Qt.DecorationRole)
    if isinstance(icon, QIcon):
        page.setIcon(icon)
    page.setToolTip(index.data(Qt.ToolTipRole))
    return page
