[Qt-interest] QDialog with rounded "corners"

Philipp Tkachev zoonman at gmail.com
Fri Feb 11 07:16:41 CET 2011


Hello!

You need code like that:

QPalette palette;
palette.setColor(QPalette::Base, Qt::transparent);
yourWidget.setPalette(palette);
yourWidget.setAttribute(Qt::WA_TranslucentBackground);

I used it with QML:

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
        QDeclarativeView view;
        // enable semi-transparent
        QPalette palette;
        palette.setColor(QPalette::Base, Qt::transparent);
        view.setPalette(palette);
        view.setAttribute(Qt::WA_TranslucentBackground);

        // loading QML from file
        view.setSource(QUrl::fromLocalFile("../qml1/qml1.qml"));

        // disable OS GIU form-control
        view.setWindowFlags(Qt::FramelessWindowHint);

        view.show();

    return a.exec();
}

-- 
Sincerely, Philipp Tkachev.



More information about the Qt-interest-old mailing list