forked from nodegui/nodegui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnutils.cpp
More file actions
26 lines (24 loc) · 803 Bytes
/
nutils.cpp
File metadata and controls
26 lines (24 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "nutils.h"
#include <string>
#include <QWidget>
#include "deps/spdlog/spdlog.h"
void extrautils::noop(){}
YGSize extrautils::measureQtWidget (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode){
FlexLayout::NodeContext *ctx = FlexLayout::getNodeContext(node);
if(ctx){
QLayoutItem* childLayoutItem = ctx->item;
QWidget* widget = childLayoutItem->widget();
float width = 0.0;
float height = 0.0;
if(widget){
QSize size = widget->sizeHint();
width = static_cast<float>(size.width());
height = static_cast<float>(size.height());
return YGSize{
width,
height,
};
}
}
return YGSize{width, height};
}