I have a QGraphisTextItem with Qt::TextBrowserInteraction flag enabled. But when I select text (or any part of the text) there is dashed frame around whole text.
Does anybody knows how to remove the dashed frame?
Thanks in advance,
Toni
I have a QGraphisTextItem with Qt::TextBrowserInteraction flag enabled. But when I select text (or any part of the text) there is dashed frame around whole text.
Does anybody knows how to remove the dashed frame?
Thanks in advance,
Toni
Qt::TextBrowserInteraction is not a flag for graphics item.
Perhaps, you should specify QGraphicsItem::GraphicsItemFlag or QGraphicsItem::GraphicsItemFlags, as follows.
textItem->setFlag(QGraphicsItem::ItemIsMovable, true); // item support interactive movement.
textItem->setFlag(QGraphicsItem::ItemIsSelectable, false); // if flag is true, item supports selection.
about QGraphicsItem::ItemIsSelectable flag, Qt Reference says
I'm sorry in poor English.The item supports selection. Enabling this feature will enable setSelected() to
toggle selection for the item. It will also let the item be selected automatically as a
result of calling QGraphicsScene::setSelectionArea(), by clicking on an item, or by
using rubber band selection in QGraphicsView.
kichi
I have missed that question! It was several times asked here. Simply remove the QStyle::State_Selected option in the paint method of your item!
Something like:
Qt Code:
void StatusTextItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) { }To copy to clipboard, switch view to plain text mode
It doesn't work, at least on Qt 4.6 RC1. I have not tested with Qt 4.5.3. I don't know if it's bug.
Something like:
Qt Code:
void StatusTextItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) { }To copy to clipboard, switch view to plain text mode
It doesn't work, at least on Qt 4.6 RC1. I have not tested with Qt 4.5.3. I don't know if it's bug.
Something like:
Qt Code:
void StatusTextItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) { }To copy to clipboard, switch view to plain text mode
It doesn't work, at least on Qt 4.6 RC1. I have not tested with Qt 4.5.3. I don't know if it's bug.
Ehm, for your case it's QStyle::State_HasFocus
Bookmarks