1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#pragma once
// Qt
#include <QMainWindow> // Required for inheritance
#include <QString>
#include <QVector>
#include <QPair>
class QVBoxLayout;
class QSyntaxStyle;
class QComboBox;
class QCheckBox;
class QSpinBox;
class QCompleter;
class QStyleSyntaxHighlighter;
class QCodeEditor;
/**
* @brief Class, that describes demo main window.
*/
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
/**
* @brief Constructor.
* @param parent Pointer to parent widget.
*/
explicit MainWindow(QWidget* parent=nullptr);
private:
void loadStyle(QString path);
QString loadCode(QString path);
void initData();
void createWidgets();
void setupWidgets();
void performConnections();
QVBoxLayout* m_setupLayout;
QComboBox* m_codeSampleCombobox;
QComboBox* m_highlighterCombobox;
QComboBox* m_completerCombobox;
QComboBox* m_styleCombobox;
QCheckBox* m_readOnlyCheckBox;
QCheckBox* m_wordWrapCheckBox;
QCheckBox* m_parenthesesEnabledCheckbox;
QCheckBox* m_tabReplaceEnabledCheckbox;
QSpinBox* m_tabReplaceNumberSpinbox;
QCheckBox* m_autoIndentationCheckbox;
QCodeEditor* m_codeEditor;
QVector<QPair<QString, QString>> m_codeSamples;
QVector<QPair<QString, QCompleter*>> m_completers;
QVector<QPair<QString, QStyleSyntaxHighlighter*>> m_highlighters;
QVector<QPair<QString, QSyntaxStyle*>> m_styles;
};
|