[Qt-interest] Changin the pen width for QGLWidget
Sujan Dasmahapatra
sujan.dasmahapatra at gmail.com
Fri Dec 4 08:08:36 CET 2009
How can we get the current paintEngine from QGLWidget. As painEngine()
method is a pure virtual function how can we implement this function so that
it returns current QPaintEngine
Any idea from anyone
Thanks
On Fri, Dec 4, 2009 at 12:05 PM, Sujan Dasmahapatra <
sujan.dasmahapatra at gmail.com> wrote:
> when I am trying to setPen it crashes.
>
> QPen pen(Qt::blue,8);
> paintEngine()->painter()->setPen(pen);
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000006f895b in QPainter::setPen ()
> whats going wrong in this.
> On Fri, Dec 4, 2009 at 11:40 AM, 程梁 <chengliang.soft at gmail.com> wrote:
>
>> Because QPainter::pen() function returns const QPen &, so you cannot
>> change its attributes using QPainter::pen()'s return.
>> You should use QPainter::setPen() with a new QPen instance instead.
>>
>> 2009/12/4 Sujan Dasmahapatra <sujan.dasmahapatra at gmail.com>
>>
>>> Dear Friends
>>> I am trying to change the width of the pen which is currently used by the
>>> paintEngine() in QGLWidget. For a particular object being drawn I want to
>>> increase the width.But it gives error see below.
>>> ////////////////////////////////////////////////
>>> paintEngine()->painter()->pen().setWidth(8);
>>> paintEngine()->painter()->pen().setColor(trolltechPurple);
>>> //errors
>>> rc/graphicsview_mesh.cpp:852: error: passing `const QPen' as `this'
>>> argument of `void QPen::setWidth(int)' discards qualifiers
>>> src/graphicsview_mesh.cpp:853: error: passing `const QPen' as `this'
>>> argument of `void QPen::setColor(const QColor&)' discards qualifiers
>>> Please someone tell what am I doing wrong.
>>> I want to increase the width and color for a particular object and after
>>> drawing that object I want the width and color to be normal.
>>>
>>> How can I achieve this. Any help would be appreciated.
>>>
>>> --
>>> Thanks & Regards
>>> S. Dasmahapatra
>>> B.E. (Aeronautics-Aerodynamics)
>>> Software programmer
>>> Bangalore, India
>>> Ph:91-9900839788
>>> Office:91-80-66470248
>>> mail id : sujan.dasmahapatra at gmail.com
>>>
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>
>>>
>>
>>
>> --
>> Cheng Liang
>> from: chengliang.soft at gmail.com
>>
>
>
>
> --
> Thanks & Regards
> S. Dasmahapatra
> B.E. (Aeronautics-Aerodynamics)
> Software programmer
> Bangalore, India
> Ph:91-9900839788
> Office:91-80-66470248
> mail id : sujan.dasmahapatra at gmail.com
>
--
Thanks & Regards
S. Dasmahapatra
B.E. (Aeronautics-Aerodynamics)
Software programmer
Bangalore, India
Ph:91-9900839788
Office:91-80-66470248
mail id : sujan.dasmahapatra at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091204/9c6d6703/attachment.html
More information about the Qt-interest-old
mailing list