Hello,

i'm working on a large project and i would like to be able to do as follows:
Qt Code:
  1. typedef qreal Ratio;
  2. typedef qreal PositiveRatio;
  3. typedef qreal NegativeRatio;
  4. Q_DECLARE_METATYPE(Ratio);
  5. Q_DECLARE_METATYPE(PositiveRatio);
  6. Q_DECLARE_METATYPE(NegativeRatio);
To copy to clipboard, switch view to plain text mode 
However, the compiler doesn't like it, and only accepts to register the first one.

My question is, how can i register metatypes based on the same underlying type as different types? What would be the trick if any?

Thanks,
Pierre.

[edit:] The goal is to provide different edition widgets, like that, in my editors factory:
Qt Code:
  1. /* ... */
  2. else if (t==qMetaTypeId<Ratio>() || t==qMetaTypeId<PositiveRatio>() || t==qMetaTypeId<NegativeRatio>()) {
  3. QDoubleSpinBox *spnBx = new QDoubleSpinBox(p);
  4. spnBx->setRange(t==qMetaTypeId<PositiveRatio>() ? 0.0 : -1.0, t==qMetaTypeId<NegativeRatio>() ? 0.0 : 1.0);
  5. spnBx->setSingleStep (.05);
  6. return spnBx;
  7. }
  8. /* ... */
To copy to clipboard, switch view to plain text mode 
[/edit]