Class: MetaBuilder::ParameterTypes::FileParameter
- Inherits:
-
StringParameter
- Object
- MetaBuilder::ParameterType
- StringParameter
- MetaBuilder::ParameterTypes::FileParameter
- Defined in:
- lib/MetaBuilder/Parameters/strings.rb,
lib/MetaBuilder/Qt4/Parameters/strings.rb
Overview
An integer
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
The file filters, Qt style.
Instance Method Summary collapse
-
#initialize(type) ⇒ FileParameter
constructor
A new instance of FileParameter.
- #qt4_create_input_widget(parent = nil, target = nil, style = nil) ⇒ Object
-
#qt4_get(parent, title, label, default, target = nil) ⇒ Object
Directly wraps to Qt::FileDialog.get_open_file_name; the title is therefore ignored…
- #type_name ⇒ Object
Methods inherited from StringParameter
Methods inherited from MetaBuilder::ParameterType
#default_value, from_string, get_param_type, get_type, #lookup_const, #option_parser_long_option, #option_parser_option, #option_parser_raw, #string_to_type, #stt_run_hook, type_name, #type_to_string, #type_to_string_internal, #type_to_variant, #variant_to_type
Constructor Details
#initialize(type) ⇒ FileParameter
Returns a new instance of FileParameter.
47 48 49 50 |
# File 'lib/MetaBuilder/Parameters/strings.rb', line 47 def initialize(type) super(type) @filter = type[:filter] end |
Instance Attribute Details
#filter ⇒ Object (readonly)
The file filters, Qt style.
45 46 47 |
# File 'lib/MetaBuilder/Parameters/strings.rb', line 45 def filter @filter end |
Instance Method Details
#qt4_create_input_widget(parent = nil, target = nil, style = nil) ⇒ Object
28 29 30 |
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 28 def (parent = nil, target = nil, style = nil) return Qt4MB::FileInputWidget.new(parent, self) end |
#qt4_get(parent, title, label, default, target = nil) ⇒ Object
Directly wraps to Qt::FileDialog.get_open_file_name; the title is therefore ignored…
34 35 36 37 38 39 40 41 42 |
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 34 def qt4_get(parent, title, label, default, target = nil) file = Qt::FileDialog.get_open_file_name(parent, label, File.dirname(default), filter) if file.nil? raise CancelInput end end |
#type_name ⇒ Object
52 53 54 |
# File 'lib/MetaBuilder/Parameters/strings.rb', line 52 def type_name return 'file' end |