Skip to content

Commit 241e948

Browse files
committed
Print Preview becomes the main printing dialog
1 parent 1c27f43 commit 241e948

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

doc/CONSTANTS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,4 @@ A typical ``{PEB_executable_directory}`` looks like this:
8888
All specific keyboard shortcuts are available only in the QtWebKit builds of PEB.
8989

9090
* <kbd>Ctrl</kbd> + <kbd>I</kbd> - start QWebInspector
91-
* <kbd>Ctrl</kbd> + <kbd>P</kbd> - get printer selection dialog. If no printer is configured, no dialog is displayed.
92-
* <kbd>Ctrl</kbd> + <kbd>R</kbd> - get print preview
91+
* <kbd>Ctrl</kbd> + <kbd>P</kbd> - get Print Preview

src/webkit-view.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ QViewWidget::QViewWidget()
3434

3535
// Keyboard shortcuts:
3636
#ifndef QT_NO_PRINTER
37-
QShortcut *printShortcut = new QShortcut(QKeySequence("Ctrl+P"), this);
38-
QObject::connect(printShortcut, SIGNAL(activated()),
39-
this, SLOT(qPrintSlot()));
40-
4137
QShortcut *printPreviewShortcut =
42-
new QShortcut(QKeySequence("Ctrl+R"), this);
38+
new QShortcut(QKeySequence("Ctrl+P"), this);
4339
QObject::connect(printPreviewShortcut, SIGNAL(activated()),
4440
this, SLOT(qStartPrintPreviewSlot()));
4541
#endif

src/webkit-view.h

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ public slots:
145145
.screen()->rect().width() * 0.8,
146146
QDesktopWidget()
147147
.screen()->rect().height() * 0.8);
148-
connect(&preview, SIGNAL(paintRequested(QPrinter*)),
149-
SLOT(qPrintPreviewSlot(QPrinter*)));
148+
QObject::connect(&preview, SIGNAL(paintRequested(QPrinter*)),
149+
SLOT(qPrintPreviewSlot(QPrinter*)));
150150
preview.exec();
151151
#endif
152152
}
@@ -160,26 +160,6 @@ public slots:
160160
#endif
161161
}
162162

163-
void qPrintSlot()
164-
{
165-
#ifndef QT_NO_PRINTER
166-
QPrinter printer;
167-
QPrintDialog *printDialog = new QPrintDialog(&printer);
168-
printDialog->setWindowModality(Qt::WindowModal);
169-
QSize dialogSize = printDialog->sizeHint();
170-
QRect screenRect = QDesktopWidget().screen()->rect();
171-
printDialog->move(QPoint((screenRect.width() / 2)
172-
- (dialogSize.width() / 2),
173-
(screenRect.height() / 2)
174-
- (dialogSize.height() / 2)));
175-
if (printDialog->exec() == QDialog::Accepted) {
176-
QViewWidget::print(&printer);
177-
}
178-
printDialog->close();
179-
printDialog->deleteLater();
180-
#endif
181-
}
182-
183163
// ==============================
184164
// QWebInspector window:
185165
// ==============================

0 commit comments

Comments
 (0)