screen.cpp:
#include "screen.h"
#include <qevent.h>
#include <qrect.h>
#include <qsize.h>
#include <qstring.h>
#include <QShowEvent>
#include <QFrame>
#include <QHideEvent>
#include <iostream>
#include <qmatrix.h>
#include <qfont.h>
#include <qpen.h>
Screen::Screen( QWidget *parent, const char *name, Qt::WFlags flags ): QFrame( parent, name, flags | Qt::WNoAutoErase )
{
setLineWidth( FrameWidth );
setFrameStyle( Panel | Sunken );
setBackgroundMode( Qt::PaletteBase );
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
firstShow = TRUE;
}
void Screen::showEvent( QShowEvent * )
{
if ( firstShow )
initNumber();
initCordinate( drawPainter );
}
QSize Screen::minimumSize () const
{
return QSize( 20 * SpaceMargin, 20 * SpaceMargin );
}
void Screen::hideEvent( QHideEvent * )
{
firstShow = FALSE;
}
void Screen::setXTitle(QString str )
{
stringXTitle = str;
}
void Screen::setYTitle( QString str )
{
stringYTitle = str;
}
void Screen::initNumber( )
{
saveBuffer.resize( size() ); //set the size and the backcolor of
saveBuffer.fill( this, 0, 0 );//those three QPixmaps as same as the Screen
newBuffer.resize( size() );
newBuffer.fill( this, 0, 0 );
midBuffer.resize( size() );
midBuffer.fill( this, 0, 0 );
drawPainter.begin(&newBuffer);
QRect newWindow = drawPainter.window();
newY = 0;
oldY =0;
sec = 0;
min = 0;
hour = 0;
- 1
- 2
- 3
- 4
- 5
- 6
前往页