diff options
author | Trond Kjernaasen <trond@trolltech.com> | 2009-03-03 14:51:31 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond@trolltech.com> | 2009-05-12 09:09:04 (GMT) |
commit | 8c0cdfdd4772e81164d838b9549e8c554ecf5966 (patch) | |
tree | b8b88fec086b5b3340130fe945daa26a9b97f397 /src | |
parent | 1aa3de46c5aea526e151025d953ab705f678676e (diff) | |
download | Qt-8c0cdfdd4772e81164d838b9549e8c554ecf5966.zip Qt-8c0cdfdd4772e81164d838b9549e8c554ecf5966.tar.gz Qt-8c0cdfdd4772e81164d838b9549e8c554ecf5966.tar.bz2 |
Work around a limitation in QFormLayout - 0 width content margins
aren't really supported.
Also set the default focus to be the preview widget itself.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/dialogs/qprintpreviewdialog.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index 494c455..3580fdc 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -228,7 +228,6 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer) QObject::connect(preview, SIGNAL(previewChanged()), q, SLOT(_q_previewChanged())); setupActions(); - pageNumEdit = new LineEdit; pageNumEdit->setAlignment(Qt::AlignRight); pageNumEdit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); @@ -265,13 +264,18 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer) toolbar->addAction(firstPageAction); toolbar->addAction(prevPageAction); - // this is to ensure the label text and the editor text - // are aligned in all styles + // this is to ensure the label text and the editor text are + // aligned in all styles - the extra QVBoxLayout is a workaround + // for bug in QFormLayout QWidget *pageEdit = new QWidget(toolbar); + QVBoxLayout *vboxLayout = new QVBoxLayout; + vboxLayout->setContentsMargins(0, 0, 0, 0); QFormLayout *formLayout = new QFormLayout; formLayout->setWidget(0, QFormLayout::LabelRole, pageNumEdit); formLayout->setWidget(0, QFormLayout::FieldRole, pageNumLabel); - pageEdit->setLayout(formLayout); + vboxLayout->addLayout(formLayout); + vboxLayout->setAlignment(Qt::AlignVCenter); + pageEdit->setLayout(vboxLayout); toolbar->addWidget(pageEdit); toolbar->addAction(nextPageAction); @@ -318,6 +322,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer) #endif ) pageSetupAction->setEnabled(false); + preview->setFocus(); } static inline void qt_setupActionIcon(QAction *action, const QLatin1String &name) |