5 #ifndef pqPythonUtils_h 6 #define pqPythonUtils_h 8 #include <QAbstractTextDocumentLayout> 24 QTextCursor curs = QTextCursor(text.document());
25 curs.movePosition(QTextCursor::Start);
26 for (std::int32_t i = 0; i < text.document()->blockCount(); ++i)
28 QTextBlock block = curs.block();
30 QRect r1 = text.viewport()->geometry();
31 QRect r2 = text.document()
33 ->blockBoundingRect(block)
34 .translated(text.viewport()->geometry().x(),
35 text.viewport()->geometry().y() - (text.verticalScrollBar()->sliderPosition()))
38 if (r1.contains(r2,
true))
43 curs.movePosition(QTextCursor::NextBlock);
51 return QFileInfo(filepath).fileName();
60 template <
typename E,
class T, std::
size_t N = static_cast<
size_t>(E::END)>
63 T&
operator[](E e) {
return std::array<T, N>::operator[](static_cast<size_t>(e)); }
64 const T&
operator[](E e)
const {
return std::array<T, N>::operator[](static_cast<size_t>(e)); }
67 #endif // pqPythonUtils_h
Stack array using an enum as indexer.
std::int32_t getFirstVisibleBlockId(const QTextEdit &text)
Returns the id of the first visible block inside a QTextEdit.
QString stripFilename(const QString &filepath)
const T & operator[](E e) const