xhsoldier
20th October 2010, 04:53
class settingwindow : public QGraphicsView
...
settingwindow::settingwindow( QWidget * parent) : QGraphicsView(parent)
{
setWindowState ( Qt::WindowFullScreen );
QSize widgetSize = QSize(); //seems that QSize() return (-1,-1)
QPixmap pixmap;
pixmap.load("C:/Users/cherrson/qt_workspace/first/setting_1.JPG");
QPixmap scaledPixmap = pixmap.scaled(widgetSize, Qt::IgnoreAspectRatio);
setBackgroundBrush(scaledPixmap );
scene = new QGraphicsScene;
}
In the main function, I create the settingwindow, and then call:
setting->showFullScreen();
But the background image is not show full screen, why & how?
before I call showFullScreen(), I do not know the size.
I also implement in resizeEvent , but size still (-1, -1)
void settingwindow::resizeEvent ( QResizeEvent * event )
{
QSize widgetSize = QSize(); //still (-1,-1)
QPixmap pixmap;
pixmap.load("C:/Users/cherrson/qt_workspace/first/setting_1.JPG");
QPixmap scaledPixmap = pixmap.scaled(widgetSize, Qt::IgnoreAspectRatio);
setBackgroundBrush(scaledPixmap);
}
does not work too.
...
settingwindow::settingwindow( QWidget * parent) : QGraphicsView(parent)
{
setWindowState ( Qt::WindowFullScreen );
QSize widgetSize = QSize(); //seems that QSize() return (-1,-1)
QPixmap pixmap;
pixmap.load("C:/Users/cherrson/qt_workspace/first/setting_1.JPG");
QPixmap scaledPixmap = pixmap.scaled(widgetSize, Qt::IgnoreAspectRatio);
setBackgroundBrush(scaledPixmap );
scene = new QGraphicsScene;
}
In the main function, I create the settingwindow, and then call:
setting->showFullScreen();
But the background image is not show full screen, why & how?
before I call showFullScreen(), I do not know the size.
I also implement in resizeEvent , but size still (-1, -1)
void settingwindow::resizeEvent ( QResizeEvent * event )
{
QSize widgetSize = QSize(); //still (-1,-1)
QPixmap pixmap;
pixmap.load("C:/Users/cherrson/qt_workspace/first/setting_1.JPG");
QPixmap scaledPixmap = pixmap.scaled(widgetSize, Qt::IgnoreAspectRatio);
setBackgroundBrush(scaledPixmap);
}
does not work too.