Papierkorb / qt5.cr

Qt5 bindings for Crystal, based on Bindgen
Mozilla Public License 2.0
211 stars 20 forks source link

Qt 5.14 errors #31

Open docelic opened 4 years ago

docelic commented 4 years ago

Initial output of trying to build for Qt 5.14:

=> Generating bindings for all platforms (1/1) Generating linux-gnu-x86_64-qt5.14 Invalid alias name "QAbstractSpinBox::StepType" at Qt::Binding::QAbstractSpinBox::StepType Invalid alias name "Qt::HighDpiScaleFactorRoundingPolicy" at Qt::Binding::Qt::HighDpiScaleFactorRoundingPolicy Invalid alias name "QTextDocument::MarkdownFeatures" at Qt::Binding::QTextDocument::MarkdownFeatures Invalid alias name "QGradient::Preset" at Qt::Binding::QGradient::Preset Invalid alias name "QTextBlockFormat::MarkerType" at Qt::Binding::QTextBlockFormat::MarkerType Result type QAbstractSpinBox::StepType is unreachable at Qt::Binding#stepType() Argument 2 has unreachable type QAbstractSpinBox::StepType at Qt::Binding#setStepType(stepType) Result type QAbstractSpinBox::StepType is unreachable at Qt::Binding#stepType() Argument 2 has unreachable type QAbstractSpinBox::StepType at Qt::Binding#setStepType(stepType) Argument 1 has unreachable type Qt::HighDpiScaleFactorRoundingPolicy at Qt::Binding.setHighDpiScaleFactorRoundingPolicy(policy) Result type Qt::HighDpiScaleFactorRoundingPolicy is unreachable at Qt::Binding.highDpiScaleFactorRoundingPolicy() Argument 2 has unreachable type QTextDocument::MarkdownFeatures at Qt::Binding#toMarkdown(features) Argument 2 has unreachable type QTextDocument::MarkdownFeatures at Qt::Binding#toMarkdown(features) Argument 3 has unreachable type QTextDocument::MarkdownFeatures at Qt::Binding#setMarkdown(markdown, features) Argument 6 has unreachable type QGradient::Preset at Qt::Binding#fillRect(x, y, w, h, preset) Argument 3 has unreachable type QGradient::Preset at Qt::Binding#fillRect(r, preset) Argument 3 has unreachable type QGradient::Preset at Qt::Binding#fillRect(r, preset) Argument 2 has unreachable type QTextBlockFormat::MarkerType at Qt::Binding#setMarker(marker) Result type QTextBlockFormat::MarkerType is unreachable at Qt::Binding#marker() Result type Binding::QAbstractSpinBox::StepType is unreachable at Qt::SpinBox#stepType() Argument 1 has unreachable type Binding::QAbstractSpinBox::StepType at Qt::SpinBox#setStepType(stepType) Result type Binding::QAbstractSpinBox::StepType is unreachable at Qt::DoubleSpinBox#stepType() Argument 1 has unreachable type Binding::QAbstractSpinBox::StepType at Qt::DoubleSpinBox#setStepType(stepType) Argument 1 has unreachable type Binding::Qt::HighDpiScaleFactorRoundingPolicy at Qt::GuiApplication.setHighDpiScaleFactorRoundingPolicy(policy) Result type Binding::Qt::HighDpiScaleFactorRoundingPolicy is unreachable at Qt::GuiApplication.highDpiScaleFactorRoundingPolicy() Argument 1 has unreachable type Binding::QTextDocument::MarkdownFeatures at Qt::TextEdit#toMarkdown(features) Argument 1 has unreachable type Binding::QTextDocument::MarkdownFeatures at Qt::TextDocument#toMarkdown(features) Argument 2 has unreachable type Binding::QTextDocument::MarkdownFeatures at Qt::TextDocument#setMarkdown(markdown, features) Argument 5 has unreachable type Binding::QGradient::Preset at Qt::Painter#fillRect(x, y, w, h, preset) Argument 2 has unreachable type Binding::QGradient::Preset at Qt::Painter#fillRect(r, preset) Argument 2 has unreachable type Binding::QGradient::Preset at Qt::Painter#fillRect(r, preset) Argument 1 has unreachable type Binding::QTextBlockFormat::MarkerType at Qt::TextBlockFormat#setMarker(marker) Result type Binding::QTextBlockFormat::MarkerType is unreachable at Qt::TextBlockFormat#marker() Found 33 errors. Aborting. Failed to build linux-gnu-x86_64-qt5.14 using Qt5.14 on x86_64-unknown-linux-gnu - Abort.

