[fbreader] Added ZLTextArea::selectionIsEmpty() and clearSelection()

This commit is contained in:
Slava Monich 2017-09-07 18:13:54 +03:00
parent 48cb24f8a1
commit c8bad41b7f
2 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
* Copyright (C) 2016 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2017 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -69,6 +69,15 @@ void ZLTextArea::clear() {
myTextElementMap.clear();
myTreeNodeMap.clear();
clearSelection();
}
bool ZLTextArea::selectionIsEmpty() const
{
return mySelectionModel.isNull() || mySelectionModel->isEmpty();
}
void ZLTextArea::clearSelection() const {
if (!mySelectionModel.isNull()) {
mySelectionModel->clear();
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
* Copyright (C) 2016 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2017 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -89,6 +89,8 @@ public:
int paragraphIndexByCoordinates(int x, int y, bool absolute = true) const;
ZLTextSelectionModel &selectionModel();
bool selectionIsEmpty() const;
void clearSelection() const;
void paint(ZLSize *size = 0);