Getting tooltipped how cute Qt is…

I have seen others praising Qt. Thought they are just a little bit too euphoric. But then I never really had to code against the Win32 API or to use AWT, so perhaps I miss some experience in hell to recognize heaven.

And looking at Qt4 I especially miss to see brilliance if looking at the printing framework or the QDockWidget system, those are not really pleasing me and my needs. And connections of signals and slots not being checked at compile-time has always annoyed me.

But now and then I find solutions that are really making me happy:
Yesterday I wanted to add tooltip support to bookmarks in Okteta, so if hovering over a bookmark mark in the view the name of the bookmark (now editable) would be shown in a tooltip. After I had thought a while about how to achieve this, involving QTimer and mouse events, I was not too satisfied with my ideas and hoped this could be done easier. So I used a well known index service and was pointed to this coding example by the Trolls themselves, which showed me how to do this with just a few lines in a very straightforward way. I liked this. Thank you who made this possible πŸ™‚

It basically boiled down to (real code needs refactoring):


bool AbstractByteArrayViewPrivate::event( QEvent* event )
{
    Q_Q( AbstractByteArrayView );

    if( event->type() == QEvent::ToolTip )
    {
        QHelpEvent* helpEvent = static_cast( event );

        KHECore::Bookmark* bookmark = 0;

        KHECore::Bookmarkable* bookmarks = qobject_cast( mByteArrayModel );
        if( bookmarks )
        {
            const int index = indexByPoint( helpEvent->pos() );
            if( index != -1 )
                bookmark = bookmarks->bookmarkFor( index );
        }

        if( bookmark) )
            QToolTip::showText( helpEvent->globalPos(), bookmark->name() );
        else
        {
            QToolTip::hideText();
            event->ignore();
        }

        return true;
     }

    return q->ColumnsView::event( event );
}

So with KDE 4.3 you will have tooltips if hovering over bookmarks marks in Okteta. Have a good look at them, because you will loose all of them if closing the file they are set for, because storing the bookmarks will not be done in time for the hard feature freeze and has to wait for at least KDE 4.4, yes, a pity.

Advertisements

6 thoughts on “Getting tooltipped how cute Qt is…

  1. why would you bother adding book marks then and not wait until you can implement the feature properly where they are saved? This is why people get bad taste for KDE4, who wants a half finished feature?

  2. How does this relate to KDE4? Isn’t this a general problem with software? And better a halfway working feature than none. Usually one solves the problems in one session, so bookmarks are not needed on the next load of the file.

    Just for comparison: KHexEdit did not store bookmarks, too, and this was KDE 1 to 3. Where can I read your complains about KDE1 to KDE3? πŸ™‚

  3. ok, this is why people have a bad taste for linux desktops then, a bunch of half finished most times broken garbage. sound better? My point was, it would be better for users to wait to add something that is fully working than only half.

    Example.. user1 hears user2 ask about hex editors..user2 uses windows. user1 convinces user2 to try linux with kde and okteta since user2 wanted a good hex editor. user2 installs a distro with kde in VM, attempts to use hex editor..feature half working..user2 then says “yea user1 remind me never to listen to you again”. user1 not only lost a possible linux user, but now gave user2 such a bad taste in his mouth he will probably speak of his bad experience for years to come.

    most of that was from experience, but user2 in reality wanted a feature hexworkshop had in windows, so he just shelled out the cash.

    I also wouldn’t agree with the problem solving in one session, especially working on multi gig files. Which i was actually impressed okteta handled. I apologize if I sounded rude before, but I think it is bad practice to surprise users by having a feature like that, and then they go looking for them next time they start the editor up.

  4. No need to apologize, still thanks, you didn’t sound too rude, you just pointed out a negative issue, I understood that. I only cannot agree that this is really only negative. Okteta is really a young program and simple in many regards. Comparing it to hexworkshop is not (yet) fair, to both. And the producers of hexworkshop might be glad they found one more paying customer. I just follow the “release often and early” mantra. See, Okteta forgets almost everything if you close it. And you cannot even set the defaults. It is a work in progress. Still many find it already quite usable. Those would not be served if I develop some more years on my local hard disk until it is able to match the behaviour of existing elaborated programs. I just wonder if it was not user1 who possibly did a mistake by telling user2 of features which do not exist (storing bookmarks until next reload).
    I did nowhere promise bookmarks will be preserved. Sure, I also did not tell in the GUI they will be gone. Perhaps I should add a warning on the first addition of the bookmark, thanks for the hint that this might be helpful. String freeze is only in three days, I might be able to do this in time.

    BTW, regarding multi gig files, this depends on your RAM, as Okteta is still simple here, too, and loads the whole file into the working memory. So just do not tell others to do the same, please, they might be disappointed.

    Please do not forget, I develop Okteta for fun and experience (also personal needs), just share it with the rest of the world in case they might find it useful, too. And I also hope for others to join the coding. I am not out to suck the market for hexeditors πŸ™‚ Then I think it does already better then some of the simple shareware programs. Not at least because I can hack my personal needs in it, as the source is open and free to use (and known to me πŸ˜‰ ). And because it looks more stylish, thanks to Oxygen!

  5. I especially like the way you can use HTML (or – if you don’t like raw html in your code – a QTextDocument/Cursor) to format it with a fixed width, tables, etc. Probably not a feature unique to Qt, but still cool πŸ™‚

  6. lose = verlieren (lose a game, lose settings), “s” in lose weich gesprochen (phonetisch also eher “looze”)

    loose = Adjektiv: locker (“nicht festsitzend”, z.B. loose tongue = lockeres mundwerk), “s” in loose hart gesprochen (in dt. schreibweise ca. “luhss”)

    loosen = Verb fΓΌr loose, also “lockern” (loosen a rope)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s