Frage

According to Gtkmm docs Gtk::Scale::Scale is overloaded constructor and can take nothing or Gtk::Orientation.

I created object:

Gtk::Scale m_scale;

And added it to Gtk::HBox

hbox.pack_start(m_scale, false, 0);

But it produces error:

 error: call of overloaded ‘Scale()’ is ambiguous

And it tells me that candidates are Gtk::Scale without any parameter and one with Gtk::Orientation.

How should I force to use Gtk::Scale constructor without parameters?

Thanks, S.

War es hilfreich?

Lösung

It seems like the constructor taking Gtk::Orientation has a default value for that parameter, therefore it can also be called with no arguments:

public:
  Scale();
  explicit Scale(Orientation orientation = ORIENTATION_HORIZONTAL);

The keyword explicit here does not help, it only possibly disallows converting anything passed in to the Orientation type for it to match.

I say just provide the orientation value, it will at least be explicitly apparent which kind of Scale widget you are creating for anyone else reading the code.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top