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


C++ QPlainTextEdit::setLineWrapMode方法代码示例

本文整理汇总了C++中QPlainTextEdit::setLineWrapMode方法的典型用法代码示例。如果您正苦于以下问题:C++ QPlainTextEdit::setLineWrapMode方法的具体用法?C++ QPlainTextEdit::setLineWrapMode怎么用?C++ QPlainTextEdit::setLineWrapMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPlainTextEdit的用法示例。


在下文中一共展示了QPlainTextEdit::setLineWrapMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: catchException

        void catchException(const std::exception& ex) {
            QString error = QString::fromUtf8(ex.what());
            QString message = "<qt><b>qtfuzzylite</b> has experienced an internal error and will exit.<br><br>"
                    "Please report this error to &nbsp; <a href='mailto:[email protected]'>"
                    "[email protected]</a><br><br>"
                    "Your report will help to make <b>fuzzylite</b> and <b>qtfuzzylite</b> a better "
                    "free open source fuzzy logic library!<br><br>"
                    "Many thanks in advance for your help!"
                    "</qt>";
            QMessageBox x(NULL);
            x.setText(message);
            x.setWindowTitle("Internal Error");
            x.setIcon(QMessageBox::Critical);
            QLabel dummy;
            x.layout()->addWidget(&dummy);

            QLabel viewLabel("Error message:");
            QPlainTextEdit viewError;
            viewError.setReadOnly(true);
            viewError.setPlainText(error);
            viewError.setLineWrapMode(QPlainTextEdit::NoWrap);
            QFont tt("?");
            tt.setStyleHint(QFont::TypeWriter);
            tt.setPointSize(tt.pointSize() - 2);
            viewError.setFont(tt);

            QWidget* view = new QWidget;
            view->setLayout(new QVBoxLayout);
            view->layout()->addWidget(&viewLabel);
            view->layout()->addWidget(&viewError);
            x.layout()->addWidget(view);
            x.exec();
        }
开发者ID:DevasenaInupakutika,项目名称:assn2,代码行数:33,代码来源:main.cpp

示例2: readme

About::About(QWidget * parent, Qt::WindowFlags f)
   : QDialog(parent, f)
{
   // stuff
   setWindowTitle("About LibreLibreCell");

   QLabel *versionLabel = new QLabel(QString("Git revision: %1").arg(LIBRELIBRECELL_VERSION));
   QPlainTextEdit *aboutBox = new QPlainTextEdit;
   QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);

   QVBoxLayout *vLayout = new QVBoxLayout;
   vLayout->addWidget(versionLabel);
   vLayout->addWidget(aboutBox, 1);
   vLayout->addSpacing(10);
   vLayout->addWidget(buttonBox);

   setLayout(vLayout);


   aboutBox->setReadOnly(true);
   aboutBox->setTabChangesFocus(true);
   aboutBox->setWordWrapMode(QTextOption::NoWrap);
   aboutBox->setLineWrapMode(QPlainTextEdit::NoWrap);
   aboutBox->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
   aboutBox->setFont(QFont("Monospace", 10));

   QFile readme(":/README.txt");
   if (readme.open(QIODevice::ReadOnly))
   {
      QTextStream stream(&readme);
      aboutBox->setPlainText(stream.readAll());
      readme.close();
   }
   else
   {
      aboutBox->setPlainText("Could not open README.txt.");
   }
   QFontMetrics fm(aboutBox->font());
   aboutBox->setMinimumSize(fm.width(QLatin1Char('m')) * 76, 450);

   connect(buttonBox, SIGNAL(accepted()),
               this, SLOT(accept()));
}
开发者ID:dubhater,项目名称:LibreLibreCell,代码行数:43,代码来源:about.cpp

示例3: createValueWidget

