Hi,
Is it possible to treat each line of a qtextedit individually and attach them to a slot? I know I can get the text from each line and treat it separately but what I want to do is be able to push a shortcut key (like control+r) when the curser is on a line and have that call a function.
Specifically what I want is this: have a qtextedit with a list of file names that I plot. When the cursor is on one of the lines and i press control+t I want that file to be plotted on the right Y-axis.
Right now I am getting the text and plotting it like this
QString textEntered
= this
->textedit
->toPlainText
();
line = line.trimmed();
Filepath = qstrudup(line.toLatin1() );
myPlot->plotFile(Filename)
}
}
QString textEntered = this->textedit->toPlainText();
QStringList lines = textEntered.split( "\n", QString::SkipEmptyParts );
foreach( QString line, lines ) {
line = line.trimmed();
Filepath = qstrudup(line.toLatin1() );
myPlot->plotFile(Filename)
}
}
To copy to clipboard, switch view to plain text mode
I'm not sure if I'd use this same kind of thing or not.
And I know, I know, it would be much easier to use individual qlineedits, but my boss wants the textedit.
Thanks!
Bookmarks