fixed compiling

This commit is contained in:
fourtf
2018-01-15 04:08:48 +01:00
parent d045f6963a
commit 6701c3d0b2
5 changed files with 70 additions and 80 deletions
+1 -74
View File
@@ -275,80 +275,7 @@ int MessageLayout::getLastCharacterIndex() const
int MessageLayout::getSelectionIndex(QPoint position)
{
// if (this->wordParts.size() == 0) {
// return 0;
// }
// // find out in which line the cursor is
// int lineNumber = 0, lineStart = 0, lineEnd = 0;
// for (size_t i = 0; i < this->wordParts.size(); i++) {
// LayoutItem &part = this->wordParts[i];
// if (part.getLineNumber() != 0 && position.y() < part.getY()) {
// break;
// }
// if (part.getLineNumber() != lineNumber) {
// lineStart = i;
// lineNumber = part.getLineNumber();
// }
// lineEnd = i + 1;
// }
// // count up to the cursor
// int index = 0;
// for (int i = 0; i < lineStart; i++) {
// LayoutItem &part = this->wordParts[i];
// index += part.getWord().isImage() ? 2 : part.getText().length() + 1;
// }
// for (int i = lineStart; i < lineEnd; i++) {
// LayoutItem &part = this->wordParts[i];
// // curser is left of the word part
// if (position.x() < part.getX()) {
// break;
// }
// // cursor is right of the word part
// if (position.x() > part.getX() + part.getWidth()) {
// index += part.getCharacterLength();
// continue;
// }
// // cursor is over the word part
// if (part.getWord().isImage()) {
// if (position.x() - part.getX() > part.getWidth() / 2) {
// index++;
// }
// } else {
// // TODO: use word.getCharacterWidthCache();
// auto text = part.getText();
// int x = part.getX();
// for (int j = 0; j < text.length(); j++) {
// if (x > position.x()) {
// break;
// }
// index++;
// x = part.getX() + part.getWord().getFontMetrics(this->scale).width(text, j +
// 1);
// }
// }
// break;
// }
// return index;
return 0;
return this->container.getSelectionIndex(position);
}
} // namespace layouts
} // namespace messages