class ConfigDialog

Public Class Methods

new() click to toggle source
Calls superclass method
# File examples/dialogs/configdialog/configdialog.rb, line 32
def initialize()
    super
    @contentsWidget = Qt::ListWidget.new do |c|
        c.viewMode = Qt::ListView::IconMode
        c.iconSize = Qt::Size.new(96, 84)
        c.movement = Qt::ListView::Static
        c.maximumWidth = 128
        c.spacing = 12
    end

    @pagesWidget = Qt::StackedWidget.new do |p|
        p.addWidget(ConfigurationPage.new)
        p.addWidget(UpdatePage.new)
        p.addWidget(QueryPage.new)
    end

    closeButton = Qt::PushButton.new(tr("Close"))

    createIcons()
    @contentsWidget.currentRow = 0

    connect(closeButton, SIGNAL('clicked()'), self, SLOT('close()'))

    horizontalLayout = Qt::HBoxLayout.new do |h|
        h.addWidget(@contentsWidget)
        h.addWidget(@pagesWidget, 1)
    end

    buttonsLayout = Qt::HBoxLayout.new do |b|
        b.addStretch(1)
        b.addWidget(closeButton)
    end

    self.layout = Qt::VBoxLayout.new do |m|
        m.addLayout(horizontalLayout)
        m.addStretch(1)
        m.addSpacing(12)
        m.addLayout(buttonsLayout)
    end

    self.windowTitle = tr("Config Dialog")
end

Public Instance Methods

changePage(current, previous) click to toggle source
# File examples/dialogs/configdialog/configdialog.rb, line 102
def changePage(current, previous)
    if current.nil?
        current = previous
    end

    @pagesWidget.currentIndex = @contentsWidget.row(current)
end
createIcons() click to toggle source
# File examples/dialogs/configdialog/configdialog.rb, line 75
def createIcons
    configButton = Qt::ListWidgetItem.new(@contentsWidget) do |c|
        c.icon = Qt::Icon.new("images/config.png")
        c.text = tr("Configuration")
        c.textAlignment = Qt::AlignHCenter
        c.flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled
    end

    updateButton = Qt::ListWidgetItem.new(@contentsWidget) do |u|
        u.icon = Qt::Icon.new("images/update.png")
        u.text = tr("Update")
        u.textAlignment = Qt::AlignHCenter
        u.flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled
    end

    queryButton = Qt::ListWidgetItem.new(@contentsWidget) do |q|
        q.icon = Qt::Icon.new("images/query.png")
        q.text = tr("Query")
        q.textAlignment = Qt::AlignHCenter
        q.flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled
    end

    connect(@contentsWidget,
            SIGNAL('currentItemChanged(QListWidgetItem*, QListWidgetItem*)'),
            self, SLOT('changePage(QListWidgetItem*, QListWidgetItem*)'))
end