当前位置: 首页>>代码示例>>C++>>正文


C++ QTextEdit::setWordWrap方法代码示例

本文整理汇总了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 ();
}
开发者ID:svn2github,项目名称:rkward-svn-mirror,代码行数:33,代码来源:rkreadlinedialog.cpp

示例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"));
}
开发者ID:BackupTheBerlios,项目名称:tfla-01-svn,代码行数:23,代码来源:aboutdialog.cpp

示例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);
}
开发者ID:tmarques,项目名称:waheela,代码行数:101,代码来源:helix-configdialog.cpp


注:本文中的QTextEdit::setWordWrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。