Borderless window:
setWindowFlags( Qt::FramelessWindowHint );
Set background color:
QPalette pal = mainWin->Getui().qvtkWidget->palette();
pal.setColor( QPalette::Background, Qt::black );
setAutoFillBackground( true );
this->setPalette( pal );
Make window stay on the top level:
setWindowFlags(Qt::WindowStaysOnTopHint)
Remove maximize button in widget:
setWindowFlags( this->windowFlags() & ~Qt::WindowMaximizeButtonHint );
Definite buttons on title bar:
setWindowFlags( Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint); //Only Maximize Button
We can set one widget as the child of another big widget if we want it has relatively position and size for the bigger one. void QObject::setParent(QObject *parent)
Message box:
QMessageBox msg;
msg.setIcon(QMessageBox::Warning);
msg.addButton(msg_confirm, QMessageBox::AcceptRole);
msg.addButton(msg_cancel, QMessageBox::RejectRole);
msg.setWindowTitle( QString("Title") );
msg.setWindowIcon( QIcon("qrc:/") );
msg.setText(msg_info);
msg.exec();
Make MessageBox have no close button:
QMessageBox mbox;
mbox.setWindowFlags( Qt::CustomizeWindowHint | Qt::WindowTitleHint );