I am trying to extend the Qt example FlowLayout to include the insertWidgetAt(int position, QWidget* w) method.

I wrote (borrowed the code from QBoxLayout):

Qt Code:
  1. //public:
  2. void FlowLayout::insertWidgetAt(int pos,QWidget *w){
  3. addChildWidget(w);
  4. insertItem(pos,QLayoutPrivate::createWidgetItem(this, w)); //***
  5. invalidate();
  6. }
  7.  
  8. //private:
  9. void FlowLayout::insertItem(int pos,QLayoutItem *item){
  10. itemList.insert(pos,item);
  11. }
To copy to clipboard, switch view to plain text mode 

At the line marked with //***, gcc gives "incomplete type `QLayoutPrivate' used in nested name specifier" error. What should I do to implement the method?