Skip to content

[QMS-980] Configure content and size of the items in the workspace list#981

Merged
kiozen merged 3 commits intoMaproom:devfrom
kiozen:testing_stuff
Feb 21, 2026
Merged

[QMS-980] Configure content and size of the items in the workspace list#981
kiozen merged 3 commits intoMaproom:devfrom
kiozen:testing_stuff

Conversation

@kiozen
Copy link
Collaborator

@kiozen kiozen commented Feb 19, 2026

What is the linked issue for this pull request:

QMS-#980

What you have done:

  • Increased c++ and c standard to c++20 and c99
  • Added a control structure with flags for the status line
  • Added a lot of stuff to CSetupWorkspace to configure the status line's control structure
  • Fixed all code in CWksItemDelegate to use the control structure's flags while processing the item painting

Steps to perform a simple smoke test:

  • Load some projects into the workspace.
  • If available connect a device.
  • Expand the projects.
  • Open the CSetupWorkspace dialog.
  • Changes in the dialog should be seen in the workspace list.
  • Check for persistent configuration storage.

Does the code comply to the coding rules and naming conventions Coding Guidelines:

  • yes

Is every user facing string in a tr() macro?

  • yes

Did you add the ticket number and title into the changelog? Keep the numeric order in each release block.

  • yes, I didn't forget to change changelog.txt

@kiozen
Copy link
Collaborator Author

kiozen commented Feb 19, 2026

I switched in this PR to c++20 and c99. This is because I want to use nested anonymous structures. This might be a problem for some compilers. At least if they are used as plain standard compilers. However all major compilers should be fine if the correct compiler flags are used. I did this for gcc on Linux. But we might need additional tweaks for Windows and MacOS. I would really keep that feature as the code gets so much more readable. Therefore it would be nice if you guys find the correct compile flags if necessary.

@JFritzle @mitxel-m @wthaem @kkarsten62 please test.

@eyzdh
Copy link

eyzdh commented Feb 19, 2026

