Hi Bruno, QVBoxLayout as proposed elesewhere ?
But the trouble you (may) have is to make sure the columns of the table are aligned on those of the footer table. That may be tricky to achieve. stF On Wed, 24 May 2017 15:38:15 -0400 Bruno-Pierre Jobin <[email protected]> wrote: > Hi all, > > I want to create a footer on a TableWidget so I'm trying to stack a single > row QTableWidget (self.footer) on top of the original one (self.table). > Right now, I can see both table using the > setStackingMode(QStackedLayout.StackAll) but I'm unable to move the footer > at the bottom of self.table. Any suggestion for this? > > Also, I'm pretty sure there is a cleaner way to set flags to multiple table > at once. Maybe a for loop that acts on a type of widget? Or I could also > just make a list of those two tables a itterate through that list.. I'm > thinking as I type. > > Any suggestions are welcome! > Thank you > > > > from PySide.QtGui import * > from PySide.QtCore import * > > class TableWidget(QWidget): > def __init__(self): > super(TableWidget, self).__init__() > self.setMinimumSize(400, 300) > > self.table = QTableWidget() > self.table.setColumnCount(2) > self.table.setRowCount(5) > self.table.setSelectionMode(QTableView.ExtendedSelection) > self.table.setSelectionBehavior(QTableView.SelectRows) > self.table.setSortingEnabled(1) > self.table.setAlternatingRowColors(True) > self.table.horizontalHeader().setStretchLastSection(True) > self.table.verticalHeader().setVisible(False) > self.table.setColumnWidth(0, 180) > self.table.horizontalHeader().setVisible(False) > self.table.setEditTriggers(QAbstractItemView.NoEditTriggers) > > self.footer = QTableWidget() > self.footer.setRowCount(1) > self.footer.setColumnCount(2) > self.footer.setSelectionMode(QTableView.ExtendedSelection) > self.footer.setSelectionBehavior(QTableView.SelectRows) > self.footer.setSortingEnabled(1) > self.footer.setAlternatingRowColors(True) > self.footer.horizontalHeader().setStretchLastSection(True) > self.footer.verticalHeader().setVisible(False) > self.footer.setColumnWidth(0, 180) > self.footer.horizontalHeader().setVisible(False) > self.footer.setEditTriggers(QAbstractItemView.NoEditTriggers) > self.footer.setMaximumHeight(35) > self.footer.move(0,200) > > self.table_stack = QStackedLayout() > self.table_stack.addWidget(self.table) > self.table_stack.addWidget(self.footer) > self.table_stack.setStackingMode(QStackedLayout.StackAll) > > self.setLayout(self.table_stack) > a = TableWidget() > a.show() > > > > > > > > -- > Bruno-Pierre Jobin > www.bpjobin.com -- Timeo Danaos et dona ferentes Twitter : @Arakowa1 _______________________________________________ PySide mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/pyside
