Hi,
I'm porting my qt4 application to qt5. While it compiled successfully in qt 5.1 (if I'm not wrong), with version 5.2 I got the following compile error:

no match for ‘operator=’ (operand types are ‘QWeakPointer<MainWindow>’ and ‘MainWindow*’)
The error is triggered at this line:

Qt Code:
  1. m_mainWindow = new MainWindow();
To copy to clipboard, switch view to plain text mode 

where m_mainWindow is:

Qt Code:
  1. QWeakPointer<MainWindow> m_mainWindow;
To copy to clipboard, switch view to plain text mode 

and this is MainWindow:

mainwindow.h

Qt Code:
  1. //...
  2. namespace Ui {
  3. class MainWindow;
  4. }
  5.  
  6. class MainWindow;
  7.  
  8. namespace The {
  9. MainWindow* mainWindow();
  10. }
  11.  
  12. class MainWindow : public QMainWindow
  13. {
  14. Q_OBJECT
  15. friend MainWindow* The::mainWindow();
  16.  
  17. public:
  18. explicit MainWindow(QWidget *parent = 0);
  19. virtual ~MainWindow();
  20. //...
  21. };
To copy to clipboard, switch view to plain text mode 

mainwindow.cpp

Qt Code:
  1. QWeakPointer<MainWindow> MainWindow::s_instance;
  2.  
  3. namespace The {
  4. MainWindow* mainWindow() { return MainWindow::s_instance.data(); }
  5. }
  6.  
  7. MainWindow::MainWindow(QWidget *parent) :
  8. QMainWindow(parent),
  9. ui_(new Ui::MainWindow)
  10. {
  11. //...
  12. }
To copy to clipboard, switch view to plain text mode 

Anything changed in Qt 5.2 regarding QWeakPointer?

Regards