Borderless window:
C++
setWindowFlags( Qt::FramelessWindowHint );
Set background color:
C++
QPalette pal = mainWin->Getui().qvtkWidget->palette();
pal.setColor( QPalette::Background, Qt::black );
setAutoFillBackground( true );
this->setPalette( pal );
Make window stay on the top level:
C++
setWindowFlags(Qt::WindowStaysOnTopHint)
Remove maximize button in widget:
C++
setWindowFlags( this->windowFlags() & ~Qt::WindowMaximizeButtonHint );
Definite buttons on title bar:
C++
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:
C++
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:
C++
QMessageBox mbox;
mbox.setWindowFlags( Qt::CustomizeWindowHint | Qt::WindowTitleHint );

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You cannot copy content of this page