Changeset 561 for trunk/demos/textedit
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/demos/textedit/example.html
r224 r561 27 27 <p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><span style=" font-size:16pt; font-weight:600;">Images</span></p> 28 28 <p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt; font-weight:600;"><span style=" font-size:11pt; font-weight:400;">Inline images are treated like ordinary ranges of characters in the text editor, so they flow with the surrounding text. Images can also be selected in the same way as text, making it easy to cut, copy, and paste them. </span></p> 29 <p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><img src=":/images/logo32.png" /><span style=" font-style:italic;"> Try to select this image by clicking and dragging over it with the mouse, or use the text cursor to select it by holding down Shift and using the arrow keys. You can then cut or copy it, and past ingit into different parts of this document.</span></p>29 <p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><img src=":/images/logo32.png" /><span style=" font-style:italic;"> Try to select this image by clicking and dragging over it with the mouse, or use the text cursor to select it by holding down Shift and using the arrow keys. You can then cut or copy it, and paste it into different parts of this document.</span></p> 30 30 <p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><span style=" font-size:16pt; font-weight:600;">Tables</span></p> 31 31 <p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt; font-weight:600;"><span style=" font-size:11pt; font-weight:400;">QTextEdit can arrange and format tables, supporting features such as row and column spans, text formatting within cells, and size constraints for columns. </span></p> -
trunk/demos/textedit/main.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the demonstration applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/demos/textedit/textedit.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the demonstration applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 76 76 : QMainWindow(parent) 77 77 { 78 setToolButtonStyle(Qt::ToolButtonFollowStyle); 78 79 setupFileActions(); 79 80 setupEditActions(); … … 88 89 89 90 textEdit = new QTextEdit(this); 90 connect(textEdit, SIGNAL(currentCharFormatChanged( const QTextCharFormat &)),91 this, SLOT(currentCharFormatChanged( const QTextCharFormat &)));91 connect(textEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), 92 this, SLOT(currentCharFormatChanged(QTextCharFormat))); 92 93 connect(textEdit, SIGNAL(cursorPositionChanged()), 93 94 this, SLOT(cursorPositionChanged())); … … 128 129 connect(textEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); 129 130 131 #ifndef QT_NO_CLIPBOARD 130 132 connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); 133 #endif 131 134 132 135 QString initialFile = ":/example.html"; … … 158 161 QAction *a; 159 162 160 a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this); 163 QIcon newIcon = QIcon::fromTheme("document-new", QIcon(rsrcPath + "/filenew.png")); 164 a = new QAction( newIcon, tr("&New"), this); 165 a->setPriority(QAction::LowPriority); 161 166 a->setShortcut(QKeySequence::New); 162 167 connect(a, SIGNAL(triggered()), this, SLOT(fileNew())); … … 164 169 menu->addAction(a); 165 170 166 a = new QAction(QIcon(rsrcPath + "/fileopen.png"), tr("&Open..."), this); 171 a = new QAction(QIcon::fromTheme("document-open", QIcon(rsrcPath + "/fileopen.png")), 172 tr("&Open..."), this); 167 173 a->setShortcut(QKeySequence::Open); 168 174 connect(a, SIGNAL(triggered()), this, SLOT(fileOpen())); … … 172 178 menu->addSeparator(); 173 179 174 actionSave = a = new QAction(QIcon(rsrcPath + "/filesave.png"), tr("&Save"), this); 180 actionSave = a = new QAction(QIcon::fromTheme("document-save", QIcon(rsrcPath + "/filesave.png")), 181 tr("&Save"), this); 175 182 a->setShortcut(QKeySequence::Save); 176 183 connect(a, SIGNAL(triggered()), this, SLOT(fileSave())); … … 180 187 181 188 a = new QAction(tr("Save &As..."), this); 189 a->setPriority(QAction::LowPriority); 182 190 connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs())); 183 191 menu->addAction(a); … … 185 193 186 194 #ifndef QT_NO_PRINTER 187 a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("&Print..."), this); 195 a = new QAction(QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png")), 196 tr("&Print..."), this); 197 a->setPriority(QAction::LowPriority); 188 198 a->setShortcut(QKeySequence::Print); 189 199 connect(a, SIGNAL(triggered()), this, SLOT(filePrint())); … … 191 201 menu->addAction(a); 192 202 193 a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("Print Preview..."), this); 203 a = new QAction(QIcon::fromTheme("fileprint", QIcon(rsrcPath + "/fileprint.png")), 204 tr("Print Preview..."), this); 194 205 connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview())); 195 206 menu->addAction(a); 196 207 197 a = new QAction(QIcon(rsrcPath + "/exportpdf.png"), tr("&Export PDF..."), this); 208 a = new QAction(QIcon::fromTheme("exportpdf", QIcon(rsrcPath + "/exportpdf.png")), 209 tr("&Export PDF..."), this); 210 a->setPriority(QAction::LowPriority); 198 211 a->setShortcut(Qt::CTRL + Qt::Key_D); 199 212 connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf())); … … 215 228 tb->setWindowTitle(tr("Edit Actions")); 216 229 addToolBar(tb); 217 218 230 QMenu *menu = new QMenu(tr("&Edit"), this); 219 231 menuBar()->addMenu(menu); 220 232 221 233 QAction *a; 222 a = actionUndo = new QAction(QIcon(rsrcPath + "/editundo.png"), tr("&Undo"), this); 234 a = actionUndo = new QAction(QIcon::fromTheme("edit-undo", QIcon(rsrcPath + "/editundo.png")), 235 tr("&Undo"), this); 223 236 a->setShortcut(QKeySequence::Undo); 224 237 tb->addAction(a); 225 238 menu->addAction(a); 226 a = actionRedo = new QAction(QIcon(rsrcPath + "/editredo.png"), tr("&Redo"), this); 239 a = actionRedo = new QAction(QIcon::fromTheme("edit-redo", QIcon(rsrcPath + "/editredo.png")), 240 tr("&Redo"), this); 241 a->setPriority(QAction::LowPriority); 227 242 a->setShortcut(QKeySequence::Redo); 228 243 tb->addAction(a); 229 244 menu->addAction(a); 230 245 menu->addSeparator(); 231 a = actionCut = new QAction(QIcon(rsrcPath + "/editcut.png"), tr("Cu&t"), this); 246 a = actionCut = new QAction(QIcon::fromTheme("edit-cut", QIcon(rsrcPath + "/editcut.png")), 247 tr("Cu&t"), this); 248 a->setPriority(QAction::LowPriority); 232 249 a->setShortcut(QKeySequence::Cut); 233 250 tb->addAction(a); 234 251 menu->addAction(a); 235 a = actionCopy = new QAction(QIcon(rsrcPath + "/editcopy.png"), tr("&Copy"), this); 252 a = actionCopy = new QAction(QIcon::fromTheme("edit-copy", QIcon(rsrcPath + "/editcopy.png")), 253 tr("&Copy"), this); 254 a->setPriority(QAction::LowPriority); 236 255 a->setShortcut(QKeySequence::Copy); 237 256 tb->addAction(a); 238 257 menu->addAction(a); 239 a = actionPaste = new QAction(QIcon(rsrcPath + "/editpaste.png"), tr("&Paste"), this); 258 a = actionPaste = new QAction(QIcon::fromTheme("edit-paste", QIcon(rsrcPath + "/editpaste.png")), 259 tr("&Paste"), this); 260 a->setPriority(QAction::LowPriority); 240 261 a->setShortcut(QKeySequence::Paste); 241 262 tb->addAction(a); 242 263 menu->addAction(a); 264 #ifndef QT_NO_CLIPBOARD 243 265 actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty()); 266 #endif 244 267 } 245 268 … … 253 276 menuBar()->addMenu(menu); 254 277 255 actionTextBold = new QAction(QIcon(rsrcPath + "/textbold.png"), tr("&Bold"), this); 278 actionTextBold = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")), 279 tr("&Bold"), this); 256 280 actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); 257 QFont bold; 281 actionTextBold->setPriority(QAction::LowPriority); 282 QFont bold; 258 283 bold.setBold(true); 259 284 actionTextBold->setFont(bold); … … 263 288 actionTextBold->setCheckable(true); 264 289 265 actionTextItalic = new QAction(QIcon(rsrcPath + "/textitalic.png"), tr("&Italic"), this); 290 actionTextItalic = new QAction(QIcon::fromTheme("format-text-italic", QIcon(rsrcPath + "/textitalic.png")), 291 tr("&Italic"), this); 292 actionTextItalic->setPriority(QAction::LowPriority); 266 293 actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); 267 294 QFont italic; … … 273 300 actionTextItalic->setCheckable(true); 274 301 275 actionTextUnderline = new QAction(QIcon(rsrcPath + "/textunder.png"), tr("&Underline"), this); 302 actionTextUnderline = new QAction(QIcon::fromTheme("format-text-underline", QIcon(rsrcPath + "/textunder.png")), 303 tr("&Underline"), this); 276 304 actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); 305 actionTextUnderline->setPriority(QAction::LowPriority); 277 306 QFont underline; 278 307 underline.setUnderline(true); … … 286 315 287 316 QActionGroup *grp = new QActionGroup(this); 288 connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction*)));317 connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*))); 289 318 290 319 // Make sure the alignLeft is always left of the alignRight 291 320 if (QApplication::isLeftToRight()) { 292 actionAlignLeft = new QAction(QIcon(rsrcPath + "/textleft.png"), tr("&Left"), grp); 293 actionAlignCenter = new QAction(QIcon(rsrcPath + "/textcenter.png"), tr("C&enter"), grp); 294 actionAlignRight = new QAction(QIcon(rsrcPath + "/textright.png"), tr("&Right"), grp); 321 actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), 322 tr("&Left"), grp); 323 actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp); 324 actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp); 295 325 } else { 296 actionAlignRight = new QAction(QIcon (rsrcPath + "/textright.png"), tr("&Right"), grp);297 actionAlignCenter = new QAction(QIcon (rsrcPath + "/textcenter.png"), tr("C&enter"), grp);298 actionAlignLeft = new QAction(QIcon (rsrcPath + "/textleft.png"), tr("&Left"), grp);299 } 300 actionAlignJustify = new QAction(QIcon (rsrcPath + "/textjustify.png"), tr("&Justify"), grp);326 actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp); 327 actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp); 328 actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp); 329 } 330 actionAlignJustify = new QAction(QIcon::fromTheme("format-justify-fill", QIcon(rsrcPath + "/textjustify.png")), tr("&Justify"), grp); 301 331 302 332 actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); 303 333 actionAlignLeft->setCheckable(true); 334 actionAlignLeft->setPriority(QAction::LowPriority); 304 335 actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); 305 336 actionAlignCenter->setCheckable(true); 337 actionAlignCenter->setPriority(QAction::LowPriority); 306 338 actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); 307 339 actionAlignRight->setCheckable(true); 340 actionAlignRight->setPriority(QAction::LowPriority); 308 341 actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); 309 342 actionAlignJustify->setCheckable(true); 343 actionAlignJustify->setPriority(QAction::LowPriority); 310 344 311 345 tb->addActions(grp->actions()); … … 337 371 comboStyle->addItem("Ordered List (Alpha lower)"); 338 372 comboStyle->addItem("Ordered List (Alpha upper)"); 373 comboStyle->addItem("Ordered List (Roman lower)"); 374 comboStyle->addItem("Ordered List (Roman upper)"); 339 375 connect(comboStyle, SIGNAL(activated(int)), 340 376 this, SLOT(textStyle(int))); … … 342 378 comboFont = new QFontComboBox(tb); 343 379 tb->addWidget(comboFont); 344 connect(comboFont, SIGNAL(activated( const QString &)),345 this, SLOT(textFamily( const QString &)));380 connect(comboFont, SIGNAL(activated(QString)), 381 this, SLOT(textFamily(QString))); 346 382 347 383 comboSize = new QComboBox(tb); … … 354 390 comboSize->addItem(QString::number(size)); 355 391 356 connect(comboSize, SIGNAL(activated( const QString &)),357 this, SLOT(textSize( const QString &)));392 connect(comboSize, SIGNAL(activated(QString)), 393 this, SLOT(textSize(QString))); 358 394 comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font() 359 395 .pointSize()))); … … 476 512 QPrinter printer(QPrinter::HighResolution); 477 513 QPrintPreviewDialog preview(&printer, this); 478 connect(&preview, SIGNAL(paintRequested(QPrinter *)), SLOT(printPreview(QPrinter*)));514 connect(&preview, SIGNAL(paintRequested(QPrinter*)), SLOT(printPreview(QPrinter*))); 479 515 preview.exec(); 480 516 #endif … … 574 610 style = QTextListFormat::ListUpperAlpha; 575 611 break; 612 case 7: 613 style = QTextListFormat::ListLowerRoman; 614 break; 615 case 8: 616 style = QTextListFormat::ListUpperRoman; 617 break; 576 618 } 577 619 … … 639 681 void TextEdit::clipboardDataChanged() 640 682 { 683 #ifndef QT_NO_CLIPBOARD 641 684 actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty()); 685 #endif 642 686 } 643 687 -
trunk/demos/textedit/textedit.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the demonstration applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/demos/textedit/textedit.pro
r2 r561 20 20 INSTALLS += target sources 21 21 22 symbian: include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
Note:
See TracChangeset
for help on using the changeset viewer.