Results 1 to 12 of 12

Thread: How can I do, item is read only and not selectable ?

  1. #1
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default How can I do, item is read only and not selectable ?

    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.

  2. #2

    Default Re: How can I do, item is read only and not selectable ?

    what's the meaning?

  3. #3
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default Re: How can I do, item is read only and not selectable ?

    i want to do that table widget`s item must be read only and not selectable .

    how can i do that ?

  4. #4
    Join Date
    Dec 2008
    Location
    France
    Posts
    93
    Thanked 23 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: How can I do, item is read only and not selectable ?

    Did you try something like this?
    Qt Code:
    1. newCell->setFlags( newCell->flags() & !Qt::ItemIsEditable & !Qt::ItemIsSelectable );
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I do, item is read only and not selectable ?

    Qt Code:
    1. item->setFlags( Qt::ItemIsEnabled );
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default Re: How can I do, item is read only and not selectable ?

    Quote Originally Posted by nix View Post
    Did you try something like this?
    Qt Code:
    1. newCell->setFlags( newCell->flags() & !Qt::ItemIsEditable & !Qt::ItemIsSelectable );
    To copy to clipboard, switch view to plain text mode 
    Quote Originally Posted by wysota View Post
    Qt Code:
    1. item->setFlags( Qt::ItemIsEnabled );
    To copy to clipboard, switch view to plain text mode 

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

    is there another solution for this problem.

    i use QT 4.4.3

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I do, item is read only and not selectable ?

    Works fine for me...

    Qt Code:
    1. #include <QListWidget>
    2. #include <QApplication>
    3.  
    4. int main(int argc, char **argv){
    5. QApplication app(argc, argv);
    6. item->setText("Selectable");
    7. item = new QListWidgetItem(&w);
    8. item->setText("Not selectable");
    9. item->setFlags(Qt::ItemIsEnabled);
    10. w.show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default Re: How can I do, item is read only and not selectable ?

    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 .

  9. #9
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default Re: How can I do, item is read only and not selectable ?

    i send picture.

    selecting item picture.
    Attached Images Attached Images

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I do, item is read only and not selectable ?

    This is "highlighted", not "selected". If you don't want that as well, disable the ItemIsEnabled flag as well.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default Re: How can I do, item is read only and not selectable ?

    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.

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I do, item is read only and not selectable ?

    Look at my previous post, I already told you how to do it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.