hi friends,
i try to send the QPen value as argument like
in lineitem.h
Qt Code:
  1. class LineItem : public QObject, public QGraphicsLineItem
  2. {
  3. Q_OBJECT
  4. public:
  5. LineItem(const QLineF &rect, const QPen &pen);
  6. private:
  7. int xvalue, yvalue;
  8. QPen pen;
  9. }
To copy to clipboard, switch view to plain text mode 
in lineitem.cpp
Qt Code:
  1. LineItem::LineItem(const QLineF &line, const QPen &pen)
  2. pen(pen)
  3. {
  4. void LineItem ::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
  5. {
  6. painter->setPen(pen);
  7. painter->drawLine(line());
  8.  
  9. }
To copy to clipboard, switch view to plain text mode 

in graphicsview
Qt Code:
  1. line1 = new LineItem(QLineF(2,4, 2 ,30), Qt::green);
  2. line1->setPos(100,550);
  3. scene->addItem(line1);
To copy to clipboard, switch view to plain text mode 

its giving error as
dualmon.cpp:93: error: no matching function for call to ‘LineItem::LineItem(QLineF, Qt::GlobalColor)’
lineitem.h:13: note: candidates are: LineItem::LineItem(const QLineF&, const QPen&)
lineitem.h:8: note: LineItem::LineItem(const LineItem&)
or as


but if the same QPen i replace with QBrush its running perfectly ...
i can send color as argument for QBrush but not for QPen why?

please help




}