// Constructor
public TableDialog() {
okPressed = false;
setWindowTitle(tr("Insert Table"));
setWindowIcon(new QIcon(iconPath+"table.png"));
QGridLayout grid = new QGridLayout();
QGridLayout input = new QGridLayout();
QGridLayout msgGrid = new QGridLayout();
QGridLayout button = new QGridLayout();
setLayout(grid);
unit = new QComboBox(this);
unit.addItem(tr("Percent"),new Boolean(true));
unit.addItem(tr("Pixels"),new Boolean(false));
width = new QLineEdit("80");
widthValidator = new QIntValidator(0,100, this);
width.setValidator(widthValidator);
width.textChanged.connect(this, "validateWidth()");
rows = new QSpinBox();
cols = new QSpinBox();
rows.setMaximum(30);
rows.setMinimum(1);
cols.setMaximum(30);
cols.setMinimum(1);
unit.activated.connect(this, "unitChanged()");
input.addWidget(new QLabel(tr("Rows")), 1,1);
input.addWidget(rows, 1, 2);
input.addWidget(new QLabel(tr("Columns")), 2,1);
input.addWidget(cols, 2, 2);
input.addWidget(new QLabel(tr("Width")), 3,1);
input.addWidget(width, 3, 2);
input.addWidget(new QLabel(tr("Unit")),4,1);
input.addWidget(unit,4,2);
input.setContentsMargins(10, 10, -10, -10);
grid.addLayout(input, 1,1);
error = new QLabel();
msgGrid.addWidget(error, 1, 1);
grid.addLayout(msgGrid, 2, 1);
ok = new QPushButton(tr("OK"));
ok.clicked.connect(this, "okButtonPressed()");
QPushButton cancel = new QPushButton(tr("Cancel"));
cancel.clicked.connect(this, "cancelButtonPressed()");
button.addWidget(ok, 1, 1);
button.addWidget(cancel, 1,2);
grid.addLayout(button, 3, 1);
// width.textChanged.connect(this, "validateInput()");
}