]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/EmptyTable.h
Implement sane UI for switching tristate toolbars (#6364)
[lyx.git] / src / frontends / qt / EmptyTable.h
1 // -*- C++ -*-
2 /**
3  * \file EmptyTable.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Jürgen Spitzmüller
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef EMPTYTABLE_H
14 #define EMPTYTABLE_H
15
16 #include <QTableWidget>
17
18
19 class QMouseEvent;
20
21 //namespace lyx {
22
23 /**
24  * A simple widget for a quick "preview" in TabularCreateDialog.
25  * The user can drag on the widget to change the table dimensions.
26  */
27 class EmptyTable : public QTableWidget {
28         Q_OBJECT
29 public:
30         EmptyTable(QWidget * parent = 0, int rows = 5, int columns = 5);
31
32         QSize sizeHint() const override;
33 public Q_SLOTS:
34         /// set the number of columns in the table and emit colsChanged() signal
35         void setNumberColumns(int nr_cols);
36         /// set the number of rows in the table and emit rowsChanged() signal
37         void setNumberRows(int nr_rows);
38 Q_SIGNALS:
39         /// the number of columns changed
40         void colsChanged(int);
41         /// the number of rows changed
42         void rowsChanged(int);
43 protected:
44         /// fill in a cell
45         virtual void paintCell(class QPainter *, int, int);
46         void mouseMoveEvent(QMouseEvent *) override;
47
48         /// Reset all the cell size to default
49         virtual void resetCellSize();
50
51 private:
52 };
53
54
55 //} // namespace lyx
56
57 #endif