Changeset 77130 in webkit
- Timestamp:
- Jan 31, 2011 7:39:43 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r77123 r77130 1 2011-01-31 Zoltan Horvath <zoltan@webkit.org> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Add Take Screen Shot action to MiniBrowser 6 https://bugs.webkit.org/show_bug.cgi?id=53422 7 8 Add Take Screen Shot action to MiniBrowser's view menu. 9 10 * MiniBrowser/qt/BrowserWindow.cpp: 11 (BrowserWindow::BrowserWindow): 12 (BrowserWindow::screenshot): 13 * MiniBrowser/qt/BrowserWindow.h: 14 1 15 2011-01-31 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 16 -
trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp
r76930 r77130 69 69 zoomText->setCheckable(true); 70 70 zoomText->setChecked(false); 71 viewMenu->addSeparator(); 72 viewMenu->addAction("Take Screen Shot...", this, SLOT(screenshot())); 71 73 72 74 zoomIn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus)); … … 180 182 } 181 183 184 void BrowserWindow::screenshot() 185 { 186 QPixmap pixmap = QPixmap::grabWidget(m_browser); 187 QLabel* label = 0; 188 #if !defined(Q_OS_SYMBIAN) 189 label = new QLabel; 190 label->setAttribute(Qt::WA_DeleteOnClose); 191 label->setWindowTitle("Screenshot - Preview"); 192 label->setPixmap(pixmap); 193 label->show(); 194 #endif 195 196 #ifndef QT_NO_FILEDIALOG 197 QString fileName = QFileDialog::getSaveFileName(label, "Screenshot", QString(), QString("PNG File (.png)")); 198 if (!fileName.isEmpty()) { 199 QRegExp rx("*.png"); 200 rx.setCaseSensitivity(Qt::CaseInsensitive); 201 rx.setPatternSyntax(QRegExp::Wildcard); 202 203 if (!rx.exactMatch(fileName)) 204 fileName += ".png"; 205 206 pixmap.save(fileName, "png"); 207 if (label) 208 label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName)); 209 } 210 #endif 211 } 212 182 213 void BrowserWindow::zoomIn() 183 214 { -
trunk/Tools/MiniBrowser/qt/BrowserWindow.h
r76930 r77130 62 62 void resetZoom(); 63 63 void toggleZoomTextOnly(bool on); 64 void screenshot(); 64 65 65 66 void showUserAgentDialog();
Note: See TracChangeset
for help on using the changeset viewer.