I'm trying to create/add a dialog to my application - To explain why the name of the dialog - it's to allow configuration/settings to be maintained such as themes/styles, and such so it's called SettingsDialog. For whatever reason, I'm getting no errors in the header file but I get errors in the cpp file - at first it was yelling at me that the constructor looked like a constructor but was not one or something like that - I seemed to fix that just by applying bodies to every other method (even though I've never got that error before). Now when I'm trying to create a QSplitter, it's telling me 'this' is not a QWidget when it refers to this class, a QDialog which according to the QT documentation is inherited from QWidget. I feel like there's a typo somewhere I'm missing maybe. Please I hope someone can see the blockage and help me resolve it.
Before anyone complains about it being not as simple as they'd like it - I include only the bare minimum methods and items - Every widget I create has an initPanel/Window/Dialog method and an initControls method that is called from the other init method after other configurations. As you can see, in the constructor, I call initDialog. I put my classes in a namespace - sure it may be a lot of white space but if by removing the namespace section it fixes it - that doesn't fix it for me - The namespaces are essential so I need a solution that keeps them in the code which is why I have not removed them. Otherwise, I can't strip anything else out. More will end up going in there eventually when I get this part to stop erroring in build, so cutting out the init methods even though they're not being called now won't help anything one bit.
SettingsDialog.h:
#pragma once #include <QDialog> #include <QSplitter> namespace net { namespace draconia { namespace mediadb { namespace ui { class SettingsDialog : public QDialog { Q_OBJECT QSplitter *mPnlSplitter; protected: QSplitter *getSplitter() const; void initControls(); void initDialog(); public: SettingsDialog(QWidget *parent = nullptr); }; } } } } SettingsDialog.cpp:
#include "SettingsDialog.h" using namespace net::draconia::mediadb::ui; QSplitter *SettingsDialog::getSplitter() const { if(mPnlSplitter == nullptr) { mPnlSplitter = new QSplitter(Qt::Orientation::Horizontal, this); // Error - no matching constructors evidently } } void SettingsDialog::initControls() { } void SettingsDialog::initDialog() { } SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent) , mPnlSplitter(nullptr) { initDialog(); }