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

Qt Code:
  1. QString textEntered = this->textedit->toPlainText();
  2. QStringList lines = textEntered.split( "\n", QString::SkipEmptyParts );
  3. foreach( QString line, lines ) {
  4. line = line.trimmed();
  5. Filepath = qstrudup(line.toLatin1() );
  6. myPlot->plotFile(Filename)
  7. }
  8. }
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!