本文整理汇总了C++中setLineWrapMode函数的典型用法代码示例。如果您正苦于以下问题:C++ setLineWrapMode函数的具体用法?C++ setLineWrapMode怎么用?C++ setLineWrapMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLineWrapMode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setLineWrapMode
void ExtendedTextEdit::toggleWrapping()
{
if(lineWrapMode() != QPlainTextEdit::NoWrap)
setLineWrapMode(QPlainTextEdit::NoWrap);
else
setLineWrapMode(QPlainTextEdit::WidgetWidth);
}
开发者ID:OFFIS-Automation,项目名称:Framework,代码行数:7,代码来源:ExtendedTextEdit.cpp
示例2: setLineWrapMode
void PgxEditor::toggleWrap()
{
if(lineWrapMode() == QPlainTextEdit::WidgetWidth)
setLineWrapMode(QPlainTextEdit::NoWrap);
else
setLineWrapMode(QPlainTextEdit::WidgetWidth);
}
开发者ID:ssundar81,项目名称:pgXplorer,代码行数:7,代码来源:pgxeditor.cpp
示例3: QPlainTextEdit
GenericTextEditorDocument::GenericTextEditorDocument(QWidget *parent) : QPlainTextEdit(parent),
mCodec(0), mCompleter(0), mDocName(""), mFilePath(""), mTextModified(false), mFile(0), mIsOfsFile(false),
mInitialDisplay(true), mCloseEvtAlreadyProcessed(false)
{
QSettings settings;
QFont fnt = font();
fnt.setFamily("Courier New");
fnt.setPointSize(settings.value("preferences/fontSize").toUInt());
setFont(fnt);
QPlainTextEdit::LineWrapMode mode;
if(settings.value("preferences/lineWrapping").toBool())
mode = QPlainTextEdit::WidgetWidth;
else
mode = QPlainTextEdit::NoWrap;
setLineWrapMode(mode);
setAttribute(Qt::WA_DeleteOnClose);
QFontMetrics fm(fnt);
setTabStopWidth(fm.width("abcd"));
mLineNumberArea = new LineNumberArea(this);
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(const QRect &, int)), this, SLOT(updateLineNumberArea(const QRect &, int)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));
updateLineNumberAreaWidth(0);
highlightCurrentLine();
}
开发者ID:jacmoe,项目名称:ogitor,代码行数:32,代码来源:generictexteditordocument.cpp
示例4: QTextEdit
/**
* 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();
}
开发者ID:liyulun,项目名称:mantid,代码行数:36,代码来源:ScriptOutputDisplay.cpp
示例5: QPlainTextEdit
TextEditor::TextEditor(QWidget *parent) : QPlainTextEdit(parent)
{
lineNumberArea = new LineNumberArea(this);
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));
updateLineNumberAreaWidth(0);
highlightCurrentLine();
QFont font("consolas",9);
const int tabStop = 4; // 4 characters
QFontMetrics metrics(font);
setTabStopWidth(tabStop * metrics.width(' '));
setFont(font);
setLineWrapMode(QPlainTextEdit::NoWrap);
m_highlighter = new Highlighter(document());
m_autoUpdate = false;
m_timer = new QTimer();
m_timer->setSingleShot(true);
m_timer->setInterval(1000);
connect(m_timer, SIGNAL(timeout()), this, SLOT(updateShader()));
connect(this, SIGNAL(textChanged()), this, SLOT(resetTimer()));
}
开发者ID:XT95,项目名称:VisualLiveSystem,代码行数:27,代码来源:texteditor.cpp
示例6: QTextEdit
HaiQTextEdit::HaiQTextEdit(QWidget *parent) :
QTextEdit(parent),
num_tab_spaces(0),
emit_key_only_mode(false)
{
setTabStopWidth(20); //pixels
setFrameStyle(QFrame::NoFrame);
//here's a temporary workaround to the setLineWrapMode(QTextEdit:NoWrap) bug...
setLineWrapMode(QTextEdit::NoWrap); //CHECK IF THIS WORKS!!
//setLineWrapMode(QTextEdit::FixedPixelWidth);
//setLineWrapColumnOrWidth(2500);
////////////////s//////////////////////////////////////////////////////////////////
braces_highlighting_timer.setSingleShot(true);
braces_highlighting_timer.setInterval(600);
connect(&braces_highlighting_timer,SIGNAL(timeout()),this,SLOT(slot_clear_braces_highlighting()));
setAcceptRichText(true);
grabShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Tab), Qt::ApplicationShortcut);
has_temporary_marker=false;
do_emit_modification_changed=true;
}
开发者ID:magland,项目名称:sequencetree5,代码行数:25,代码来源:haiqtextedit.cpp
示例7: setHorizontalScrollBarPolicy
void SourceViewerWidget::optionChanged(const QString &option, const QVariant &value)
{
if (option == QLatin1String("Interface/ShowScrollBars"))
{
setHorizontalScrollBarPolicy(value.toBool() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(value.toBool() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
}
else if (option == QLatin1String("SourceViewer/ShowLineNumbers"))
{
if (value.toBool() && !m_marginWidget)
{
m_marginWidget = new MarginWidget(this);
m_marginWidget->show();
m_marginWidget->setGeometry(QRect(contentsRect().left(), contentsRect().top(), m_marginWidget->width(), contentsRect().height()));
}
else if (!value.toBool() && m_marginWidget)
{
m_marginWidget->deleteLater();
m_marginWidget = NULL;
setViewportMargins(0, 0, 0, 0);
}
}
else if (option == QLatin1String("SourceViewer/WrapLines"))
{
setLineWrapMode(value.toBool() ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
}
}
开发者ID:davidyang5405,项目名称:otter-browser,代码行数:28,代码来源:SourceViewerWidget.cpp
示例8: QPlainTextEdit
PathListPlainTextEdit::PathListPlainTextEdit(QWidget *parent) :
QPlainTextEdit(parent)
{
// No wrapping, scroll at all events
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setLineWrapMode(QPlainTextEdit::NoWrap);
}
开发者ID:KDE,项目名称:android-qt-creator,代码行数:7,代码来源:pathlisteditor.cpp
示例9: QPlainTextEdit
QScriptEdit::QScriptEdit(QWidget *parent)
: QPlainTextEdit(parent)
{
m_baseLineNumber = 1;
m_executionLineNumber = -1;
m_extraArea = new QScriptEditExtraArea(this);
QObject::connect(this, SIGNAL(blockCountChanged(int)),
this, SLOT(updateExtraAreaWidth()));
QObject::connect(this, SIGNAL(updateRequest(QRect,int)),
this, SLOT(updateExtraArea(QRect,int)));
QObject::connect(this, SIGNAL(cursorPositionChanged()),
this, SLOT(highlightCurrentLine()));
updateExtraAreaWidth();
//> NeoScriptTools
setTabStopWidth(24);
#ifdef WIN32
QFont font("Courier New");
font.setPointSize(10);
document()->setDefaultFont(font);
#endif
setLineWrapMode(QPlainTextEdit::NoWrap);
//< NeoScriptTools
#ifndef QT_NO_SYNTAXHIGHLIGHTER
(void) new QScriptSyntaxHighlighter(document());
#endif
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:32,代码来源:qscriptedit.cpp
示例10: QPlainTextEdit
ide::Editor::Editor(QWidget* w) : QPlainTextEdit(w) {
setFont(monospace_font());
setBackgroundRole(QPalette::Base);
setLineWrapMode(NoWrap); // please, no line wrap.
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
setDocumentTitle(path.isEmpty() ? "*unsaved*" : path);
}
开发者ID:flowgrammable,项目名称:arbiter,代码行数:7,代码来源:Editor.C
示例11: setPlainText
void pqXmlView::openFile(QString file) {
this->file = file;
setPlainText(file2string(file));
new XmlSyntaxHighlighter(document());
setLineWrapMode(QTextEdit::NoWrap);
}
开发者ID:CapelliC,项目名称:loqt,代码行数:7,代码来源:pqXmlView.cpp
示例12: Q_UNUSED
void
body_view::set_wrap(bool on)
{
Q_UNUSED(on);
// for text parts, we'll probably need to implement wrapmode by HTML-styling the contents
#ifndef TODO_WEBKIT
if (on) {
setWordWrapMode(QTextOption::WordWrap);
setLineWrapMode(QTextEdit::WidgetWidth);
}
else {
setLineWrapMode(QTextEdit::NoWrap);
setWordWrapMode(QTextOption::NoWrap);
}
#endif
}
开发者ID:albancrommer,项目名称:manitou-mail-ui,代码行数:16,代码来源:body_view.cpp
示例13: setFont
Wt_TextEdit::Wt_TextEdit()
{
QFont font;
font.setFamily("monaco");
font.setFixedPitch(true);
font.setPointSize(9);
setFont(font);
setTabStopWidth(4 * fontMetrics().width(' '));
//setStyleSheet("QPlainTextEdit {background: #262626; color:#D4D4D4}");
setStyleSheet("QPlainTextEdit {background: #373737; color:#D4D4D4;}");
//setStyleSheet("QPlainTextEdit {background: #F2F2F2; color:#D4D4D4}");
//setStyleSheet("QPlainTextEdit {background: url('bg2.png'); color:#D4D4D4}");
setLineWrapMode(QPlainTextEdit::NoWrap);
setTabChangesFocus(true);
highLight = new Wt_HighLight(this->document());
//QShortcut *action = new QShortcut(QKeySequence(tr("ctrl+f")),this);
//connect(action, SIGNAL(activated()), this, SLOT(wt_selectionHighLight()));
//connect(this, SIGNAL(selectionChanged()), this, SLOT(wt_selectionChanged()));
//Wt_HighLight *searchTextHighLight = new Wt_HighLight(this->document(), Wt_HighLight::HighLightSearchText);
//searchTextHighLight->initSearchTextHighlighting(tr("include"));
//this->document()->setTextWidth(100);
//block().blockFormat().setLineHeight(20, QTextBlockFormat::FixedHeight);
}
开发者ID:vvilp,项目名称:wt_editor,代码行数:27,代码来源:Wt_TextEdit.cpp
示例14: setAcceptDrops
void LogViewer::init()
{
setAcceptDrops(true);
setReadOnly(true);
setTabWidth(4);
setLineWrapMode(QPlainTextEdit::NoWrap);
setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
QPalette palette;
palette.setColor(QPalette::Inactive, QPalette::Highlight, palette.color(QPalette::Active, QPalette::Highlight));
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, palette.color(QPalette::Active, QPalette::HighlightedText));
setPalette(palette);
// Read settings.
setFont(INIMANAGER()->font());
setForegroundColor(INIMANAGER()->foregroundColor());
setBackgroundColor(INIMANAGER()->backgroundColor());
setCustomBackgroundColor(INIMANAGER()->customBackgroundColor());
setCurrentLineFgColor(INIMANAGER()->currentLineFgColor());
setCurrentLineBgColor(INIMANAGER()->currentLineBgColor());
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(drawCurrentLine()));
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(blockCountChanged(int)));
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
// Line Number.
updateLineNumberAreaWidth(0);
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
// Keyword Highlighter.
connect(m_keywordHighlighter, SIGNAL(modelCreated(QStandardItemModel*)), this, SLOT(modelCreated(QStandardItemModel*)));
connect(m_keywordHighlighter, SIGNAL(chartLoaded(QPixmap*)), this, SLOT(chartLoaded(QPixmap*)));
}
开发者ID:joonhwan,项目名称:monkeylogviewer,代码行数:34,代码来源:LogViewer.cpp
示例15: QPlainTextEdit
CodeEditor::CodeEditor(Config* config, QWidget* parent)
: QPlainTextEdit(parent), config(config)
{
highlighter = new Highlighter(config, this); // тормоз
extraArea = new QWidget(this);
extraArea->setCursor(Qt::PointingHandCursor);
extraArea->setAutoFillBackground(true);
extraArea->installEventFilter(this);
completer = new QCompleter(config->keywordsSorted, this);
completer->setWidget(this);
completer->setCompletionMode(QCompleter::PopupCompletion);
completer->setWrapAround(false);
setLineWrapMode(QPlainTextEdit::NoWrap);
setCursorWidth(2);
blockCountChanged(0);
setMouseTracking(true);
reconfig();
// не допускаем проваливание на последнем свернутом блоке
connect(this, SIGNAL(cursorPositionChanged()), SLOT(ensureCursorVisible()));
connect(this, SIGNAL(blockCountChanged(int)), SLOT(blockCountChanged(int)));
connect(document(), SIGNAL(contentsChange(int, int, int)), SLOT(contentsChange(int, int, int)));
connect(completer, SIGNAL(activated(const QString&)), SLOT(insertCompletion(const QString&)));
connect(config, SIGNAL(reread(int)), SLOT(reconfig(int)));
connect(this, SIGNAL(updateRequest(QRect, int)), extraArea, SLOT(update()));
}
开发者ID:MichaelJE,项目名称:Clips,代码行数:30,代码来源:codeeditor.cpp
示例16: updateCurrentLineHighlighting
void GenericCodeEditor::applySettings( Settings::Manager *settings )
{
settings->beginGroup("IDE/editor");
bool lineWrap = settings->value("lineWrap").toBool();
bool showWhitespace = settings->value("showWhitespace").toBool();
mInactiveFadeAlpha = settings->value("inactiveEditorFadeAlpha").toInt();
QPalette palette;
settings->beginGroup("colors");
if (settings->contains("text")) {
QTextCharFormat format = settings->value("text").value<QTextCharFormat>();
QBrush bg = format.background();
QBrush fg = format.foreground();
if (bg.style() != Qt::NoBrush)
palette.setBrush(QPalette::Base, bg);
if (fg.style() != Qt::NoBrush)
palette.setBrush(QPalette::Text, fg);
}
if (settings->contains("lineNumbers")) {
// NOTE: the line number widget will inherit the palette from the editor
QTextCharFormat format = settings->value("lineNumbers").value<QTextCharFormat>();
QBrush bg = format.background();
QBrush fg = format.foreground();
if (bg.style() != Qt::NoBrush)
palette.setBrush(QPalette::Mid, bg);
if (fg.style() != Qt::NoBrush)
palette.setBrush(QPalette::ButtonText, fg);
}
if (settings->contains("selection")) {
QTextCharFormat format = settings->value("selection").value<QTextCharFormat>();
QBrush bg = format.background();
QBrush fg = format.foreground();
if (bg.style() != Qt::NoBrush)
palette.setBrush(QPalette::Highlight, bg);
if (fg.style() != Qt::NoBrush)
palette.setBrush(QPalette::HighlightedText, fg);
}
mCurrentLineTextFormat = settings->value("currentLine").value<QTextCharFormat>();
mSearchResultTextFormat = settings->value("searchResult").value<QTextCharFormat>();
settings->endGroup(); // colors
mHighlightCurrentLine = settings->value("highlightCurrentLine").toBool();
updateCurrentLineHighlighting();
settings->endGroup(); // IDE/editor
setLineWrapMode( lineWrap ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap );
setShowWhitespace( showWhitespace );
setPalette(palette);
setActiveAppearance(hasFocus());
}
开发者ID:mblewett,项目名称:supercollider,代码行数:59,代码来源:editor.cpp
示例17: m
//
// custom_user_field
//
custom_user_field::custom_user_field()
{
QFontMetrics m(font()) ;
setFixedHeight(m.lineSpacing()*4); // 4 visible lines
setMinimumWidth(50*m.width("a")); // ~70 characters
setLineWrapMode(QPlainTextEdit::NoWrap);
setTabChangesFocus(true);
}
开发者ID:manitou-mail,项目名称:manitou-mail-ui,代码行数:11,代码来源:users_dialog.cpp
示例18: setLineWrapMode
void OpenedFile::initialize()
{
setLineWrapMode(QPlainTextEdit::NoWrap);
setTabChangesFocus(false);
document()->setDefaultFont(QFont(DEF_FONT_INFO));
document()->setDocumentLayout(new QPlainTextDocumentLayout(document()));
}
开发者ID:bkchr,项目名称:Rockete,代码行数:8,代码来源:OpenedFile.cpp
示例19: setLineWrapMode
void CodeEditor::rename( const QString &path ){
_path=path;
_fileType=extractExt( _path ).toLower();
QString t=';'+_fileType+';';
_txt=textFileTypes.contains( t );
_code=codeFileTypes.contains( t );
_monkey=_fileType=="monkey";
if( _txt ){
setLineWrapMode( QPlainTextEdit::WidgetWidth );
}else{
setLineWrapMode( QPlainTextEdit::NoWrap );
}
}
开发者ID:JochenHeizmann,项目名称:monkey,代码行数:17,代码来源:codeeditor.cpp
示例20: QPlainTextEdit
//! Constructor
ModelicaEditor::ModelicaEditor(ProjectTab *pParent)
: QPlainTextEdit(pParent)
{
mpParentProjectTab = pParent;
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setTabStopWidth(Helper::tabWidth);
setObjectName("ModelicaEditor");
document()->setDocumentMargin(2);
setLineWrapMode(QPlainTextEdit::NoWrap);
// depending on the project tab readonly state set the text view readonly state
setReadOnly(mpParentProjectTab->isReadOnly());
connect(this, SIGNAL(focusOut()), mpParentProjectTab, SLOT(modelicaEditorTextChanged()));
connect(this, SIGNAL(textChanged()), SLOT(hasChanged()));
mpFindWidget = new QWidget;
mpFindWidget->setContentsMargins(0, 0, 0, 0);
mpFindWidget->hide();
mpSearchLabelImage = new QLabel;
mpSearchLabelImage->setPixmap(QPixmap(":/Resources/icons/search.png"));
mpSearchLabel = new QLabel(Helper::search);
mpSearchTextBox = new QLineEdit;
connect(mpSearchTextBox, SIGNAL(textChanged(QString)), SLOT(updateButtons()));
connect(mpSearchTextBox, SIGNAL(returnPressed()), SLOT(findNextText()));
mpPreviuosButton = new QToolButton;
mpPreviuosButton->setAutoRaise(true);
mpPreviuosButton->setText(tr("Previous"));
mpPreviuosButton->setIcon(QIcon(":/Resources/icons/previous.png"));
mpPreviuosButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
connect(mpPreviuosButton, SIGNAL(clicked()), SLOT(findPreviuosText()));
mpNextButton = new QToolButton;
mpNextButton->setAutoRaise(true);
mpNextButton->setText(tr("Next"));
mpNextButton->setIcon(QIcon(":/Resources/icons/next.png"));
mpNextButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
connect(mpNextButton, SIGNAL(clicked()), SLOT(findNextText()));
mpMatchCaseCheckBox = new QCheckBox(tr("Match case"));
mpMatchWholeWordCheckBox = new QCheckBox(tr("Match whole word"));
mpCloseButton = new QToolButton;
mpCloseButton->setAutoRaise(true);
mpCloseButton->setIcon(QIcon(":/Resources/icons/exit.png"));
connect(mpCloseButton, SIGNAL(clicked()), SLOT(hideFindWidget()));
mpLineNumberArea = new LineNumberArea(this);
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));
updateLineNumberAreaWidth(0);
highlightCurrentLine();
// make previous and next buttons disabled for first time
updateButtons();
}
开发者ID:world2005,项目名称:OpenModelica,代码行数:59,代码来源:ModelicaEditor.cpp
注:本文中的setLineWrapMode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论