AutoResizeMixin::AutoResizeMixin (const QPoint& point, RectGetter_f size, QWindow *window) : QObject (window) , OrigPoint_ (point) , Mover_ ([window] (const QPoint& pos) { window->setPosition (pos); }) , Rect_ (size) { window->installEventFilter (this); Refit (window->size ()); }
bool AutoResizeMixin::eventFilter (QObject*, QEvent *event) { if (event->type () != QEvent::Resize) return false; auto re = static_cast<QResizeEvent*> (event); Refit (re->size ()); return false; }
AutoResizeMixin::AutoResizeMixin (const QPoint& point, RectGetter_f size, QWidget *view) : QObject (view) , OrigPoint_ (point) , Mover_ ([view] (const QPoint& pos) { view->move (pos); }) , Rect_ (size) { view->installEventFilter (this); Refit (view->size ()); }
void GLFitDirector::HandleFitMenu ( const JIndex index ) { if (index == kNonLinearCmd) { itsNLFitDialog = new GLNonLinearFitDialog(this); assert(itsNLFitDialog != NULL); itsNLFitDialog->BeginDialog(); ListenTo(itsNLFitDialog); } else if (index == kPolyCmd) { itsPolyFitDialog = new GLPolyFitDialog(this); assert(itsPolyFitDialog != NULL); itsPolyFitDialog->BeginDialog(); ListenTo(itsPolyFitDialog); } else if (index == kRemoveFitCmd) { JIndex index; if (itsFitList->GetCurrentFitIndex(&index)) { itsExprWidget->ClearFunction(); itsExprWidget->Hide(); GetFitManager()->RemoveFitDescription(index); } } else if (index == kFitCmd) { Fit(); AddHistoryText(); } else if (index == kTestFitCmd) { TestFit(); } else if (index == kShowStartCmd) { itsParameterTable->ShowStartCol(!itsParameterTable->IsShowingStartCol()); } else if (index == kRefitCmd) { Refit(); AddHistoryText(kJTrue); } else if (index == kPlotCmd) { // JString fn = itsCurrentFit->GetFitFunctionString(); // need to check - via // JFunction* f; // if (JParseFunction(itsFunctionString->GetText(), itsList, &f)) // { // return kJTrue; // } // whether or not the function is valid. JIndex index; JBoolean ok = itsCurveList->GetCurrentCurveIndex(&index); JPlotDataBase* data = &(itsPlot->GetCurve(index)); assert(itsCurrentFit != NULL); JPlotFitProxy* proxy = new JPlotFitProxy(itsCurrentFit, itsPlot, data); assert(proxy != NULL); JIndex findex; ok = itsFitList->GetCurrentFitIndex(&findex); assert(ok); const GLFitDescription& fd = GetFitManager()->GetFitDescription(findex); itsDir->AddFitProxy(proxy, index, fd.GetFnName()); } else if (index == kShowHistoryCmd) { itsHistory->Activate(); } else if (index == kPrintCmd) { itsPrinter->BeginUserPrintSetup(); } else if (index == kCloseCmd) { Close(); } }