CustusX  18.04
An IGT application
cxViewUtilities.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #include "cxViewUtilities.h"
13 #include <QGridLayout>
14 
15 namespace cx
16 {
17 namespace view_utils
18 {
19 
20 void setStretchFactors(QGridLayout* layout, LayoutRegion region, int stretchFactor)
21 {
22  // set stretch factors for the affected cols to 1 in order to get even distribution
23  for (int i = region.pos.col; i < region.pos.col + region.span.col; ++i)
24  {
25  if(i>=0)
26  layout->setColumnStretch(i, stretchFactor);
27  }
28  // set stretch factors for the affected rows to 1 in order to get even distribution
29  for (int i = region.pos.row; i < region.pos.row + region.span.row; ++i)
30  {
31  if(i>=0)
32  layout->setRowStretch(i, stretchFactor);
33  }
34 }
35 
36 } // namespace view_utils
37 } /* namespace cx */
LayoutPosition span
size of region
Definition: cxLayoutData.h:46
void setStretchFactors(QGridLayout *layout, LayoutRegion region, int stretchFactor)
LayoutPosition pos
start position of region
Definition: cxLayoutData.h:45
Namespace for all CustusX production code.