Skip to content

Commit

Permalink
set a sample keyword pattern for highlight text
Browse files Browse the repository at this point in the history
in log bar
  • Loading branch information
Daniele Giunchi committed Jan 24, 2011
1 parent bfd1c78 commit 62035ef
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mafGUI/mafGUIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,23 @@ mafTreeWidget *mafGUIManager::createTreeWidget(mafTreeModel *model, QWidget *par
mafTextEditWidget *mafGUIManager::createLogWidget(QWidget *parent) {
//syntax highlighter
mafTextHighlighter *hl = new mafTextHighlighter();

// create some rules
mafStringList keywordPatterns;
keywordPatterns << "\\bvme\\b" << "\\bmatrix\\b" << "\\bpose\\b"
<< "\\btimestamp\\b" << "\\name\\b" << "\\bDataVector\\b";

//generate some rules
int count = 0;
foreach (const QString &pattern, keywordPatterns) {
mafString keywordName = "keyword";
keywordName.append(mafString::number(count++));
hl->insertRule(keywordName, mafRegExp(pattern), hl->format("keywords"));
}

mafTextEditWidget *w = new mafTextEditWidget(hl, parent);
w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
w->enableEditing(false);

if(parent) {
if(parent->layout()) {
Expand Down

0 comments on commit 62035ef

Please sign in to comment.