Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KadasMapCanvasItemManager singleton with Q_GLOBAL_STATIC #218

Merged
merged 8 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ jobs:
run: |
cmake --build build --config Release

# A preliminary smoke test to determine basic functional python
# To be replaced with something proper when testing lands
- name: 🚭 PySmokeTest
shell: bash
env:
PYTHONPATH: build/output/python/
run: |
./build/vcpkg_installed/x64-windows/tools/python3/python.exe -c 'from kadas.kadasgui import *'
./build/vcpkg_installed/x64-windows/tools/python3/python.exe -c 'from kadas.kadascore import *'
./build/vcpkg_installed/x64-windows/tools/python3/python.exe -c 'from kadas.kadasanalysis import *'

- name: 📦 Package
run: |
cmake --build build --target bundle --config Release
Expand All @@ -136,6 +125,23 @@ jobs:
path: |
build/kadas-*-win64.msi

# A preliminary smoke test to determine basic functional python
# To be replaced with something proper when testing lands
- name: 🚭 PySmokeTest
shell: bash
env:
PYTHONPATH: build/output/python/
run: |
set -e
$(./build/vcpkg_installed/x64-windows/tools/python3/python.exe <<EOF
import os
os.add_dll_directory(os.getcwd() + '/build/output/bin')
from kadas.kadasgui import *
from kadas.kadascore import *
from kadas.kadasanalysis import *
EOF
)

- name: Upload release assets
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'release' }}
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ include(GenerateExportHeader)

set(CMAKE_CXX_STANDARD 17)

set(BUILD_SHARED_LIBS
ON
CACHE BOOL "Build using shared libraries"
)
set(KADAS_NAME
"Kadas"
CACHE STRING "Kadas application name"
Expand Down
2 changes: 1 addition & 1 deletion kadas/app/kadasbookmarksmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class QgsMapCanvas;
class QgsMessageBar;


class KADAS_GUI_EXPORT KadasBookmarksMenu : public QMenu
class KadasBookmarksMenu : public QMenu
{
Q_OBJECT
public:
Expand Down
5 changes: 3 additions & 2 deletions kadas/gui/kadasmapcanvasitemmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "kadas/gui/kadasmapcanvasitemmanager.h"
#include "kadas/gui/mapitems/kadasmapitem.h"

Q_GLOBAL_STATIC( KadasMapCanvasItemManager, sKadasMapCanvasItemManager )

KadasMapCanvasItemManager::KadasMapCanvasItemManager()
{
connect( QgsProject::instance(), &QgsProject::readProject, this, &KadasMapCanvasItemManager::readFromProject );
Expand All @@ -28,8 +30,7 @@ KadasMapCanvasItemManager::KadasMapCanvasItemManager()

KadasMapCanvasItemManager *KadasMapCanvasItemManager::instance()
{
static KadasMapCanvasItemManager manager;
return &manager;
return sKadasMapCanvasItemManager;
}

void KadasMapCanvasItemManager::addItem( KadasMapItem *item )
Expand Down
3 changes: 1 addition & 2 deletions kadas/gui/kadasmapcanvasitemmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class KADAS_GUI_EXPORT KadasMapCanvasItemManager : public QObject
Q_OBJECT

public:
KadasMapCanvasItemManager() SIP_FORCE;
static KadasMapCanvasItemManager *instance();
static void addItem( KadasMapItem *item );
static void removeItem( KadasMapItem *item );
Expand All @@ -46,8 +47,6 @@ class KADAS_GUI_EXPORT KadasMapCanvasItemManager : public QObject
void itemWillBeRemoved( const KadasMapItem *item );

private:
KadasMapCanvasItemManager() SIP_FORCE;

QList<KadasMapItem *> mMapItems;

private slots:
Expand Down