# include "qtsgraph.h"
int main ( int argc , char * argv [ ] )
{
QApplication a ( argc , argv ) ;
/*
* З а д а ё т с я р а з м е р и п о л о ж е н и е о к н а
* ( int w = 640 , int h = 480 , int x = - 1 , int y = - 1 , QWidget * parent = nullptr )
* В с л у ч а е о т р и ц а т е л ь н о г о з н а ч е н и я x и л и y , о к н о с о з д а ё т с я в ц е н т р е э к р а н а .
*/
QTSGraph w ( 600 , 600 ) ;
//w.SwapYAxis = true;
//w.MoveOtoCenter = true;
w . show ( ) ;
return a . exec ( ) ;
}
void QTSGraph : : PaintBox ( )
{
// Начало рисования
//ShowAxes();
SetColor ( clGreen ) ;
Line ( 0 , 0 , 600 , 600 ) ;
SetColor ( 0xFF0000 ) ;
Line ( 600 , 0 , 0 , 600 ) ;
Rectangle ( 0 , 0 , 599 , 599 ) ;
QColor c = Qt : : blue ;
SetColor ( c ) ;
SetTextStyle ( 10 , 45 , 0 ) ;
OutTextXY ( 70 , 70 , " Hello world! " ) ;
SetTextStyle ( 1 , 0 , 20 ) ;
OutTextXY ( 170 , 50 , " Кликните мышкой... " ) ;
int m = ReadMouseButton ( ) ;
SetColor ( clRed ) ;
SetTextStyle ( 20 , 0 , 1 ) ;
if ( m = = 1 ) OutTextXY ( 150 , 80 , " Нажата левая кнопка " ) ;
else if ( m = = 2 ) OutTextXY ( 150 , 80 , " Нажата правая кнопка " ) ;
else if ( m = = 3 ) OutTextXY ( 150 , 80 , " Нажата средняя кнопка " ) ;
else OutTextXY ( 150 , 80 , " Нажата неизвестная кнопка " ) ;
SetTextStyle ( 30 , 180 , 2 ) ;
OutTextXY ( 460 , 550 , " Hello world! " ) ;
SetColor ( 0x999999 ) ;
SetPenStyle ( 5 ) ;
SetFillStyle ( 1 , clMagenta ) ;
Ellipse ( 250 , 280 , 350 , 320 ) ;
TPixel p ;
while ( ReadMouseButton ( ) ! = 2 )
{
p = ReadMousePosition ( ) ;
SetColor ( clBlack ) ;
SetPenStyle ( 1 , 1 ) ;
SetFillStyle ( 1 , clWhite ) ;
Rectangle ( 10 , 10 , 100 , 100 ) ;
SetTextStyle ( 16 , 0 , 0 ) ;
OutTextXY ( 30 , 30 , std : : to_string ( p . x ) ) ;
OutTextXY ( 30 , 60 , std : : to_string ( p . y ) ) ;
}
// Конец рисования
}