void SettingWidget::createValueWidget()
{
    rsArgument* argument = task->getArgument(option->name);
    
    switch(option->type) {
        case G_OPTION_ARG_FILENAME:
        case G_OPTION_ARG_STRING:
        case G_OPTION_ARG_STRING_ARRAY:
        case G_OPTION_ARG_CALLBACK:
        case G_OPTION_ARG_INT:
        case G_OPTION_ARG_INT64:
        case G_OPTION_ARG_DOUBLE:
            {
                // Display text box if number of values is not restricted
                if ( option->allowedValues == NULL ) {
                    if ( option->nLines < 2 ) {
                        QLineEdit *w = new QLineEdit();
                        valueWidget = w;
                        w->setPlaceholderText(option->cli_arg_description);
                        connect(w, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
                        if ( argument != NULL ) {
                            w->setText(argument->value);
                        } else if ( option->defaultValue != NULL ) {
                            w->setText(option->defaultValue);
                        }
                    } else { // create a QTextEdit field instead
                        QPlainTextEdit *w = new QPlainTextEdit();
                        valueWidget = w;
                        connect(w, SIGNAL(textChanged()), this, SLOT(textChanged()));
                        if ( argument != NULL ) {
                            w->setPlainText(argument->value);
                        } else if ( option->defaultValue != NULL ) {
                            w->setPlainText(option->defaultValue);
                        }
                        QFontMetrics m(w->font()) ;
                        int rowHeight = m.lineSpacing() ;
                        w->setFixedHeight(option->nLines * rowHeight) ;
                        w->setLineWrapMode(QPlainTextEdit::NoWrap);
                    }
                } else { // if the allowed values are restricted display radio buttons instead
                    QWidget *w = new QWidget();
                    QBoxLayout *wLayout = new QBoxLayout(QBoxLayout::TopToBottom);
                    QButtonGroup *buttonGroup = new QButtonGroup();
                    buttonGroup->setExclusive(true);
                    valueWidget = w;
                    connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(buttonClicked(int)));
                    
                    // go through all options and add a radio button for them
                    rsUIOptionValue** values = option->allowedValues;
                    for (size_t i=0; values[i] != NULL; i++ ) {
                        // add radio button
                        QRadioButton *b = new QRadioButton(QString("'")+QString(values[i]->name)+QString("'"));
                        QFont f("Arial", 12, QFont::Bold);
                        b->setFont(f);
                        buttonGroup->addButton(b, (int)i);
                        wLayout->addWidget(b);
                        
                        // set it to checked if it is the default or set value
                        b->setChecked(false);
                        if ( argument != NULL ) {
                            if ( ! strcmp(argument->value,values[i]->name) ) {
                                b->setChecked(true);
                            }
                        } else if ( ! strcmp(option->defaultValue,values[i]->name) ) {
                            b->setChecked(true);
                        }
                        
                        // add its description
                        QLabel *label = new QLabel(values[i]->description);
                        label->setIndent(22);
                        label->setWordWrap(true);
                        label->setContentsMargins(0, 0, 0, 4);
                        QFont f2("Arial", 11, QFont::Normal);
                        label->setFont(f2);
                        wLayout->addWidget(label);
                    }
                    w->setLayout(wLayout);
                }
            }
            break;
        /*
        case G_OPTION_ARG_INT:
        case G_OPTION_ARG_INT64:
            valueWidget = new QSpinBox();
            break;
        case G_OPTION_ARG_DOUBLE:
            valueWidget = new QDoubleSpinBox();
            break;
        */
        case G_OPTION_ARG_NONE:
            {
                QCheckBox *w = new QCheckBox("Enabled"); // new SwitchWidget();
                valueWidget = w;
                connect(w, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
                if ( argument != NULL ) {
                    w->setCheckState(Qt::Checked);
                } else {
                    w->setCheckState(Qt::Unchecked);
                }
            }
//.........这里部分代码省略.........
开发者ID:janeisklar,项目名称:RSTools-jobeditor,代码行数:101,代码来源:SettingWidget.cpp


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