本文整理汇总了C++中QTextEdit::setFixedHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::setFixedHeight方法的具体用法?C++ QTextEdit::setFixedHeight怎么用?C++ QTextEdit::setFixedHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::setFixedHeight方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: qDebug
InfoPanel::InfoPanel(QWidget *parent) :QWidget(parent)
{
#ifdef K_DEBUG
#ifdef Q_OS_WIN
qDebug() << "[InfoPanel()]";
#else
TINIT;
#endif
#endif
QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom);
QLabel *label = new QLabel(tr("Tips"));
label->setAlignment(Qt::AlignHCenter);
layout->addWidget(label);
mainLayout->addLayout(layout);
QTextEdit *textArea = new QTextEdit;
textArea->setFixedHeight(250);
textArea->setHtml("<p><b>" + tr("X Key or Right Mouse Button") + ":</b> " + tr("Close line") + "</p>");
mainLayout->addWidget(textArea);
mainLayout->addStretch(2);
}
示例3: qDebug
ZoomConfigurator::ZoomConfigurator(QWidget *parent) :QWidget(parent)
{
#ifdef K_DEBUG
#ifdef Q_OS_WIN32
qDebug() << "[ZoomConfigurator()]";
#else
TINIT;
#endif
#endif
QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom);
scale = new QLabel(tr("Scale Factor"));
scale->setFont(QFont("Arial", 8, QFont::Normal, false));
scale->setAlignment(Qt::AlignHCenter);
layout->addWidget(scale);
factor = new QDoubleSpinBox();
factor->setDecimals(1);
factor->setSingleStep(0.1);
factor->setMinimum(0.1);
factor->setMaximum(0.9);
layout->addWidget(factor);
QLabel *label = new QLabel(tr("Tips"));
label->setAlignment(Qt::AlignHCenter);
label->setFont(QFont("Arial", 8, QFont::Normal, false));
QTextEdit *textArea = new QTextEdit;
textArea->setFont(QFont("Arial", 8, QFont::Normal, false));
textArea->setHtml("<p><b>" + tr("Zoom Square mode") + ":</b> " + tr("Press Ctrl key + Mouse left button") + "</p>");
QString text = textArea->document()->toPlainText();
int height = (text.length()*270)/207;
textArea->setFixedHeight(height);
mainLayout->addLayout(layout);
mainLayout->addWidget(label);
mainLayout->addWidget(textArea);
mainLayout->addStretch(2);
TCONFIG->beginGroup("ZoomTool");
double value = TCONFIG->value("zoomFactor", -1).toDouble();
if (value > 0)
factor->setValue(value);
else
factor->setValue(0.5);
}
示例4: createThumbnail
void TextZone::createThumbnail()
{
QWidget *w = QApplication::focusWidget();
if(w){
// pixmap.fill( Qt::white );
// QPainter painter( &pixmap );
// painter.setPen( Qt::black );
//// rect.translate( 0, rect.height()+10 );
//// rect.setHeight( 160 );
// doc.setTextWidth( rect.width() );
// painter.save();
// painter.translate( rect.topLeft() );
// doc.drawContents( &painter, rect.translated( -rect.topLeft() ) );
// painter.restore();
// rect.setHeight( textDocument.size().height()-160 );
// painter.setBrush( Qt::gray );
// painter.drawRect( rect );
// pixmap.save( "text.png" );
QTextEdit tempEdit;
tempEdit.setDocument(textDocument);
tempEdit.setFixedHeight(textDocument->size().height());
tempEdit.setFixedWidth(textDocument->textWidth());
#if QT_VERSION < 0x050000
QPixmap thumbnail = QPixmap::grabWidget(&tempEdit);
#endif
#if QT_VERSION >= 0x050000
QPixmap thumbnail = tempEdit.grab();
#endif
emit textThumbnailSignal(thumbnail);
}
}
示例5: addItem
void DialogEditor::addItem()
{
int itemCount = ui->treeWidget->topLevelItemCount();
QTreeWidgetItem* item = new QTreeWidgetItem(QTreeWidgetItem::Type);
item->setText(0, "Dialog_"+QString::number(itemCount));
ui->treeWidget->addTopLevelItem(item);
QTextEdit* dialog = new QTextEdit();
dialog->setFixedHeight(60);
ui->treeWidget->setItemWidget(item, 2, dialog);
QComboBox* cb = new QComboBox();
cb->addItem("Message");
cb->addItem("Start Quest");
cb->addItem("Sell Item");
cb->addItem("End");
ui->treeWidget->setItemWidget(item, 1, cb);
}
示例6: textAreaChanged
void myTextEdit::textAreaChanged()
{
QTextDocument *document = qobject_cast<QTextDocument*>(sender());
if (document)
{
QTextEdit *editor = qobject_cast<QTextEdit*>(document->parent()->parent());
if (editor)
{
int newheight = document->size().rheight();
if (newheight != editor->height())
{
editor->setFixedHeight(newheight+5);
this->setFixedHeight(newheight);
}
}
}
}
示例7: QBoxLayout
Configurator::Configurator(QWidget *parent) :QWidget(parent)
{
#ifdef K_DEBUG
TINIT;
#endif
QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
QTextEdit *textArea = new QTextEdit;
textArea->setFixedHeight(170);
textArea->setHtml("<p>" + tr("This tool is just a <b>proof-of-concept</b> of the basic algorithm for the Tupi's free-tracing vectorial brushes") + "</p>");
mainLayout->addWidget(textArea);
QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom);
QLabel *label = new QLabel(tr("Parameters"));
label->setAlignment(Qt::AlignHCenter);
layout->addWidget(label);
mainLayout->addLayout(layout);
QBoxLayout *structureLayout = new QBoxLayout(QBoxLayout::TopToBottom);
QLabel *structureLabel = new QLabel(tr("Structure"));
structureLabel->setAlignment(Qt::AlignHCenter);
structureLayout->addWidget(structureLabel);
structureCombo = new QComboBox();
structureCombo->addItem(tr("Basic"));
structureCombo->addItem(tr("Axial"));
structureCombo->addItem(tr("Organic"));
structureCombo->setCurrentIndex(2);
structureLayout->addWidget(structureCombo);
mainLayout->addLayout(structureLayout);
QBoxLayout *spaceLayout = new QBoxLayout(QBoxLayout::TopToBottom);
QLabel *spaceLabel = new QLabel(tr("Dot Spacing"));
spaceLabel->setAlignment(Qt::AlignHCenter);
spaceLayout->addWidget(spaceLabel);
spacingBox = new QSpinBox();
spacingBox->setSingleStep(1);
spacingBox->setMinimum(1);
spacingBox->setMaximum(10);
spacingBox->setValue(2);
spaceLayout->addWidget(spacingBox);
connect(spacingBox, SIGNAL(valueChanged(int)), this, SIGNAL(updateSpacing(int)));
mainLayout->addLayout(spaceLayout);
QBoxLayout *sizeLayout = new QBoxLayout(QBoxLayout::TopToBottom);
QLabel *sizeLabel = new QLabel(tr("Size Tolerance"));
sizeLabel->setAlignment(Qt::AlignHCenter);
sizeLayout->addWidget(sizeLabel);
sizeBox = new QSpinBox();
sizeBox->setSingleStep(10);
sizeBox->setMinimum(0);
sizeBox->setMaximum(200);
sizeBox->setValue(0);
sizeLayout->addWidget(sizeBox);
connect(sizeBox, SIGNAL(valueChanged(int)), this, SIGNAL(updateSizeTolerance(int)));
mainLayout->addLayout(sizeLayout);
QBoxLayout *checkLayout = new QBoxLayout(QBoxLayout::TopToBottom);
checkBox = new QCheckBox(tr("Run simulation"));
checkLayout->addWidget(checkBox);
connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(updateInterface(int)));
mainLayout->addLayout(checkLayout);
QBoxLayout *smoothLayout = new QBoxLayout(QBoxLayout::TopToBottom);
QLabel *smoothLabel = new QLabel(tr("Smoothness"));
smoothLabel->setAlignment(Qt::AlignHCenter);
smoothLayout->addWidget(smoothLabel);
smoothBox = new QDoubleSpinBox();
smoothBox->setValue(2.0);
smoothBox->setDecimals(2);
smoothBox->setSingleStep(0.1);
smoothBox->setMaximum(100);
smoothLayout->addWidget(smoothBox);
mainLayout->addLayout(smoothLayout);
smoothBox->setDisabled(true);
mainLayout->addStretch(2);
}