r24145 by jghali - Fix Box class inheriting uselessly from QObject
scribus-commit
scribus-commit at lists.scribus.net
Sun Nov 1 01:55:10 UTC 2020
Author: jghali
Date: Sun Nov 1 01:55:10 2020
New Revision: 24145
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24145
Log:
Fix Box class inheriting uselessly from QObject
Modified:
trunk/Scribus/scribus/text/CMakeLists.txt
trunk/Scribus/scribus/text/boxes.cpp
trunk/Scribus/scribus/text/boxes.h
trunk/Scribus/scribus/text/textlayout.cpp
trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters
trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj
trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters
trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj
trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters
Modified: trunk/Scribus/scribus/text/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/scribus/text/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/text/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/text/CMakeLists.txt Sun Nov 1 01:55:10 2020
@@ -11,7 +11,6 @@
set(SCRIBUS_TEXT_MOC_CLASSES
storytext.h
- boxes.h
)
set(SCRIBUS_TEXT_LIB_SOURCES
Modified: trunk/Scribus/scribus/text/boxes.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/scribus/text/boxes.cpp
==============================================================================
--- trunk/Scribus/scribus/text/boxes.cpp (original)
+++ trunk/Scribus/scribus/text/boxes.cpp Sun Nov 1 01:55:10 2020
@@ -39,11 +39,11 @@
if (containsPoint(coord) && (m_boxes.count() > 0))
{
- LineBox* firstLine = qobject_cast<LineBox*>(m_boxes.first());
+ LineBox* firstLine = dynamic_cast<LineBox*>(m_boxes.first());
if (firstLine && (coord.y() < firstLine->y()))
return firstLine->firstChar();
- LineBox* lastLine = qobject_cast<LineBox*>(m_boxes.last());
+ LineBox* lastLine = dynamic_cast<LineBox*>(m_boxes.last());
if (lastLine && (coord.y() > lastLine->y() + lastLine->naturalHeight()))
return lastLine->lastChar() + 1;
}
@@ -144,8 +144,6 @@
m_naturalHeight = ceil(box->y() + box->ascent() - box->naturalDescent());
}
}
-
-// emit boxChanged();
}
#if 0
@@ -260,7 +258,7 @@
QRectF lastRect;
for (int i = 0; i < boxes().count(); i++)
{
- const GlyphBox* box = qobject_cast<const GlyphBox*>(boxes()[i]);
+ const GlyphBox* box = dynamic_cast<const GlyphBox*>(boxes()[i]);
if (!box)
continue;
const CharStyle& style = box->style();
@@ -345,8 +343,6 @@
m_naturalAscent = qMax(m_naturalAscent, box->naturalAsc());
m_naturalDescent = qMin(m_naturalDescent, box->naturalDescent());
}
-
-// emit boxChanged();
}
#if 0
@@ -475,15 +471,13 @@
m_firstChar = qMin(m_firstChar, box->firstChar());
m_lastChar = qMax(m_lastChar, box->lastChar());
}
-
-// emit boxChanged();
}
void PathLineBox::drawBackGround(TextLayoutPainter *p) const
{
for (int i = 0; i < boxes().count(); i++)
{
- const GlyphBox* box = qobject_cast<const GlyphBox*>(boxes()[i]);
+ const GlyphBox* box = dynamic_cast<const GlyphBox*>(boxes()[i]);
if (!box)
continue;
Modified: trunk/Scribus/scribus/text/boxes.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/scribus/text/boxes.h
==============================================================================
--- trunk/Scribus/scribus/text/boxes.h (original)
+++ trunk/Scribus/scribus/text/boxes.h Sun Nov 1 01:55:10 2020
@@ -25,11 +25,11 @@
and LineBoxes into GroupBox(T_Block).
(and in the future: math atoms, tables & table cells, ...)
*/
-class Box: public QObject {
- Q_OBJECT
-
-public:
- enum BoxType {
+class Box
+{
+public:
+ enum BoxType
+ {
T_Invalid,
T_Block,
T_Line,
@@ -38,7 +38,8 @@
T_Object
};
- enum BoxDirection {
+ enum BoxDirection
+ {
D_Horizontal,
D_Vertical
};
@@ -143,11 +144,6 @@
/// return box type
BoxType type() const { return m_type; }
-
-//public slots:
-// virtual void childChanged() { }
-//signals:
-// void boxChanged();
protected:
BoxType m_type;
@@ -168,7 +164,6 @@
class GroupBox: public Box
{
- Q_OBJECT
public:
GroupBox(BoxDirection direction)
{
@@ -207,7 +202,6 @@
class LineBox: public GroupBox
{
- Q_OBJECT
public:
LineBox()
: GroupBox(D_Horizontal)
@@ -239,7 +233,6 @@
class PathLineBox: public LineBox
{
- Q_OBJECT
public:
PathLineBox()
{
@@ -253,7 +246,6 @@
class GlyphBox: public Box
{
- Q_OBJECT
public:
GlyphBox(const GlyphCluster& run)
: m_glyphRun(run)
@@ -285,7 +277,6 @@
class ObjectBox: public GlyphBox
{
- Q_OBJECT
public:
ObjectBox(const GlyphCluster& run, ITextContext* ctx)
: GlyphBox(run)
Modified: trunk/Scribus/scribus/text/textlayout.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/scribus/text/textlayout.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textlayout.cpp (original)
+++ trunk/Scribus/scribus/text/textlayout.cpp Sun Nov 1 01:55:10 2020
@@ -62,7 +62,7 @@
for (const Box *box : m_box->boxes())
{
if (i < count + box->boxes().count())
- return qobject_cast<const LineBox*>(box->boxes()[i - count]);
+ return dynamic_cast<const LineBox*>(box->boxes()[i - count]);
count += box->boxes().count();
}
assert(false);
@@ -87,7 +87,7 @@
assert(ls->lastChar() < story()->length());
assert(!m_box->boxes().empty());
- GroupBox* column = qobject_cast<GroupBox*>(m_box->boxes().last());
+ GroupBox* column = dynamic_cast<GroupBox*>(m_box->boxes().last());
assert(column);
if (ls->type() == Box::T_PathLine)
ls->setAscent(ls->y() - column->naturalHeight());
@@ -103,7 +103,7 @@
if (boxes.isEmpty())
return;
- GroupBox* column = qobject_cast<GroupBox*>(boxes.last());
+ GroupBox* column = dynamic_cast<GroupBox*>(boxes.last());
assert(column);
int lineCount = column->boxes().count();
@@ -310,7 +310,7 @@
return 0;
const QList<Box*>& boxes = m_box->boxes();
- const GroupBox* column = qobject_cast<const GroupBox*>(boxes.first());
+ const GroupBox* column = dynamic_cast<const GroupBox*>(boxes.first());
assert(column);
// Beware of columns hidden by other objects
@@ -320,7 +320,7 @@
int columnCount = boxes.count();
for (int i = 1; i < columnCount; ++i)
{
- column = qobject_cast<const GroupBox*>(boxes.at(i));
+ column = dynamic_cast<const GroupBox*>(boxes.at(i));
assert(column);
if (!column->isEmpty())
@@ -341,7 +341,7 @@
int columnIndex = boxes.count() - 1;
do
{
- column = qobject_cast<const GroupBox*>(boxes.at(columnIndex));
+ column = dynamic_cast<const GroupBox*>(boxes.at(columnIndex));
assert(column);
if (!column->isEmpty())
Modified: trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
==============================================================================
--- trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj (original)
+++ trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj Sun Nov 1 01:55:10 2020
@@ -404,7 +404,7 @@
<moc Include="..\..\..\scribus\ui\fontreplacedialog.h" />
<ClInclude Include="..\..\..\scribus\fpoint.h" />
<ClInclude Include="..\..\..\scribus\fpointarray.h" />
- <moc Include="..\..\..\scribus\text\boxes.h" />
+ <ClInclude Include="..\..\..\scribus\text\boxes.h" />
<ClInclude Include="..\..\..\scribus\text\frect.h" />
<ClInclude Include="..\..\..\scribus\text\fsize.h" />
<ClInclude Include="..\..\..\scribus\fonts\ftface.h" />
Modified: trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters
==============================================================================
--- trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters (original)
+++ trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters Sun Nov 1 01:55:10 2020
@@ -158,6 +158,9 @@
<ClInclude Include="..\..\..\scribus\fpointarray.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\..\..\scribus\text\boxes.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\..\..\scribus\text\frect.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -4127,9 +4130,6 @@
<moc Include="..\..\..\scribus\ui\recoverdialog.h">
<Filter>Header Files</Filter>
</moc>
- <moc Include="..\..\..\scribus\text\boxes.h">
- <Filter>Header Files</Filter>
- </moc>
<moc Include="..\..\..\scribus\ui\directionselect.h">
<Filter>Header Files</Filter>
</moc>
Modified: trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj
==============================================================================
--- trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj (original)
+++ trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj Sun Nov 1 01:55:10 2020
@@ -404,7 +404,7 @@
<moc Include="..\..\..\scribus\ui\fontreplacedialog.h" />
<ClInclude Include="..\..\..\scribus\fpoint.h" />
<ClInclude Include="..\..\..\scribus\fpointarray.h" />
- <moc Include="..\..\..\scribus\text\boxes.h" />
+ <ClInclude Include="..\..\..\scribus\text\boxes.h" />
<ClInclude Include="..\..\..\scribus\text\frect.h" />
<ClInclude Include="..\..\..\scribus\text\fsize.h" />
<ClInclude Include="..\..\..\scribus\fonts\ftface.h" />
Modified: trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters
==============================================================================
--- trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters (original)
+++ trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters Sun Nov 1 01:55:10 2020
@@ -158,6 +158,9 @@
<ClInclude Include="..\..\..\scribus\fpointarray.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\..\..\scribus\text\boxes.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\..\..\scribus\text\frect.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -4127,9 +4130,6 @@
<moc Include="..\..\..\scribus\ui\recoverdialog.h">
<Filter>Header Files</Filter>
</moc>
- <moc Include="..\..\..\scribus\text\boxes.h">
- <Filter>Header Files</Filter>
- </moc>
<moc Include="..\..\..\scribus\ui\directionselect.h">
<Filter>Header Files</Filter>
</moc>
Modified: trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj
==============================================================================
--- trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj (original)
+++ trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj Sun Nov 1 01:55:10 2020
@@ -405,7 +405,7 @@
<moc Include="..\..\..\scribus\ui\fontreplacedialog.h" />
<ClInclude Include="..\..\..\scribus\fpoint.h" />
<ClInclude Include="..\..\..\scribus\fpointarray.h" />
- <moc Include="..\..\..\scribus\text\boxes.h" />
+ <ClInclude Include="..\..\..\scribus\text\boxes.h" />
<ClInclude Include="..\..\..\scribus\text\frect.h" />
<ClInclude Include="..\..\..\scribus\text\fsize.h" />
<ClInclude Include="..\..\..\scribus\fonts\ftface.h" />
Modified: trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24145&path=/trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters
==============================================================================
--- trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters (original)
+++ trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters Sun Nov 1 01:55:10 2020
@@ -158,6 +158,9 @@
<ClInclude Include="..\..\..\scribus\fpointarray.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\..\..\scribus\text\boxes.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
<ClInclude Include="..\..\..\scribus\text\frect.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -4127,9 +4130,6 @@
<moc Include="..\..\..\scribus\ui\recoverdialog.h">
<Filter>Header Files</Filter>
</moc>
- <moc Include="..\..\..\scribus\text\boxes.h">
- <Filter>Header Files</Filter>
- </moc>
<moc Include="..\..\..\scribus\ui\directionselect.h">
<Filter>Header Files</Filter>
</moc>
More information about the scribus-commit
mailing list