HelloDan
30th March 2009, 05:34
Test::Test(QWidget* parent):QDialog(parent)
{
setBackgroundRole(QPalette::Dark);
setAutoFillBackground(true);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//buttons settings
settingButton=new QPushButton;
settingButton->setText("settings");
settingButton->adjustSize();
oneStepButton=new QPushButton;
oneStepButton->setText("one step");
oneStepButton->adjustSize();
runAllButton=new QPushButton;
runAllButton->setText("run all");
runAllButton->adjustSize();
//place the buttons in a proper position
settingButton->move(5, 5);
oneStepButton->move(5 + settingButton->width() + 5, 5);
runAllButton->move(15+settingButton->width()+oneStepButton->width(),5);
//plotter settings
minX = 0.0;
maxX = 10.0;
numXTicks = 5;
minY = 0.0;
maxY = 10.0;
numYTicks = 5;
iniPoints();
resize(600,400);
}
void Test::refreshPixmap()
{
pixmap = QPixmap(size());
pixmap.fill(this, 0, 0);
QPainter painter(&pixmap);
painter.initFrom(this);
drawGrid(&painter);
drawPoints(&painter);
update();
}
In this program, I want to draw a coordinate and points in it. above the coordinate, I post three QPushButtons . Now my app can be executed, but the buttons can not turn up, leaving only the coordinate. I don't know why? Do you have any advise?
Thanks!
{
setBackgroundRole(QPalette::Dark);
setAutoFillBackground(true);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//buttons settings
settingButton=new QPushButton;
settingButton->setText("settings");
settingButton->adjustSize();
oneStepButton=new QPushButton;
oneStepButton->setText("one step");
oneStepButton->adjustSize();
runAllButton=new QPushButton;
runAllButton->setText("run all");
runAllButton->adjustSize();
//place the buttons in a proper position
settingButton->move(5, 5);
oneStepButton->move(5 + settingButton->width() + 5, 5);
runAllButton->move(15+settingButton->width()+oneStepButton->width(),5);
//plotter settings
minX = 0.0;
maxX = 10.0;
numXTicks = 5;
minY = 0.0;
maxY = 10.0;
numYTicks = 5;
iniPoints();
resize(600,400);
}
void Test::refreshPixmap()
{
pixmap = QPixmap(size());
pixmap.fill(this, 0, 0);
QPainter painter(&pixmap);
painter.initFrom(this);
drawGrid(&painter);
drawPoints(&painter);
update();
}
In this program, I want to draw a coordinate and points in it. above the coordinate, I post three QPushButtons . Now my app can be executed, but the buttons can not turn up, leaving only the coordinate. I don't know why? Do you have any advise?
Thanks!