Module: QtFlags
- Included in:
- ObjectTableModel, Qt::CheckBox
- Defined in:
- lib/qtext/flags.rb
Overview
The Qt bindings look up constants for each call. This module
caches the constant values. Most of these are called for each
cell in a table, so caching them gives us a good performance
increase.
Instance Method Summary collapse
-
#const_as_string(constant) ⇒ Object
ewww.
- #item_boolean_flags ⇒ Object
- #qt_aligncenter ⇒ Object
- #qt_alignleft ⇒ Object
- #qt_alignright ⇒ Object
- #qt_background_role ⇒ Object
- #qt_checked ⇒ Object
- #qt_checkstate_role ⇒ Object
- #qt_decoration_role ⇒ Object
- #qt_display_role ⇒ Object
- #qt_edit_role ⇒ Object
- #qt_font_role ⇒ Object
- #qt_foreground_role ⇒ Object
- #qt_item_is_editable ⇒ Object
- #qt_paste_role ⇒ Object
- #qt_size_hint_role ⇒ Object
- #qt_text_alignment_role ⇒ Object
- #qt_tooltip_role ⇒ Object
- #qt_unchecked ⇒ Object
Instance Method Details
#const_as_string(constant) ⇒ Object
ewww
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/qtext/flags.rb', line 83 def const_as_string( constant ) case constant when qt_text_alignment_role; 'Qt::TextAlignmentRole' when qt_checkstate_role; 'Qt::CheckStateRole' when qt_edit_role; 'Qt:EditRole' when qt_display_role; 'Qt::DisplayRole' when Qt::ToolTipRole; 'Qt::ToolTipRole' when Qt::StatusTipRole; 'Qt::StatusTipRole' when Qt::DecorationRole; 'Qt::DecorationRole' when Qt::BackgroundRole; 'Qt::BackgroundRole' when Qt::FontRole; 'Qt::FontRole' when Qt::ForegroundRole; 'Qt::ForegroundRole' when Qt::TextColorRole; 'Qt::TextColorRole' else "#{constant} unknown" end end |
#item_boolean_flags ⇒ Object
10 11 12 |
# File 'lib/qtext/flags.rb', line 10 def item_boolean_flags @item_boolean_flags ||= Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable end |
#qt_aligncenter ⇒ Object
58 59 60 |
# File 'lib/qtext/flags.rb', line 58 def qt_aligncenter @qt_aligncenter ||= Qt::AlignCenter end |
#qt_alignleft ⇒ Object
50 51 52 |
# File 'lib/qtext/flags.rb', line 50 def qt_alignleft @qt_alignleft ||= Qt::AlignLeft end |
#qt_alignright ⇒ Object
54 55 56 |
# File 'lib/qtext/flags.rb', line 54 def qt_alignright @qt_alignright ||= Qt::AlignRight end |
#qt_background_role ⇒ Object
66 67 68 |
# File 'lib/qtext/flags.rb', line 66 def qt_background_role @qt_background_role ||= Qt::BackgroundRole end |
#qt_checked ⇒ Object
42 43 44 |
# File 'lib/qtext/flags.rb', line 42 def qt_checked @qt_checked ||= Qt::Checked end |
#qt_checkstate_role ⇒ Object
30 31 32 |
# File 'lib/qtext/flags.rb', line 30 def qt_checkstate_role @qt_checkstate_role ||= Qt::CheckStateRole end |
#qt_decoration_role ⇒ Object
62 63 64 |
# File 'lib/qtext/flags.rb', line 62 def qt_decoration_role @qt_decoration_role ||= Qt::DecorationRole end |
#qt_display_role ⇒ Object
18 19 20 |
# File 'lib/qtext/flags.rb', line 18 def qt_display_role @qt_display_role ||= Qt::DisplayRole end |
#qt_edit_role ⇒ Object
22 23 24 |
# File 'lib/qtext/flags.rb', line 22 def qt_edit_role @qt_edit_role ||= Qt::EditRole end |
#qt_font_role ⇒ Object
70 71 72 |
# File 'lib/qtext/flags.rb', line 70 def qt_font_role @qt_font_role ||= Qt::FontRole end |
#qt_foreground_role ⇒ Object
74 75 76 |
# File 'lib/qtext/flags.rb', line 74 def qt_foreground_role @qt_foreground_role ||= Qt::ForegroundRole end |
#qt_item_is_editable ⇒ Object
14 15 16 |
# File 'lib/qtext/flags.rb', line 14 def qt_item_is_editable @qt_item_is_editable ||= Qt::ItemIsEditable end |
#qt_paste_role ⇒ Object
26 27 28 |
# File 'lib/qtext/flags.rb', line 26 def qt_paste_role @qt_paste_role ||= Qt::PasteRole end |
#qt_size_hint_role ⇒ Object
38 39 40 |
# File 'lib/qtext/flags.rb', line 38 def qt_size_hint_role @qt_size_hint_role ||= Qt::SizeHintRole end |
#qt_text_alignment_role ⇒ Object
34 35 36 |
# File 'lib/qtext/flags.rb', line 34 def qt_text_alignment_role @qt_text_alignment_role ||= Qt::TextAlignmentRole end |