1. Заголосочний файл mainwindow.cpp
# ifndef MAINWINDOW_H
# define MAINWINDOW_H
# include
# include
# include
# include
Ui {MainWindow;
}
MainWindow: public QMainWindow
{_OBJECT
: MainWindow (QWidget * parent = 0);
~ MainWindow ();
: isStopState (const QChar c); isAllowedState (const QChar c); getMeaningByState (const QChar c); writeSymbol (QChar c); moveRight (); moveLeft (); :: MainWindow * ui; stateSet; symbolsSet; endStateSet; allowedStateSet; ribbon; ribbonPos, fakePos; currentX, currentY; currentState; timer; running; ready;
on_ruleTable_cellPressed (int row, int column);
on_comboWriteSymbol_currentIndexChanged (int index);
on_comboMoveTo_currentIndexChanged (int index); on_comboSetState_currentIndexChanged (int index);
on_comboSpaceSymbol_currentIndexChanged (int index);
on_buttonStep_clicked ();
on_buttonStartStop_clicked ();
on_horizontalSlider_sliderMoved (int position);
on_buttonReset_clicked ();
on_lineEndState_editingFinished ();
on_lineAllowedState_editingFinished ();
on_pushButton_clicked ();
on_about_triggered ();
on_about_Qt_triggered ();
: stateChanged ();
};
# endif// MAINWINDOW_H
2. Заголовний файл visualization.h
# ifndef VISUALISATION_H
# define VISUALISATION_H
# include
visualisation: public QWidget
{_OBJECT: visualisation (QWidget * parent = 0); setRibbon (QList * r); setSpaceSymbol (QChar c); setFakePos (int * pos); setRealPos (int * pos); setState (QChar * c); setResultText (const QString str);
: * ribbon; resultText; spaceSymbol, * state; * fakePos, * realPos;:
slots:
: paintEvent (QPaintEvent *);
};
# endif// VISUALISATION_H
3. Реалізація mainwindow.cpp
# include
# include