[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

qtruby: updating widgets' display

Bauduin Raphael

12/26/2004 5:45:00 PM

Hi,

When calling this method:

def create_tab_widget
puts "creating tabs widget"
@TailTabs = Qt::TabWidget.new(centralWidget(), "@TailTabs")
@TailTabs.setSizePolicy( Qt::SizePolicy.new(7, 7, 2, 3,
@TailTabs.sizePolicy().hasHeightForWidth()) )

@tab = Qt::Widget.new(@TailTabs, "@tab")
@tabLayout = Qt::VBoxLayout.new(@tab, 11, 6, '@tabLayout')
@TailTabs.insertTab(@tab, trUtf8("Tab 1"))
@Form1Layout.addWidget(@TailTabs)
update
end

in initialize, the widget is created and displayed.

When calling from another method, the widget is created but not displayed.

Any hints?

Thanks.

Raph
2 Answers

Richard Dale

12/28/2004 11:27:00 AM

0

Bauduin Raphael wrote:

> Hi,
>
> When calling this method:
>
> def create_tab_widget
> puts "creating tabs widget"
> @TailTabs = Qt::TabWidget.new(centralWidget(), "@TailTabs")
> @TailTabs.setSizePolicy( Qt::SizePolicy.new(7, 7, 2, 3,
> @TailTabs.sizePolicy().hasHeightForWidth()) )
>
> @tab = Qt::Widget.new(@TailTabs, "@tab")
> @tabLayout = Qt::VBoxLayout.new(@tab, 11, 6, '@tabLayout')
> @TailTabs.insertTab(@tab, trUtf8("Tab 1"))
> @Form1Layout.addWidget(@TailTabs)
> update
> end
>
> in initialize, the widget is created and displayed.
>
> When calling from another method, the widget is created but not displayed.
>
> Any hints?
It's difficult to know what's going wrong without seeing the full context in
which the method is called. Could you either post the whole program, or
email it to me if it's too big? The documentation for QWidget::update()
says:

"This function does not cause an immediate repaint; instead it schedules a
paint event for processing when Qt returns to the main event loop."

Your previous problem was related to ruby threads not working with QtRuby
calls. So is this a problem with ruby threads messing up the Qt main event
loop, and the paint event getting lost somehow?

-- Richard

Richard Dale

12/28/2004 11:27:00 AM

0

Bauduin Raphael wrote:

> Hi,
>
> When calling this method:
>
> def create_tab_widget
> puts "creating tabs widget"
> @TailTabs = Qt::TabWidget.new(centralWidget(), "@TailTabs")
> @TailTabs.setSizePolicy( Qt::SizePolicy.new(7, 7, 2, 3,
> @TailTabs.sizePolicy().hasHeightForWidth()) )
>
> @tab = Qt::Widget.new(@TailTabs, "@tab")
> @tabLayout = Qt::VBoxLayout.new(@tab, 11, 6, '@tabLayout')
> @TailTabs.insertTab(@tab, trUtf8("Tab 1"))
> @Form1Layout.addWidget(@TailTabs)
> update
> end
>
> in initialize, the widget is created and displayed.
>
> When calling from another method, the widget is created but not displayed.
>
> Any hints?
It's difficult to know what's going wrong without seeing the full context in
which the method is called. Could you either post the whole program, or
email it to me if it's too big? The documentation for QWidget::update()
says:

"This function does not cause an immediate repaint; instead it schedules a
paint event for processing when Qt returns to the main event loop."

Your previous problem was related to ruby threads not working with QtRuby
calls. So is this a problem with ruby threads messing up the Qt main event
loop, and the paint event getting lost somehow?

-- Richard