Ruby QT Hiding the mouse


#1

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?


#2

Alle Tuesday 09 December 2008, Michael Pope ha scritto:

widget.show()

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


#3

Sorry, I wanted to create a new post only by mistake I gave reply to
your post.
Sorry again.


#4

Hi,

I have to check the body of the email which is a html code, like the
following:

Text1: Text2

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

#5

not at all


#6

On Tue, Dec 9, 2008 at 10:05 AM, Erika removed_email_address@domain.invalid wrote:

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

ary = mail.scan( %r{

(.?) } ).
map{ |ttext| ttext.scan( %r{(.?)} )[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 :wink:

HTH
R.


Il computer non è una macchina intelligente che aiuta le persone
stupide, anzi, è 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