| 183 | } |
| 184 | |
| 185 | void BehaviorTreeDataModel::initWidget() |
| 186 | { |
| 187 | if( _style_icon.isEmpty() == false ) |
| 188 | { |
| 189 | _caption_logo_left->setFixedWidth( 20 ); |
| 190 | _caption_logo_right->setFixedWidth( 1 ); |
| 191 | |
| 192 | QFile file(_style_icon); |
| 193 | if(!file.open(QIODevice::ReadOnly)) |
| 194 | { |
| 195 | qDebug()<<"file not opened: "<< _style_icon; |
| 196 | file.close(); |
| 197 | } |
| 198 | else { |
| 199 | QByteArray ba = file.readAll(); |
| 200 | QByteArray new_color_fill = QString("fill:%1;").arg( _style_caption_color.name() ).toUtf8(); |
| 201 | ba.replace("fill:#ffffff;", new_color_fill); |
| 202 | _icon_renderer = new QSvgRenderer(ba, this); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | _caption_label->setText( _style_caption_alias ); |
| 207 | |
| 208 | QPalette capt_palette = _caption_label->palette(); |
| 209 | capt_palette.setColor(_caption_label->backgroundRole(), Qt::transparent); |
| 210 | capt_palette.setColor(_caption_label->foregroundRole(), _style_caption_color); |
| 211 | _caption_label->setPalette(capt_palette); |
| 212 | |
| 213 | _caption_logo_left->adjustSize(); |
| 214 | _caption_logo_right->adjustSize(); |
| 215 | _caption_label->adjustSize(); |
| 216 | |
| 217 | updateNodeSize(); |
| 218 | } |
| 219 | |
| 220 | unsigned int BehaviorTreeDataModel::nPorts(QtNodes::PortType portType) const |
| 221 | { |
no test coverage detected