From 39c5098dbb3dd547c315c5baf0f83ebe81b28756 Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 24 Mar 2014 18:53:06 +0100 Subject: QPrintDialog - Add Direct print to manual test Enable printing without dialog. Change-Id: I1058361febc7ddd8a5e0471e4365969e2f8becfe Reviewed-by: Friedemann Kleint --- tests/manual/dialogs/printdialogpanel.cpp | 8 ++++++++ tests/manual/dialogs/printdialogpanel.h | 1 + tests/manual/dialogs/printdialogpanel.ui | 7 +++++++ 3 files changed, 16 insertions(+) (limited to 'tests/manual') diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp index f7d027020c..1a18f94406 100644 --- a/tests/manual/dialogs/printdialogpanel.cpp +++ b/tests/manual/dialogs/printdialogpanel.cpp @@ -379,6 +379,7 @@ PrintDialogPanel::PrintDialogPanel(QWidget *parent) connect(m_panel.m_printButton, SIGNAL(clicked()), this, SLOT(showPrintDialog())); connect(m_panel.m_printPreviewButton, SIGNAL(clicked()), this, SLOT(showPreviewDialog())); connect(m_panel.m_pageSetupButton, SIGNAL(clicked()), this, SLOT(showPageSetupDialog())); + connect(m_panel.m_directPrintButton, SIGNAL(clicked()), this, SLOT(directPrint())); enablePanels(); m_blockSignals = false; @@ -686,6 +687,13 @@ void PrintDialogPanel::showPageSetupDialog() retrieveSettings(m_printer.data()); } +void PrintDialogPanel::directPrint() +{ + applySettings(m_printer.data()); + print(m_printer.data()); + retrieveSettings(m_printer.data()); +} + #include "moc_printdialogpanel.cpp" #include "printdialogpanel.moc" diff --git a/tests/manual/dialogs/printdialogpanel.h b/tests/manual/dialogs/printdialogpanel.h index 3932cd174f..3d340c7ccc 100644 --- a/tests/manual/dialogs/printdialogpanel.h +++ b/tests/manual/dialogs/printdialogpanel.h @@ -101,6 +101,7 @@ private slots: void showPrintDialog(); void showPreviewDialog(); void showPageSetupDialog(); + void directPrint(); void unitsChanged(); void pageSizeChanged(); void pageDimensionsChanged(); diff --git a/tests/manual/dialogs/printdialogpanel.ui b/tests/manual/dialogs/printdialogpanel.ui index 733d52ad9e..2f0fe606a3 100644 --- a/tests/manual/dialogs/printdialogpanel.ui +++ b/tests/manual/dialogs/printdialogpanel.ui @@ -644,6 +644,13 @@ + + + + Direct Print + + + -- cgit v1.2.3 From b5eb850e0deb61ff71e26a5a2d0e070b91306aa2 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 31 Mar 2014 14:17:29 +0200 Subject: OSX: add several menuitem roles to support menu shortcuts in dialogs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now menu items and key shortcuts for Cut, Copy, Paste and Select All work in the standard ways in dialogs such as the file dialog, provided that the corresponding QActions have been created and added to the menu. This depends on new roles to identify each menu item which is so broadly applicable that it should work even when a native widget has focus; but the role will be auto-detected, just as we were already doing for application menu items such as Quit, About and Preferences. When the QFileDialog is opened, it will call redirectKnownMenuItemsToFirstResponder() which will make only those "special" menu items have the standard actions and nil targets. When the dialog is dismissed, those NSMenuItems must be reverted by calling resetKnownMenuItemsToQt(), because to invoke a QAction, the NSMenuItem's action should be itemFired and the target should be the QCocoaMenuDelegate. Task-number: QTBUG-17291 Change-Id: I501375ca6fa13fac75d4b4fdcede993ec2329cc7 Reviewed-by: Morten Johan Sørvig --- tests/manual/dialogs/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/manual') diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp index 6082727c3b..b2b5007662 100644 --- a/tests/manual/dialogs/main.cpp +++ b/tests/manual/dialogs/main.cpp @@ -70,6 +70,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) QAction *quitAction = fileMenu->addAction(tr("Quit")); quitAction->setShortcut(QKeySequence(QKeySequence::Quit)); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + QMenu *editMenu = menuBar()->addMenu(tr("&Edit")); + QAction *action = editMenu->addAction(tr("Cut")); + action->setShortcut(QKeySequence(QKeySequence::Quit)); + action = editMenu->addAction(tr("Copy")); + action->setShortcut(QKeySequence(QKeySequence::Copy)); + action = editMenu->addAction(tr("Paste")); + action->setShortcut(QKeySequence(QKeySequence::Paste)); + action = editMenu->addAction(tr("Select All")); + action->setShortcut(QKeySequence(QKeySequence::SelectAll)); QTabWidget *tabWidget = new QTabWidget; tabWidget->addTab(new FileDialogPanel, tr("QFileDialog")); tabWidget->addTab(new ColorDialogPanel, tr("QColorDialog")); -- cgit v1.2.3