本文整理汇总了C++中QTextEdit::setWordWrap方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::setWordWrap方法的具体用法?C++ QTextEdit::setWordWrap怎么用?C++ QTextEdit::setWordWrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::setWordWrap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLabel
RKReadLineDialog::RKReadLineDialog (QWidget *parent, const QString &caption, const QString &prompt, RCommand *command) : KDialogBase (parent, 0, true, caption, KDialogBase::Ok | KDialogBase::Cancel) {
RK_TRACE (DIALOGS);
RK_ASSERT (command);
QVBox *page = makeVBoxMainWidget ();
new QLabel (caption, page);
int screen_width = qApp->desktop ()->width () - 2*marginHint() - 2*spacingHint (); // TODO is this correct on xinerama?
QString context = command->fullOutput ();
if (!context.isEmpty ()) {
new QLabel (i18n ("Context:"), page);
QTextEdit *output = new QTextEdit (page);
output->setUndoRedoEnabled (false);
output->setTextFormat (QTextEdit::PlainText);
output->setCurrentFont (QFont ("Courier"));
output->setWordWrap (QTextEdit::NoWrap);
output->setText (context);
output->setReadOnly (true);
int cwidth = output->contentsWidth ();
output->setMinimumWidth (screen_width < cwidth ? screen_width : cwidth);
output->scrollToBottom ();
output->setFocusPolicy (QWidget::NoFocus);
}
QLabel *promptl = new QLabel (prompt, page);
promptl->setAlignment (Qt::WordBreak | promptl->alignment ());
input = new QLineEdit (QString (), page);
input->setMinimumWidth (fontMetrics ().maxWidth ()*20);
input->setFocus ();
}
示例2: setupLicenseTab
// -------------------------------------------------------------------------------------------------
void AboutDialog::setupLicenseTab()
{
QVBox* licenseTab = new QVBox(this);
QTextEdit* textEdit = new QTextEdit(licenseTab);
textEdit->setReadOnly(true);
textEdit->setWordWrap(QTextEdit::FixedColumnWidth);
textEdit->setWrapColumnOrWidth(100);
QString fileName = qApp->applicationDirPath() + "/../share/tfla-01/COPYING";
if (QFile::exists(fileName))
{
QFile file(fileName);
if (file.open( IO_ReadOnly ))
{
QTextStream stream(&file);
textEdit->setText("<pre>" + stream.read() + "</pre>");
}
}
m_tabWidget->addTab(licenseTab, tr("&License"));
}
示例3: pageName
//.........这里部分代码省略.........
grid->setColStretch( 0, 1 );
grid->setColStretch( 1, 1 );
if( sv )
sv->setMinimumWidth( grid->sizeHint().width() + 20 );
engine->m_coredir = HelixConfig::coreDirectory();
m_core = new HelixConfigEntry( parent, engine->m_coredir,
config, row,
i18n("Helix/Realplay core directory"),
HelixConfig::coreDirectory().utf8(),
i18n("This is the directory where clntcore.so is located"));
++row;
engine->m_pluginsdir = HelixConfig::pluginDirectory();
m_plugin = new HelixConfigEntry( parent, engine->m_pluginsdir,
config, row,
i18n("Helix/Realplay plugins directory"),
HelixConfig::pluginDirectory().utf8(),
i18n("This is the directory where, for example, vorbisrend.so is located"));
++row;
engine->m_codecsdir = HelixConfig::codecsDirectory();
m_codec = new HelixConfigEntry( parent, engine->m_codecsdir,
config, row,
i18n("Helix/Realplay codecs directory"),
HelixConfig::codecsDirectory().utf8(),
i18n("This is the directory where, for example, cvt1.so is located"));
++row;
grid->addMultiCellWidget( new KSeparator( KSeparator::Horizontal, parent ), row, row, 0, 1 );
++row;
m_device = new HelixSoundDevice( parent, config, row, engine );
// lets find the logo if we can
QPixmap *pm = 0;
QString logo = HelixConfig::coreDirectory();
if (logo.isEmpty())
logo = HELIX_LIBS "/common";
logo.append("/../share/");
QString tmp = logo;
tmp.append("hxplay/logo.png");
if (QFileInfo(tmp).exists())
{
logo = tmp;
pm = new QPixmap(logo);
}
else
{
tmp = logo;
tmp.append("realplay/logo.png");
if (QFileInfo(tmp).exists())
{
logo = tmp;
pm = new QPixmap(logo);
}
}
if (pm)
{
QLabel *l = new QLabel(parent);
l->setPixmap(*pm);
grid->addMultiCellWidget( l, 20, 20, 1, 1, Qt::AlignRight );
}
entries.setAutoDelete( true );
pageName = i18n("Plugins");
addTab( sv = new QScrollView, pageName );
parent = new QWidget( sv->viewport() );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->addChild( parent );
QTextEdit *le = new QTextEdit( parent );
if( sv )
sv->setMinimumWidth( le->sizeHint().width() );
grid = new QGridLayout( parent, /*rows*/1, /*cols*/1, /*margin*/2, /*spacing*/1 );
grid->addMultiCellWidget( le, 0, 1, 0, 1, 0 );
le->setWordWrap(QTextEdit::NoWrap);
int n = engine->numPlugins();
const char *description, *copyright, *moreinfourl;
row = 0;
for (int i=0; i<n; i++)
{
if (!engine->getPluginInfo(i, description, copyright, moreinfourl))
{
le->append(QString(description));
le->append(QString(copyright));
le->append(QString(moreinfourl));
le->append(QString(" "));
}
}
le->setReadOnly(true);
le->setContentsPos(0,0);
}