Esempio n. 1
0
void EMainWindow::disconnectControls(EPainting *painting)
{
	if (!painting) return;
	Q_CHECK_PTR(painting);

	_objCreateGroup->setEnabled(false);

	QAction *openFileAction = _mainUi.actionOpen;
	QAction *saveFileAction = _mainUi.actionSave;
	QAction *exportAction = _mainUi.actionExport;

	// Соединения от MainWindow к EPainting
	Q_ASSERT(disconnect(openFileAction, SIGNAL(triggered()), painting, SLOT(openFile())));
	Q_ASSERT(disconnect(saveFileAction, SIGNAL(triggered()), painting, SLOT(saveFile())));
	Q_ASSERT(disconnect(exportAction, SIGNAL(triggered()), painting, SLOT(exportToSVG())));

	// Соединения от EPainting к MainWindow
	Q_ASSERT(disconnect(painting, SIGNAL(itemCreated()), this, SLOT(setSelectTool())));			//	сигнал перехода в режим "выбрать объект"
	Q_ASSERT(disconnect(painting, SIGNAL(nameChanged(QString)), this, SLOT(setCurrentTabName(QString))));
}
Esempio n. 2
0
void NMGPlotWidget::slotExportTo(NMGModulePreferencesManager* preferences)
{
  QString lastExportPath;
  if(preferences)
  {
    lastExportPath = preferences->getValue("GRAPHICS_EXPORT_PATH");
  }
  if(lastExportPath.isEmpty()) lastExportPath = QDir::homePath();
  
  QString filters = tr("Portable Network Graphics (*.png);;") + 
                    tr("Joint Photographic Experts Group (*.jpg);;") + 
                    tr("Scalable Vector Graphics (*.svg);;") + 
                    tr("Portable Document Format(*.pdf)");
  QFileDialog dialog(this, tr("Exporting to..."), lastExportPath, filters);
  dialog.setFileMode(QFileDialog::AnyFile);
  dialog.setAcceptMode(QFileDialog::AcceptSave);
  dialog.setLabelText(QFileDialog::Accept, tr("&Export"));
  if(dialog.exec())
  {
    QString exportFile = dialog.selectedFiles().value(0);
    if (!exportFile.isEmpty())
    {
      // save export path
      if(preferences)
      {
        QString path = exportFile;
        int lastPos = path.lastIndexOf("/",-1);
        preferences->addValue("GRAPHICS_EXPORT_PATH", path.left(lastPos));
      }
      QString selectedFilter = dialog.selectedFilter();
      if(selectedFilter.contains("*.png")) exportToPNG(exportFile);
      else if(selectedFilter.contains("*.jpg")) exportToJPG(exportFile);
      else if(selectedFilter.contains("*.svg")) exportToSVG(exportFile);
      else if(selectedFilter.contains("*.pdf")) exportToPDF(exportFile);
    }
  }
}