PDA

View Full Version : How can I do, item is read only and not selectable ?



newermind
13th August 2009, 17:08
How can I do, item is read only and not selectable ?

I did this;

item->setFlags( Qt::ItemIsEditable );

item is read only but it is selectable.

robertkun
14th August 2009, 07:22
what's the meaning?

newermind
14th August 2009, 08:31
i want to do that table widget`s item must be read only and not selectable .

how can i do that ?

nix
14th August 2009, 11:24
Did you try something like this?

newCell->setFlags( newCell->flags() & !Qt::ItemIsEditable & !Qt::ItemIsSelectable );

wysota
14th August 2009, 11:57
item->setFlags( Qt::ItemIsEnabled );

newermind
14th August 2009, 13:19
Did you try something like this?

newCell->setFlags( newCell->flags() & !Qt::ItemIsEditable & !Qt::ItemIsSelectable );



item->setFlags( Qt::ItemIsEnabled );


these codes are not worked. item is read only but selectable.

is there another solution for this problem.

i use QT 4.4.3

wysota
14th August 2009, 13:26
Works fine for me...


#include <QListWidget>
#include <QApplication>

int main(int argc, char **argv){
QApplication app(argc, argv);
QListWidget w;
QListWidgetItem *item = new QListWidgetItem(&w);
item->setText("Selectable");
item = new QListWidgetItem(&w);
item->setText("Not selectable");
item->setFlags(Qt::ItemIsEnabled);
w.show();
return app.exec();
}

newermind
14th August 2009, 13:35
i tried your code. but nothing changed.

what is your qt version wysota ?

i think that problem is in QT 4.4.3 .

but i must use QT 4.4.3 .

newermind
14th August 2009, 13:41
i send picture.

selecting item picture.

wysota
14th August 2009, 14:06
This is "highlighted", not "selected". If you don't want that as well, disable the ItemIsEnabled flag as well.

newermind
14th August 2009, 14:16
This is "highlighted", not "selected". If you don't want that as well, disable the ItemIsEnabled flag as well.

How can i closed highlighted ?

i don`t want highlighted.

wysota
14th August 2009, 15:09
Look at my previous post, I already told you how to do it.