File indexing completed on 2022-11-29 18:12:02

0001 /*
0002     SPDX-FileCopyrightText: 2006 Carsten Niehaus <cniehaus@kde.org>
0003     SPDX-FileCopyrightText: 2007 Ian Monroe <ian@monroe.nu>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef TABLESDIALOG_H
0008 #define TABLESDIALOG_H
0009 
0010 #include <QTableWidget>
0011 #include <QTableWidgetItem>
0012 
0013 #include <KPageDialog>
0014 
0015 /**
0016  * @author Carsten Niehaus
0017  */
0018 class TablesDialog : public KPageDialog
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit TablesDialog(QWidget *parent = nullptr);
0024     ~TablesDialog() override;
0025 
0026     void createNumbersTable();
0027     void createGreekSymbolTable();
0028 };
0029 
0030 /**
0031  * Disallows the table widget item from being edited.
0032  * @author Ian Monroe
0033  */
0034 class MyWidgetItem : public QTableWidgetItem
0035 {
0036 public:
0037     explicit MyWidgetItem(const QString &s)
0038         : QTableWidgetItem(s)
0039     {
0040         setFlags(Qt::ItemIsEnabled);
0041     }
0042 };
0043 
0044 /**
0045  * Adds a context menu which copies to the clipboard the current cell.
0046  * @author Ian Monroe
0047  */
0048 class MyTableWidget : public QTableWidget
0049 {
0050     Q_OBJECT
0051 
0052 public:
0053     explicit MyTableWidget(QWidget *parent);
0054 
0055 protected:
0056     void contextMenuEvent(QContextMenuEvent *event) override;
0057 private Q_SLOTS:
0058     void copyToClipboard();
0059 };
0060 
0061 #endif // TABLESDIALOG_H