void LxQtTray::realign() { mLayout->setEnabled(false); ILxQtPanel *panel = mPlugin->panel(); if (panel->isHorizontal()) { mLayout->setRowCount(panel->lineCount()); mLayout->setColumnCount(0); } else { mLayout->setColumnCount(panel->lineCount()); mLayout->setRowCount(0); } mLayout->setEnabled(true); }
void LxQtTaskBar::realign() { mLayout->setEnabled(false); refreshButtonRotation(); ILxQtPanel *panel = mPlugin->panel(); QSize maxSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); QSize minSize = QSize(0, 0); bool rotated = false; if (panel->isHorizontal()) { if (mButtonStyle == Qt::ToolButtonIconOnly) { // Horizontal + Icons ************** mLayout->setRowCount(panel->lineCount()); mLayout->setColumnCount(0); mLayout->setStretch(LxQt::GridLayout::StretchVertical); minSize.rheight() = 0; minSize.rwidth() = 0; maxSize.rheight() = QWIDGETSIZE_MAX; maxSize.rwidth() = mButtonWidth; } else { // Horizontal + Text *************** mLayout->setRowCount(panel->lineCount()); mLayout->setColumnCount(0); mLayout->setStretch(LxQt::GridLayout::StretchHorizontal | LxQt::GridLayout::StretchVertical); minSize.rheight() = 0; minSize.rwidth() = 0; maxSize.rheight() = QWIDGETSIZE_MAX; maxSize.rwidth() = mButtonWidth; } } else { if (mButtonStyle == Qt::ToolButtonIconOnly) { // Vertical + Icons **************** mLayout->setRowCount(0); mLayout->setColumnCount(panel->lineCount()); mLayout->setStretch(LxQt::GridLayout::StretchHorizontal); minSize.rheight() = 0; minSize.rwidth() = 0; maxSize.rheight() = QWIDGETSIZE_MAX; maxSize.rwidth() = QWIDGETSIZE_MAX; } else { if (mAutoRotate) { switch (panel->position()) { case ILxQtPanel::PositionLeft: case ILxQtPanel::PositionRight: rotated = true; break; default:; } } // Vertical + Text ***************** if (rotated) { mLayout->setColumnCount(panel->lineCount()); mLayout->setRowCount(0); mLayout->setStretch(LxQt::GridLayout::StretchHorizontal | LxQt::GridLayout::StretchVertical); minSize.rheight() = 0; minSize.rwidth() = 0; maxSize.rheight() = mButtonWidth; maxSize.rwidth() = QWIDGETSIZE_MAX; } else { mLayout->setColumnCount(1); mLayout->setRowCount(0); mLayout->setStretch(LxQt::GridLayout::StretchHorizontal); minSize.rheight() = 0; minSize.rwidth() = mButtonWidth; maxSize.rheight() = QWIDGETSIZE_MAX; maxSize.rwidth() = QWIDGETSIZE_MAX; } } } mLayout->setCellMinimumSize(minSize); mLayout->setCellMaximumSize(maxSize); mLayout->setDirection(rotated ? LxQt::GridLayout::TopToBottom : LxQt::GridLayout::LeftToRight); mLayout->setEnabled(true); refreshIconGeometry(); }