summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_network_ssl_qsslconfiguration.cpp
diff options
context:
space:
mode:
authorck <qt-info@nokia.com>2009-07-31 12:41:45 (GMT)
committerck <qt-info@nokia.com>2009-07-31 12:41:45 (GMT)
commitc0f0e798e903c39d5f8b6dc6dd2abdfbcc8a7d93 (patch)
tree038a5d019ec3367033f9dfe3654a5f5a7ba7e957 /doc/src/snippets/code/src_network_ssl_qsslconfiguration.cpp
parent7c4b1863495905c3486ea36e0d559f49c6f2ebb4 (diff)
downloadQt-c0f0e798e903c39d5f8b6dc6dd2abdfbcc8a7d93.zip
Qt-c0f0e798e903c39d5f8b6dc6dd2abdfbcc8a7d93.tar.gz
Qt-c0f0e798e903c39d5f8b6dc6dd2abdfbcc8a7d93.tar.bz2
Assistant: Performance fixes for help generator's pattern matching.
Reading a help project was unacceptably slow with pattern matching. Now we do it only for filenames that contain wildcard symbols. Also, we cache the results of QDir::entryList() calls.
Diffstat (limited to 'doc/src/snippets/code/src_network_ssl_qsslconfiguration.cpp')
0 files changed, 0 insertions, 0 deletions
ontains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //! [0] class AppendText : public QUndoCommand { public: AppendText(QString *doc, const QString &text) : m_document(doc), m_text(text) { setText("append text"); } virtual void undo() { m_document->chop(m_text.length()); } virtual void redo() { m_document->append(m_text); } private: QString *m_document; QString m_text; }; //! [0] //! [1] MyCommand *command1 = new MyCommand(); stack->push(command1); MyCommand *command2 = new MyCommand(); stack->push(command2); stack->undo(); MyCommand *command3 = new MyCommand(); stack->push(command3); // command2 gets deleted //! [1] //! [2] QUndoCommand *insertRed = new QUndoCommand(); // an empty command insertRed->setText("insert red text"); new InsertText(document, idx, text, insertRed); // becomes child of insertRed new SetColor(document, idx, text.length(), Qt::red, insertRed); stack.push(insertRed); //! [2] //! [3] bool AppendText::mergeWith(const QUndoCommand *other) { if (other->id() != id()) // make sure other is also an AppendText command return false; m_text += static_cast<const AppendText*>(other)->m_text; return true; } //! [3] //! [4] stack.beginMacro("insert red text"); stack.push(new InsertText(document, idx, text)); stack.push(new SetColor(document, idx, text.length(), Qt::red)); stack.endMacro(); // indexChanged() is emitted //! [4] //! [5] QUndoCommand *insertRed = new QUndoCommand(); // an empty command insertRed->setText("insert red text"); new InsertText(document, idx, text, insertRed); // becomes child of insertRed new SetColor(document, idx, text.length(), Qt::red, insertRed); stack.push(insertRed); //! [5]