MauiKit Image Tools

textscanner.cpp
1#include "textscanner.h"
2
3#ifndef Q_OS_ANDROID
4#include <ocs.h>
5#endif
6
7TextScanner::TextScanner(QObject *parent)
8 : QObject{parent}
9 #ifndef Q_OS_ANDROID
10 ,m_ocr(new OCS(this))
11 #endif
12{
13
14}
15
16void TextScanner::setUrl(const QString &url)
17{
18#ifndef Q_OS_ANDROID
19 m_url = url;
20 m_ocr->setFilePath(m_url);
21#endif
22}
23
24bool TextScanner::containsText(const QString &query)
25{
26#ifndef Q_OS_ANDROID
27
28 if(m_url.isEmpty())
29 return false;
30
31 QString text = m_ocr->getText();
32
33 return text.contains(query, Qt::CaseInsensitive);
34#endif
35
36 return false;
37}
38
39QString TextScanner::getText()
40{
41#ifndef Q_OS_ANDROID
42
43 if(m_url.isEmpty())
44 return QString();
45
46 return m_ocr->getText();
47#endif
48
49 return QString();
50}
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
CaseInsensitive
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.