Frage

I'm new to Qt, tried several widgets and found that QDockWidget is the most modern/interactive one to work with

But I've found a little limitation "about where to dock the widget only in the 4 sides, left/right/top/bottom"

I want to do one of the two following things and any one should work.

  1. Add more areas to dock widget "for example it can recognize separators between widgets and get its data from there , then resize itself depending on that"
  2. Reimplement the whole functions of QDockWidget into QWidget and do it like option 1

Thanks in advance

War es hilfreich?

Lösung

In Qt you can pretty much inherit any class into a new class of your own and extend it yourself. for example:

// New class that inherits QDockWidget and extends its functionality
ExtendedQDockWidget : public QDockWidget
{
public:
    ExtendedQDockWidget(QWidget * parent = 0) : 
        QDockWidget(parent)
    {
        // ... do any extra initialisations here
    }

    ExtendedFunc(/* some params */)
    {
        // code here
    }
}

You can also re-implement or overload existing functions to do exactly what you want.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top