示例#1
0
  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();
  }
示例#2
0
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);
}
示例#3
0
// FIXME: combine to common init function
ShowTextDlg::ShowTextDlg(const QString &fname, bool rich, QWidget *parent)
	: QDialog(parent)
{
	setAttribute(Qt::WA_DeleteOnClose);
	QString text;

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

	QVBoxLayout *vb1 = new QVBoxLayout(this);
	vb1->setMargin(8);
	QTextEdit *te = new QTextEdit(this);
	te->setReadOnly(true);
	te->setAcceptRichText(rich);
	te->setText(text);

	vb1->addWidget(te);

	QHBoxLayout *hb1 = new QHBoxLayout;
	vb1->addLayout(hb1);
	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);
}
示例#4
0
aboutDialog::aboutDialog() :
	QDialog( engine::mainWindow() ),
	Ui::AboutDialog()
{
	setupUi( this );


	iconLabel->setPixmap( embed::getIconPixmap( "icon", 64, 64 ) );

	versionLabel->setText( versionLabel->text().
					arg( LMMS_VERSION ).
					arg( PLATFORM ).
					arg( MACHINE ).
					arg( QT_VERSION_STR ).
					arg( GCC_VERSION ) );

	authorLabel->setPlainText( embed::getText( "AUTHORS" ) );

	licenseLabel->setPlainText( embed::getText( "COPYING" ) );

	QString contText = embed::getText( "CONTRIBUTORS" );
	if ( contText.length() >= 2 )
	{
		QWidget *widget = new QWidget();
		QVBoxLayout *layout = new QVBoxLayout();
		QTextEdit *contWidget = new QTextEdit();
		contWidget->setReadOnly(true);
		contWidget->setText( contText );

		layout->addWidget( new QLabel( tr("Contributors ordered by number of commits:"), this ) );
		layout->addWidget( contWidget );
		widget->setLayout( layout );
		tabWidget->insertTab( 2, widget, tr("Involved") );
	}
}
示例#5
0
void GOpcodeSBB::initUI(void){
    m_pleOp1 = new QLineEdit();
    m_pleOp2 = new QLineEdit();

    m_pleOp1->setAlignment(Qt::AlignCenter);
    m_pleOp2->setAlignment(Qt::AlignCenter);

    QLabel* plblSBB = new QLabel("<h1><strong>sbb</strong></h1>");
    QLabel* plblComma = new QLabel("<h1><strong>,</strong></h1>");

    QHBoxLayout* phblGeneral = new QHBoxLayout();
    phblGeneral->addStretch();
    phblGeneral->addWidget(plblSBB);
    phblGeneral->addWidget(m_pleOp1);
    phblGeneral->addWidget(plblComma);
    phblGeneral->addWidget(m_pleOp2);
    phblGeneral->addStretch();

    QString info_str = "Производит вычитание второго операнда из первого. Из полученной разности вычитается "
            "значение флажка CF, установленного предыдущими операциями. Полученный результат заносится на "
            "место первого операнда.\n"
            "Устанавливает флажки CF, AF, SF, ZF, PF, OF в соответствии с результатом операции. Причем "
            "флажки CF и AF становятся флажками заема и устанавливаются в 1, если вычитаемое больше уменьшаемого.\n"
            "Наличие заема и переполнение определяется по тем же признакам, что и для команды SUB.\n"
            "Команда SBB используется при вычитании с повышенной точностью, т.к. учитывает заем.";
    QTextEdit* info = new QTextEdit();
    info->setText(info_str);
    info->setReadOnly(true);

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

    setLayout(pvblGeneral);
}
示例#6
0
  int setCharProperty(GWEN_DIALOG_PROPERTY prop,
                      int index,
                      const char *value,
                      int doSignal) {
    QTextEdit *qw;
    QString text;

    qw=(QTextEdit*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL);
    assert(qw);

    if (value)
      text=QString::fromUtf8(value);

    switch(prop) {
    case GWEN_DialogProperty_Value:
      qw->setText(text);
      return 0;
    default:
      break;
    }

    DBG_WARN(GWEN_LOGDOMAIN,
             "Function is not appropriate for this type of widget (%s)",
             GWEN_Widget_Type_toString(GWEN_Widget_GetType(_widget)));
    return GWEN_ERROR_INVALID;
  };
示例#7
0
void GOpcodeNEG::initUI(void){
    m_pleOp = new QLineEdit();

    m_pleOp->setAlignment(Qt::AlignCenter);

    QLabel* plblNEG = new QLabel("<h1><strong>neg</strong></h1>");

    QHBoxLayout* phblGeneral = new QHBoxLayout();
    phblGeneral->addStretch();
    phblGeneral->addWidget(plblNEG);
    phblGeneral->addWidget(m_pleOp);
    phblGeneral->addStretch();

    QString info_str = "Изменяет знак операнда образованием дополнительного кода. Если операнд "
            "равен нулю, его значение не изменяется.\n"
            "Команда модифицирует все арифметические флажки. Флажок CF всегда устанавливается в "
            "нулевое состояние, за исключением случая, конда операнд равен нулю, - тогда CF=0.";
    QTextEdit* info = new QTextEdit();
    info->setText(info_str);
    info->setReadOnly(true);

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

    setLayout(pvblGeneral);
}
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 ();
}
示例#9
0
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);
}
示例#10
0
void GOpcodeAAS::initUI(void){
    QLabel* plblAAS = new QLabel("<h1><strong><center>aas</center></strong></h1>");

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

    QString info_str = "Производит символьную коррекцию результата двоичного вычитания байтовых ASCII-чисел, "
            "который содержится в регистре AL.\n"
            "Вычитание производится в два этапа: сначала осуществляется вычитание как для обычных двоичных чисел, "
            "а затем результат корректируется по следующим правилам:\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"
            "Флажки AF и CF устанавливаются в 1, если вычитаемое больше уменьшаемого (AF и CF интерпретируются как флажки заема). \n"
            "Состояние остальных флажков не определено.\n"
            "Вычитание ASCII-чисел с повышенной точностью похоже на двоичную арифметику с повышенной точностью, но после каждого "
            "байтового вычитания необходимо производить символьную коррекцию";
    QTextEdit* info = new QTextEdit();
    info->setText(info_str);
    info->setReadOnly(true);

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

    setLayout(pvblGeneral);
}
示例#11
0
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();
}
示例#12
0
void GOpcodeCMP::initUI(void){
    m_pleOp1 = new QLineEdit();
    m_pleOp2 = new QLineEdit();

    m_pleOp1->setAlignment(Qt::AlignCenter);
    m_pleOp2->setAlignment(Qt::AlignCenter);

    QLabel* plblCMP = new QLabel("<h1><strong>cmp</strong></h1>");
    QLabel* plblComma = new QLabel("<h1><strong>,</strong></h1>");

    QHBoxLayout* phblGeneral = new QHBoxLayout();
    phblGeneral->addStretch();
    phblGeneral->addWidget(plblCMP);
    phblGeneral->addWidget(m_pleOp1);
    phblGeneral->addWidget(plblComma);
    phblGeneral->addWidget(m_pleOp2);
    phblGeneral->addStretch();

    QString info_str = "Производит сравнение операндов, вычитая из первого операнда второй. При этом "
            "операнды остаются без изменения.\n"
            "Устанавливает флажки CF, AF, SF, ZF, PF, OF в соответствии с результатом операции. Причем "
            "флажки CF и AF становятся флажками заема и устанавливаются в 1, если вычитаемое больше уменьшаемого.\n"
            "При сравнении чисел повышенной точности, проще использовать команды вычитания SUB и SBB.";
    QTextEdit* info = new QTextEdit();
    info->setText(info_str);
    info->setReadOnly(true);

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

    setLayout(pvblGeneral);
}
示例#13
0
void CellWidget::setCells(vector<CellTrack::Cell*> visable_cells, vector<CellTrack::Cell*> marked_cells)
{
	clearCells();
	m_cells = visable_cells;
	orderCells();
	int cell_num = m_cells.size();
	setLayoutItems(cell_num);
	set<CellTrack::Cell*> marked_cells_set(marked_cells.begin(), marked_cells.end());
	for(int i = 0; i < cell_num; i++)
	{
		CellTrack::Cell* cell = m_cells[i];
		QCheckBox* checker = m_checkers[i];
		QTextEdit* editor = m_editors[i];
		editor->setText(tr("<span style=\" color:#%1;\">%2</span>")
				.arg(getColorStr(cell->getColor()))
				.arg(cell->getSize()));
		checker->setText(tr("%1 : ").arg(cell->getTrack()->trackId() + 1));
		if(marked_cells_set.find(m_cells[i]) != marked_cells_set.end())
		{
			checker->setChecked(true);
		}
		else checker->setChecked(false);
		connect(checker,SIGNAL(stateChanged(int)), this, SLOT(onCellChecked(int)));
	}
}
示例#14
0
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"));
}
示例#15
0
// ============================================================================
// Help button handler
void GameUIMain::on_buttonHelp_clicked()
{
	QString help = 
	"Controls\n\n"
	"Mouse Up/Down\t- elevator\n"
	"Mouse Wheel\t- throttle\n"
	"Mouse Left Button\t- fire gun\n"
	"Mouse Right Button\t- release bomb\n"
	"Page Up/Page Down\t- zoom in/out\n"
	"F/V\t- flaps\n"
	"Space\t- flip/turn\n"
	"B\t- wheel brake\n"
	"A\t- toggle autopilot\n"
	"P\t- pause";
	
	GameUIDialog* pHelpDialog = new GameUIDialog( scene() );
	pHelpDialog->setWindowFlags(  Qt::WindowSystemMenuHint | pHelpDialog->windowFlags() );
	pHelpDialog->setWindowTitle( "Help" );
	pHelpDialog->setLayout( new QVBoxLayout );
	pHelpDialog->setSizeGripEnabled( true );
	
	connect( this, SIGNAL(destroyed()), pHelpDialog, SLOT(deleteLater()) );
	
	QTextEdit *pHelp = new QTextEdit( pHelpDialog );
	pHelpDialog->layout()->addWidget( pHelp );
	pHelp->setText( help );
	pHelp->setReadOnly( true );
	
	scene()->addWindow( pHelpDialog, 1.0 );
	pHelpDialog->setFocus();
	
}
示例#16
0
void GOpcodeJMP::initUI(void){
    m_pleOp = new QLineEdit();

    m_pleOp->setAlignment(Qt::AlignCenter);

    QLabel* plblJMP = new QLabel("<h1><strong>jmp</strong></h1>");

    QHBoxLayout* phblGeneral = new QHBoxLayout();
    phblGeneral->addStretch();
    phblGeneral->addWidget(plblJMP);
    phblGeneral->addWidget(m_pleOp);
    phblGeneral->addStretch();

    QString info_str = "Осуществляет безусловный переход, модифицируя указатель команд IP "
            "(при переходе типа NEAR) или пару регистров CS:IP (при переходе типа FAR).\n"
            "Старое значение регистров IP и CS теряется.\n"
            "Регистр флажков не модифицируется.";
    QTextEdit* info = new QTextEdit();
    info->setText(info_str);
    info->setReadOnly(true);

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

    setLayout(pvblGeneral);
}
/**funcion que valida numeros ingresados*/
void sudoku::correccionInGame(){
     QTextEdit *numberTextTemp = ( QTextEdit *) sender();
     int contador=0;
     long inputNumber = numberTextTemp->toPlainText().toLong();
     if ((inputNumber>9 || inputNumber<1)&& inputNumber!=NULL){
         QMessageBox::information(this, "Advertencia", "El numero ingresado no es valido esta fuera del rango");
         numberTextTemp->setText("");
      }

     for(int i = 0; i < 9; i++){
         for(int j = 0; j < 9; j++){
             if(getDisplayValue(i,j)!=0){
                 contador++;
             }
             if(contador==81){
                 on_comprobar_clicked();
             }

             if(((getDisplayValue(i,j)!=0) && numbertext[i][j]->isEnabled())){
                 CorreccionFila(i,j);
                 CorreccionColumna(i,j);
                 CorreccionCuadrante(i,j);
             }
         }
     }
}
示例#18
0
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();
  }
}
示例#19
0
void MainWindow::open()
{
    //qDebug("File->Open triggered.");
    QString fileName = QFileDialog::getOpenFileName(this,
        tr("Open glTF File (OpenGL Transport Format)"), "C:\\Users", tr("glTF Files (*.json)"));
    if (! fileName.isNull())
    {
        // Attempt to open the glTF file.
        if (! m_reader.open(fileName.toUtf8()))
        {
            qDebug("Unable to open glTF file.");
        } else {
            // Successfully read glTF file.
            QglTFReader::dumpJsonObject(m_reader.getData());

            // Update source editor.
            QString *text = m_reader.toString();
            QTextEdit *sourceEditor = m_ui->textEdit;
            sourceEditor->setText(*text);

            // Update structure editor.
            QJsonObject data = m_reader.getData();
            m_tree->loadData(data);

            // Clean up.
            delete text;
        }
    }
}
示例#20
0
ShowTextDlg::ShowTextDlg(const QString &text, bool nonfile, bool rich, QWidget *parent)
	: QDialog(parent)
{
	Q_UNUSED(nonfile);

	setAttribute(Qt::WA_DeleteOnClose);

	QVBoxLayout *vb1 = new QVBoxLayout(this);
	vb1->setMargin(8);
	QTextEdit *te = new QTextEdit(this);
	te->setReadOnly(true);
	te->setAcceptRichText(rich);
	te->setText(text);

	vb1->addWidget(te);

	QHBoxLayout *hb1 = new QHBoxLayout;
	vb1->addLayout(hb1);
	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);
}
示例#21
0
static void *
qQuailNotifyFormatted(const char *title, const char *primary,
                      const char *secondary, const char *text)
{
	QDialog *dialog;
	QVBoxLayout *layout;
	QLabel *label;
    QTextEdit *textview;
	QString message;
	QString newTitle;

	message = "";

	if (primary != NULL)
	{
		message += "<p>";
		message += primary;
		message += "</p>";
	}

	if (secondary != NULL)
	{
		message += "<p>";
		message += secondary;
		message += "</p>";
	}

	if (title == NULL)
	{
		if (primary != NULL)
            newTitle = QString(primary).trimmed();
		else
			newTitle = "";
	}
	else
		newTitle = title;


    //dialog = new QDialog(NULL, "notify-formatted");
    dialog = new QDialog();
    dialog->setWindowTitle(newTitle);

    layout = new QVBoxLayout();
    dialog->setLayout(layout);

    //layout->setAutoAdd(true);

	label = new QLabel(dialog);
    layout->addWidget(label);
	label->setText(message);

    textview = new QTextEdit(dialog);
    layout->addWidget(textview);
	textview->setText(text);

    dialog->show();

	return NULL;
}
void MainWindow::reset(){
    QList<QTextEdit*> textEdits = centralWidget->findChildren<QTextEdit *>();
    for(int i = 0; i < textEdits.count(); i++) {
        QTextEdit * tile = textEdits.at(i);
        QString s ="";
        tile->setText(s);
    }
}
示例#23
0
PluginPage::PluginPage(QWidget *parent) : SettingsPage(parent)
{
	QTextEdit *textedit = new QTextEdit(this);
	textedit->setText("Text Editor");
	textedit->setReadOnly(true);
	
	QGridLayout *layout = new QGridLayout(this);
	layout->addWidget(textedit);
	layout->setContentsMargins(0, 0, 0, 0);
}
示例#24
0
void SqlItemView::setCurrentIndex(int row, int column)
{
	m_column = column;
	m_row = row;
	if ((row >= 0) && (column >= 0))
	{
		m_changing = true;
		bool writeable = qobject_cast<SqlTableModel *>(m_model) != 0;
		for (int i = 0; i < m_count; ++i)
		{
			QWidget * w = m_gridLayout->itemAtPosition(i, 1)->widget();
			QTextEdit * te = qobject_cast<QTextEdit *>(w);
			if (te)
			{
				QColor color =
					m_model->data(m_model->index(row, i),
								  Qt::BackgroundColorRole).value<QColor>();
				QPalette p(te->palette());
				p.setColor(QPalette::Active, QPalette::Base, color);
				p.setColor(QPalette::Inactive, QPalette::Base, color);
				te->setPalette(p);
				QVariant rawdata = m_model->data(
					m_model->index(row, i), Qt::EditRole);
				if (rawdata.type() == QVariant::ByteArray)
				{
					te->setText(m_model->data(
						m_model->index(row, i), Qt::DisplayRole).toString());
					te->setReadOnly(true);
				}
				else
				{
					te->setReadOnly(!writeable);
					Qt::ItemDataRole role = (writeable && (i == column)) ?
						Qt::EditRole : Qt::DisplayRole;
					te->setText(m_model->data(
						m_model->index(row, i), role).toString());
				}
			}
		}
		m_changing = false;
	}
	updateButtons(row);
}
void MainWindow::put_results(){
    QList<QTextEdit*> textEdits = centralWidget->findChildren<QTextEdit *>();
    for(int i = 0; i < textEdits.count(); i++) {
        int y = (int(floor(i / 3)) % 3) + (3 * floor(i / 27));
        int x = (i % 3) + (3 * floor(i / 9)) - (9 * floor(i / 27));
        QTextEdit * tile = textEdits.at(i);
        QString s = QString::number(Sudoku[y][x]+1);
        tile->setText(s);
    }
}
示例#26
0
//static
void
body_view::rich_to_plain(QString& s)
{
  QTextEdit tmp; 
  /* hack: remove <br /> or the conversion to plaintext will insert
     question marks at line break positions. <p> on the other hand
     is correctly replaced by '\n' */
  s.replace("<br />", "<p>");
  tmp.setText(s);
  s = tmp.toPlainText();
}
void SourceViewer::setSourceText(const QString &key, const QString &name, const QString &searchText, const QByteArray &sourceTextBuffer)
{
	QTextEdit *logTextEdit = NULL;
	QTextEditorContextMap::const_iterator i = logTextWidgetMap_.find(key);
	if(i == logTextWidgetMap_.end())
	{
		// New tab created..
		logTextEdit = new QTextEdit();
		QObject::connect(logTextEdit, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
		logTextEdit->setReadOnly(true);

		SourceViewContext* ctx = new SourceViewContext();
		ctx->logTextEdit = logTextEdit;
		logTextWidgetMap_.insert(key, ctx);
		ui.tabWidget->insertTab(0, logTextEdit, name);
		ui.tabWidget->setCurrentIndex(0);
	}
	else
	{
		// Already the tab exists.
		logTextEdit = i.value()->logTextEdit;
		int index = ui.tabWidget->indexOf(logTextEdit);
		if(index >= 0)
		{
			ui.tabWidget->setCurrentIndex(index);
		}
	}

	workingHighlightText_ = true;

	ui.searchText->setText(searchText);

	logTextEdit->setText(sourceTextBuffer);

	logTextEdit->setFocus();

	if(searchText.isEmpty() == false) 
	{
		doHighlightText(searchText, ui.caseSensitiveCheck->isChecked());
	
		QTextDocument::FindFlags flags = 0x0;
		if(ui.caseSensitiveCheck->isChecked())
			flags |=  QTextDocument::FindCaseSensitively;

		logTextEdit->moveCursor(QTextCursor::Start);

		while(logTextEdit->find(searchText, flags))
		{
			break;
		}
	}

	workingHighlightText_ = false;
}
示例#28
0
void PluginTextEditor::openFile(QString file)
{
	Project *project = IPlatform::getInstance()->getProjectManager()->getProject();
	if(project)
	{
		QTabWidget *tabwidget = IPlatform::getInstance()->getWindowManager()->getWindow()->getTabWidget();
		QTextEdit *textedit = new QTextEdit(tabwidget);
		textedit->setText(Backend::readFile(project->getLocation() + file));
		tabwidget->addTab(textedit, file);
		tabwidget->setCurrentWidget(textedit);
	}
}
示例#29
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
  m_sa = new QScrollArea(this);

  setCentralWidget(m_sa);

  QTextEdit *te = new QTextEdit(this);
  te->setMinimumSize(QSize(1000,2000));
  te->setText("very long message\nvery long message\nvery long message\nvery long message\nvery long message\nvery long message\nvery long message\nvery long message\nvery long message\n");
  m_sa->setWidget(te);

}
示例#30
-1
void MainWindow::aboutCredits() {
    QDialog *dialog = new QDialog( this );

    QTextEdit *qteCreditsWritten = new QTextEdit( dialog );
        qteCreditsWritten->setReadOnly( 1 );
        qteCreditsWritten->setLineWrapMode( QTextEdit::NoWrap );
        qteCreditsWritten->setText( "Tim Kleinschmidt <*****@*****.**>" );

    QTextEdit *qteCreditsArtwork = new QTextEdit( dialog );
        qteCreditsArtwork->setReadOnly( 1 );
        qteCreditsArtwork->setLineWrapMode( QTextEdit::NoWrap );
        qteCreditsArtwork->setText( "Elementary Theme\n" );

    QTabWidget *qtwCredits = new QTabWidget( dialog );
        qtwCredits->addTab( qteCreditsWritten, tr( "Written by" ));
        qtwCredits->addTab( qteCreditsArtwork, tr( "Artwork by" ));
        qtwCredits->setElideMode( Qt::ElideRight );

    QPushButton *qpbClose = new QPushButton( IconLoader::Load( "window-close"), tr( "&Close" ), dialog );
        connect( qpbClose, SIGNAL( clicked()), dialog, SLOT( close()));

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

    dialog->setWindowTitle( tr( "Credits" ));
    dialog->setLayout( qglDialog );
    dialog->setFixedSize( 250, 200 );
    dialog->exec();
}