In this stage of learning the SC Library (Qt and C++ ) it would have been enough for me to create an empty window which is dockable into the SCIDE with no other functionality.
But I already have some problems
A potential QcDocklet
class should work exactly like a Window
in the sense that it should contain a View in which any object could be created into.
So my first attempt was to copy the QcWindow constructor at once adapting the code accordingly.
The result is then:
#pragma once
#include "BasicWidgets.h"
#include <QDockWidget>
class QcDocklet : public QcCustomPainted {
Q_OBJECT
public :
QcDocklet(QWidget* parent = nullptr);
Q_INVOKABLE QcDocklet(const QRectF& geom);
};
the plan wuld be to instantiate the Docklet
only by setting its Geometry, hence the geom
parameter in the Q_INVOKABLE
constructor.
The QcDocklet
should be of course a child of QDockWidget
so I modified my code adding:
#include <QDockWidget>
class QcDocklet : public QcCustomPainted, public QDockWidget {
Q_OBJECT
...
at this point I could implement the constructor in the source file.
It seemed to me that every widget has or needs a factory function in order to be created as proxy (right…?): a Button has the following statement:
QC_DECLARE_QWIDGET_FACTORY(QcButton);
but QcWindow
has its own factory function and since QcDocklet
should share the basic functionality of a window I considered copying the same function into the QcDocklet
source as well.
So now the big question: hoe do I return a QDockWidget
instead of a Window
?
Some of you might say: “well learn Qt” since everything I have done until now has been copying code from another source. But I’m really struggling in understanding the Class tree…I don’t know why Widgets needs a Factory Function, why they should be returned as proxy and why a window is actually a Window
(I mean is it declared somewhere?
I took a look into the docklet.cpp
(from scide) and its children, but I get really confused.
So for example the class Docklet
has a private
member QDockWidget* mDockWidget;
which is instantiated in the class constructor.
Does this returns an actual Docklet?
I hope that you are interested in this project and that you are willing to help me.
Thank you for your help!