File indexing completed on 2024-04-28 04:32:09

0001 /*
0002  * Copyright (C) 2010-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 #ifndef TextElementDlg_H
0012 #define TextElementDlg_H
0013 
0014 #include <QDialog>
0015 
0016 #include "ui_TextElement.h"
0017 
0018 class TextElement;
0019 class QHideEvent;
0020 class QShowEvent;
0021 
0022 class TextElementDlg : public QDialog
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     TextElementDlg(QWidget *, TextElement *);
0028     virtual ~TextElementDlg() = default;
0029 
0030 protected:
0031     virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
0032     virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
0033 
0034 private slots:
0035     void on_FillBackground_toggled(bool);
0036     void on_BackgroundColor_activated(const QColor &);
0037     void on_BackgroundTransparency_valueChanged(int);
0038 
0039     void on_BoldButton_clicked();
0040     void on_UnderlineButton_clicked();
0041     void on_ItalicButton_clicked();
0042     void on_FontFamily_currentFontChanged(const QFont &);
0043     void on_PointSize_valueChanged(int);
0044     void on_TextColor_clicked();
0045     void textAlign(QAbstractButton *);
0046 
0047     void on_Text_currentCharFormatChanged(const QTextCharFormat &);
0048     void on_Text_cursorPositionChanged();
0049 
0050     void on_DialogButtonBox_accepted();
0051     void on_DialogButtonBox_rejected();
0052     void on_DialogButtonBox_helpRequested();
0053 
0054 private:
0055     void mergeFormatOnWordOrSelection(const QTextCharFormat &);
0056     void fontChanged(const QFont &);
0057     void colorChanged(const QColor &);
0058     void alignmentChanged(Qt::Alignment);
0059 
0060     Ui::TextElement ui;
0061 
0062     TextElement *m_textElement;
0063 };
0064 
0065 #endif // TextElementDlg_H