سؤال

I'm using tablemodel with vertical scrollbar and want to keep the scrollbar always enabled no matter what status the table is.

Perhaps its possible to disable all flags for table or docking the scrollbar on the right side of the table.

هل كانت مفيدة؟

المحلول

If you're using QAbstractTableModel, you can reimpliment the flags() member function to return a read-only flag.

Have a look at the Qt::ItemFlags to see which ones you need and then leave off what you don't. At the very least, you should not be returning Qt::ItemIsEditable

نصائح أخرى

We had this issue with QScrollArea and solved it manually (eventually subclass and reimplement setEnabled).

area->setDisabled(false);
foreach(QWidget *w, area->findchildren<QWidget*>())
{
    w->setDisabled(true);
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top