ZaWertun commented 4 years ago

To fix this you has to modify config/enums.yml, like in this commit that fixes build for Qt-5.13: https://github.com/ZaWertun/qt5.cr/commit/87b14713ff457b234766ec833719154923b667d6. See that I've added mappings for QGradient::Preset and QAbstractSpinBox::StepType.

ZaWertun commented 4 years ago

I'll try to fix this and make PR.

docelic commented 4 years ago

Hey, sure, just listed it here due to a question in #20. I already added some, but will wait for your PR then not to duplicate effort. Thanks!

docelic commented 4 years ago

@ZaWertun speaking of which, are you aware of a way to add entries depending on version? From what I see here, once we add e.g. new enum entries, older versions no longer build, erroring out with:

Enum doesn't have any constants at <enum name>
ZaWertun commented 4 years ago

@ZaWertun speaking of which, are you aware of a way to add entries depending on version? From what I see here, once we add e.g. new enum entries, older versions no longer build, erroring out with:

Enum doesn't have any constants at <enum name>

Didn't think about it. I think we need some enum mappings defined only in Qt >= 5.13 for example. Could it be done in current bindgen version?

ZaWertun commented 4 years ago

@ZaWertun speaking of which, are you aware of a way to add entries depending on version? From what I see here, once we add e.g. new enum entries, older versions no longer build, erroring out with:

Enum doesn't have any constants at <enum name>

Or maybe that check is wrong...

docelic commented 4 years ago

I think we need some enum mappings defined only in Qt >= 5.13 for example. Could it be done in current bindgen version?

I did a quick search and didn't find an example of it. It seems that if_* can only compare against strings and regexes. I also wonder how Stefan was able to generate bindings for those 4 or 5 Qt versions without needing this feature.

ZaWertun commented 4 years ago

I think we need some enum mappings defined only in Qt >= 5.13 for example. Could it be done in current bindgen version?

I did a quick search and didn't find an example of it. It seems that if_* can only compare against strings and regexes. I also wonder how Stefan was able to generate bindings for those 4 or 5 Qt versions without needing this feature.

Maybe we need something like this conditions syntax in YML files for bindgen:

Papierkorb commented 4 years ago

@ZaWertun Yeah that would be the ideal addition. The syntax I chose is X_(is|isnt|match)_Y to be as readable as possible (Without the reader scouring some docs on that syntax). Maybe there's a syntax possible in that vein like X_olderthan_Y. Why it's not there yet? I guess I didn't need it, can't remember really.

ZaWertun commented 4 years ago

@ZaWertun Yeah that would be the ideal addition. The syntax I chose is X_(is|isnt|match)_Y to be as readable as possible (Without the reader scouring some docs on that syntax). Maybe there's a syntax possible in that vein like X_olderthan_Y. Why it's not there yet? I guess I didn't need it, can't remember really.

Maybe just call it newer / older? (newer_or_equals / older_or_equals)

docelic commented 4 years ago

Hey how about we just rename newer and older to newer_or and older_or before this gets used in practice? This small rename could better capture the inclusion of equal (">="/"<="), and also it would not clash with possible future addition of real newer/older which does not imply the "=".

ZaWertun commented 4 years ago

Hey how about we just rename newer and older to newer_or and older_or before this gets used in practice? This small rename could better capture the inclusion of equal (">="/"<="), and also it would not clash with possible future addition of real newer/older which does not imply the "=".

Looks good.