void KNoteEdit::setRichText( bool f ) { if ( f == acceptRichText() ) { return; } setAcceptRichText( f ); if ( f ) { setAutoFormatting( AutoAll ); } else { setAutoFormatting( AutoNone ); } const QString t = toPlainText(); if ( f ) { // if the note contains html source try to render it if ( Qt::mightBeRichText( t ) ) { setHtml( t ); } else { setPlainText( t ); } enableRichTextActions(); } else { setPlainText( t ); disableRichTextActions(); } }
TextEdit::TextEdit(QWidget *p, const char *name) : TextShow(p, name) { m_param = NULL; m_bEmpty = true; m_bBold = false; m_bItalic = false; m_bUnderline = false; m_bSelected = false; m_bNoSelected = false; m_bInClick = false; setReadOnly(false); curFG = colorGroup().color(QColorGroup::Text); m_bCtrlMode = true; setWordWrap(WidgetWidth); #if QT_VERSION >= 0x030100 setAutoFormatting(0); #endif connect(this, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(fontChanged(const QFont&))); connect(this, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(slotColorChanged(const QColor&))); connect(this, SIGNAL(textChanged()), this, SLOT(slotTextChanged())); #if QT_VERSION >= 300 connect(this, SIGNAL(clicked(int,int)), this, SLOT(slotClicked(int,int))); #endif viewport()->installEventFilter(this); fontChanged(font()); }
VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/) : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()) { setReadOnly(true); setUndoRedoEnabled(false); setOverwriteMode(false); setPlainText(""); setTextInteractionFlags(Qt::TextBrowserInteraction); setAutoFormatting(QTextEdit::AutoAll); setTabChangesFocus(true); setAcceptRichText(false); /* * Font. * Create actions for font menu items. */ m_pCourierFontAction = new QAction(tr("Courier"), this); m_pCourierFontAction->setCheckable(true); m_pCourierFontAction->setShortcut(Qt::ControlModifier + Qt::Key_D); connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(setFontCourier())); m_pMonospaceFontAction = new QAction(tr("Monospace"), this); m_pMonospaceFontAction->setCheckable(true); m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M); connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(setFontMonospace())); /* Create action group for grouping of exclusive font menu items. */ QActionGroup *pActionFontGroup = new QActionGroup(this); pActionFontGroup->addAction(m_pCourierFontAction); pActionFontGroup->addAction(m_pMonospaceFontAction); pActionFontGroup->setExclusive(true); /* * Color scheme. * Create actions for color-scheme menu items. */ m_pGreenOnBlackAction = new QAction(tr("Green On Black"), this); m_pGreenOnBlackAction->setCheckable(true); m_pGreenOnBlackAction->setShortcut(Qt::ControlModifier + Qt::Key_1); connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(setColorGreenOnBlack())); m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this); m_pBlackOnWhiteAction->setCheckable(true); m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2); connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(setColorBlackOnWhite())); /* Create action group for grouping of exclusive color-scheme menu items. */ QActionGroup *pActionColorGroup = new QActionGroup(this); pActionColorGroup->addAction(m_pGreenOnBlackAction); pActionColorGroup->addAction(m_pBlackOnWhiteAction); pActionColorGroup->setExclusive(true); /* * Set the defaults (which syncs with the menu item checked state). */ setFontCourier(); setColorGreenOnBlack(); NOREF(pszName); }
XbelWriter::XbelWriter(BookmarkModel *model) : QXmlStreamWriter() , bookmarkModel(model) { TRACE_OBJ setAutoFormatting(true); }
bool GeoWriter::write(QIODevice* device, const GeoNode *feature) { setDevice( device ); setAutoFormatting( true ); writeStartDocument(); //FIXME: write the starting tags. Possibly register a tag handler to do this // with a null string as the object name? GeoTagWriter::QualifiedName name( "", m_documentType ); const GeoTagWriter* writer = GeoTagWriter::recognizes(name); if( writer ) { //FIXME is this too much of a hack? //geodataobject is never used in this context GeoNode node; writer->write( &node, *this ); } else { mDebug() << "There is no GeoWriter registered for: " << name; return false; } if( ! writeElement( feature ) ) { return false; } //close the document writeEndElement(); return true; }
/** * Constructor * @param title :: The title * @param parent :: The parent widget * @param flags :: Window flags */ ScriptOutputDisplay::ScriptOutputDisplay(QWidget *parent) : QTextEdit(parent), m_copy(NULL), m_clear(NULL), m_save(NULL), m_origFontSize(8), m_zoomLevel(0) { #ifdef __APPLE__ // Make all fonts 4 points bigger on the Mac because otherwise they're tiny! m_zoomLevel += 4; #endif // the control is readonly, but if you set it read only then ctrl+c for // copying does not work // this approach allows ctrl+c and disables user editing through the use of // the KeyPress handler // and disabling drag and drop // also the mouseMoveEventHandler prevents dragging out of the control // affecting the text. setReadOnly(false); this->setAcceptDrops(false); setLineWrapMode(QTextEdit::WidgetWidth); setLineWrapColumnOrWidth(105); setAutoFormatting(QTextEdit::AutoNone); // Change to fix width font so that table formatting isn't screwed up resetFont(); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu(const QPoint &))); initActions(); }
QT_BEGIN_NAMESPACE QhpWriter::QhpWriter(const QString &namespaceName, const QString &virtualFolder) { m_namespaceName = namespaceName; m_virtualFolder = virtualFolder; setAutoFormatting(true); }
void XmlWrite_Input::Write() { //QHash的迭代器 QHashIterator<QString, SimData_Input*>HashIterator_SimData_Input(Hash_SimData_Input); //用于记录输入变量当前个数,并在<addition>中输出 int num = 0; //自动格式化,让输出的xml文件自动考虑空格等排版因素 setAutoFormatting(true); //写文档头,作用类似于创建一个xml文档,并在文档开头部分写入版本信息和编码信息 writeStartDocument(); //遍历所有的仿真输入数据 while(HashIterator_SimData_Input.hasNext()) { //迭代下一个数据 HashIterator_SimData_Input.next(); //指向每个仿真输入数据 pSimData_Input = HashIterator_SimData_Input.value(); //写入开始记号 writeStartElement("Data"); //写入文本信息记号 writeTextElement("name", pSimData_Input->getName()); writeTextElement("des", pSimData_Input->getDes()); writeTextElement("type", pSimData_Input->getType()); writeTextElement("init", pSimData_Input->getInit()); writeTextElement("min", QString::number(pSimData_Input->getMin())); writeTextElement("max", QString::number(pSimData_Input->getMax())); writeTextElement("enable", QString::number(pSimData_Input->getEnable())); writeStartElement("unit"); writeTextElement("type", pSimData_Input->getUnit_type()); writeTextElement("std", pSimData_Input->getUnit_std()); writeTextElement("super", pSimData_Input->getUnit_super()); writeTextElement("StdtoSuper", QString::number(pSimData_Input->getUnit_StdtoSpuer())); //</unit> writeEndElement(); writeStartElement("addition"); writeTextElement("currentNum", QString::number(num++)); writeTextElement("memAddress","暂不支持输出内存地址值"); //</addition> writeEndElement(); //</Data> writeEndElement(); } //对应于writeStartDocument(),当调用这个函数时,即表示文档信息写入完毕 writeEndDocument(); qDebug()<<"INFO:输出仿真输入数据xml成功!"; }
void GwfStreamWriter::startWriting(const char* encoding) { QTextCodec *codec = QTextCodec::codecForName(encoding); setCodec(codec); setAutoFormatting(true); writeStartDocument(); writeStartElement("GWF"); writeAttribute("version", "1.6"); writeStartElement("staticSector"); isWritingStarted = true; }
TextEdit::TextEdit(QWidget *p, const char *name) : TextShow(p, name) { setReadOnly(false); curFG = colorGroup().color(QColorGroup::Text); m_bCtrlMode = true; setWordWrap(WidgetWidth); #if QT_VERSION >= 0x030100 setAutoFormatting(0); #endif viewport()->installEventFilter(this); }
TextEdit::TextEdit(QWidget *p, const char *name) : TextShow(p, name) { setReadOnly(false); curFG = colorGroup().color(QColorGroup::Text); m_bCtrlMode = true; setWordWrap(WidgetWidth); #if QT_VERSION >= 0x030100 setAutoFormatting(0); #endif connect(this, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(slotColorChanged(const QColor&))); viewport()->installEventFilter(this); }
Editor::Editor( QWidget* parent, const char* name ): QTextEdit( parent, name ) { d = new Private; d->eval = 0; d->index = 0; d->autoCompleteEnabled = true; d->completion = new EditorCompletion( this ); d->completionTimer = new QTimer( this ); d->autoCalcEnabled = true; d->syntaxHighlightEnabled = true; d->highlighter = new EditorHighlighter( this ); d->autoCalcTimer = new QTimer( this ); d->matchingTimer = new QTimer( this ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setWordWrap( NoWrap ); setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOff ); setTextFormat( PlainText ); setAutoFormatting( AutoNone ); setTabChangesFocus( true ); setLinkUnderline( false ); connect( d->completion, SIGNAL( selectedCompletion( const QString& ) ), SLOT( autoComplete( const QString& ) ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkAutoComplete() ) ); connect( d->completionTimer, SIGNAL( timeout() ), SLOT( triggerAutoComplete() ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkMatching() ) ); connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingLeft() ) ); connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingRight() ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkAutoCalc() ) ); connect( d->autoCalcTimer, SIGNAL( timeout() ), SLOT( autoCalc() ) ); d->autoCalcLabel = new CalcResultLabel( 0, "autocalc", WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM ); d->autoCalcLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); d->autoCalcLabel->setPalette( QToolTip::palette() ); d->autoCalcLabel->hide(); setHighlightColor( Number, QColor(0,0,127) ); setHighlightColor( FunctionName, QColor(85,0,0) ); setHighlightColor( Variable, QColor(0,85,0) ); setHighlightColor( MatchedPar, QColor(255,255,183) ); }
TextEdit::TextEdit(const QString & str, QWidget *parent) : QTextEdit(parent) { setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //setFrameShape(QFrame::NoFrame); setFrameShadow(QFrame::Plain); setLineWrapMode(QTextEdit::NoWrap); setAcceptRichText(false); setAutoFormatting(QTextEdit::AutoNone); setTabChangesFocus(true); setPlainText(str); CalcSize(); connect( this, SIGNAL( textChanged() ), this, SLOT( sltTextChanged() ) ); QTextCursor cursor = this->textCursor(); cursor.select(QTextCursor::LineUnderCursor); setTextCursor( cursor ); }
bool OptionsTreeWriter::write(QIODevice* device) { setDevice(device); // turn it off for even more speed setAutoFormatting(true); setAutoFormattingIndent(1); writeStartDocument(); writeDTD(QString("<!DOCTYPE %1>").arg(configName_)); writeStartElement(configName_); writeAttribute("version", configVersion_); writeAttribute("xmlns", configNS_); writeTree(&options_->tree_); writeEndDocument(); return true; }
KNoteEdit::KNoteEdit( KActionCollection *actions, QWidget *parent ) : KTextEdit( parent ), m_note( 0 ) { setAcceptDrops( true ); setWordWrapMode( QTextOption::WordWrap ); setLineWrapMode( WidgetWidth ); if ( acceptRichText() ) { setAutoFormatting( AutoAll ); } else { setAutoFormatting( AutoNone ); } setCheckSpellingEnabled( true ); // create the actions modifying the text format m_textBold = new KToggleAction( KIcon( "format-text-bold" ), i18n( "Bold" ), this ); actions->addAction( "format_bold", m_textBold ); m_textBold->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_B ) ); m_textItalic = new KToggleAction( KIcon( "format-text-italic" ), i18n( "Italic" ), this ); actions->addAction( "format_italic", m_textItalic ); m_textItalic->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_I ) ); m_textUnderline = new KToggleAction( KIcon( "format-text-underline" ), i18n( "Underline" ), this ); actions->addAction( "format_underline", m_textUnderline ); m_textUnderline->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_U ) ); m_textStrikeOut = new KToggleAction( KIcon( "format-text-strikethrough" ), i18n( "Strike Out" ), this ); actions->addAction( "format_strikeout", m_textStrikeOut ); m_textStrikeOut->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ) ); connect( m_textBold, SIGNAL(toggled(bool)), SLOT(textBold(bool)) ); connect( m_textItalic, SIGNAL(toggled(bool)), SLOT(setFontItalic(bool)) ); connect( m_textUnderline, SIGNAL(toggled(bool)), SLOT(setFontUnderline(bool)) ); connect( m_textStrikeOut, SIGNAL(toggled(bool)), SLOT(textStrikeOut(bool)) ); m_textAlignLeft = new KToggleAction( KIcon( "format-justify-left" ), i18n( "Align Left" ), this ); actions->addAction( "format_alignleft", m_textAlignLeft ); connect( m_textAlignLeft, SIGNAL(triggered(bool)), SLOT(textAlignLeft()) ); m_textAlignLeft->setShortcut( QKeySequence( Qt::ALT + Qt::Key_L ) ); m_textAlignLeft->setChecked( true ); // just a dummy, will be updated later m_textAlignCenter = new KToggleAction( KIcon( "format-justify-center" ), i18n( "Align Center" ), this ); actions->addAction( "format_aligncenter", m_textAlignCenter ); connect( m_textAlignCenter, SIGNAL(triggered(bool)), SLOT(textAlignCenter()) ); m_textAlignCenter->setShortcut( QKeySequence( Qt::ALT + Qt::Key_C ) ); m_textAlignRight = new KToggleAction( KIcon( "format-justify-right" ), i18n( "Align Right" ), this ); actions->addAction( "format_alignright", m_textAlignRight ); connect( m_textAlignRight, SIGNAL(triggered(bool)), SLOT(textAlignRight()) ); m_textAlignRight->setShortcut( QKeySequence( Qt::ALT + Qt::Key_R ) ); m_textAlignBlock = new KToggleAction( KIcon( "format-justify-fill" ), i18n( "Align Block" ), this ); actions->addAction( "format_alignblock", m_textAlignBlock ); connect( m_textAlignBlock, SIGNAL(triggered(bool)), SLOT(textAlignBlock()) ); m_textAlignBlock->setShortcut( QKeySequence( Qt::ALT + Qt::Key_B ) ); QActionGroup *group = new QActionGroup( this ); group->addAction( m_textAlignLeft ); group->addAction( m_textAlignCenter ); group->addAction( m_textAlignRight ); group->addAction( m_textAlignBlock ); m_textList = new KToggleAction( KIcon( "format-list-ordered" ), i18n( "List" ), this ); actions->addAction( "format_list", m_textList ); connect( m_textList, SIGNAL(triggered(bool)), SLOT(textList()) ); m_textSuper = new KToggleAction( KIcon( "format-text-superscript" ), i18n( "Superscript" ), this ); actions->addAction( "format_super", m_textSuper ); connect( m_textSuper, SIGNAL(triggered(bool)), SLOT(textSuperScript()) ); m_textSub = new KToggleAction( KIcon( "format-text-subscript" ), i18n( "Subscript" ), this ); actions->addAction( "format_sub", m_textSub ); connect( m_textSub, SIGNAL(triggered(bool)), SLOT(textSubScript()) ); m_textIncreaseIndent = new KAction( KIcon( "format-indent-more" ), i18n( "Increase Indent" ), this ); actions->addAction( "format_increaseindent", m_textIncreaseIndent ); m_textIncreaseIndent->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_I ) ); connect( m_textIncreaseIndent, SIGNAL(triggered(bool)), SLOT(textIncreaseIndent()) ); m_textDecreaseIndent = new KAction( KIcon( "format-indent-less" ), i18n( "Decrease Indent" ), this ); actions->addAction( "format_decreaseindent", m_textDecreaseIndent ); m_textDecreaseIndent->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_D ) ); connect( m_textDecreaseIndent, SIGNAL(triggered(bool)), SLOT( textDecreaseIndent() ) ); group = new QActionGroup( this ); group->addAction( m_textIncreaseIndent ); group->addAction( m_textDecreaseIndent ); QPixmap pix( ICON_SIZE, ICON_SIZE ); pix.fill( Qt::black ); // just a dummy, gets updated before widget is shown m_textColor = new KAction( i18n( "Text Color..." ), this ); actions->addAction( "format_color", m_textColor ); m_textColor->setIcon( pix ); connect( m_textColor, SIGNAL(triggered(bool)), SLOT(slotTextColor()) ); KAction *act = new KAction(KIcon( "format-fill-color" ), i18n( "Text Background Color..." ), this ); actions->addAction( "text_background_color", act ); connect( act, SIGNAL(triggered(bool)), SLOT(slotTextBackgroundColor()) ); m_textFont = new KFontAction( i18n( "Text Font" ), this ); actions->addAction( "format_font", m_textFont ); connect( m_textFont, SIGNAL(triggered(QString)), this, SLOT(setFontFamily(QString)) ); m_textSize = new KFontSizeAction( i18n( "Text Size" ), this ); actions->addAction( "format_size", m_textSize ); connect( m_textSize, SIGNAL(fontSizeChanged(int)), this, SLOT(setTextFontSize(int)) ); // QTextEdit connections connect( this, SIGNAL(currentCharFormatChanged(QTextCharFormat)), SLOT(slotCurrentCharFormatChanged(QTextCharFormat)) ); connect( this, SIGNAL(cursorPositionChanged()), SLOT(slotCursorPositionChanged()) ); slotCurrentCharFormatChanged( currentCharFormat() ); slotCursorPositionChanged(); }
EvaTextEdit::EvaTextEdit(const TQString &text, const TQString &context, TQWidget *parent, const char *name): KTextEdit(text, context, parent, name), isEnterSend(false) { setAutoFormatting(TQTextEdit::AutoNone); setWrapPolicy(TQTextEdit::AtWordOrDocumentBoundary); }
VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, IVirtualBox *a_pVirtualBox /* = NULL */, const char *pszName/* = NULL*/) : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()), m_pVirtualBox(a_pVirtualBox) { setReadOnly(true); setUndoRedoEnabled(false); setOverwriteMode(false); setPlainText(""); setTextInteractionFlags(Qt::TextBrowserInteraction); setAutoFormatting(QTextEdit::AutoAll); setTabChangesFocus(true); setAcceptRichText(false); /* * Create actions for color-scheme menu items. */ m_pGreenOnBlackAction = new QAction(tr("Green On Black"), this); m_pGreenOnBlackAction->setCheckable(true); m_pGreenOnBlackAction->setShortcut(Qt::ControlModifier + Qt::Key_1); m_pGreenOnBlackAction->setData((int)kGreenOnBlack); connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(sltSelectColorScheme())); m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this); m_pBlackOnWhiteAction->setCheckable(true); m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2); m_pBlackOnWhiteAction->setData((int)kBlackOnWhite); connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(sltSelectColorScheme())); /* Create action group for grouping of exclusive color-scheme menu items. */ QActionGroup *pActionColorGroup = new QActionGroup(this); pActionColorGroup->addAction(m_pGreenOnBlackAction); pActionColorGroup->addAction(m_pBlackOnWhiteAction); pActionColorGroup->setExclusive(true); /* * Create actions for font menu items. */ m_pCourierFontAction = new QAction(tr("Courier"), this); m_pCourierFontAction->setCheckable(true); m_pCourierFontAction->setShortcut(Qt::ControlModifier + Qt::Key_D); m_pCourierFontAction->setData((int)kFontType_Courier); connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); m_pMonospaceFontAction = new QAction(tr("Monospace"), this); m_pMonospaceFontAction->setCheckable(true); m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M); m_pMonospaceFontAction->setData((int)kFontType_Monospace); connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); /* Create action group for grouping of exclusive font menu items. */ QActionGroup *pActionFontGroup = new QActionGroup(this); pActionFontGroup->addAction(m_pCourierFontAction); pActionFontGroup->addAction(m_pMonospaceFontAction); pActionFontGroup->setExclusive(true); /* * Create actions for font size menu. */ uint32_t const uDefaultFontSize = font().pointSize(); m_pActionFontSizeGroup = new QActionGroup(this); for (uint32_t i = 0; i < RT_ELEMENTS(m_apFontSizeActions); i++) { char szTitle[32]; RTStrPrintf(szTitle, sizeof(szTitle), s_uMinFontSize + i != uDefaultFontSize ? "%upt" : "%upt (default)", s_uMinFontSize + i); m_apFontSizeActions[i] = new QAction(tr(szTitle), this); m_apFontSizeActions[i]->setCheckable(true); m_apFontSizeActions[i]->setData(i + s_uMinFontSize); connect(m_apFontSizeActions[i], SIGNAL(triggered()), this, SLOT(sltSelectFontSize())); m_pActionFontSizeGroup->addAction(m_apFontSizeActions[i]); } /* * Set the defaults (which syncs with the menu item checked state). */ /* color scheme: */ com::Bstr bstrColor; HRESULT hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), bstrColor.asOutParam()) : E_FAIL; if ( SUCCEEDED(hrc) && bstrColor.compareUtf8("blackonwhite", com::Bstr::CaseInsensitive) == 0) setColorScheme(kBlackOnWhite, false /*fSaveIt*/); else setColorScheme(kGreenOnBlack, false /*fSaveIt*/); /* font: */ com::Bstr bstrFont; hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/Font").raw(), bstrFont.asOutParam()) : E_FAIL; if ( SUCCEEDED(hrc) && bstrFont.compareUtf8("monospace", com::Bstr::CaseInsensitive) == 0) setFontType(kFontType_Monospace, false /*fSaveIt*/); else setFontType(kFontType_Courier, false /*fSaveIt*/); /* font size: */ com::Bstr bstrFontSize; hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/FontSize").raw(), bstrFontSize.asOutParam()) : E_FAIL; if (SUCCEEDED(hrc)) { com::Utf8Str strFontSize(bstrFontSize); uint32_t uFontSizePrf = strFontSize.strip().toUInt32(); if ( uFontSizePrf - s_uMinFontSize < (uint32_t)RT_ELEMENTS(m_apFontSizeActions) && uFontSizePrf != uDefaultFontSize) setFontSize(uFontSizePrf, false /*fSaveIt*/); } NOREF(pszName); }
SimpleRichTextEdit::SimpleRichTextEdit(QWidget *parent) : KTextEdit(parent) { enableFindReplace(false); setCheckSpellingEnabled(true); setAutoFormatting(KTextEdit::AutoNone); setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); QTextDocument *textDocument = document(); QTextOption textOption; textOption.setAlignment(Qt::AlignCenter); textOption.setWrapMode(QTextOption::NoWrap); textDocument->setDefaultTextOption(textOption); QFont defaultFont = font(); defaultFont.setPointSize(defaultFont.pointSize() + 2); textDocument->setDefaultFont(defaultFont); QString styleSheet("p {" " display: block;" " white-space: pre;" " margin-top: 0px;" " margin-bottom: 0px;" "}"); textDocument->setDefaultStyleSheet(styleSheet); setTextInteractionFlags(Qt::TextEditorInteraction); m_actions[Undo] = new QAction(this); m_actions[Undo]->setIcon(QIcon::fromTheme("edit-undo")); m_actions[Undo]->setText(i18n("Undo")); m_actions[Undo]->setShortcuts(KStandardShortcut::undo()); connect(m_actions[Undo], SIGNAL(triggered()), this, SLOT(undo())); m_actions[Redo] = new QAction(this); m_actions[Redo]->setIcon(QIcon::fromTheme("edit-redo")); m_actions[Redo]->setText(i18n("Redo")); m_actions[Redo]->setShortcuts(KStandardShortcut::redo()); connect(m_actions[Redo], SIGNAL(triggered()), this, SLOT(redo())); m_actions[Cut] = new QAction(this); m_actions[Cut]->setIcon(QIcon::fromTheme("edit-cut")); m_actions[Cut]->setText(i18n("Cut")); m_actions[Cut]->setShortcuts(KStandardShortcut::cut()); connect(m_actions[Cut], SIGNAL(triggered()), this, SLOT(cut())); m_actions[Copy] = new QAction(this); m_actions[Copy]->setIcon(QIcon::fromTheme("edit-copy")); m_actions[Copy]->setText(i18n("Copy")); m_actions[Copy]->setShortcuts(KStandardShortcut::copy()); connect(m_actions[Copy], SIGNAL(triggered()), this, SLOT(copy())); #if !defined(QT_NO_CLIPBOARD) m_actions[Paste] = new QAction(this); m_actions[Paste]->setIcon(QIcon::fromTheme("edit-paste")); m_actions[Paste]->setText(i18n("Paste")); m_actions[Paste]->setShortcuts(KStandardShortcut::paste()); connect(m_actions[Paste], SIGNAL(triggered()), this, SLOT(paste())); #endif m_actions[Delete] = new QAction(this); m_actions[Delete]->setIcon(QIcon::fromTheme("edit-delete")); m_actions[Delete]->setText(i18n("Delete")); m_actions[Delete]->setShortcut(QKeySequence::Delete); connect(m_actions[Delete], SIGNAL(triggered()), this, SLOT(deleteText())); m_actions[Clear] = new QAction(this); m_actions[Clear]->setIcon(QIcon::fromTheme("edit-clear")); m_actions[Clear]->setText(i18nc("@action:inmenu Clear all text", "Clear")); connect(m_actions[Clear], SIGNAL(triggered()), this, SLOT(undoableClear())); m_actions[SelectAll] = new QAction(this); m_actions[SelectAll]->setIcon(QIcon::fromTheme("edit-select-all")); m_actions[SelectAll]->setText(i18n("Select All")); m_actions[SelectAll]->setShortcut(QKeySequence::SelectAll); connect(m_actions[SelectAll], SIGNAL(triggered()), this, SLOT(selectAll())); m_actions[ToggleBold] = new QAction(this); m_actions[ToggleBold]->setIcon(QIcon::fromTheme("format-text-bold")); m_actions[ToggleBold]->setText(i18nc("@action:inmenu Toggle bold style", "Bold")); m_actions[ToggleBold]->setShortcut(QKeySequence("Ctrl+B")); connect(m_actions[ToggleBold], SIGNAL(triggered()), this, SLOT(toggleFontBold())); m_actions[ToggleItalic] = new QAction(this); m_actions[ToggleItalic]->setIcon(QIcon::fromTheme("format-text-italic")); m_actions[ToggleItalic]->setText(i18nc("@action:inmenu Toggle italic style", "Italic")); m_actions[ToggleItalic]->setShortcut(QKeySequence("Ctrl+I")); connect(m_actions[ToggleItalic], SIGNAL(triggered()), this, SLOT(toggleFontItalic())); m_actions[ToggleUnderline] = new QAction(this); m_actions[ToggleUnderline]->setIcon(QIcon::fromTheme("format-text-underline")); m_actions[ToggleUnderline]->setText(i18nc("@action:inmenu Toggle underline style", "Underline")); m_actions[ToggleUnderline]->setShortcut(QKeySequence("Ctrl+U")); connect(m_actions[ToggleUnderline], SIGNAL(triggered()), this, SLOT(toggleFontUnderline())); m_actions[ToggleStrikeOut] = new QAction(this); m_actions[ToggleStrikeOut]->setIcon(QIcon::fromTheme("format-text-strikethrough")); m_actions[ToggleStrikeOut]->setText(i18nc("@action:inmenu Toggle strike through style", "Strike Through")); m_actions[ToggleStrikeOut]->setShortcut(QKeySequence("Ctrl+T")); connect(m_actions[ToggleStrikeOut], SIGNAL(triggered()), this, SLOT(toggleFontStrikeOut())); m_actions[ChangeTextColor] = new QAction(this); m_actions[ChangeTextColor]->setIcon(QIcon::fromTheme("format-text-color")); m_actions[ChangeTextColor]->setText(i18nc("@action:inmenu Change Text Color", "Text Color")); m_actions[ChangeTextColor]->setShortcut(QKeySequence("Ctrl+Shift+C")); connect(m_actions[ChangeTextColor], SIGNAL(triggered()), this, SLOT(changeTextColor())); m_actions[CheckSpelling] = new QAction(this); m_actions[CheckSpelling]->setIcon(QIcon::fromTheme("tools-check-spelling")); m_actions[CheckSpelling]->setText(i18n("Check Spelling...")); connect(m_actions[CheckSpelling], SIGNAL(triggered()), this, SLOT(checkSpelling())); m_actions[ToggleAutoSpellChecking] = new QAction(this); m_actions[ToggleAutoSpellChecking]->setText(i18n("Auto Spell Check")); m_actions[ToggleAutoSpellChecking]->setCheckable(true); connect(m_actions[ToggleAutoSpellChecking], SIGNAL(triggered()), this, SLOT(toggleAutoSpellChecking())); m_actions[AllowTabulations] = new QAction(this); m_actions[AllowTabulations]->setText(i18n("Allow Tabulations")); connect(m_actions[AllowTabulations], SIGNAL(triggered()), this, SLOT(toggleTabChangesFocus())); QMenu *menu = createStandardContextMenu(); menu->setParent(this); QList<QAction *> actions = menu->actions(); m_insertUnicodeControlCharMenu = 0; for(QList<QAction *>::ConstIterator it = actions.constBegin(), end = actions.constEnd(); it != end; ++it) { if((*it)->menu()) { // this depends on Qt private implementation but at least is guaranteed // to behave reasonably if that implementation changes in the future. if(!strcmp((*it)->menu()->metaObject()->className(), "QUnicodeControlCharacterMenu")) { m_insertUnicodeControlCharMenu = (*it)->menu(); break; } } } }
XbelWriter::XbelWriter() { setAutoFormatting(true); }
//! [0] XbelWriter::XbelWriter(QTreeWidget *treeWidget) : treeWidget(treeWidget) { setAutoFormatting(true); }
KeysXmlWriter::KeysXmlWriter(KeyEngine *input) : m_input(input) { setAutoFormatting(true); }
EvaTextEdit::EvaTextEdit(QWidget *parent, const char * name): KTextEdit(parent, name), isEnterSend(false) { setAutoFormatting(QTextEdit::AutoNone); setWrapPolicy(QTextEdit::AtWordOrDocumentBoundary); }
QT_BEGIN_NAMESPACE QhcpWriter::QhcpWriter() { setAutoFormatting(true); }
OpenSearchWriter::OpenSearchWriter() : QXmlStreamWriter() { setAutoFormatting(true); }