예제 #1
0
void StationTreeView::saveList()
{
	TreeItem* item = static_cast<StationTreeModel*>(model())->getItem(
	        this->selectionModel()->currentIndex());
	QString listName = item->data(0).toString();
	QString fileName = QFileDialog::getSaveFileName(this, "Save station list", "","*.stn");
	if (!fileName.isEmpty())
		emit stationListSaved(listName, fileName);
}
예제 #2
0
void StationTreeView::writeToFile()
{
    QModelIndex index (this->selectionModel()->currentIndex());
    if (!index.isValid())
        OGSError::box("No station list selected.");
    else
    {
        TreeItem* item = static_cast<StationTreeModel*>(model())->getItem(index);
        QString listName = item->data(0).toString();
        QString fileName = QFileDialog::getSaveFileName(this, "Save station list",
            LastSavedFileDirectory::getDir() + listName, "*.stn");
        if (!fileName.isEmpty())
        {
            LastSavedFileDirectory::setDir(fileName);
            emit stationListSaved(listName, fileName);
        }
    }
}