Is there a way that I can subclass a QTab and just reuse that class
for each tab
Yes you can subclass QTabWidget. Nothing prevent you for doing that. But if it is only to setup the UI, I usually do
QLayout* setupViewLayout()
{
//add bunch of stuff to layout
}
QTabWidget * tabwidget = new QTabWidget ;
QLayout* tablayout = setupViewLayout();
QWidget* widget = new QWidget;
widget->setLayout(tablayout );
tabwidget->addTab(widget);
And I dont need to create one class for each kind of view I want.
Is there anyway I can do a similar sort of thing with QML for each
subclass?
Yes, you have qt quick designer for QML and Qt designer for creating ui files which will compile as c/c++. You can create graphically some template UI which provide an initial setup and then add specific customization in the codeIt can be handful if only few sub-widgets change between different tabs. I did something similar with a UI which was tab- based too.