Results 1 to 3 of 3

Thread: Set some kind of a property to the item

  1. #1
    Join Date
    Nov 2019
    Posts
    31
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Set some kind of a property to the item

    Hi,

    I'm trying to find a way to set some kind of a property for a plotted item where I could keep information about the item.
    For example I plot 10 curves. 7 of them should be signed as "good", and the 3 rest should be "bad". So this would allow me to sort these 10 items after getting them from QwtPlot widget like:
    Qt Code:
    1. QwtPlotItemList qwtItmList = QwtPlotWidget->itemList();
    2. for(int i = 0; i < qwtItmList.size(); i++){
    3. QString prop = qwtItmList[i].MyProperty();
    4. if (prop == "good){
    5. ...
    6. } else if (prop == "good) {
    7. ...
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,253
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set some kind of a property to the item

    I will add the Q_GADGET keyword to all plot items. Q_GADGET is available since some early Qt5 version ( need to find out which exactly ) - always wanted to do this.

    Does this help ?

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    Vasya (1st March 2020)

  4. #3
    Join Date
    Nov 2019
    Posts
    31
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Set some kind of a property to the item

    I didnt work with Q_GADGET yet but as I understood from description this would allow to use such function like setProperty(const char *name, const QVariant &value) and return the QVariant value with property(const char *name) const for plotted items.

    I think that would be great

Similar Threads

  1. Replies: 1
    Last Post: 24th November 2014, 09:28
  2. Replies: 4
    Last Post: 27th August 2012, 20:27
  3. height property not adjusted when QTreeView item selected
    By hubbobubbo in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2010, 16:38
  4. How to code this kind of UI?
    By stephenteh in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 23rd September 2009, 12:31
  5. QMenu/QPopupMenu item's color and italic property
    By ultr in forum Qt Programming
    Replies: 0
    Last Post: 30th March 2009, 13:47

Tags for this Thread

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.