1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 11:52:08 +01:00

Some more PDF export dialog polishing

This commit is contained in:
Martin Tůma 2016-05-28 07:39:40 +02:00
parent 498d33b77d
commit 330b6547c4
2 changed files with 9 additions and 4 deletions

View File

@ -74,8 +74,8 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
QGridLayout *marginsLayout = new QGridLayout();
marginsLayout->addWidget(_topMargin, 0, 0, 1, 2, Qt::AlignCenter);
marginsLayout->addWidget(_leftMargin, 1, 0, 1, 1, Qt::AlignCenter);
marginsLayout->addWidget(_rightMargin, 1, 1, 1, 1, Qt::AlignCenter);
marginsLayout->addWidget(_leftMargin, 1, 0, 1, 1, Qt::AlignRight);
marginsLayout->addWidget(_rightMargin, 1, 1, 1, 1, Qt::AlignLeft);
marginsLayout->addWidget(_bottomMargin, 2, 0, 1, 2, Qt::AlignCenter);
#ifndef Q_OS_MAC
@ -116,7 +116,6 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
layout->addWidget(outputFileBox);
#endif // Q_OS_MAC
layout->addWidget(buttonBox);
setLayout(layout);
setWindowTitle(tr("Export to PDF"));

View File

@ -1,12 +1,17 @@
#include <QPushButton>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QFileInfo>
#include <QApplication>
#include <QFontMetrics>
#include "fileselectwidget.h"
FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
{
QFontMetrics fm(QApplication::font());
_edit = new QLineEdit();
_edit->setMinimumWidth(fm.boundingRect(QDir::homePath()).width());
_button = new QPushButton(tr("Browse..."));
connect(_button, SIGNAL(clicked()), this, SLOT(browse()));
@ -19,8 +24,9 @@ FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
void FileSelectWidget::browse()
{
QFileInfo fi(_edit->text());
QString fileName = QFileDialog::getSaveFileName(this, tr("Select file"),
QDir::currentPath(), _filter);
fi.dir().absolutePath(), _filter);
if (!fileName.isEmpty())
_edit->setText(fileName);