Exemplo n.º 1
0
void RazorTaskBar::realign()
{
    mLayout->setEnabled(false);
    IRazorPanel *panel = mPlugin->panel();

    QSize maxSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
    QSize minSize = QSize(0, 0);

    maxSize.setHeight(panel->lineSize());
    minSize.setHeight(maxSize.height());

    if (panel->isHorizontal())
    {
        mLayout->setRowCount(panel->lineCount());
        mLayout->setColumnCount(0);

        minSize.rheight() = panel->lineSize();
        maxSize.rheight() = panel->lineSize();

        if (mButtonStyle == Qt::ToolButtonIconOnly)
        {
            mLayout->setStretch(RazorGridLayout::StretchVert);
            minSize.rwidth() = maxSize.height();
            maxSize.rwidth() = maxSize.height();
        }
        else
        {
            mLayout->setStretch(RazorGridLayout::StretchHoriz | RazorGridLayout::StretchVert);
            maxSize.rwidth() = mButtonWidth;
        }
    }
    else
    {
        mLayout->setRowCount(0);
        mLayout->setStretch(RazorGridLayout::NoStretch);

        minSize.rheight() = panel->lineSize();
        maxSize.rheight() = panel->lineSize();

        if (mButtonStyle == Qt::ToolButtonIconOnly)
        {
            mLayout->setColumnCount(panel->lineCount());
            maxSize.rwidth() = maxSize.height();
        }
        else
        {
            mLayout->setColumnCount(1);
            maxSize.rwidth() = mButtonWidth;
        }
        minSize.rwidth() = maxSize.width();
    }

    mLayout->setCellMinimumSize(minSize);
    mLayout->setCellMaximumSize(maxSize);

    mLayout->setEnabled(true);
}
Exemplo n.º 2
0
void RazorTray::realign()
{
    mLayout->setEnabled(false);
    IRazorPanel *panel = mPlugin->panel();

    mLayout->setCellMinimumSize(QSize(panel->lineSize(), panel->lineSize()));

    if (panel->isHorizontal())
    {
        mLayout->setRowCount(panel->lineCount());
        mLayout->setColumnCount(0);
    }
    else
    {
        mLayout->setColumnCount(panel->lineCount());
        mLayout->setRowCount(0);
    }
    mLayout->setEnabled(true);
}