Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, February 2008
Enable or disable Selected in QListWidget


Message 1 in thread

Hi,

I have a QListWidget which display message as well as menu items which
can be selected and clicked by mouse. The problem is when the message
is displayed on list, I don't want it to be selectable. How can I
disable selected feature when it displays messages on the QListWidget?

I checked the reference, it does have void
QListWidget::setItemSelected ( const QListWidgetItem * item, bool
select ), I guess if set select to false, the item on the list won't
be selected. Is it correct?  I use QString to add item to the
QListWidget, void insertItem ( int row, const QString & label ), but
the setItemSelected() does not have a QString type?

Thank you.

Kind Regards,

Jim

--
 [ signature omitted ] 

Message 2 in thread

Try using the

void setSelectionMode ( QAbstractItemView::SelectionMode mode )

function, inherited from QAbstractItemView into QListWidget. Here use
the QAbstractItemView::NoSelection enumerator to set the items
non-selectable in the list widget.

Hope this helps.

On Wed, Feb 27, 2008 at 6:56 AM, hce <webmail.hce@xxxxxxxxx> wrote:
> Hi,
>
>  I have a QListWidget which display message as well as menu items which
>  can be selected and clicked by mouse. The problem is when the message
>  is displayed on list, I don't want it to be selectable. How can I
>  disable selected feature when it displays messages on the QListWidget?
>
>  I checked the reference, it does have void
>  QListWidget::setItemSelected ( const QListWidgetItem * item, bool
>  select ), I guess if set select to false, the item on the list won't
>  be selected. Is it correct?  I use QString to add item to the
>  QListWidget, void insertItem ( int row, const QString & label ), but
>  the setItemSelected() does not have a QString type?
>
>  Thank you.
>
>  Kind Regards,
>
>  Jim
>
>  --
>  To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
>  List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ]