Hi List,
/////////////////////////////////////////
First, I would like to say I am actually enjoying learning Wt.
I have been avoiding Web Programming for the longest time,
mainly because I just dont have time to learn all of the
different web technologies.
I am primarily a C++ programmer, and am very familiar with Qt,
so Wt was a natural choice for me, and all of the other benefits
like security, browser compatibility, etc.. are nice too.
My main comment is sometimes the documentation leaves something to be
desired.
/////////////////////////////////////////
Case in point:
/////////////////////////////////////////
I cannot figure out how to get the proper on screen dimensions of a
widget in a form that a painter understands.
These widgets are laid out with in a (arbitrary) layout hierarchy.
How do I get the widgets CALCULATED (post layout) dimensions ?
see the paintEvent() method below for the behavior I am seeing now..
/////////////////////////////////////////
Thanks,
mtm
/////////////////////////////////////////
class MyPaintedWidget : public Wt::WPaintedWidget
{
public:
MyPaintedWidget(const char* ptitle=0, IAction* pact = 0)
: Wt::WPaintedWidget(0)
, mTitle(ptitle?ptitle:"")
, mpAction(pact)
{
//resize(200, 200); // provide a default size
}
void setFoo(int foo)
{
//foo_ = foo;
update(); // trigger a repaint
}
void paintEvent(Wt::WPaintDevice *paintDevice)
{
Wt::WPainter painter(paintDevice);
Wt::WRectF viewport = painter.viewPort();
Wt::WRectF window = painter.window();
Wt::WLength widget_w = width();
Wt::WLength widget_h = height();
double widget_wp = widget_w.toPixels();
double widget_hp = widget_h.toPixels();
Wt::WLength paintdev_w = paintDevice->width();
Wt::WLength paintdev_h = paintDevice->height();
double paintdev_wp = paintdev_w.toPixels();
double paintdev_hp = paintdev_h.toPixels();
// Shows Up, Just like I would expect!
painter.drawLine(0,0, 20, 20 );
// Does Not Show Up!
painter.drawLine(0,0, widget_wp, widget_hp );
// Does Not Show Up!
painter.drawLine(0,0, paintdev_wp, paintdev_hp );
// Does Not Show Up!
painter.drawLine(viewport.topLeft(),viewport.bottomRight());
// Does Not Show Up!
painter.drawLine(window.topLeft(),window.bottomRight());
}
std::string mTitle;
std::string mDestUrl;
IAction* mpAction;
};
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest