Class: Qt::MainWindow
Instance Attribute Summary collapse
-
#guis ⇒ Object
readonly
Returns the value of attribute guis.
Instance Method Summary collapse
- #caption=(title) ⇒ Object
-
#initialize(parent) ⇒ MainWindow
constructor
A new instance of MainWindow.
- #saveGUI ⇒ Object
- #setGUI(gui) ⇒ Object
Constructor Details
#initialize(parent) ⇒ MainWindow
Returns a new instance of MainWindow.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rui/toolkits/qt/qt.rb', line 46 def initialize(parent) super(parent) setToolButtonStyle(Qt::ToolButtonFollowStyle) # create basic GUI @guis = [] @gui = Qt::gui(:qt_base) do |g| g. do |mb| mb.merge_point mb.(:settings, :text => KDE::i18n("&Settings")) mb.(:help, :text => KDE::i18n("&Help")) do |m| m.action :about m.action :about_qt end end end end |
Instance Attribute Details
#guis ⇒ Object (readonly)
Returns the value of attribute guis.
44 45 46 |
# File 'lib/rui/toolkits/qt/qt.rb', line 44 def guis @guis end |
Instance Method Details
#caption=(title) ⇒ Object
99 100 101 102 |
# File 'lib/rui/toolkits/qt/qt.rb', line 99 def (title) self.window_title = $qApp.application_name.capitalize + " - " + title end |
#saveGUI ⇒ Object
90 91 92 93 94 95 96 97 |
# File 'lib/rui/toolkits/qt/qt.rb', line 90 def saveGUI settings = Qt::Settings.new settings.begin_group("mainwindow") settings.set_value("geometry", Qt::Variant.new(save_geometry)) settings.set_value("state", Qt::Variant.new(save_state)) settings.end_group settings.sync end |
#setGUI(gui) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/rui/toolkits/qt/qt.rb', line 65 def setGUI(gui) regular_action(:about, :text => KDE::i18n("&About")) do Qt::MessageBox.about(nil, $qApp.data[:name], [$qApp.data[:description], $qApp.data[:copyright]].join("\n")) end regular_action(:about_qt, :text => KDE::i18n("About &Qt")) { $qApp.about_qt } @gui.merge!(gui) @guis.each {|g| @gui.merge! g } RUI::GuiBuilder.build(self, @gui) # restore state settings = Qt::Settings.new state = nil geometry = nil if settings.contains("mainwindow/state") state = settings.value("mainwindow/state").toByteArray geometry = settings.value("mainwindow/geometry").toByteArray restore_geometry(geometry) restore_state(state) end end |