here is what i tend to design:
when the tablewidget changes(say its rowcount),
the label will show the rowcount.But when i tried it, Qtcreator says:
Object::connect: No such signal QTableWidget::rowCountChanged(int,int) in ..\ui\mainwindow.cpp:55
why? rowCountChanged(int, int) is one slot inherited from QTableView, i think...
Thanks
As merlin said, Thats a protected slot.
But you can ask for the underlying model:
(Since widget inherits from tableView which inherits from AbstractView)
QAbstractItemModel * QAbstractItemView::model () const
And connect to model signals:
void QAbstractItemModel::rowsInserted ( const QModelIndex & parent, int start, int end ) [signal]
void QAbstractItemModel::rowsRemoved ( const QModelIndex & parent, int start, int end ) [signal]
Here You got all model signals
In fact, there is another way i would explore:
Subclassing QTableWidget, (public) you will have access to that protected slot.
So, creating your own signal:
void YourTableWidget::rowCountChanged(int,int)
{
QTableWidget::rowCountChanged(int,int);
emit your_signal(...);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With