i tested it, too with help of ai.
I had a Problem in qmt_map2jnx/main.cpp:670. After "I" changed from:
if (success && (idx >= 0) && (idx < file.colortable.size())) {
to
if (success && (idx >= 0) && (idx < 256)) {
I could build QMS for macOS - thank you for the great work, it looks great.

@kiozen
Copy link
Collaborator Author

kiozen commented Feb 19, 2026

Yes, I need to rebase tomorrow.

@JFritzle
Copy link
Contributor

JFritzle commented Feb 20, 2026

I have just now successfully compiled your testing stuff with MSVC 2022 and without changing any compiler flags.

About C++ compiler

With MSVC 2022, compiler, flag for C++ 20 is /std:c++20 (Default: /std:c++14)

In Visual Studio 2019 version 16.6 and later versions, the compiler fully implements the standard C99 preprocessor
via the /Zc:preprocessor

CL /? reports (German):

/Zc:arg1[,arg2] Sprachübereinstimmung. Folgende Argumente sind zulässig:
  ...
  preprocessor[-]       Standardkonformitätspräprozessor in C/C++ aktivieren
                        (standardmäßig in C11 oder höher aktiviert)

-> Standard C99 preprocessor is activated by default.

About C compiler

You can invoke the Microsoft C compiler by using the /TC or /Tc compiler option. It's used by default for code that has a .c file extension, unless overridden by a /TP or /Tp option. The default C compiler (that is, the compiler when /std:c11 or /std:c17 isn't specified) implements ANSI C89, but includes several Microsoft extensions, some of which are part of ISO C99. Some Microsoft extensions to C89 can be disabled by using the /Za compiler option, but others remain in effect. It isn't possible to specify strict C89 conformance. The compiler doesn't implement several required features of C99, so it isn't possible to specify C99 conformance, either.

-> C99 is not fully supported. Same eith MSVC 2026,

@kkarsten62
Copy link
Contributor

I compiled QMS-980 from your branch testing-stuff on Fedora 43 with Qt Creator 17.0.2, Qt 6.10.1 GCC 15.2.1 20251211, (Red Hat 15.2.1-5), x86_64.

No errors, but 2 warnings during compilation:

  1. New
[  9%] Building CXX object 3rdparty/GarminFitSdk/CMakeFiles/GarminFit.dir/cpp/fit_mesg.cpp.o
/home/karl/GPS/qmapshack_kiozen/3rdparty/alglib/src/ap.cpp: In function ‘void alglib_impl::ae_spin_wait(ae_int_t)’:
/home/karl/GPS/qmapshack_kiozen/3rdparty/alglib/src/ap.cpp:4613:21: warning: ‘++’ expression of ‘volatile’-qualified type is deprecated [-Wvolatile]
 4613 |     for(i=0; i<cnt; i++)
      |                     ^
/home/karl/GPS/qmapshack_kiozen/3rdparty/alglib/src/ap.cpp:4615:13: warning: ‘--’ expression of ‘volatile’-qualified type is deprecated [-Wvolatile]
 4615 |             ae_never_change_it--;
      |             ^~~~~~~~~~~~~~~~~~
[  9%] Building CXX object 3rdparty/GarminFitSdk/CMakeFiles/GarminFit.dir/cpp/fit_mesg_definition.cpp.o
[
  1. Existing since we switch to Qt6
[ 83%] Building CXX object src/qmapshack/CMakeFiles/qmapshack.dir/mouse/CMouseWptBubble.cpp.o
/home/karl/GPS/qmapshack_kiozen/src/qmapshack/map/garmin/CGarminTyp.cpp: In member function ‘virtual bool CGarminTyp::parsePolyline(QDataStream&, QMap<unsigned int, polyline_property>&)’:
/home/karl/GPS/qmapshack_kiozen/src/qmapshack/map/garmin/CGarminTyp.cpp:842:49: warning: ‘QImage QImage::mirrored(bool, bool) const &’ is deprecated: Use flipped(Qt::Orientations) instead [-Wdeprecated-declarations]
  842 |       property.imgDay = property.imgDay.mirrored(false, true);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/qt6/QtGui/qpixmap.h:13,
                 from /usr/include/qt6/QtGui/qicon.h:10,
                 from /usr/include/qt6/QtGui/qabstractfileiconprovider.h:10,
                 from /usr/include/qt6/QtGui/QtGui:5,
                 from /home/karl/GPS/qmapshack_kiozen/src/qmapshack/map/garmin/CGarminTyp.h:22,
                 from /home/karl/GPS/qmapshack_kiozen/src/qmapshack/map/garmin/CGarminTyp.cpp:22:
/usr/include/qt6/QtGui/qimage.h:220:26: note: declared here
  220 |     [[nodiscard]] QImage mirrored(bool horizontally = false, bool vertically = true) const &
      |                          ^~~~~~~~
/home/karl/GPS/qmapshack_kiozen/src/qmapshack/map/garmin/CGarminTyp.cpp:843:53: warning: ‘QImage QImage::mirrored(bool, bool) const &’ is deprecated: Use flipped(Qt::Orientations) instead [-Wdeprecated-declarations]
  843 |       property.imgNight = property.imgNight.mirrored(false, true);
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/usr/include/qt6/QtGui/qimage.h:220:26: note: declared here
  220 |     [[nodiscard]] QImage mirrored(bool horizontally = false, bool vertically = true) const &
      |                          ^~~~~~~~
[ 84%] Building CXX object src/qmapshack/CMakeFiles/qmapshack.dir/mouse/CScrOptPrint.cpp.o

I tested the new option in Workspace > Setup Workspace:

  1. No sum calculation of Ascent/Descent in project when one of the project tracks has no elevation data (DEMs were inactive when creating)
image
  1. Personal view
    Very helpful new feature - may thanks :-).
    But for me its a bit irritating that we have now 2 closing procedure in the Setup Workspace dialog. For the DB/Device related stuff we have to restart QMS (two buttons) and the new options will have immediately effect (one buttons). May be we can separate a bit better, may be two tabs on top, one for the DB/device stuff and one tab for the new options? Or even more tabs: Saving | Database | Devices | Display?

@kiozen
Copy link
Collaborator Author

kiozen commented Feb 20, 2026

@JFritzle Windows was my least concern as they seem to have introduced anonymous structs in their c++ compiler first. My concerns are more MacOS if you are using clang.

@kkarsten62 Thanks for feedback.

Compiler warning 1: Yes that is alglib snafu. Maybe I should check if it is fixed in a newer version. Maybe we can remove the code completely. Depends a bit on how distributions bundle it these days. Ages ago they ignored it because there was no real build environment.

Compiler warning 2: Yes I know. I would need in increase the minimum Qt version for that. And that would probably break some distributions.

Sum calculation: Yes I known. This is by intention. It's a bit of a point of view. Is it sensible to show a total sum if one of the elements is missing? I would say no.

O, cancel, close:

Device related stuff we have to restart QMS (two buttons) and the new options will have immediately effect (one buttons). May be we can separate a bit better, may be two tabs on top, one for the DB/device stuff and one tab for the new options? Or even more tabs: Saving | Database | Devices | Display?

I give it a thought and rebuild the dialog.

@JFritzle
Copy link
Contributor

With macOS Sonoma, clang compiler is version 15.0.0.

man clang reports:

-std=<standard>
       Specify the language standard to compile for.

       Supported values for the C language are:
           ...
           c99
           iso9899:1999
              ISO C 1999
           gnu99
              ISO C 1999 with GNU extensions
           ...
The default C language standard is gnu17, except on PS4, where it is gnu99.

       Supported values for the C++ language are:
           ...
           c++20
              ISO C++ 2020 with amendments
           gnu++20
              ISO C++ 2020 with amendments and GNU extensions
           ...
The default C++ language standard is gnu++98.

@eyzdh
Copy link

eyzdh commented Feb 20, 2026

macOS26 Clan Version should be 17.

In my Building Log i had (i know is macOS not Linux)

  1. no Warning

  2. Just a clang++: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]

