Exemplo n.º 1
0
// Consider making this a QStyle state
bool panelWidget(const QWidget *widget)
{
    if (!widget)
        return false;

    // Do not style dialogs or explicitly ignored widgets
    if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
        return false;

    if (qobject_cast<const Utils::FancyMainWindow *>(widget))
        return true;

    if (qobject_cast<const QTabBar *>(widget))
        return styleEnabled(widget);

    const QWidget *p = widget;
    while (p) {
        if (qobject_cast<const QToolBar *>(p) ||
            qobject_cast<const QStatusBar *>(p) ||
            qobject_cast<const QMenuBar *>(p) ||
            p->property("panelwidget").toBool())
            return styleEnabled(widget);
        p = p->parentWidget();
    }
    return false;
}
Exemplo n.º 2
0
// Consider making this a QStyle state
bool panelWidget(const QWidget *widget) {
    const QWidget *p = widget;

    while (p) {
        if (qobject_cast<const QToolBar *>(p) && styleEnabled(p))
            return true;
        else if (qobject_cast<const QStatusBar *>(p) && styleEnabled(p))
            return true;
        else if (qobject_cast<const QMenuBar *>(p) && styleEnabled(p))
            return true;
        p = p->parentWidget();
    }
    return false;
}