����ѡ����
| 221 | |
| 222 | //����ѡ���� |
| 223 | void FindResultView::on_copySelectLine() |
| 224 | { |
| 225 | int startPos = SendScintilla(SCI_GETSELECTIONSTART); |
| 226 | int endPos = SendScintilla(SCI_GETSELECTIONEND); |
| 227 | |
| 228 | int startLine = SendScintilla(SCI_LINEFROMPOSITION, startPos); |
| 229 | int endLine = SendScintilla(SCI_LINEFROMPOSITION, endPos); |
| 230 | |
| 231 | int start = SendScintilla(SCI_POSITIONFROMLINE, startLine); |
| 232 | int end = SendScintilla(SCI_POSITIONFROMLINE, endLine+1); |
| 233 | |
| 234 | char *dest = new char[end - start + 1]; |
| 235 | dest[end - start] = '\0'; |
| 236 | |
| 237 | Sci_TextRange tr; |
| 238 | tr.chrg.cpMin = static_cast<Sci_PositionCR>(start); |
| 239 | tr.chrg.cpMax = static_cast<Sci_PositionCR>(end); |
| 240 | tr.lpstrText = dest; |
| 241 | |
| 242 | this->SendScintilla(SCI_GETTEXTRANGE, 0, &tr); |
| 243 | |
| 244 | QString text(dest); |
| 245 | |
| 246 | QStringList lineText = text.split("\n"); |
| 247 | QString selectConnect; |
| 248 | |
| 249 | for (int i = 0; i < lineText.size(); ++i) |
| 250 | { |
| 251 | const QString& t = lineText.at(i); |
| 252 | int pos = t.indexOf(": "); |
| 253 | if (pos != -1) |
| 254 | { |
| 255 | QString v = t.mid(pos + 2); |
| 256 | selectConnect.append(v); |
| 257 | selectConnect.append("\n"); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | QClipboard* clipboard = QApplication::clipboard(); |
| 262 | clipboard->setText(selectConnect); |
| 263 | |
| 264 | //CTipWin::showTips(this, tr("Copy to clipboard Finished!"), 1200, true); |
| 265 | } |
| 266 | |
| 267 | void FindResultView::on_clear() |
| 268 | { |
nothing calls this directly
no test coverage detected