mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
AudioBook Plugin: Actions, item selection
This commit is contained in:
@ -18,6 +18,9 @@
|
||||
#include "pdfdocumenttextfloweditormodel.h"
|
||||
#include "pdfdocumenttextflow.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QBrush>
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
@ -97,6 +100,14 @@ QVariant PDFDocumentTextFlowEditorModel::data(const QModelIndex& index, int role
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (role == Qt::BackgroundRole)
|
||||
{
|
||||
if (m_editor->isSelected(index.row()))
|
||||
{
|
||||
return QBrush(QColor(255, 255, 200));
|
||||
}
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
{
|
||||
switch (index.column())
|
||||
@ -218,4 +229,27 @@ void PDFDocumentTextFlowEditorModel::endFlowChange()
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void PDFDocumentTextFlowEditorModel::setSelectionActivated(bool activate)
|
||||
{
|
||||
if (!m_editor || m_editor->isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_editor->setSelectionActive(activate);
|
||||
m_editor->deselect();
|
||||
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
|
||||
}
|
||||
|
||||
void PDFDocumentTextFlowEditorModel::selectByRectangle(QRectF rectangle)
|
||||
{
|
||||
if (!m_editor || m_editor->isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_editor->selectByRectangle(rectangle);
|
||||
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
Reference in New Issue
Block a user