Changeset 561 for trunk/demos/textedit


Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
1 deleted
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/demos/textedit/example.html

    r224 r561  
    2727<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>
    2828<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 pasting it 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>
    3030<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>
    3131<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  
    22**
    33** 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)
    56**
    67** This file is part of the demonstration applications of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/demos/textedit/textedit.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the demonstration applications of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    7676    : QMainWindow(parent)
    7777{
     78    setToolButtonStyle(Qt::ToolButtonFollowStyle);
    7879    setupFileActions();
    7980    setupEditActions();
     
    8889
    8990    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)));
    9293    connect(textEdit, SIGNAL(cursorPositionChanged()),
    9394            this, SLOT(cursorPositionChanged()));
     
    128129    connect(textEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool)));
    129130
     131#ifndef QT_NO_CLIPBOARD
    130132    connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
     133#endif
    131134
    132135    QString initialFile = ":/example.html";
     
    158161    QAction *a;
    159162
    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);
    161166    a->setShortcut(QKeySequence::New);
    162167    connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
     
    164169    menu->addAction(a);
    165170
    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);
    167173    a->setShortcut(QKeySequence::Open);
    168174    connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
     
    172178    menu->addSeparator();
    173179
    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);
    175182    a->setShortcut(QKeySequence::Save);
    176183    connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
     
    180187
    181188    a = new QAction(tr("Save &As..."), this);
     189    a->setPriority(QAction::LowPriority);
    182190    connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
    183191    menu->addAction(a);
     
    185193
    186194#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);   
    188198    a->setShortcut(QKeySequence::Print);
    189199    connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
     
    191201    menu->addAction(a);
    192202
    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);
    194205    connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
    195206    menu->addAction(a);
    196207
    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);
    198211    a->setShortcut(Qt::CTRL + Qt::Key_D);
    199212    connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
     
    215228    tb->setWindowTitle(tr("Edit Actions"));
    216229    addToolBar(tb);
    217 
    218230    QMenu *menu = new QMenu(tr("&Edit"), this);
    219231    menuBar()->addMenu(menu);
    220232
    221233    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);
    223236    a->setShortcut(QKeySequence::Undo);
    224237    tb->addAction(a);
    225238    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);
    227242    a->setShortcut(QKeySequence::Redo);
    228243    tb->addAction(a);
    229244    menu->addAction(a);
    230245    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);
    232249    a->setShortcut(QKeySequence::Cut);
    233250    tb->addAction(a);
    234251    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);
    236255    a->setShortcut(QKeySequence::Copy);
    237256    tb->addAction(a);
    238257    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);
    240261    a->setShortcut(QKeySequence::Paste);
    241262    tb->addAction(a);
    242263    menu->addAction(a);
     264#ifndef QT_NO_CLIPBOARD
    243265    actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());
     266#endif
    244267}
    245268
     
    253276    menuBar()->addMenu(menu);
    254277
    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);
    256280    actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
    257     QFont bold;
     281    actionTextBold->setPriority(QAction::LowPriority);
     282        QFont bold;
    258283    bold.setBold(true);
    259284    actionTextBold->setFont(bold);
     
    263288    actionTextBold->setCheckable(true);
    264289
    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);
    266293    actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
    267294    QFont italic;
     
    273300    actionTextItalic->setCheckable(true);
    274301
    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);
    276304    actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
     305    actionTextUnderline->setPriority(QAction::LowPriority);
    277306    QFont underline;
    278307    underline.setUnderline(true);
     
    286315
    287316    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*)));
    289318
    290319    // Make sure the alignLeft  is always left of the alignRight
    291320    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);
    295325    } 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);
    301331
    302332    actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
    303333    actionAlignLeft->setCheckable(true);
     334    actionAlignLeft->setPriority(QAction::LowPriority);
    304335    actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
    305336    actionAlignCenter->setCheckable(true);
     337    actionAlignCenter->setPriority(QAction::LowPriority);
    306338    actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
    307339    actionAlignRight->setCheckable(true);
     340    actionAlignRight->setPriority(QAction::LowPriority);
    308341    actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
    309342    actionAlignJustify->setCheckable(true);
     343    actionAlignJustify->setPriority(QAction::LowPriority);
    310344
    311345    tb->addActions(grp->actions());
     
    337371    comboStyle->addItem("Ordered List (Alpha lower)");
    338372    comboStyle->addItem("Ordered List (Alpha upper)");
     373    comboStyle->addItem("Ordered List (Roman lower)");
     374    comboStyle->addItem("Ordered List (Roman upper)");
    339375    connect(comboStyle, SIGNAL(activated(int)),
    340376            this, SLOT(textStyle(int)));
     
    342378    comboFont = new QFontComboBox(tb);
    343379    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)));
    346382
    347383    comboSize = new QComboBox(tb);
     
    354390        comboSize->addItem(QString::number(size));
    355391
    356     connect(comboSize, SIGNAL(activated(const QString &)),
    357             this, SLOT(textSize(const QString &)));
     392    connect(comboSize, SIGNAL(activated(QString)),
     393            this, SLOT(textSize(QString)));
    358394    comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font()
    359395                                                                   .pointSize())));
     
    476512    QPrinter printer(QPrinter::HighResolution);
    477513    QPrintPreviewDialog preview(&printer, this);
    478     connect(&preview, SIGNAL(paintRequested(QPrinter *)), SLOT(printPreview(QPrinter *)));
     514    connect(&preview, SIGNAL(paintRequested(QPrinter*)), SLOT(printPreview(QPrinter*)));
    479515    preview.exec();
    480516#endif
     
    574610                style = QTextListFormat::ListUpperAlpha;
    575611                break;
     612            case 7:
     613                style = QTextListFormat::ListLowerRoman;
     614                break;
     615            case 8:
     616                style = QTextListFormat::ListUpperRoman;
     617                break;
    576618        }
    577619
     
    639681void TextEdit::clipboardDataChanged()
    640682{
     683#ifndef QT_NO_CLIPBOARD
    641684    actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());
     685#endif
    642686}
    643687
  • trunk/demos/textedit/textedit.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the demonstration applications of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/demos/textedit/textedit.pro

    r2 r561  
    2020INSTALLS += target sources
    2121
     22symbian: include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
Note: See TracChangeset for help on using the changeset viewer.