[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KJots link dialog and QComboBox difficulties... What to do?
From:       Stephen Kelly <steveire () gmail ! com>
Date:       2008-06-11 0:54:26
Message-ID: g2n7nr$4cn$1 () ger ! gmane ! org
[Download RAW message or body]

Hi,

I recently added a dialog to KJots to allow creating and configuring
external links and internal kjots links. Internal kjots links take the form
kjots://0.0.0.0/$id, where $id is the id of the kjots book or page. To the
user the id is meaningless, so I added a KComboBox to allow selecting the
link target from the same model used on the left side of kjots.

http://img71.imageshack.us/img71/3382/kjotslinkdialogcomboboxjg0.png

That works fine for creating new links, but when configuring an existing
link, I need to make sure the existing selection in the combobox is the
current link target. The bug is that when configuring an existing kjots
link, the item at the top of the bookshelf is always selected, instead of
the actual current entry. 

I tried a few things solve this without success, and asked on qt-interest as
well without getting it resolved.

http://lists.trolltech.com/qt-interest/2008-06/thread00247-0.html

I've sent a bug report/wishlist item to qt-bugs with pretty much the same
information.

It looks like QComboBox may not intend to allow selection via its selection
model. I think I need a workaround, but not sure what direction to go.

The options might be:

 1. Patch KComboBox to allow selection using a QModelIndex. (I don't know        
    if that is possible)

 2. Create a flat QListModel in the dialog, containing all the entries like:

        -- Book 1
        -- Book 1 / Page 1
        -- Book 1 / Page 2
        -- Book 2
        -- Book 2 / Page 1

    etc., set that as the combobox model and use 

        comboBox->setCurrentIndex(view->currentIndex().row());

    to set the selection.

 3. See if qt patches this in a release soon and ignore the bug.

 4. Something else.

I'm interested to get some thoughts on this as it's a bug that's been
annoying me for about a week now.

All the best,

Steve.


 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic