25 #include <QApplication>
26 #include <QFileDialog>
27 #include <QMessageBox>
28 #include <QVBoxLayout>
33 , m_view(new
GUI::RealSpace::Canvas)
35 , m_containingMultiLayerItem(nullptr)
38 auto* layout =
new QVBoxLayout;
40 layout->setSpacing(0);
49 std::visit([&](
auto&& arg) { isValid = arg !=
nullptr; }, item);
72 QPixmap pixmap(this->size());
73 render(&pixmap, QPoint(), childrenRegion());
88 QString defaultExtension =
".png";
89 QString selectedFilter(
"*" + defaultExtension);
90 QString defaultName = dirname +
"/untitled";
91 QString fileName = QFileDialog::getSaveFileName(
92 nullptr,
"Save 3D real space view", defaultName, selectedFilter,
nullptr,
94 : QFileDialog::DontUseNativeDialog);
96 fileName.endsWith(defaultExtension) ? fileName : fileName + defaultExtension;
98 if (!nameToSave.isEmpty()) {
100 pixmap.save(nameToSave);
101 }
catch (
const std::exception& ex) {
102 QString message =
"Attempt to save file with the name '";
103 message.append(nameToSave);
104 message.append(
"' has failed with following error message\n\n");
105 message.append(QString::fromStdString(ex.what()));
119 QApplication::setOverrideCursor(Qt::WaitCursor);
123 const auto colorForMaterialName = [&](
const QString& materialName) {
134 }
catch (
const std::exception& ex) {
141 QApplication::restoreOverrideCursor();
ApplicationSettings * appSettings
global pointer to the instance
Defines class ApplicationSettings.
Defines class CautionSign.
Defines class MaterialItem.
Defines class MultiLayerItem.
Defines class ProjectDocument.
Defines class RealSpaceBuilder.
Defines class RealSpaceCanvas.
SessionData * gSessionData
global pointer to the single instance
Defines struct SessionData.
bool useNativeFileDialog() const
The CautionSign controls appearance of CautionSignWidget on top of parent widget.
void clear()
Clears caution message;.
void setCautionMessage(const QString &cautionMessage)
Shows caution sign on the screen. If clear of previous caution sign had happened just few msec ago,...
const Position & getPos() const
MaterialItem * materialFromName(const QString &name) const
MaterialItems & materialItems()
void populate(RealSpace::Model *model, ItemForRealSpace item, const SceneGeometry &sceneGeometry, const RealSpace::Camera::Position &cameraPosition=RealSpace::Camera::Position(RealSpace::Vector3D(0, -200, 120), RealSpace::Vector3D(0, 0, 0), RealSpace::Vector3D::_z)) const
SceneGeometry m_sceneGeometry
void setCurrentItem(MultiLayerItem *containingMultiLayerItem, ItemForRealSpace item)
GUI::RealSpace::Canvas * m_view
std::variant< MultiLayerItem *, LayerItem *, ParticleLayoutItem *, ItemWithParticles * > ItemForRealSpace
Defines the item types which can be the "current item".
std::optional< ItemForRealSpace > m_currentItem
void showEvent(QShowEvent *) override
CautionSign * m_cautionSign
void changeLayerSize(double layerSizeChangeScale)
MultiLayerItem * m_containingMultiLayerItem
std::unique_ptr< GUI::RealSpace::Model > m_realSpaceModel
RealSpaceCanvas(QWidget *parent=nullptr)
void warning(QWidget *parent, const QString &title, const QString &text, const QString &detailedText)
std::optional< ProjectDocument * > projectDocument