Qt 基础360UI学习

1、setWindowFlags(Qt::FramelessWindowHint);  去掉操作系统提供的窗口边框

2、setAttribute(Qt::WA_TranslucentBackground);

Indicates that the widget should have a translucentbackground, i.e. ,any nonopaque regions of the widgets will be translucent because the widget will have an alpha     channel. Setting this flag causes WA_NoSystemBackground to be set. On Windows the widget also needs the Qt::FramelessWindowHint window flag to be set. This flag is     set or cleared by the widget's author.

3、m_vecBtn[i]->setAutoExclusive(true);

其中m_vecBtn 为Vector<QPushButton。
If auto-exclusivity is enabled, checkable buttons that belong to the same parent widget behave as if they were part of the same exclusive buttongroup. In an exclusive  buttongroup, only one button canbe checked at anytime; checking another button automatically unchecks the previously checked one.

3、label_checkUpdate->setOpenExternalLinks(true);

4、背景半透明

void MainWindow::paintEvent(QPaintEvent *)
{
//    QPainter painter(this);
//    painter.drawPixmap(m_pixmapBg.rect(), m_pixmapBg);
    QPainter painter(this);
    QLinearGradient grad(0, 0, rect().width(), rect().height());
    {
            QGradientStops gs;
            gs << QGradientStop(0.0, QColor(0,0,0,100))
                    << QGradientStop(0.5, QColor(0,0,0,100))
                    << QGradientStop(1.0, QColor(0,0,0,100));
            grad.setStops(gs);
    }
    painter.fillRect(0, 0, rect().width(), rect().height(), grad);
}
原文地址:https://www.cnblogs.com/wiessharling/p/3021726.html