Feature/bug fixes (#254)
* cleanup * Check for preventing double addition due to the way reconciler works * set scrollarea as resizeable by default
This commit is contained in:
parent
a3aa6ea44a
commit
f8c9557166
@ -20,7 +20,7 @@
|
||||
\
|
||||
Napi::String napiText = info[0].As<Napi::String>(); \
|
||||
std::string text = napiText.Utf8Value(); \
|
||||
this->instance->setText(text.c_str()); \
|
||||
this->instance->setText(QString::fromUtf8(text.c_str())); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
\
|
||||
|
||||
@ -76,7 +76,7 @@ Napi::Value QLabelWrap::setText(const Napi::CallbackInfo& info) {
|
||||
|
||||
Napi::String text = info[0].As<Napi::String>();
|
||||
std::string label = text.Utf8Value();
|
||||
this->instance->setText(label.c_str());
|
||||
this->instance->setText(QString::fromUtf8(label.c_str()));
|
||||
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
@ -10,9 +10,9 @@ void EventWidget::subscribeToQtEvent(std::string evtString) {
|
||||
this->subscribedEvents.insert(
|
||||
{static_cast<QEvent::Type>(evtType), evtString});
|
||||
} catch (...) {
|
||||
qDebug() << "EventWidget: Couldn't subscribe to qt event"
|
||||
<< evtString.c_str()
|
||||
<< ". If this is a signal you can safely ignore this warning";
|
||||
// qDebug() << "EventWidget: Couldn't subscribe to qt event"
|
||||
// << evtString.c_str()
|
||||
// << ". If this is a signal you can safely ignore this warning";
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,9 +22,9 @@ void EventWidget::unSubscribeToQtEvent(std::string evtString) {
|
||||
this->subscribedEvents.erase(
|
||||
static_cast<QEvent::Type>(evtType)); // erasing by key
|
||||
} catch (...) {
|
||||
qDebug() << "EventWidget: Couldn't unsubscribe to qt event "
|
||||
<< evtString.c_str()
|
||||
<< ". If this is a signal you can safely ignore this warning ";
|
||||
// qDebug() << "EventWidget: Couldn't unsubscribe to qt event "
|
||||
// << evtString.c_str()
|
||||
// << ". If this is a signal you can safely ignore this warning ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import { NodeObject } from '../QtCore/QObject';
|
||||
export abstract class NodeLayout extends NodeObject {
|
||||
type = 'layout';
|
||||
abstract addWidget(childWidget: NodeWidget, ...args: any[]): void;
|
||||
abstract removeWidget(childWidget: NodeWidget): void;
|
||||
activate(): boolean {
|
||||
return this.native.activate();
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ export class QScrollArea extends QAbstractScrollArea {
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.nodeParent = parent;
|
||||
this.setWidgetResizable(true);
|
||||
}
|
||||
setWidget(widget: NodeWidget): void {
|
||||
// react:✓, //TODO:getter
|
||||
|
||||
@ -14,6 +14,9 @@ export class FlexLayout extends NodeLayout {
|
||||
protected flexNode?: FlexNode;
|
||||
|
||||
addWidget(childWidget: NodeWidget, childFlexNode?: FlexNode): void {
|
||||
if (this.nodeChildren.has(childWidget)) {
|
||||
return;
|
||||
}
|
||||
const childYogaNode = childFlexNode || childWidget.getFlexNode();
|
||||
this.nodeChildren.add(childWidget);
|
||||
this.native.addWidget(childWidget.native, childYogaNode);
|
||||
@ -25,6 +28,9 @@ export class FlexLayout extends NodeLayout {
|
||||
childFlexNode?: FlexNode,
|
||||
beforeChildFlexNode?: FlexNode,
|
||||
): void {
|
||||
if (this.nodeChildren.has(childWidget)) {
|
||||
return;
|
||||
}
|
||||
const childYogaNode = childFlexNode || childWidget.getFlexNode();
|
||||
const beforeChildYogaNode = beforeChildFlexNode || beforeChildWidget.getFlexNode();
|
||||
this.nodeChildren.add(childWidget); // No orderer required yet, so just inserting at the end.
|
||||
@ -36,8 +42,8 @@ export class FlexLayout extends NodeLayout {
|
||||
return;
|
||||
}
|
||||
const childYogaNode = childFlexNode || childWidget.getFlexNode();
|
||||
this.nodeChildren.delete(childWidget);
|
||||
this.native.removeWidget(childWidget.native, childYogaNode);
|
||||
this.nodeChildren.delete(childWidget);
|
||||
}
|
||||
|
||||
setFlexNode(flexNode: FlexNode): void {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user