# HG changeset patch # User Teemu Piippo # Date 1627234761 -10800 # Node ID 5760cbb32bc022f625ac20c2853c39741b7ea580 # Parent 1f42c03fafca1638c4576ebc005bef1371e89c68 use QT_NO_KEYWORDS diff -r 1f42c03fafca -r 5760cbb32bc0 CMakeLists.txt --- a/CMakeLists.txt Sun Jul 25 20:29:14 2021 +0300 +++ b/CMakeLists.txt Sun Jul 25 20:39:21 2021 +0300 @@ -18,6 +18,7 @@ find_package(OpenGL REQUIRED) include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) include_directories(${GLM_INCLUDE_DIR}) +add_definitions(-DQT_NO_KEYWORDS) source_group("1 Foundation code" REGULAR_EXPRESSION "src/.+\\.(cpp|h|ui)") source_group("4 OpenGL renderer" REGULAR_EXPRESSION "src/gl/.+\\.(cpp|h|ui)") source_group("5 LDraw line types" REGULAR_EXPRESSION "src/linetypes/.+\\.(cpp|h|ui)") diff -r 1f42c03fafca -r 5760cbb32bc0 src/document.h --- a/src/document.h Sun Jul 25 20:29:14 2021 +0300 +++ b/src/document.h Sun Jul 25 20:39:21 2021 +0300 @@ -43,7 +43,7 @@ void setRenderPreferences(const gl::RenderPreferences& newPreferences); void setCanvasOverpaintCallback(Canvas::OverpaintCallback fn); Model::EditContext editModel(); -signals: +Q_SIGNALS: void newStatusText(const QString& newStatusText); void splitterChanged(); void mouseClick(Document* document, Canvas* canvas); diff -r 1f42c03fafca -r 5760cbb32bc0 src/gl/partrenderer.cpp --- a/src/gl/partrenderer.cpp Sun Jul 25 20:29:14 2021 +0300 +++ b/src/gl/partrenderer.cpp Sun Jul 25 20:39:21 2021 +0300 @@ -85,7 +85,7 @@ 0.1f, 10000.f); this->compiler->setUniformMatrix("projectionMatrix", this->projectionMatrix); - emit projectionMatrixChanged(this->projectionMatrix); + Q_EMIT projectionMatrixChanged(this->projectionMatrix); } static GLenum getGlTypeForArrayClass(const gl::ArrayClass vboClass) @@ -202,14 +202,14 @@ const double z = 2 * std::exp(this->zoom) * (1 + this->compiler->modelDistance()); this->viewMatrix = glm::lookAt(glm::vec3{0, 0, z}, {0, 0, 0}, {0, -1, 0}); this->compiler->setUniformMatrix("viewMatrix", this->viewMatrix); - emit this->viewMatrixChanged(this->viewMatrix); + Q_EMIT this->viewMatrixChanged(this->viewMatrix); } void PartRenderer::updateModelMatrix() { this->modelMatrix = glm::mat4_cast(this->modelQuaternion); this->compiler->setUniformMatrix("modelMatrix", modelMatrix); - emit this->modelMatrixChanged(this->modelMatrix); + Q_EMIT this->modelMatrixChanged(this->modelMatrix); this->update(); } @@ -383,7 +383,7 @@ this->build(); this->setupBackgroundColor(); } - emit this->renderPreferencesChanged(); + Q_EMIT this->renderPreferencesChanged(); this->update(); } diff -r 1f42c03fafca -r 5760cbb32bc0 src/gl/partrenderer.h --- a/src/gl/partrenderer.h Sun Jul 25 20:29:14 2021 +0300 +++ b/src/gl/partrenderer.h Sun Jul 25 20:39:21 2021 +0300 @@ -46,7 +46,7 @@ glm::quat modelQuaternion; QPoint lastMousePosition; gl::RenderPreferences renderPreferences; -signals: +Q_SIGNALS: void projectionMatrixChanged(const glm::mat4& newMatrix); void modelMatrixChanged(const glm::mat4& newMatrix); void viewMatrixChanged(const glm::mat4& newMatrix); diff -r 1f42c03fafca -r 5760cbb32bc0 src/libraries.cpp --- a/src/libraries.cpp Sun Jul 25 20:29:14 2021 +0300 +++ b/src/libraries.cpp Sun Jul 25 20:39:21 2021 +0300 @@ -96,9 +96,9 @@ */ void LibraryManager::addLibrary(const Library& library) { - emit layoutAboutToBeChanged(); + Q_EMIT layoutAboutToBeChanged(); libraries.append(library); - emit layoutChanged(); + Q_EMIT layoutChanged(); } /** @@ -110,9 +110,9 @@ Q_ASSERT(isValidIndex(libraryIndex)); if (isValidIndex(libraryIndex)) { - emit layoutAboutToBeChanged(); + Q_EMIT layoutAboutToBeChanged(); libraries.remove(libraryIndex); - emit layoutChanged(); + Q_EMIT layoutChanged(); } } @@ -189,7 +189,7 @@ (isValidIndex(libraryToIndex) or libraryToIndex == count()) and libraryFromIndex != libraryToIndex) { - emit layoutAboutToBeChanged(); + Q_EMIT layoutAboutToBeChanged(); const Library library = this->library(libraryFromIndex); if (libraryToIndex > libraryFromIndex) { @@ -201,7 +201,7 @@ this->libraries.removeAt(libraryFromIndex); this->libraries.insert(libraryToIndex, library); } - emit layoutChanged(); + Q_EMIT layoutChanged(); } } @@ -349,7 +349,7 @@ Q_ASSERT(isValidIndex(libraryIndex)); const QModelIndex topLeft = this->index(libraryIndex, 0); const QModelIndex bottomRight = this->index(libraryIndex, columnCount({}) - 1); - emit dataChanged(topLeft, bottomRight); + Q_EMIT dataChanged(topLeft, bottomRight); } /** diff -r 1f42c03fafca -r 5760cbb32bc0 src/mainwindow.h --- a/src/mainwindow.h Sun Jul 25 20:29:14 2021 +0300 +++ b/src/mainwindow.h Sun Jul 25 20:39:21 2021 +0300 @@ -35,7 +35,7 @@ public: MainWindow(QWidget *parent = nullptr); ~MainWindow() override; -private slots: +private Q_SLOTS: void newModel(); void openModel(); void openModelFromPath(const QString& path); @@ -76,7 +76,7 @@ void loadColors(); Q_SLOT void toolActionTriggered(); void selectTool(BaseTool* tool); -private slots: +private Q_SLOTS: void canvasMousePressed(QMouseEvent* event); void canvasMouseReleased(Document *document, Canvas *canvas); void canvasMouseDoubleClicked(QMouseEvent* event); diff -r 1f42c03fafca -r 5760cbb32bc0 src/model.cpp --- a/src/model.cpp Sun Jul 25 20:29:14 2021 +0300 +++ b/src/model.cpp Sun Jul 25 20:39:21 2021 +0300 @@ -121,9 +121,9 @@ void Model::append(ModelObjectPointer&& object) { const int position = static_cast(this->body.size()); - emit beginInsertRows({}, position, position); + Q_EMIT beginInsertRows({}, position, position); this->body.push_back(std::move(object)); - emit endInsertRows(); + Q_EMIT endInsertRows(); this->needRecache = true; } @@ -131,9 +131,9 @@ { if (position >= 0 and position < signed_cast(this->body.size())) { - emit beginRemoveRows({}, position, position); + Q_EMIT beginRemoveRows({}, position, position); this->body.erase(std::begin(this->body) + position); - emit endRemoveRows(); + Q_EMIT endRemoveRows(); this->needRecache = true; } } diff -r 1f42c03fafca -r 5760cbb32bc0 src/model.h --- a/src/model.h Sun Jul 25 20:29:14 2021 +0300 +++ b/src/model.h Sun Jul 25 20:39:21 2021 +0300 @@ -50,7 +50,7 @@ ldraw::Id checkType(ldraw::id_t id) const; template const R* get(ldraw::Id id, QModelIndex* index_out = nullptr) const; -signals: +Q_SIGNALS: void objectAdded(ldraw::id_t id, int position); private: using ModelObjectPointer = std::unique_ptr; @@ -107,12 +107,12 @@ ldraw::Id Model::append(Args&&... args) { const int position = static_cast(this->body.size()); - emit beginInsertRows({}, position, position); + Q_EMIT beginInsertRows({}, position, position); this->body.push_back(std::make_unique(args...)); ldraw::Object* pointer = this->body.back().get(); this->objectsById[pointer->id] = pointer; - emit objectAdded(pointer->id, static_cast(this->body.size() - 1)); - emit endInsertRows(); + Q_EMIT objectAdded(pointer->id, static_cast(this->body.size() - 1)); + Q_EMIT endInsertRows(); this->needRecache = true; return ldraw::Id{pointer->id.value}; } @@ -120,12 +120,12 @@ template ldraw::Id Model::insert(const std::size_t position, Args&&... args) { - emit beginInsertRows({}, position, position); + Q_EMIT beginInsertRows({}, position, position); this->body.insert(std::begin(this->body) + position, std::make_unique(args...)); ldraw::Object* pointer = this->body[position].get(); this->objectsById[pointer->id] = pointer; - emit objectAdded(pointer->id, static_cast(position)); - emit endInsertRows(); + Q_EMIT objectAdded(pointer->id, static_cast(position)); + Q_EMIT endInsertRows(); this->needRecache = true; return ldraw::Id{pointer->id.value}; } diff -r 1f42c03fafca -r 5760cbb32bc0 src/modeleditcontext.cpp --- a/src/modeleditcontext.cpp Sun Jul 25 20:29:14 2021 +0300 +++ b/src/modeleditcontext.cpp Sun Jul 25 20:39:21 2021 +0300 @@ -30,7 +30,7 @@ for (ldraw::id_t id : this->modifiedObjects) { const QModelIndex index = this->model().lookup(id); - emit this->model().dataChanged(index, index); + Q_EMIT this->model().dataChanged(index, index); } } diff -r 1f42c03fafca -r 5760cbb32bc0 src/settingseditor/librarieseditor.h --- a/src/settingseditor/librarieseditor.h Sun Jul 25 20:29:14 2021 +0300 +++ b/src/settingseditor/librarieseditor.h Sun Jul 25 20:39:21 2021 +0300 @@ -10,7 +10,7 @@ LibrariesEditor(Configuration* settings, QWidget* parent = nullptr); ~LibrariesEditor(); void saveSettings(Configuration* settings); -private slots: +private Q_SLOTS: void searchPathForNewLibrary(); void addNewLibrary(); void showContextMenu(const QPoint position); diff -r 1f42c03fafca -r 5760cbb32bc0 src/settingseditor/settingseditor.h --- a/src/settingseditor/settingseditor.h Sun Jul 25 20:29:14 2021 +0300 +++ b/src/settingseditor/settingseditor.h Sun Jul 25 20:39:21 2021 +0300 @@ -14,7 +14,7 @@ const uiutilities::KeySequenceMap& defaultKeyboardShortcuts = {}, QWidget* parent = nullptr); ~SettingsEditor(); -private slots: +private Q_SLOTS: void handleAccepted(); private: class Ui_SettingsEditor& ui; diff -r 1f42c03fafca -r 5760cbb32bc0 src/ui/canvas.cpp --- a/src/ui/canvas.cpp Sun Jul 25 20:29:14 2021 +0300 +++ b/src/ui/canvas.cpp Sun Jul 25 20:39:21 2021 +0300 @@ -292,7 +292,7 @@ { this->selection.clear(); this->compiler->setSelectedObjects(this->selection); - emit selectionChanged(this->selection); + Q_EMIT selectionChanged(this->selection); this->update(); } @@ -300,7 +300,7 @@ { this->selection.insert(id); this->compiler->setSelectedObjects(this->selection); - emit selectionChanged(this->selection); + Q_EMIT selectionChanged(this->selection); this->update(); } diff -r 1f42c03fafca -r 5760cbb32bc0 src/ui/canvas.h --- a/src/ui/canvas.h Sun Jul 25 20:29:14 2021 +0300 +++ b/src/ui/canvas.h Sun Jul 25 20:39:21 2021 +0300 @@ -22,7 +22,7 @@ void drawWorldPoint(QPainter* painter, const glm::vec3& worldPoint) const; void drawWorldPolygon(QPainter* painter, const std::vector& points); const std::optional& getWorldPosition() const; -public slots: +public Q_SLOTS: void handleSelectionChange(const QSet& selectedIds, const QSet& deselectedIds); protected: void mouseMoveEvent(QMouseEvent* event) override; @@ -30,7 +30,7 @@ void mouseReleaseEvent(QMouseEvent* event) override; void initializeGL() override; void paintGL() override; -signals: +Q_SIGNALS: void newStatusText(const QString& newStatusText); void selectionChanged(const QSet& newSelection); void mouseClick(Canvas* canvas); diff -r 1f42c03fafca -r 5760cbb32bc0 src/widgets/colorselectdialog.h --- a/src/widgets/colorselectdialog.h Sun Jul 25 20:29:14 2021 +0300 +++ b/src/widgets/colorselectdialog.h Sun Jul 25 20:39:21 2021 +0300 @@ -14,7 +14,7 @@ ~ColorSelectDialog(); void setCurrentColor(ldraw::Color color); ldraw::Color currentColor() const; -private slots: +private Q_SLOTS: void populateColors(); void updateSelectedColorTexts(); void handleButtonClick(); diff -r 1f42c03fafca -r 5760cbb32bc0 src/widgets/matrixeditor.cpp --- a/src/widgets/matrixeditor.cpp Sun Jul 25 20:29:14 2021 +0300 +++ b/src/widgets/matrixeditor.cpp Sun Jul 25 20:39:21 2021 +0300 @@ -19,7 +19,7 @@ *spinbox = this->findChild(name); connect(*spinbox, qOverload(&QDoubleSpinBox::valueChanged), [&]() { - emit this->valueChanged(this->value()); + Q_EMIT this->valueChanged(this->value()); }); Q_ASSERT(*spinbox != nullptr); } @@ -82,7 +82,7 @@ { newValue[column] = glm::vec4{dialog.value(), (column == 3) ? 1 : 0}; this->setValue(newValue); - emit valueChanged(newValue); + Q_EMIT valueChanged(newValue); } } }