Forum: Ruby Ruby QT Hiding the mouse

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Michael P. (Guest)
on 2008-12-09 05:00
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?
Stefano C. (Guest)
on 2008-12-09 09:29
(Received via mailing list)
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
Erika (Guest)
on 2008-12-09 11:14
(Received via mailing list)
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
Erika (Guest)
on 2008-12-09 11:30
(Received via mailing list)
Sorry, I wanted to create a new post only by mistake I gave reply to
your post.
Sorry again.
Robert D. (Guest)
on 2008-12-09 17:40
(Received via mailing list)
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{<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.

--
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
Re:
mutati0n mutati0n (Guest)
on 2008-12-10 01:06
(Received via mailing list)
not at all
This topic is locked and can not be replied to.