Fri, 22 Jun 2018 12:13:01 +0300
replaced uses of QList with QVector
--- a/src/basics.cpp Thu Jun 21 19:21:49 2018 +0300 +++ b/src/basics.cpp Fri Jun 22 12:13:01 2018 +0300 @@ -44,7 +44,7 @@ } -QString joinStrings(const QList<StringFormatArg>& values, QString delimeter) +QString joinStrings(const QVector<StringFormatArg>& values, QString delimeter) { QStringList list;
--- a/src/basics.h Thu Jun 21 19:21:49 2018 +0300 +++ b/src/basics.h Fri Jun 22 12:13:01 2018 +0300 @@ -105,7 +105,7 @@ qreal determinant(const QMatrix4x4& matrix); QString formatFileSize(qint64 size); int gcd(int a, int b); -QString joinStrings(const QList<class StringFormatArg>& values, QString delimeter = " "); +QString joinStrings(const QVector<class StringFormatArg>& values, QString delimeter = " "); QString largeNumberRep(int number); double log1000(double x); double roundToDecimals(double value, int decimals);
--- a/src/dialogs/configdialog.cpp Thu Jun 21 19:21:49 2018 +0300 +++ b/src/dialogs/configdialog.cpp Fri Jun 22 12:13:01 2018 +0300 @@ -553,7 +553,7 @@ // // Finds the given list widget item in the list of widget items given. // -int ConfigDialog::getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack) +int ConfigDialog::getItemRow (QListWidgetItem* item, QVector<QListWidgetItem*>& haystack) { int i = 0; @@ -582,9 +582,9 @@ // // Get the list of shortcuts selected // -QList<ShortcutListItem*> ConfigDialog::getShortcutSelection() +QVector<ShortcutListItem*> ConfigDialog::getShortcutSelection() { - QList<ShortcutListItem*> out; + QVector<ShortcutListItem*> out; for (QListWidgetItem* entry : ui.shortcutsList->selectedItems()) out << static_cast<ShortcutListItem*> (entry); @@ -597,7 +597,7 @@ // void ConfigDialog::slot_setShortcut() { - QList<ShortcutListItem*> sel = getShortcutSelection(); + QVector<ShortcutListItem*> sel = getShortcutSelection(); if (countof(sel) < 1) return; @@ -613,7 +613,7 @@ // void ConfigDialog::slot_resetShortcut() { - QList<ShortcutListItem*> sel = getShortcutSelection(); + QVector<ShortcutListItem*> sel = getShortcutSelection(); for (ShortcutListItem* item : sel) { @@ -627,7 +627,7 @@ // void ConfigDialog::slot_clearShortcut() { - QList<ShortcutListItem*> sel = getShortcutSelection(); + QVector<ShortcutListItem*> sel = getShortcutSelection(); for (ShortcutListItem* item : sel) {
--- a/src/dialogs/configdialog.h Thu Jun 21 19:21:49 2018 +0300 +++ b/src/dialogs/configdialog.h Fri Jun 22 12:13:01 2018 +0300 @@ -69,7 +69,7 @@ private: class Ui_ConfigDialog& ui; - QList<QListWidgetItem*> quickColorItems; + QVector<QListWidgetItem*> quickColorItems; QMap<QPushButton*, QColor> m_buttonColors; ExternalProgramWidgets m_externalProgramWidgets[NumExternalPrograms]; QVector<ColorToolbarItem> quickColors; @@ -81,10 +81,10 @@ void setButtonBackground (QPushButton* button, QString value); void updateQuickColorList (ColorToolbarItem* sel = nullptr); void setShortcutText (ShortcutListItem* item); - int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack); + int getItemRow (QListWidgetItem* item, QVector<QListWidgetItem*>& haystack); QString quickColorString(); QListWidgetItem* getSelectedQuickColor(); - QList<ShortcutListItem*> getShortcutSelection(); + QVector<ShortcutListItem*> getShortcutSelection(); void initExtProgs(); void applyToWidgetOptions (std::function<void (QWidget*, QString)> func);
--- a/src/editHistory.h Thu Jun 21 19:21:49 2018 +0300 +++ b/src/editHistory.h Fri Jun 22 12:13:01 2018 +0300 @@ -28,7 +28,7 @@ Q_OBJECT public: - using Changeset = QList<AbstractHistoryEntry*>; + using Changeset = QVector<AbstractHistoryEntry*>; EditHistory (LDDocument* document); ~EditHistory(); @@ -59,7 +59,7 @@ private: LDDocument* m_document; Changeset m_currentChangeset; - QList<Changeset> m_changesets; + QVector<Changeset> m_changesets; bool m_isIgnoring; int m_position; };
--- a/src/editmodes/abstractEditMode.cpp Thu Jun 21 19:21:49 2018 +0300 +++ b/src/editmodes/abstractEditMode.cpp Fri Jun 22 12:13:01 2018 +0300 @@ -117,7 +117,7 @@ Vertex cursorPosition = renderer()->currentCamera().convert2dTo3d(data.ev->pos()); QPoint cursorPosition2D = data.ev->pos(); const Axis depthAxis = renderer()->getRelativeZ(); - QList<Vertex> vertices = currentDocument()->inlineVertices().toList(); + QVector<Vertex> vertices = currentDocument()->inlineVertices().toList().toVector(); // Sort the vertices in order of distance to camera sort(vertices.begin(), vertices.end(), [&](const Vertex& a, const Vertex& b) -> bool
--- a/src/editmodes/abstractEditMode.h Thu Jun 21 19:21:49 2018 +0300 +++ b/src/editmodes/abstractEditMode.h Fri Jun 22 12:13:01 2018 +0300 @@ -79,7 +79,7 @@ DEFINE_CLASS (AbstractDrawMode, AbstractEditMode) protected: - QList<Vertex> m_drawedVerts; + QVector<Vertex> m_drawedVerts; QBrush m_polybrush; public:
--- a/src/editmodes/drawMode.cpp Thu Jun 21 19:21:49 2018 +0300 +++ b/src/editmodes/drawMode.cpp Fri Jun 22 12:13:01 2018 +0300 @@ -67,7 +67,7 @@ void DrawMode::endDraw() { // Clean the selection and create the object - QList<Vertex>& verts = m_drawedVerts; + QVector<Vertex>& verts = m_drawedVerts; Model model {m_documents}; switch (countof(verts))
--- a/src/editmodes/linePathMode.cpp Thu Jun 21 19:21:49 2018 +0300 +++ b/src/editmodes/linePathMode.cpp Fri Jun 22 12:13:01 2018 +0300 @@ -28,7 +28,7 @@ void LinePathMode::render (QPainter& painter) const { QVector<QPointF> points; - QList<Vertex> points3d = m_drawedVerts; + QVector<Vertex> points3d = m_drawedVerts; points3d << renderer()->position3D(); for (Vertex const& vrt : points3d)
--- a/src/generics/functions.h Thu Jun 21 19:21:49 2018 +0300 +++ b/src/generics/functions.h Fri Jun 22 12:13:01 2018 +0300 @@ -100,9 +100,9 @@ } template<typename T> -int countof(const QList<T>& vector) +int countof(const QList<T>& list) { - return vector.size(); + return list.size(); } template<typename T>
--- a/src/mainwindow.h Thu Jun 21 19:21:49 2018 +0300 +++ b/src/mainwindow.h Fri Jun 22 12:13:01 2018 +0300 @@ -125,8 +125,8 @@ PrimitiveManager* m_primitives; Grid* m_grid; QVector<ColorToolbarItem> m_quickColors; - QList<QToolButton*> m_colorButtons; - QList<QAction*> m_recentFiles; + QVector<QToolButton*> m_colorButtons; + QVector<QAction*> m_recentFiles; class Ui_MainWindow& ui; QTabBar* m_tabs; bool m_updatingTabs;
--- a/src/primitives.h Thu Jun 21 19:21:49 2018 +0300 +++ b/src/primitives.h Fri Jun 22 12:13:01 2018 +0300 @@ -90,8 +90,8 @@ PatternType type; }; - QList<RegexEntry> patterns; - QList<Primitive> primitives; + QVector<RegexEntry> patterns; + QVector<Primitive> primitives; explicit PrimitiveCategory (QString name, QObject* parent = 0); bool isValidToInclude(); @@ -129,7 +129,7 @@ QVariant headerData(int section, Qt::Orientation orientation, int role) const override; private: - QList<PrimitiveCategory*> m_categories; + QVector<PrimitiveCategory*> m_categories; PrimitiveScanner* m_activeScanner; QVector<Primitive> m_primitives; PrimitiveCategory* m_unmatched;
--- a/src/toolsets/algorithmtoolset.cpp Thu Jun 21 19:21:49 2018 +0300 +++ b/src/toolsets/algorithmtoolset.cpp Fri Jun 22 12:13:01 2018 +0300 @@ -289,7 +289,7 @@ const bool replaceAllValues= ui.any->isChecked(); const bool relative = ui.relative->isChecked(); - QList<Axis> selectedAxes; + QVector<Axis> selectedAxes; int count = 0; if (ui.x->isChecked()) @@ -333,7 +333,7 @@ if (not dialog.exec()) return; - QList<Axis> sel; + QVector<Axis> sel; if (ui.x->isChecked()) sel << X; if (ui.y->isChecked()) sel << Y;
--- a/src/toolsets/extprogramtoolset.cpp Thu Jun 21 19:21:49 2018 +0300 +++ b/src/toolsets/extprogramtoolset.cpp Fri Jun 22 12:13:01 2018 +0300 @@ -285,7 +285,7 @@ // ============================================================================= // -void ExtProgramToolset::insertOutput (QString fname, bool replace, QList<LDColor> colorsToReplace) +void ExtProgramToolset::insertOutput (QString fname, bool replace, const QVector<LDColor>& colorsToReplace) { #ifdef DEBUG QFile::copy (fname, "./debug_lastOutput");
--- a/src/toolsets/extprogramtoolset.h Thu Jun 21 19:21:49 2018 +0300 +++ b/src/toolsets/extprogramtoolset.h Fri Jun 22 12:13:01 2018 +0300 @@ -62,7 +62,7 @@ bool makeTempFile (class QTemporaryFile& tmp, QString& fname); bool runExtProgram (ExtProgramType prog, QString argvstr); QString errorCodeString (ExtProgramType program, class QProcess& process); - void insertOutput (QString fname, bool replace, QList<LDColor> colorsToReplace); + void insertOutput (QString fname, bool replace, const QVector<LDColor>& colorsToReplace); void writeColorGroup (LDColor color, QString fname); void writeObjects (const QVector<LDObject*>& objects, QFile& f); void writeObjects (const QVector<LDObject*>& objects, QString fname);