Hi,

I'm getting messages from the compiler to compile warnings. I am developing an application in MDI and I have several that use the function createWidget to put the widget in MDIArea.

Follow code example:

MainWindow.cpp
Qt Code:
  1. void MainWindow::showPed()
  2. {
  3. m_Ped = new Ped(this);
  4. createWidget(m_Ped);
  5. }
  6.  
  7. template<class T> T *MainWindow::createWidget(T *widget)
  8. {
  9. child = new QMdiSubWindow(this);
  10. child->setWidget(widget);
  11. child->setAttribute(Qt::WA_DeleteOnClose);
  12. mdiArea->addSubWindow(child);
  13.  
  14. QSize minSize = qobject_cast<T *>(widget)->minimumSize();
  15. QSize maxSize = qobject_cast<T *>(widget)->maximumSize();
  16.  
  17. if (minSize == maxSize)
  18. {
  19. child->setWindowFlags(child->windowFlags() & ~Qt::WindowMaximizeButtonHint);
  20. }
  21.  
  22. child->move(0,0);
  23. child->show();
  24. }
To copy to clipboard, switch view to plain text mode 


Output compiler (GNU/Linux - Fedora 10):
MainWindow.cpp: In member function ‘T* MainWindow::createWidget(T*) [with T = Ped]’:
MainWindow.cpp:721: warning: control reaches end of non-void function

I wonder how I can resolve this, is the way I am doing is correct and I will not have future problems and suggestions for how to improve this code for reuse for other windows.

Thanks,

Marcelo E. Geyer