@JFritzle
Copy link
Contributor

Option -lm causing clang warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
is caused by line 146ff of file CMakeLists.txt:

    146 if(UNIX)
    147     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -lm")
    148     add_definitions(-Wall -Wpedantic -Wno-switch -Wno-strict-aliasing)
    ...

As macOS is a UNIX operating system too, these flags gets appended to macOS specific flags defined by
if (APPLE) at lines 79ff.

Option -lm does not make sense when only compiling.
It makes sense when compiler internally calls linker and passes this option to linker.

Changing line 146 to if (UNIX AND NOT APPLE) would probably avoid warning. Not checked for side effects!

@kiozen
Copy link
Collaborator Author

kiozen commented Feb 20, 2026

Or test if -lm needs to be added anyways. It's the math lib and I would expect it to be default anyways. If not add_link_options should be used instead of set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lm"). Can you please test both fixes. If one of them is working I can fix the CMakeLists.xtx

@JFritzle
Copy link
Contributor

Removing line set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lm") at all prevents from
warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
and nevertheless builds executables successfully.

File CMakeLists.txt now contains

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 99)

which leads at compiling time to flags
-Wall -std=c++11 -stdlib=libc++ -Wsuggest-override -Woverloaded-virtual -O3 -DNDEBUG -std=gnu++20 -arch x86_64 -mmacosx-version-min=12.0 -fPIC -Wall -Wpedantic -Wno-switch -Wno-strict-aliasing -fms-extensions -MD -MT
-> flag -std=c++11 is overriden by -std=gnu++20. Thus, first one can get removed.
-> flag -Wall is defined twice.

Compiling GarminFitSdk on macOS throws warning
warning: unknown warning option '-Wno-catch-value'; did you mean '-Wno-unused-value'? [-Wunknown-warning-option]
Option -Wno-unused-value is set in 3rdparty/GarminFitSdk/CMakeLists.txt.

If we are talking about compiler warnings, there are at least some more beside of mentioned ones:

/Users/user/qmstest/qmapshack/src/qmt_rgb2pct/main.cpp:58:8: warning: macro 'Q_OS_OSX' has been marked as deprecated: use Q_OS_MACOS instead [-Wdeprecated-pragma]
#ifdef Q_OS_OSX
       ^
/usr/local/opt/qt@6/lib/QtCore.framework/Headers/qsystemdetection.h:172:64: note: macro marked 'deprecated' here
#    pragma clang deprecated(Q_OS_OSX, "use Q_OS_MACOS instead")
                                                               ^
/Users/user/qmstest/qmapshack/src/qmt_map2jnx/main.cpp:378:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
  sprintf(buf, "%X", r & 0x0F);
  ^
