Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QWidget>
- #include <QTableWidget>
- #include <QHBoxLayout>
- #include <QDomDocument>
- #include <QFile>
- #include <QFileDialog>
- #include <QDoubleValidator>
- #include <QLineEdit>
- #include "PrintArea.h"
- class MainWidget : public QWidget
- {
- Q_OBJECT
- public:
- explicit MainWidget(QWidget *parent = 0);
- public slots:
- int saveFile();
- void newFile();
- int openFile();
- void myCellChanged(int i, int j);
- signals:
- // void documentChange(QTableWidgetItem * item);
- private:
- QDomElement RowToNode( QDomDocument&, const QTableWidget*, const int);
- bool xmlWrite(const QString& p);
- int xmlRead(const QString& p);
- QFileDialog* dialog;
- QHBoxLayout *horizontalLayout;
- QTableWidget *sheet;
- PrintArea *printArea;//distruggere!
- QDoubleValidator *validator;
- QLineEdit *lineEdit;
- QFile currentFile;
- bool modified;
- };
- //CPP file:
- class Exc{};
- MainWidget::MainWidget(QWidget *parent) : QWidget(parent), modified(false) {
- sheet = new QTableWidget(30,3, this);//settare righe e colonne dyn!!!!!!!!!!!!!!!!!!!!!
- horizontalLayout = new QHBoxLayout;
- printArea = new PrintArea(this);
- horizontalLayout->addWidget(sheet);
- horizontalLayout->addWidget(printArea);
- setLayout(horizontalLayout);
- connect(sheet, SIGNAL(cellChanged ( int, int)), this, SLOT(myCellChanged(int, int)));
- validator = new QDoubleValidator(this);
- }
- void MainWidget::myCellChanged(int i, int j)
- {
- lineEdit = new QLineEdit(sheet);
- lineEdit->setValidator(validator);
- sheet->setCellWidget(i,j,lineEdit);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement