Browse Source

- added png export... that was easy.

tags/1.3
Sven Oliver Moll 1 year ago
parent
commit
c551e02b64
4 changed files with 29 additions and 3 deletions
  1. 0
    1
      TODO
  2. 16
    0
      src/fridgegrid/DragWidget.cpp
  3. 5
    0
      src/fridgegrid/DragWidget.hpp
  4. 8
    2
      src/fridgegrid/MainWindow.cpp

+ 0
- 1
TODO View File

@@ -1,5 +1,4 @@

- export to png
- "new" in file menu
- templates


+ 16
- 0
src/fridgegrid/DragWidget.cpp View File

@@ -300,6 +300,22 @@ void DragWidget::place( QWidget *w, const QPoint &p )
}


void DragWidget::exportPng()
{
QSettings settings;
QFileInfo lastFilename( settings.value( "ExportFilename" ).toString() );
QString fileName = QFileDialog::getSaveFileName( this, QCoreApplication::applicationName(),
lastFilename.absoluteFilePath(), "*.png" );
if( fileName.isEmpty() )
{
return;
}
settings.setValue( "ExportFilename", fileName );

grab().save( fileName );
}


void DragWidget::save()
{
QSettings settings;

+ 5
- 0
src/fridgegrid/DragWidget.hpp View File

@@ -100,6 +100,11 @@ public slots:
/*!
\brief \todo

*/
void exportPng();
/*!
\brief \todo

\param d
\param p
*/

+ 8
- 2
src/fridgegrid/MainWindow.cpp View File

@@ -61,17 +61,23 @@ MainWindow::MainWindow( QWidget *parent, Qt::WindowFlags flags )
toolBar->setContextMenuPolicy( Qt::PreventContextMenu );

action = new QAction( style.standardIcon( QStyle::SP_DialogOpenButton ), "Open", this );
action->setShortcuts( QKeySequence::New );
action->setShortcuts( QKeySequence::Open );
connect( action, SIGNAL(triggered()),
mpDragWidget, SLOT(load()) );
toolBar->addAction( action );

action = new QAction( style.standardIcon( QStyle::SP_DialogSaveButton ), "Save", this );
action->setShortcuts( QKeySequence::Open );
action->setShortcuts( QKeySequence::Save );
connect( action, SIGNAL(triggered()),
mpDragWidget, SLOT(save()) );
toolBar->addAction( action );

action = new QAction( style.standardIcon( QStyle::SP_CommandLink ), "Export", this );
action->setShortcuts( QKeySequence::SaveAs );
connect( action, SIGNAL(triggered()),
mpDragWidget, SLOT(exportPng()) );
toolBar->addAction( action );

toolBar = addToolBar( tr("Element") );
toolBar->setObjectName( "ElementsToolBar" );
toolBar->setContextMenuPolicy( Qt::PreventContextMenu );

Loading…
Cancel
Save