Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Config "salvation" :-) #18

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SplitterContainer: get/set pane sizes as fractions of 10k
  • Loading branch information
scunz committed Oct 17, 2013
commit b0279f841298f4ab969f7af1427969577fc1cc53
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,28 @@ namespace Heaven
return mSplitter->orientation() == Qt::Vertical;
}

QList<int> SplitterContainerWidget::transformedSizes()
{
QList<int> sizes = mSplitter->sizes();
int w = width();

for (int i = 0; i < sizes.count(); i++) {
sizes[i] = sizes[i] * 10000 / w;
}

return sizes;
}

void SplitterContainerWidget::setTransformedSizes(const QList<int> sizes)
{
QList<int> realSizes;
int w = width();

for (int i = 0; i < sizes.count(); i++) {
realSizes << sizes[i] * w / 10000;
}

mSplitter->setSizes(realSizes);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ namespace Heaven
void setVertical( bool vert );
bool isVertical() const;

public:
QList<int> transformedSizes();
void setTransformedSizes(const QList<int> sizes);

private:
MiniSplitter* mSplitter;
};
Expand Down