slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.56k stars 604 forks source link

Naming issue regarding "_" or "-" with struct type #4659

Closed JosiahBLB closed 8 months ago

JosiahBLB commented 8 months ago

Hi slint team, just thought I would report a bug (or maybe I missed something in the docs), I made a struct called Palette_t which failed my build, but when changed to PaletteT it fixed it.

The error:

/Users/anon/projects/cpp_projects/StudyApp/build/appwindow.h:5:14: error: expected unqualified-id
class Palette-t {
             ^

My file structure:

├── CMakeLists.txt
├── compile_commands.json
├── LICENSE
├──  README.md
├──  src
│   └──  main.cpp
└──  ui
    ├──  appwindow.slint
    ├──  assets
    │   └── icons
    │       └── icon.svg
    └── palette.slint

In palette.slint:

struct Palette_t {
    primary: color,
    secondary: color,
}

export global Palette {
    in-out property<Palette_t> light: { ... }
    in-out property<Palette_t> dark: { ... }
}
ogoffart commented 8 months ago

Thanks a lot for the bug report.
This is being fixed in https://github.com/slint-ui/slint/pull/4660