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

Qt-interest Archive, November 2006
editing QListWidgetItem


Message 1 in thread

If I want to create an item in a QListWidget do I have to subclass
QItemDelegate? I get "edit: editing failed" in the console for the
following code:

  QListWidgetItem *item = new QListWidgetItem(libraryView);
  item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable |
Qt::ItemIsDropEnabled);
  item->setText("hey");

The documentation for QListWidget/QListWidgetItem doesn't give much of
a description of what the default behavior is, and how to capture the
change in the name.

thanks!

-- 
 [ signature omitted ] 

Message 2 in thread

Hi,

I don't know if it can help, but with a QTableWidget, I generally set the
flags of my QTableWidgetItems by removing features:

       item->setFlags( item->flags() & ~Qt::ItemIsSelectable );

where item is QTableWidgetItem.

I think that, by default, a QTableWidgetItem has all the features enabled
(including an editing one). This way, I have no problem to edit the cells in
my QTableWidget.

Regards,

     Émeric


2006/11/1, Patrick Stinson <patrickkidd.lists@xxxxxxxxx>:
>
> If I want to create an item in a QListWidget do I have to subclass
> QItemDelegate? I get "edit: editing failed" in the console for the
> following code:
>
>   QListWidgetItem *item = new QListWidgetItem(libraryView);
>   item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable |
> Qt::ItemIsDropEnabled);
>   item->setText("hey");
>
> The documentation for QListWidget/QListWidgetItem doesn't give much of
> a description of what the default behavior is, and how to capture the
> change in the name.
>
> thanks!
>
> --
> Patrick Kidd Stinson
> http://www.patrickkidd.com/
> http://pkaudio.sourceforge.net/
> http://pksampler.sourceforge.net/
>
> --
> 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/
>
>

Message 3 in thread

right, that does it.

On 11/1/06, Émeric Maschino <emeric.maschino@xxxxxxxxx> wrote:
> Hi,
>
> I don't know if it can help, but with a QTableWidget, I generally set the
> flags of my QTableWidgetItems by removing features:
>
>        item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
>
>  where item is QTableWidgetItem.
>
> I think that, by default, a QTableWidgetItem has all the features enabled
> (including an editing one). This way, I have no problem to edit the cells in
> my QTableWidget.
>
> Regards,
>
>      Émeric
>
>
> 2006/11/1, Patrick Stinson <patrickkidd.lists@xxxxxxxxx>:
> >
> > If I want to create an item in a QListWidget do I have to subclass
> > QItemDelegate? I get "edit: editing failed" in the console for the
> > following code:
> >
> >   QListWidgetItem *item = new QListWidgetItem(libraryView);
> >   item->setFlags(Qt::ItemIsEditable |
> Qt::ItemIsSelectable |
> > Qt::ItemIsDropEnabled);
> >   item->setText("hey");
> >
> > The documentation for QListWidget/QListWidgetItem doesn't give much of
> > a description of what the default behavior is, and how to capture the
> > change in the name.
> >
> > thanks!
> >
> > --
> > Patrick Kidd Stinson
> > http://www.patrickkidd.com/
> > http://pkaudio.sourceforge.net/
> > http://pksampler.sourceforge.net/
> >
> > --
> > 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 ]