本文整理汇总了C++中setLineWrapMode函数的典型用法代码示例。如果您正苦于以下问题:C++ setLineWrapMode函数的具体用法?C++ setLineWrapMode怎么用?C++ setLineWrapMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLineWrapMode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setLineWrapMode
void ExtendedTextEdit::toggleWrapping()
{
if(lineWrapMode() != QPlainTextEdit::NoWrap)
setLineWrapMode(QPlainTextEdit::NoWrap);
else
setLineWrapMode(QPlainTextEdit::WidgetWidth);
}
示例2: setLineWrapMode
void PgxEditor::toggleWrap()
{
if(lineWrapMode() == QPlainTextEdit::WidgetWidth)
setLineWrapMode(QPlainTextEdit::NoWrap);
else
setLineWrapMode(QPlainTextEdit::WidgetWidth);
}
示例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();
}
示例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();
}
示例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()));
}
示例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;
}
示例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);
}
}
示例8: QPlainTextEdit
PathListPlainTextEdit::PathListPlainTextEdit(QWidget *parent) :
QPlainTextEdit(parent)
{
// No wrapping, scroll at all events
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setLineWrapMode(QPlainTextEdit::NoWrap);
}
示例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
}
示例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);
}
示例11: setPlainText
void pqXmlView::openFile(QString file) {
this->file = file;
setPlainText(file2string(file));
new XmlSyntaxHighlighter(document());
setLineWrapMode(QTextEdit::NoWrap);
}
示例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
}
示例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);
}
示例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*)));
}
示例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()));
}