/Users/user/qmstest/qmapshack/src/qmapshack/mouse/range/CScrOptRangeTool.h:92:29: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
  QVector<fAction> actions{[this]() {}, [this]() { slotResetRange(); },
                            ^~~~
/Users/user/qmstest/qmapshack/src/common/gis/GeoMath.cpp:37:21: warning: unused function 'distance' [-Wunused-function]
static inline qreal distance(const QPointF& pa, const QPointF& pb) {
                    ^
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListDB.cpp:284:10: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
    case eEvtW2DCreate: {
         ^~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListDB.cpp:269:10: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
    case eEvtW2DAckInfo: {
         ^~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/common/gis/GeoMath.cpp:37:21: warning: unused function 'distance' [-Wunused-function]
static inline qreal distance(const QPointF& pa, const QPointF& pb) {
                    ^
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListDB.cpp:284:10: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
    case eEvtW2DCreate: {
         ^~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListDB.cpp:269:10: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
    case eEvtW2DAckInfo: {
         ^~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2141:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtA2WSync: {
           ^~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2129:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtA2WSave: {
           ^~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2122:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtA2WCutTrk: {
           ^~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2101:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtD2WReload: {
           ^~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2090:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtD2WUpdateItems: {
           ^~~~~~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2079:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtD2WUpdateLnF: {
           ^~~~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2067:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtD2WHideItems: {
           ^~~~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2056:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtD2WShowItems: {
           ^~~~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2037:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtD2WHideFolder: {
           ^~~~~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2017:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtD2WShowFolder: {
           ^~~~~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/CGisListWks.cpp:2006:12: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
      case eEvtD2WReqInfo: {
           ^~~~~~~~~~~~~~
/Users/user/qmstest/qmapshack/src/qmapshack/gis/db/CSearchDatabase.cpp:183:10: warning: comparison of different enumeration types in switch statement ('Type' and 'event_types_e') [-Wenum-compare-switch]
    case eEvtW2DAckInfo: {
         ^~~~~~~~~~~~~~
In file included from /Users/user/qmstest/qmapshack/src/qmapshack/gis/fit2/CFit2Project.cpp:19:
/Users/user/qmstest/qmapshack/src/qmapshack/gis/fit2/CFit2Project.h:91:15: warning: private field 'recordType' is not used [-Wunused-private-field] 
  eRecordType recordType{eRecordType::Activity};
              ^
/Users/user/qmstest/qmapshack/src/qmapshack/gis/trk/CGisItemTrk.cpp:135:22: warning: unused function 'operator|' [-Wunused-function]
inline constexpr int operator|(CTrackData::trkpt_t::invalid_e e2, CTrackData::trkpt_t::valid_e e1) {
                     ^

@mitxel-m
Copy link
Contributor

Compiled on LMDE7 and working for me.

Thanks for this work!

In the setup dialog I would replace GIS item Statistic to Item count

@kiozen kiozen force-pushed the testing_stuff branch 2 times, most recently from bd7ac70 to 0363931 Compare February 20, 2026 18:00
@kiozen
Copy link
Collaborator Author

kiozen commented Feb 20, 2026

Ok, I killed a few of the warnings. I made the setup a tab widget with 2 tabs. And I fixed "GIS item Statistic".

@mitxel-m
Copy link
Contributor

Tested and working for me.

It looks much better now with separated tabs. :-)

Selección_104

.
By chance, I found a strange behavior when someone tries to drag and drop items to manually change their order (even though it is not possible).

Selección_109

.
An empty line is generated for each drag and drop attempt.So if you do this several times, it can end up looking something like this:

Selección_110

.
Collapsing and expanding the project does not clear them. If you reorder by name or date, they are not removed either.

Selección_111

.
It's not a big problem, and everything is fine in the next QMS session, but it is strange.

@kiozen
Copy link
Collaborator Author

kiozen commented Feb 21, 2026

Good catch! Fixed. I block drop action for items in the same project, now.

And nice icons 😄

@kiozen
Copy link
Collaborator Author

kiozen commented Feb 21, 2026

ok, I merge it. Everything else is a bug ticket. 🐛

@kiozen kiozen merged commit 1622e19 into Maproom:dev Feb 21, 2026
@wthaem
Copy link
Contributor

wthaem commented Feb 21, 2026

Referring to the first contribution in this PR:

Compiled commit 1622e19 with Windows 11, MSVC 2026, Ninja generator. I got the following new warnings:

[160/475] Building CXX object src\qmapshack\CMakeFiles\qmapshack.dir\gis\CWksItemDelegate.cpp.obj
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis\CWksItemDelegate.h(34): warning C4068: Unbekanntes Pragma "GCC".
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis\CWksItemDelegate.h(35): warning C4068: Unbekanntes Pragma "GCC".
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis\CWksItemDelegate.h(82): warning C4068: Unbekanntes Pragma "GCC".
[166/475] Building CXX object src\qmapshack\CMakeFiles\qmapshack.dir\gis\CGisListWks.cpp.obj
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis/CWksItemDelegate.h(34): warning C4068: Unbekanntes Pragma "GCC".
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis/CWksItemDelegate.h(35): warning C4068: Unbekanntes Pragma "GCC".
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis/CWksItemDelegate.h(82): warning C4068: Unbekanntes Pragma "GCC".
[168/475] Building CXX object src\qmapshack\CMakeFiles\qmapshack.dir\gis\CSetupWorkspace.cpp.obj
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis/CWksItemDelegate.h(34): warning C4068: Unbekanntes Pragma "GCC".
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis/CWksItemDelegate.h(35): warning C4068: Unbekanntes Pragma "GCC".
D:\QtProjects\QMS\QMS4Qt6\src\qmapshack\gis/CWksItemDelegate.h(82): warning C4068: Unbekanntes Pragma "GCC".

There are older warnings with codes d4996 d4101 d4005 d4003 which I suppressed in the build process (not sure if 4996/4101/4005 still exist, 4003 happened in the last time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants