本文整理汇总了C++中ApplicationWindow::activeWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ ApplicationWindow::activeWindow方法的具体用法?C++ ApplicationWindow::activeWindow怎么用?C++ ApplicationWindow::activeWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationWindow
的用法示例。
在下文中一共展示了ApplicationWindow::activeWindow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initPreview
void ImportASCIIDialog::initPreview(int previewMode)
{
if (previewMode < NewTables || previewMode > Overwrite)
return;
ApplicationWindow *app = (ApplicationWindow *)parent();
if (!app)
return;
if (d_preview_table){
delete d_preview_table;
d_preview_table = NULL;
}
if (d_preview_matrix){
delete d_preview_matrix;
d_preview_matrix = NULL;
}
switch(previewMode){
case NewTables:
d_preview_table = new PreviewTable(30, 2, this);
d_preview_table->setNumericPrecision(app->d_decimal_digits);
d_preview_stack->addWidget(d_preview_table);
connect(d_preview_table, SIGNAL(modifiedColumnType()), this, SLOT(preview()));
enableTableOptions(true);
break;
case NewMatrices:
d_preview_matrix = new PreviewMatrix(app);
d_preview_stack->addWidget(d_preview_matrix);
enableTableOptions(false);
break;
case NewColumns:
case NewRows:
case Overwrite:
MdiSubWindow *w = app->activeWindow();
if (!w)
return;
if (w->inherits("Table")){
d_preview_table = new PreviewTable(30, ((Table*)w)->numCols(), this);
d_preview_table->setNumericPrecision(app->d_decimal_digits);
d_preview_stack->addWidget(d_preview_table);
connect(d_preview_table, SIGNAL(modifiedColumnType()), this, SLOT(preview()));
enableTableOptions(true);
} else if (w->isA("Matrix")){
d_preview_matrix = new PreviewMatrix(app, (Matrix *)w);
d_preview_stack->addWidget(d_preview_matrix);
enableTableOptions(false);
}
break;
}
preview();
}
示例2: add
void ErrDialog::add()
{
ApplicationWindow *app = qobject_cast<ApplicationWindow *>(parent());
if (!app)
return;
MultiLayer *plot = (MultiLayer *)app->activeWindow(ApplicationWindow::MultiLayerWindow);
if (!plot)
return;
Graph* g = plot->activeLayer();
if (!g)
return;
QString name = nameLabel->currentText();
DataCurve *curve = g->dataCurve(name);
if (!curve){
QMessageBox::critical(app, tr("QtiPlot - Error"),
tr("This feature is not available for user defined function curves!"));
return;
}
int direction = xErrBox->isChecked() ? 0 : 1;
ErrorBarsCurve *er = NULL;
if (columnBox->isChecked()){
QString errColumnName = tableNamesBox->currentText() + "_" + colNamesBox->currentText();
Table *errTable = app->table(errColumnName);
if (!errTable)
return;
/*if (w->numRows() != errTable->numRows()){
QMessageBox::critical(app, tr("QtiPlot - Error"), tr("The selected columns have different numbers of rows!"));
return;
}*/
if (errTable->isEmptyColumn(errTable->colIndex(errColumnName))){
QMessageBox::critical(app, tr("QtiPlot - Error"), tr("The selected error column is empty!"));
return;
}
er = g->addErrorBars(curve, errTable, errColumnName, direction);
} else {
Table *t = curve->table();
if (!t)
return;
if (direction == ErrorBarsCurve::Horizontal)
t->addCol(Table::xErr);
else
t->addCol(Table::yErr);
int r = curve->dataSize();
int rows = t->numRows();
int col = t->numCols() - 1;
int ycol = t->colIndex(curve->title().text());
if (!direction)
ycol = t->colIndex(curve->xColumnName());
QVarLengthArray<double> Y(r);
if (direction == ErrorBarsCurve::Horizontal){
for (int i = 0; i < r; i++)
Y[i] = curve->x(i);
} else {
for (int i = 0; i < r; i++)
Y[i] = curve->y(i);
}
if (percentBox->isChecked()){
double prc = 0.01*valueBox->value();
int aux = 0;
for (int i = curve->startRow(); i <= curve->endRow(); i++){
if (!t->text(i, ycol).isEmpty() && aux < r){
t->setCell(i, col, Y[aux]*prc);
aux++;
}
}
} else if (standardBox->isChecked() || standardErrorBox->isChecked()){
double sd = gsl_stats_sd(Y.data(), 1, r);
if (standardErrorBox->isChecked())
sd /= sqrt(r);
for (int i = 0; i < rows; i++){
if (!t->text(i, ycol).isEmpty())
t->setCell(i, col, sd);
}
}
er = g->addErrorBars(curve, t, t->colName(col), direction);
}
if (er){
er->setColor(curve->pen().color());
g->replot();
plot->notifyChanges();
}
}