Ruby QT Hiding the mouse

M

Michael Pope

I'm currently trying to build an application using Ruby with QT which
just shows output from a log with colors and logos etc. I would like to
hide the mouse cursor if possible.

I have managed to hide the cursor on the application using:

# Start GUI
app = Qt::Application.new(ARGV)

widget = MyWidget.new(nil)
widget.show()

# set the cursor for the main area to blank.
widget.cursor = Qt::Cursor.new(Qt::BlankCursor)

# Start the app
app.exec()



But I cannot do the same for a TextEdit Widget.

How do I go about hiding the cursor on a TextEdit widget?
Or is it possible to say hide the cursor for every widget in my
application?
 
S

Stefano Crocco

Alle Tuesday 09 December 2008, Michael Pope ha scritto:
I'm currently trying to build an application using Ruby with QT which
just shows output from a log with colors and logos etc. I would like to
hide the mouse cursor if possible.

I have managed to hide the cursor on the application using:

# Start GUI
app = Qt::Application.new(ARGV)

widget = MyWidget.new(nil)
widget.show()

# set the cursor for the main area to blank.
widget.cursor = Qt::Cursor.new(Qt::BlankCursor)

# Start the app
app.exec()



But I cannot do the same for a TextEdit Widget.

How do I go about hiding the cursor on a TextEdit widget?
Or is it possible to say hide the cursor for every widget in my
application?

Qt::Widget#cursor= changes the cursor only for the receiver widget (in your
case, the instance of MyWidget), but not for its children or other widget. To
change the cursor for all widget, you can use
Qt::Application.override_cursor=. This is the method which you use, for
example, to display a busy cursor (which, of course, should affect all the
widget in the application, not just one).

However, in my opinion, hiding the cursor in a GUI application produces an
unexpected behaviour for the user who is quite likely to spend some time
looking around the screen to find out where the arrow has gone. Are you sure
this is what you want?

I hope this helps

Stefano
 
E

Erika

[Note: parts of this message were removed to make it a legal post.]

Hi,

I have to check the body of the email which is a html code, like the following:
<tr><td>Text1: </td>

<td>Text2</td>

I have to check that for "Text1" what "Text2" is shown, which can vary for different reasons.

I managed to get the emails, to check the subject of the email to identify the correct email, but I can't get to resolve this problem which I mentioned previously.

Thank you,
Erika

require 'net/pop'

pop = Net::pOP3.new('smtp server name')
pop.start('user', 'parola')
if pop.mails.empty?
puts 'No mail.'
else
i = 0
pop.each_mail do |m|
sbj=m.header.split("\r\n").grep(/^Subject:/)
rate=m.pop.grep(/^Test1/)
puts sbj
puts m.pop
i += 1
end
puts "#{pop.mails.size} mails popped."
end
pop.finish
 
R

Robert Dober

assuming that you have managed to pop your body into one string, what
about the following

ary =3D mail.scan( %r{<tr>(.*?)</tr>} ).
map{ |ttext| ttext.scan( %r{<td>(.*?)</td>} )[0..1] }

And if you want to have a hash

Hash[ *ary.flatten ]

and if Text2 happens to be the key

Hash[ *ary.map{|x| x.reverse}.flatten ]

It would be a nice exercise for you to optimize the solution for that
last case ;)

HTH
R.

--=20
Il computer non =E8 una macchina intelligente che aiuta le persone
stupide, anzi, =E8 una macchina stupida che funziona solo nelle mani
delle persone intelligenti.
Computers are not smart to help stupid people, rather they are stupid
and will work only if taken care of by smart people.

Umberto Eco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top