コード例 #1
0
ファイル: utils.cpp プロジェクト: tehnick/qtcurve-qt4
 bool hasAlphaChannel(const QWidget *widget)
 {
     #ifdef Q_WS_X11
     if(compositingActive())
         return 32 == (widget ? widget->x11Info().depth() : QX11Info().appDepth()) ;
     else
         return false;
     #else
     return compositingActive();
     #endif
 }
コード例 #2
0
ファイル: aurorae.cpp プロジェクト: mleduque/kwin-tiling
void AuroraeClient::init()
{
    m_scene->setItemIndexMethod(QGraphicsScene::NoIndex);
    // HACK: we need to add the GraphicsView as a child widget to a normal widget
    // the GraphicsView eats the mouse release event and by that kwin core starts to move
    // the decoration each time the decoration is clicked
    // therefore we use two widgets and inject an own mouse release event to the parent widget
    // when the graphics view eats a mouse event
    createMainWidget();
    widget()->setAttribute(Qt::WA_TranslucentBackground);
    widget()->setAttribute(Qt::WA_NoSystemBackground);
    m_view = new QGraphicsView(m_scene, widget());
    m_view->setAttribute(Qt::WA_TranslucentBackground);
    m_view->setWindowFlags(Qt::X11BypassWindowManagerHint);
    m_view->setFrameShape(QFrame::NoFrame);
    m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_view->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    m_view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    QPalette pal = m_view->palette();
    pal.setColor(m_view->backgroundRole(), Qt::transparent);
    m_view->setPalette(pal);
    QPalette pal2 = widget()->palette();
    pal2.setColor(widget()->backgroundRole(), Qt::transparent);
    widget()->setPalette(pal2);
    m_scene->addItem(m_item);

    AuroraeFactory::instance()->theme()->setCompositingActive(compositingActive());
    connect(AuroraeFactory::instance()->theme(), SIGNAL(themeChanged()), SLOT(themeChanged()));
}
コード例 #3
0
ファイル: utils.cpp プロジェクト: Pulfer/qtcurve
bool hasAlphaChannel(const QWidget *widget)
{
#ifdef QTC_ENABLE_X11
    QWidget *window;
    if (!(widget && (window = widget->window())))
        return false;
    if (WId wid = qtcGetQWidgetWid(window)) {
        return qtcX11HasAlpha(wid);
    }
    return window->testAttribute(Qt::WA_TranslucentBackground);
#else
    Q_UNUSED(widget);
    return compositingActive();
#endif
}