Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to move the definitions from mainwindow.cpp to mainwindow.h?
-
I want to define the
class MainWindow
as a template class, but I cannot move the definitions of its functions tomainwindow.h
because of the forward declaration ofnamespace Ui { class MainWindow; }
. How to achieve such a thing? Appreciate any help or suggestions
-
Find a different approach. QObject classes cannot be templated, so it won't work even if you solve
namespace Ui
problem.
-
@sierdzio said in How to move the definitions from mainwindow.cpp to mainwindow.h?:
QObject classes cannot be templated
Could you say a few more words about this, please?
-
@JonB the problem is the Meta-Object-Compiler it can't create the magic code to make signal&slots and macros work
you could use Verdigris if you really, really need templated QObject classes