I have a mainWindow and a widget that will be a child of that main window. Below is a code example created with QTCreator.

Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4. MainWindow::MainWindow(QWidget *parent) :
  5. QMainWindow(parent),
  6. ui(new Ui::MainWindow)
  7. {
  8. ui->setupUi(this);
  9.  
  10. //create test widget
  11. QWidget* blue_widget = new QWidget(); //no parent
  12. blue_widget->setFixedSize(100,100);
  13. blue_widget->setStyleSheet("background-color:blue;");
  14. blue_widget->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool );
  15. blue_widget->setVisible(true);
  16. //create test widget END
  17.  
  18. blue_widget->setParent(this);
  19. blue_widget->move(-50,-10);
  20.  
  21. show();
  22. }
  23.  
  24. MainWindow::~MainWindow()
  25. {
  26. delete ui;
  27. }
To copy to clipboard, switch view to plain text mode 

Right now I can only see the part of the blue_widget that is inside the boundaries of the main window. I would like to be able to have the totality of the blue_widget shown. How can I prevent the main window cutting the blue_widget like that ? I really need to have the blue_widget to be a child of the main window.

Thanks for the help.