I have a mainWindow and a widget that will be a child of that main window. Below is a code example created with QTCreator.
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
//create test widget
blue_widget->setFixedSize(100,100);
blue_widget->setStyleSheet("background-color:blue;");
blue_widget->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool );
blue_widget->setVisible(true);
//create test widget END
blue_widget->setParent(this);
blue_widget->move(-50,-10);
show();
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//create test widget
QWidget* blue_widget = new QWidget(); //no parent
blue_widget->setFixedSize(100,100);
blue_widget->setStyleSheet("background-color:blue;");
blue_widget->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool );
blue_widget->setVisible(true);
//create test widget END
blue_widget->setParent(this);
blue_widget->move(-50,-10);
show();
}
MainWindow::~MainWindow()
{
delete ui;
}
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.
Bookmarks