[kde-edu]: Cartesian plane on qt canvas
Jason Harris
kstars at 30doradus.org
Wed Dec 8 21:47:29 CET 2004
Hi Trenton,
I think you just need to give your window a layout manager. The plot
widget should then resize itself automatically to match the size of the
window. Try this:
#include <qlayout.h>
#include <klocale.h>
#include <kdialog.h>
#include "trigviewer.h"
TrigViewer::TrigViewer(QWidget* parent, const char* name, WFlags fl)
: QWidget( parent, name )
{
view = new QWidget(this);
QVBoxLayout *vlay = new QVBoxLayout( view, 0, spacingHint() );
pw = new KPlotWidget( -50.0, 50.0, -50.0, 50.0, view );
pw->setDefaultPadding();
pw->setShowAxes( true );
pw->setBGColor( QColor( "white" ) );
pw->setFGColor( QColor ( "black") );
pw->setShowTickMarks( true );
pw->setXAxisLabel( i18n( "X-Axis" ) );
pw->setYAxisLabel( i18n( "Y-Axis" ) );
vlay->addWidget( pw );
resize( 500, 500 ); //optional, you can put whatever dimensions
you want here
plotObjects();
}
let me know if that works,
Jason
--
Jason Harris
jharris at 30doradus.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1072 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-edu/attachments/20041208/a4917d78/attachment.bin
More information about the kde-edu
mailing list