|
|
@ -5,6 +5,7 @@ UBWidgetList::UBWidgetList(QWidget* parent, eWidgetListOrientation orientation, |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpContainer(NULL) |
|
|
|
, mpContainer(NULL) |
|
|
|
, mMargin(5) |
|
|
|
, mMargin(5) |
|
|
|
|
|
|
|
, mListElementsSpacing(10) |
|
|
|
, mpEmptyLabel(NULL) |
|
|
|
, mpEmptyLabel(NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectName(name); |
|
|
|
setObjectName(name); |
|
|
@ -75,7 +76,8 @@ void UBWidgetList::removeWidget(QWidget *widget) |
|
|
|
|
|
|
|
|
|
|
|
int UBWidgetList::scaleWidgets(QSize pSize) |
|
|
|
int UBWidgetList::scaleWidgets(QSize pSize) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int result = 0; |
|
|
|
// to remove the first spacing that shouldn't be there.
|
|
|
|
|
|
|
|
int result = -mListElementsSpacing; |
|
|
|
int count = 0; |
|
|
|
int count = 0; |
|
|
|
foreach(QWidget* eachWidget, mWidgetInfo.keys()){ |
|
|
|
foreach(QWidget* eachWidget, mWidgetInfo.keys()){ |
|
|
|
qreal scaleFactor = 0; |
|
|
|
qreal scaleFactor = 0; |
|
|
@ -85,6 +87,7 @@ int UBWidgetList::scaleWidgets(QSize pSize) |
|
|
|
scaleFactor = (float)mWidgetInfo[eachWidget].width() / (float)pSize.width(); |
|
|
|
scaleFactor = (float)mWidgetInfo[eachWidget].width() / (float)pSize.width(); |
|
|
|
newWidgetHeight = mWidgetInfo[eachWidget].height()/scaleFactor; |
|
|
|
newWidgetHeight = mWidgetInfo[eachWidget].height()/scaleFactor; |
|
|
|
result += newWidgetHeight; |
|
|
|
result += newWidgetHeight; |
|
|
|
|
|
|
|
eachWidget->setMinimumHeight(newWidgetHeight); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
|
scaleFactor = (float)mWidgetInfo[eachWidget].height() / (float)pSize.height(); |
|
|
|
scaleFactor = (float)mWidgetInfo[eachWidget].height() / (float)pSize.height(); |
|
|
@ -99,6 +102,8 @@ int UBWidgetList::scaleWidgets(QSize pSize) |
|
|
|
qDebug() << __PRETTY_FUNCTION__ << "scale factor " << scaleFactor; |
|
|
|
qDebug() << __PRETTY_FUNCTION__ << "scale factor " << scaleFactor; |
|
|
|
qDebug() << __PRETTY_FUNCTION__ << "new height " << result; |
|
|
|
qDebug() << __PRETTY_FUNCTION__ << "new height " << result; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
//Adding a vertical/horizontal space between each element of the list
|
|
|
|
|
|
|
|
result += mListElementsSpacing; |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|