Qt 彈窗置頂國定尺寸大小等樣式設定

double64發表於2024-11-30
void MyWidgets::setWindowTopFixStyle(QString title, QWidget * widget)
{
    widget->setWindowTitle(title);
    widget->setWindowFlags(windowFlags() & ~Qt::WindowMinimizeButtonHint
        & ~Qt::WindowMaximizeButtonHint | Qt::WindowStaysOnTopHint);
    widget->setFixedSize(widget->size());
    widget->setAttribute(Qt::WA_QuitOnClose, false);
    widget->setAutoFillBackground(true);
    widget->setAttribute(Qt::WA_StyledBackground, true);
}

相關文章