@@ -16,35 +16,34 @@ StageModel::StageModel(QObject *parent) :
1616
1717void StageModel::init (libscratchcpp::Stage *stage)
1818{
19- if (!stage)
20- return ;
21-
2219 m_stage = stage;
2320
24- m_stage->bubble ()->typeChanged ().connect ([this ](libscratchcpp::TextBubble::Type type) {
25- if (type == libscratchcpp::TextBubble::Type::Say) {
26- if (m_bubbleType == TextBubbleShape::Type::Say)
27- return ;
21+ if (m_stage) {
22+ m_stage->bubble ()->typeChanged ().connect ([this ](libscratchcpp::TextBubble::Type type) {
23+ if (type == libscratchcpp::TextBubble::Type::Say) {
24+ if (m_bubbleType == TextBubbleShape::Type::Say)
25+ return ;
2826
29- m_bubbleType = TextBubbleShape::Type::Say;
30- } else {
31- if (m_bubbleType == TextBubbleShape::Type::Think)
32- return ;
27+ m_bubbleType = TextBubbleShape::Type::Say;
28+ } else {
29+ if (m_bubbleType == TextBubbleShape::Type::Think)
30+ return ;
3331
34- m_bubbleType = TextBubbleShape::Type::Think;
35- }
32+ m_bubbleType = TextBubbleShape::Type::Think;
33+ }
3634
37- emit bubbleTypeChanged ();
38- });
35+ emit bubbleTypeChanged ();
36+ });
3937
40- m_stage->bubble ()->textChanged ().connect ([this ](const std::string &text) {
41- QString newText = QString::fromStdString (text);
38+ m_stage->bubble ()->textChanged ().connect ([this ](const std::string &text) {
39+ QString newText = QString::fromStdString (text);
4240
43- if (m_bubbleText != newText) {
44- m_bubbleText = newText;
45- emit bubbleTextChanged ();
46- }
47- });
41+ if (m_bubbleText != newText) {
42+ m_bubbleText = newText;
43+ emit bubbleTextChanged ();
44+ }
45+ });
46+ }
4847}
4948
5049void StageModel::onCostumeChanged (libscratchcpp::Costume *costume)
0 commit comments