setLayout(vl=new QVBoxLayout);
vl->addLayout(gl=new QGridLayout,0);
- gl->addWidget(new QLabel(tr("Label offset:")),0,0);
- gl->addWidget(offx=new QLineEdit(QString::number(ox)),0,1);
+ int ln=0;
+ gl->addWidget(new QLabel(tr("Label offset:")),ln,0);
+ gl->addWidget(offx=new QLineEdit(QString::number(ox)),ln,1);
offx->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
- gl->addWidget(new QLabel("x"),0,2);
- gl->addWidget(offy=new QLineEdit(QString::number(oy)),0,3);
+ gl->addWidget(new QLabel("x"),ln,2);
+ gl->addWidget(offy=new QLineEdit(QString::number(oy)),ln,3);
offy->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
- gl->addWidget(new QLabel(tr("Label size:")),1,0);
- gl->addWidget(sizex=new QLineEdit(QString::number(lsx)),1,1);
+ gl->addWidget(new QLabel(tr("Label size:")),++ln,0);
+ gl->addWidget(sizex=new QLineEdit(QString::number(lsx)),ln,1);
sizex->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
- gl->addWidget(new QLabel("x"),1,2);
- gl->addWidget(sizey=new QLineEdit(QString::number(lsy)),1,3);
+ gl->addWidget(new QLabel("x"),ln,2);
+ gl->addWidget(sizey=new QLineEdit(QString::number(lsy)),ln,3);
sizey->setValidator(new QDoubleValidator(0.0,1000.0,2,this));
- gl->addWidget(new QLabel(tr("Unit:")),2,0);
- gl->addWidget(metric=new QComboBox,2,1,1,3);
+ gl->addWidget(new QLabel(tr("Unit:")),++ln,0);
+ gl->addWidget(metric=new QComboBox,ln,1,1,3);
metric->addItem(tr("Millimeter"),"mm");
metric->addItem(tr("Centimeter"),"cm");
metric->addItem(tr("Inch"),"in");
- gl->setColumnStretch(4,10);
+ gl->addWidget(warning=new QLabel(""),++ln,0,1,4);
+ QPalette pal=warning->palette();
+ pal.setColor(QPalette::WindowText,Qt::red);
+ warning->setPalette(pal);
+ gl->setColumnStretch(++ln,10);
vl->addSpacing(10);
vl->addWidget(new QLabel(tr("Page usage:")),0);
ly*=printer->logicalDpiY()/25.4;
}
+ bool dowarn=false;
if(ly>0.0){
maxrows=pr.height()/ly;
if(maxrows>ROWS)maxrows=ROWS;
+ if(maxrows<1){
+ maxrows=1;
+ dowarn=true;
+ }
}else maxrows=ROWS;
if(lx>0.0){
maxcols=pr.width()/lx;
if(maxcols>COLS)maxcols=COLS;
+ if(maxcols<1){
+ maxcols=1;
+ dowarn=true;
+ }
}else maxcols=COLS;
//update
oldpage=page->itemData(page->currentIndex()).toInt();
checks[i]->setChecked(b && checked[oldpage][i]);
checks[i]->setEnabled(b);
}
+ if(dowarn)
+ warning->setText(tr("Warning: the label may not fit on the page!"));
+ else
+ warning->setText("");
}
void MLabelDialog::saveSettings()