MCPcopy Create free account
hub / github.com/KDE/labplot / setProject

Method setProject

src/frontend/dockwidgets/ProjectDock.cpp:36–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void ProjectDock::setProject(Project* project) {
37 CONDITIONAL_LOCK_RETURN;
38 m_project = project;
39 setAspects(QList<Project*>({project}));
40
41 ui.leFileName->setText(project->fileName());
42 ui.leAuthor->setText(m_project->author());
43
44 ui.lVersion->setText(project->version());
45 ui.lCreated->setText(project->creationTime().toString());
46 ui.lModified->setText(project->modificationTime().toString());
47 ui.chkSaveDockStates->setChecked(project->saveDefaultDockWidgetState());
48
49 bool visible = !project->children<XYAnalysisCurve>(AbstractAspect::ChildIndexFlag::Recursive).isEmpty();
50 ui.lSaveCalculations->setVisible(visible);
51 ui.chkSaveCalculations->setVisible(visible);
52 ui.chkSaveCalculations->setChecked(project->saveCalculations());
53
54 // resize the height of the comment field to fit the content (word wrap is ignored)
55 const double height = ui.teComment->document()->size().height() + ui.teComment->contentsMargins().top() * 2;
56 // HACK: we set the fixed height first and then set the min and max values back to the default ones,
57 // other methods don't seem to properly trigger the update of the layout and we don't get the proper
58 // widgets sizes in the dock widget.
59 ui.teComment->setFixedHeight(height);
60 ui.teComment->setMinimumHeight(0);
61 ui.teComment->setMaximumHeight(16777215);
62
63 connect(m_project, &Project::authorChanged, this, &ProjectDock::projectAuthorChanged);
64 connect(m_project, &Project::saveDefaultDockWidgetStateChanged, this, &ProjectDock::projectSaveDockStatesChanged);
65 connect(m_project, &Project::saveCalculationsChanged, this, &ProjectDock::projectSaveCalculationsChanged);
66}
67
68void ProjectDock::retranslateUi() {
69 QString msg = i18n("If checked, the state of the default application docks is saved in the project file and restored on project load.");

Callers

nothing calls this directly

Calls 10

saveCalculationsMethod · 0.80
heightMethod · 0.80
setTextMethod · 0.45
fileNameMethod · 0.45
versionMethod · 0.45
toStringMethod · 0.45
creationTimeMethod · 0.45
isEmptyMethod · 0.45
setVisibleMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected