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


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

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


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

示例1: QDialog

AboutDialog::AboutDialog(QWidget *p, AboutDialogOptions options) : QDialog(p) {
	setWindowTitle(tr("About Murmur"));
	setMinimumSize(QSize(400, 300));

	QTabWidget *qtwTab = new QTabWidget(this);
	QVBoxLayout *vblMain = new QVBoxLayout(this);

	QTextEdit *qteLicense = new QTextEdit(qtwTab);
	qteLicense->setReadOnly(true);
	qteLicense->setPlainText(License::license());

	QTextEdit *qteAuthors = new QTextEdit(qtwTab);
	qteAuthors->setReadOnly(true);
	qteAuthors->setPlainText(License::authors());

	QTextBrowser *qtb3rdPartyLicense = new QTextBrowser(qtwTab);
	qtb3rdPartyLicense->setReadOnly(true);
	qtb3rdPartyLicense->setOpenExternalLinks(true);

	QList<LicenseInfo> thirdPartyLicenses = License::thirdPartyLicenses();
	foreach(LicenseInfo li, thirdPartyLicenses) {
		qtb3rdPartyLicense->append(QString::fromLatin1("<h3>%1 (<a href=\"%2\">%2</a>)</h3><pre>%3</pre>")
				.arg(Qt::escape(li.name))
				.arg(Qt::escape(li.url))
				.arg(Qt::escape(li.license)));
	}
开发者ID:Abextm,项目名称:mumble,代码行数:26,代码来源:About.cpp

示例2: slotActivHelp

// ----------------------------------------------------------------------
//->setWindowFlags(Qt::Window | Qt::WindowTitleHint);
//->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint);
// ----------------------------------------------------------------------
void WxMain::slotActivHelp(){
//    QString str = ((QPushButton*)sender())->text();
//    if (str == tr("Справка")){
        QTextEdit *txt = new QTextEdit;
        txt->setReadOnly(true);
	txt->setHtml( tr("<HTML>"
                "<BODY>"
                "<H2><CENTER> Справка </CENTER></H2>"
                "<P ALIGN=\"left\">"
                    "<BR>"
                    "<BR>"
                    "<BR>"
        	"</P>"
                "<H3><CENTER> Версия 1.2 </CENTER></H3>"
                "<H4><CENTER> Октябрьь 2013 </CENTER></H4>"
                "<H4><CENTER> Широков О.Ю. </CENTER></H4>"
                "<BR>"
                "</BODY>"
                "</HTML>"
               ));
        txt->resize(250, 200);
        txt->show();
//                "<BODY BGCOLOR=MAGENTA>"
//                "<FONT COLOR=BLUE>"
//                "</FONT>"
//    }
//    qDebug() << tr("Справка");  
return;
}// End slot
开发者ID:MiZaRUs,项目名称:SyMonTSTO,代码行数:33,代码来源:WxMain.cpp

示例3: aboutInit

void About::aboutInit()
{
  setModal(true);
  resize(400, 400);
  setWindowTitle("About");
  setWindowIcon(QIcon("icons/backupsoft.png"));

  QWidget *icon = new QWidget(this);
  icon->setStyleSheet("background-image: url(icons/backupsoft.png)");
  icon->setGeometry(250 , 10, 100, 100);

  QLabel *title = new QLabel("BackupSoft", this);
  title->setFont(QFont("Helvetica", 25, 10, false));
  title->setGeometry(10, 10, 200, 30);

  QLabel *version = new QLabel("Copyright 2010 by\nMichael Kohler and Fabian Gammenthaler\n\nVersion: 1.0", this);
  version->setFont(QFont("Helvetica", 8, 2, false));
  version->setGeometry(10, 70, 200, 55);

  QTextEdit *licence = new QTextEdit(this);
  licence->setGeometry(10, 160, 380, 230);
  licence->setReadOnly(true);

  QFile *file = new QFile("licence.txt");
  if (file->open(QIODevice::ReadOnly)) {
    QTextStream *stream = new QTextStream(file);
    licence->setText(stream->readAll());
  }
  else {
    QString errorMsg = "Could not open licence.txt.. Please make sure it is existent and readable.";
    AlertWindow *alertWin = new AlertWindow("ERROR", "", errorMsg);
    alertWin->show();
  }
}
开发者ID:MichaelKohler,项目名称:BackupSoft,代码行数:34,代码来源:about.cpp

示例4: createLicensePanel

QWidget* AboutBox::createLicensePanel()
{
	// Create a label to display readme.txt
	QTextEdit* label = new QTextEdit();
	label->setReadOnly(true);
	QString fileName(QString::fromUtf8(m_gleInterface->getManualLocation().c_str()));
	fileName.resize(fileName.lastIndexOf(QDir::separator()));
	fileName += QDir::separator();
	fileName += tr("LICENSE.txt");
   GLEInterface* iface = GLEGetInterfacePointer();
   std::string licenseFileTxt;
   bool res = iface->readFileOrGZIPTxt(fileName.toUtf8().constData(), &licenseFileTxt);
   if (res) {
		QFont font;
		// Set the font to be fixed pitch
		font.setFixedPitch(true);
		font.setFamily("Courier");
      font.setStretch(QFont::Condensed);
		label->setLineWrapMode(QTextEdit::NoWrap);
		label->setFont(font);
		label->setTextColor(Qt::black);
		// Get the text and put it in the label
		label->setPlainText(licenseFileTxt.c_str());
		QFontMetrics fm(font);
		m_minWidth = fm.width("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
	} else {
		label->setPlainText(tr("File not found: '%1'").arg(fileName));
	}
	return label;
}
开发者ID:pnkfelix,项目名称:glx-gle,代码行数:30,代码来源:about.cpp

示例5: QWidget

void UpgradeMessage::createPage031 ()
{
  QWidget *w = new QWidget(this);
  
  QVBoxLayout *vbox = new QVBoxLayout(w);
  vbox->setMargin(5);
  vbox->setSpacing(5);

  QString s = tr("This version of Qtstalker uses a new data format.");
  s.append(tr(" It can not read data files from previous versions."));
  s.append(tr(" This means that you will start with an empty workspace."));
  s.append(tr(" Your old data files have been preserved in $HOME/Qtstalker"));
  s.append(tr(" and can still be accessed by older Qtstalker versions."));
  s.append(tr(" If you don't intend to downgrade to a previous Qtstalker"));
  s.append(tr(" version, then you can remove that directory."));

  QTextEdit *message = new QTextEdit(w);
  message->setReadOnly(TRUE);
  message->setText(s);
  vbox->addWidget(message);

  check = new QCheckBox(tr("Do not show this message again."), w);
  vbox->addWidget(check);

  addTab(w, tr("Warning"));
  
  setOkButton(tr("&OK"));
  setCancelButton(tr("&Cancel"));
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:29,代码来源:UpgradeMessage.cpp

示例6: setLayoutItems

void CellWidget::setLayoutItems(int num)
{
	QVBoxLayout* layout = (QVBoxLayout*) this->layout();
	if(m_numLayoutItems < num)
	{
		m_checkers.resize(num);
		m_editors.resize(num);
		for(int i = m_numLayoutItems; i < num; i++)
		{
			QCheckBox* checker = new QCheckBox();
			QTextEdit* editor = new QTextEdit();
			editor->setReadOnly(true);
			editor->setFixedHeight(20);
			editor->setFixedWidth(120);
			QHBoxLayout* child_layout = new QHBoxLayout(); 
			child_layout->addWidget(checker);
			child_layout->addWidget(editor);
			layout->addLayout(child_layout);

			m_checkers[i] = checker;
			m_editors[i] = editor;
		}
	}
	else if(m_numLayoutItems > num)
	{
		for(int i = num ; i < m_numLayoutItems; i++)
		{
			m_checkers[i]->setHidden(true);
			//m_checkers[i]->setChecked(false);
			m_editors[i]->setHidden(true);
		}
	}
	m_numLayoutItems = num;
}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:34,代码来源:cellwidget.cpp

示例7: QDialog

AboutBox::AboutBox(QWidget* parent) :
    QDialog(parent)
{
    resize( 500,300);
    QTextEdit* content = new QTextEdit();
    content->setReadOnly(true);
    QString txt = "<h1>Evilpixie</h1>"
        "version 0.2<br/><br/>"
        "By Ben Campbell ([email protected])<br/><br/>"
        "Licensed under GPLv3<br/>"
        "Homepage: <a href=\"http://evilpixie.scumways.com\">http://evilpixie.scumways.com</a><br/>"
        "Source: <a href=\"http://github.com/bcampbell/evilpixie\">http://github.com/bcampbell/evilpixie</a>";

    content->setHtml(txt);

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(hide()));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(content);
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);

    setWindowTitle(tr("About EvilPixie"));


}
开发者ID:bcampbell,项目名称:evilpixie,代码行数:27,代码来源:miscwindows.cpp

示例8: file

HelpWindow::HelpWindow()
{
    resize( 600,500);
    QTextEdit* content = new QTextEdit();
    content->setReadOnly(true);
    {
        QFile file( JoinPath(g_App->DataPath(), "help.html").c_str() );
        if(file.open(QIODevice::ReadOnly | QIODevice::Text))
        {
            QString help_txt;
            help_txt = file.readAll();
            content->setHtml(help_txt);
        }
    }

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(hide()));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(content);
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);

    setWindowTitle(tr("Help"));
}
开发者ID:bcampbell,项目名称:evilpixie,代码行数:25,代码来源:miscwindows.cpp

示例9: f

ShowTextDlg::ShowTextDlg(const QString &fname, bool rich, QWidget *parent, const char *name)
:QDialog(parent, name, FALSE, WDestructiveClose)
{
	QString text;

	QFile f(fname);
	if(f.open(IO_ReadOnly)) {
		QTextStream t(&f);
		while(!t.eof())
			text += t.readLine() + '\n';
		f.close();
	}

	QVBoxLayout *vb1 = new QVBoxLayout(this, 8);
	QTextEdit *te = new QTextEdit(this);
	te->setReadOnly(TRUE);
	te->setTextFormat(rich ? QTextEdit::RichText : QTextEdit::PlainText);
	te->setText(text);

	vb1->addWidget(te);

	QHBoxLayout *hb1 = new QHBoxLayout(vb1);
	hb1->addStretch(1);
	QPushButton *pb = new QPushButton(tr("&OK"), this);
	connect(pb, SIGNAL(clicked()), SLOT(accept()));
	hb1->addWidget(pb);
	hb1->addStretch(1);

	resize(560, 384);
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:30,代码来源:showtextdlg.cpp

示例10: aboutLicense

void MainWindow::aboutLicense() {
    QDialog *dialog = new QDialog( this );

    QFile file( ":/GPL" );
    if(!file.open( QIODevice::ReadOnly | QIODevice::Text ))
        qCritical( "GPL LicenseFile not found" );

    QTextStream out ( &file );
    out.setFieldAlignment ( QTextStream::AlignCenter );

    QTextEdit *qteLicense = new QTextEdit ( dialog );
        qteLicense->setText ( out.readAll ());
        qteLicense->setReadOnly ( 1 );
    QPushButton *qpbClose = new QPushButton ( IconLoader::Load( "window-close" ), tr( "&Close" ), dialog );
        connect( qpbClose, SIGNAL( clicked()), dialog, SLOT( deleteLater()));

    qglDialog = new QGridLayout( dialog );
        qglDialog->addWidget( qteLicense, 0, 0 );
        qglDialog->addWidget( qpbClose, 1, 0, Qt::AlignRight );

        dialog->setLayout( qglDialog);
        dialog->setWindowTitle( "GNU General Public License" );
        dialog->setFixedSize( 550, 400 );
        dialog->exec();
}
开发者ID:Azd325,项目名称:simba,代码行数:25,代码来源:mainwindow.cpp

示例11: QDialog

StepPreviewDialog::StepPreviewDialog(const Step *_target, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::StepPreviewDialog)
{
    ui->setupUi(this);
    QTextEdit *textWidget;
    QPixmap pic;
    QLabel *disp;

    // set the preview widget in accordance to the type
    switch(_target->Type)
    {
    case Step::Text:
    case Step::Console:
        textWidget = new QTextEdit(_target->TextContent);
        textWidget->setReadOnly (true);
        ui->verticalLayout->addWidget (textWidget, 1);
        textWidget->show ();
        break;
    case Step::Screenshot:
        pic = QPixmap::fromImage (QImage(_target->ScreenshotPath));
        disp = new QLabel();
        disp->size ().setHeight (250);
        disp->size ().setWidth (430);
        ui->verticalLayout->addWidget (disp, 1);
        disp->show();
        disp->setPixmap (pic.scaled(disp->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
        break;
    default:
        break;


    }

}
开发者ID:ideamonk,项目名称:tuxtorial-client,代码行数:35,代码来源:steppreviewdialog.cpp

示例12: showFullExifInfo

  void FQTermImageOrigin::showFullExifInfo() {

    QString exifInfo = QString::fromStdString(exifExtractor_->extractExifInfo(model_->filePath(tree_->currentIndex()).toLocal8Bit().data()));
    QString comment;

    if ((*exifExtractor_)["UserComment"].length() > 8) {

      QString commentEncoding = QString::fromStdString((*exifExtractor_)["UserComment"].substr(0, 8));

      if (commentEncoding.startsWith("UNICODE")) {
        //UTF-16
        QTextCodec* c = QTextCodec::codecForName("UTF-16");
        comment = c->toUnicode((*exifExtractor_)["UserComment"].substr(8).c_str());
      } else if (commentEncoding.startsWith("JIS")) {
        //JIS X 0208
        QTextCodec* c = QTextCodec::codecForName("JIS X 0208");
        comment = c->toUnicode((*exifExtractor_)["UserComment"].substr(8).c_str());
      } else {
        comment = QString::fromStdString((*exifExtractor_)["UserComment"].substr(8));
      }
    }


    QTextEdit* info = new QTextEdit;
    info->setText(exifInfo + tr("Comment : ") + comment + "\n");
    info->setWindowFlags(Qt::Dialog);
    info->setAttribute(Qt::WA_DeleteOnClose);
    info->setAttribute(Qt::WA_ShowModal);
    //  info->setLineWrapMode(QTextEdit::NoWrap);
    info->setReadOnly(true);
    QFontMetrics fm(font());
    info->resize(fm.width("Orientation : 1st row - 1st col : top - left side    "), fm.height() * 20);
    info->show();
  }
开发者ID:minyoad,项目名称:fqterm,代码行数:34,代码来源:imageviewer_origin.cpp

示例13: slotNewShip

//слот - создание нового корабля
void MyServer::slotNewShip(){

    deleteShipButton->setEnabled(false);

    //создание корабля
    ShipItemStruct* ship = new ShipItemStruct;
    ship->isNew=1;
    shipList.append(ship);

    //если это первый корабль
    if(!shipCounter){
        QTextEdit *txt = (QTextEdit*) txtStack->widget(0);
        txt->append("Ship created");


        //shipCounter++;
        timer->start(500); // TIMER
    }

    //если не первый корабль
    else{
        //создаем новый лог
        QTextEdit *txt = new QTextEdit;
        txt->setReadOnly(true);
        txt->append("Ship created");

        txtStack->addWidget(txt);
        nextButton->setEnabled(true);
    }
    shipCounter++;
}
开发者ID:SimpleName,项目名称:practice,代码行数:32,代码来源:myserver.cpp

示例14: displayFile

void AboutDialog::displayFile(const QString &fileName, const QString &title)
{
    QDialog *dialog = new QDialog(this);
    QLayout *layout = new QVBoxLayout(dialog);
    QTextEdit *textEdit = new QTextEdit(dialog);
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, dialog);

    textEdit->setStyleSheet(QLatin1String("font-family: monospace"));

    QFile file(fileName);
    if (file.open(QIODevice::ReadOnly)) {
        QString text = QTextStream(&file).readAll();
        textEdit->setPlainText(text);
    }

    textEdit->setReadOnly(true);
    connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(close()));
    buttonBox->setCenterButtons(true);
    layout->addWidget(textEdit);
    layout->addWidget(buttonBox);
    layout->setMargin(6);

    dialog->setLayout(layout);
    dialog->setWindowTitle(title);
    dialog->setWindowFlags(Qt::Sheet);
    dialog->resize(600, 350);
    dialog->exec();
}
开发者ID:kingst,项目名称:op2-browser,代码行数:28,代码来源:aboutdialog.cpp

示例15: initUI

void GOpcodeAAA::initUI(void){
    QLabel* plblAAA = new QLabel("<h1><strong><center>aaa</center></strong></h1>");

    QHBoxLayout* phblGeneral = new QHBoxLayout();
    phblGeneral->addWidget(plblAAA);    

    QString info_str = "Производит символьную коррекцию результата двоичного сложения байтовых ASCII-чисел,"
                       " который содержится в аккумуляторе AL.\n"
            "Сложение ASCII-чисел производится в два этапа: сначала байты суммируются как обычные двоичные числа,"
            " а затем осуществляется коррекция по следующим правилам:\n"
            "\t1) Если младшая тетрада AL меньше или равна десятичному числу 9 и флажок AF=0, то переход к шагу 3.\n"
            "\t2) Если младшая тетрада AL больше десятичного числа 9 и флажок AF=1, то к содержимому AL прибавляется"
            " число 6, к содержимому регистра AH прибавляется единица, а флажок AF устанавливается в 1.\n"
            "\t3) Сбрасывается старшая тетрада аккумулятора AL.\n"
            "\t4) Флажок CF устанавливается в то же состояние, что и флажок AF.\n"
            "Флажки CF и AF устанавливаются в 1, если результат суммирования больше числа 9. "
            "Состояние остальных флажков не определено.";
    QTextEdit* info = new QTextEdit();
    info->setText(info_str);
    info->setReadOnly(true);

    QVBoxLayout* pvblGeneral = new QVBoxLayout();
    pvblGeneral->addWidget(info);
    pvblGeneral->addLayout(phblGeneral);

    setLayout(pvblGeneral);
}
开发者ID:aijagluk,项目名称:optasm,代码行数:27,代码来源:opcode_aaa.cpp


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