Skip to content
This repository has been archived by the owner on Dec 17, 2017. It is now read-only.

Commit

Permalink
Create a rows on panel only if it's necessary (exists some plugin on …
Browse files Browse the repository at this point in the history
…this row).
  • Loading branch information
SokoloffA committed Dec 23, 2012
1 parent e28d5d3 commit d39fc6e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions razorqt-panel/panel/razorpanellayout.cpp
Expand Up @@ -131,6 +131,8 @@ class LayoutItemGrid
int colCount() const { return mColCount; }
void setColCount(int value);

int usedColCount() const { return mUsedColCount; }

int rowCount() const { return mRowCount; }

void invalidate() { mValid = false; }
Expand All @@ -152,6 +154,7 @@ class LayoutItemGrid
private:
QVector<LayoutItemInfo> mInfoItems;
int mColCount;
int mUsedColCount;
int mRowCount;
bool mValid;
int mExpandableSize;
Expand Down Expand Up @@ -189,6 +192,7 @@ void LayoutItemGrid::clear()
mValid = false;
mExpandable = false;
mExpandableSize = 0;
mUsedColCount = 0;
}


Expand Down Expand Up @@ -235,6 +239,7 @@ void LayoutItemGrid::doAddToGrid(QLayoutItem *item)

int idx = mNextRow * mColCount + mNextCol;
mInfoItems[idx] = info;
mUsedColCount = qMax(mUsedColCount, mNextCol + 1);
mExpandable = mExpandable || info.expandable;
mRowCount = qMax(mRowCount, mNextRow+1);

Expand Down Expand Up @@ -616,7 +621,7 @@ void RazorPanelLayout::setGeometryHoriz(const QRect &geometry)
}

// Calc baselines for button like plugins.
QVector<int> baseLines(lineCount());
QVector<int> baseLines(qMax(mLeftGrid->usedColCount(), mRightGrid->usedColCount()));
{
int bh = (geometry.height() / baseLines.count()) / 2;
for (int i=0; i<baseLines.count(); ++i)
Expand All @@ -628,7 +633,7 @@ void RazorPanelLayout::setGeometryHoriz(const QRect &geometry)
for (int r=0; r<mLeftGrid->rowCount(); ++r)
{
int rw = 0;
for (int c=0; c<mLeftGrid->colCount(); ++c)
for (int c=0; c<mLeftGrid->usedColCount(); ++c)
{
const LayoutItemInfo &info = mLeftGrid->itemInfo(r, c);
if (info.item)
Expand Down Expand Up @@ -664,7 +669,7 @@ void RazorPanelLayout::setGeometryHoriz(const QRect &geometry)
for (int r=mRightGrid->rowCount()-1; r>=0; --r)
{
int rw = 0;
for (int c=0; c<mRightGrid->colCount(); ++c)
for (int c=0; c<mRightGrid->usedColCount(); ++c)
{
const LayoutItemInfo &info = mRightGrid->itemInfo(r, c);
if (info.item)
Expand Down Expand Up @@ -713,7 +718,7 @@ void RazorPanelLayout::setGeometryVert(const QRect &geometry)
}

// Calc baselines for button like plugins.
QVector<int> baseLines(lineCount());
QVector<int> baseLines(qMax(mLeftGrid->usedColCount(), mRightGrid->usedColCount()));
{
int bw = (geometry.width() / baseLines.count()) / 2;
for (int i=0; i<baseLines.count(); ++i)
Expand All @@ -726,7 +731,7 @@ void RazorPanelLayout::setGeometryVert(const QRect &geometry)
for (int r=0; r<mLeftGrid->rowCount(); ++r)
{
int rh = 0;
for (int c=0; c<mLeftGrid->colCount(); ++c)
for (int c=0; c<mLeftGrid->usedColCount(); ++c)
{
const LayoutItemInfo &info = mLeftGrid->itemInfo(r, c);
if (info.item)
Expand Down Expand Up @@ -763,7 +768,7 @@ void RazorPanelLayout::setGeometryVert(const QRect &geometry)
for (int r=mRightGrid->rowCount()-1; r>=0; --r)
{
int rh = 0;
for (int c=0; c<mRightGrid->colCount(); ++c)
for (int c=0; c<mRightGrid->usedColCount(); ++c)
{
const LayoutItemInfo &info = mRightGrid->itemInfo(r, c);
if (info.item)
Expand Down

0 comments on commit d39fc6e

Please sign in to comment.