Project

General

Profile

How do I grab the dimensions of a WPaintedWidget and draw a line with them?

Added by Mikey Nosihcan about 9 years ago

Using C 11 on Ubuntu 14.04, default GCC tool chain 4.9x:

I want to draw a line at the bottom of a WPaintedWidget - call it Wt::WLineF* mXLine - and set the position of mXline dynamically at runtime - not hard-coded. The WPaintedWidget is inside a layout manager - it gets sized automatically - I don't have to call resize(). I want to do the same with mXLine.

In the WPaintedWidget::paintEvent() event handler, I have tried:

mXLine = new WLineF( 0, height( ).Pixel, width( ).Pixel, height( ).Pixel );

and

mXLine = new WLineF( 0, this~~parent( )>height( ).Pixel, parent( )width( ).Pixel, parent( )~~>height( ).Pixel );

All the pen and painter properties are set correctly - I use them in many places - ( pen.width() == 5 )- . But I get no line and in my debugger mXLine.width() returns 1 and mXLine.height() returns 2.

How do I get this to work?