"Transparent" menu item has been added to TextItem context menu

This commit is contained in:
Arin Alexander 2017-03-04 00:30:52 +03:00
parent 242dbe75d2
commit b963428f4c

View File

@ -105,6 +105,10 @@ void TextItem::preparePopUpMenu(QMenu &menu)
action->setCheckable(true);
action->setChecked(stretchToMaxHeight());
action = menu.addAction(tr("Transparent"));
action->setCheckable(true);
action->setChecked(backgroundMode() == TransparentMode);
}
void TextItem::processPopUpAction(QAction *action)
@ -124,6 +128,13 @@ void TextItem::processPopUpAction(QAction *action)
if (action->text().compare(tr("Stretch to max height")) == 0){
setProperty("stretchToMaxHeight",action->isChecked());
}
if (action->text().compare(tr("Transparent")) == 0){
if (action->isChecked()){
setProperty("backgroundMode",TransparentMode);
} else {
setProperty("backgroundMode",OpaqueMode);
}
}
}
void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) {