本文整理汇总了C++中QTextEdit::setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::setMinimumHeight方法的具体用法?C++ QTextEdit::setMinimumHeight怎么用?C++ QTextEdit::setMinimumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::setMinimumHeight方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMinimumHeight
bool
ResizableMessageBox::event(QEvent *e)
{
bool result = QMessageBox::event(e);
//QMessageBox::event in this case will call setFixedSize on the dialog frame, making it not resizable by the user
if ( (e->type() == QEvent::LayoutRequest) || (e->type() == QEvent::Resize) ) {
setMinimumHeight(0);
setMaximumHeight(QWIDGETSIZE_MAX);
setMinimumWidth(0);
setMaximumWidth(QWIDGETSIZE_MAX);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// make the detailed text expanding
QTextEdit *textEdit = findChild<QTextEdit *>();
if (textEdit) {
textEdit->setMinimumHeight(0);
textEdit->setMaximumHeight(QWIDGETSIZE_MAX);
textEdit->setMinimumWidth(0);
textEdit->setMaximumWidth(QWIDGETSIZE_MAX);
textEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
}
}
return result;
}
示例2: setMessages
void UBMessagesDialog::setMessages(const QList<QString> messages)
{
mMessages = messages;
if (mMessages.count())
{
QVBoxLayout *messagesLayout = new QVBoxLayout(this);
foreach (QString message, mMessages)
{
QTextEdit *messageBox = new QTextEdit(this);
messageBox->setMinimumHeight(55);
messageBox->setReadOnly(true);
messageBox->setFocusPolicy(Qt::NoFocus);
messageBox->setText(message);
messagesLayout->addWidget(messageBox);
}
示例3: getMultiLineText
QString QtopiaInputDialog::getMultiLineText(QWidget *parent, const QString &title, const QString &label,
QtopiaApplication::InputMethodHint hint, const QString &hintParam,
const QString &text, bool *ok)
{
QTextEdit *te = new QTextEdit;
QtopiaApplication::setInputMethodHint(te, hint, hintParam);
te->setPlainText(text);
te->setFocus();
te->selectAll();
te->setMinimumHeight(100);
QtopiaInputDialog dlg(parent, title, label, te);
QString result;
bool accepted = (QtopiaApplication::execDialog(&dlg) == QDialog::Accepted);
if (ok)
*ok = accepted;
if (accepted)
result = te->toPlainText();
return result;
}
示例4: setModel
void SqlItemView::setModel(QAbstractItemModel * model)
{
m_model = model;
QSqlQueryModel * t = qobject_cast<QSqlQueryModel *>(model);
if (!t) { return; }
QSqlRecord rec(t->record());
if (scrollWidget->widget())
{
delete scrollWidget->takeWidget();
}
QWidget * layoutWidget = new QWidget(scrollWidget);
m_gridLayout = new QGridLayout(layoutWidget);
QString tmp("%1:");
for (int i = 0; i < rec.count(); ++i)
{
m_gridLayout->addWidget(
new QLabel(tmp.arg(rec.fieldName(i)), layoutWidget), i, 0);
QTextEdit * w = new QTextEdit(layoutWidget);
w->setReadOnly(false);
w->setAcceptRichText(false);
int mh = QFontMetrics(w->currentFont()).lineSpacing();
w->setMinimumHeight(mh);
w->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::MinimumExpanding);
m_gridLayout->addWidget(w, i, 1);
m_gridLayout->setRowMinimumHeight(i, mh);
connect(w, SIGNAL(textChanged()),
this, SLOT(textChanged()));
}
scrollWidget->setWidget(layoutWidget);
m_count = rec.count();
}
示例5: createEditor
//-----------------------------------------------------------------------------
// Function: ParameterDelegate::createEditor()
//-----------------------------------------------------------------------------
QWidget* ParameterDelegate::createEditor(QWidget* parent, QStyleOptionViewItem const& option,
QModelIndex const& index ) const
{
if (index.column() == nameColumn())
{
QWidget* editor = QStyledItemDelegate::createEditor(parent, option, index);
QLineEdit* lineEditor = qobject_cast<QLineEdit*>(editor);
if (lineEditor)
{
lineEditor->setValidator(new NameValidator(lineEditor));
}
return editor;
}
if (index.column() == choiceColumn())
{
return createChoiceSelector(parent);
}
else if (index.column() == formatColumn())
{
return createFormatSelector(parent);
}
else if (index.column() == resolveColumn())
{
return createResolveSelector(parent);
}
else if (index.column() == usageCountColumn())
{
QModelIndex valueIdIndex = index.sibling(index.row(), idColumn());
QString targetId = valueIdIndex.data(Qt::DisplayRole).toString();
emit(openReferenceTree(targetId));
return 0;
}
else if (index.column() == valueColumn() && valueIsArray(index))
{
ArrayView* editor = new ArrayView(parent);
QScrollArea* scrollingWidget = new QScrollArea(parent);
scrollingWidget->setWidgetResizable(true);
scrollingWidget->setWidget(editor);
scrollingWidget->parent()->installEventFilter(editor);
return scrollingWidget;
}
else if (isIndexForValueUsingChoice(index))
{
return createEnumerationSelector(parent, index);
}
else if (index.column() == descriptionColumn())
{
QTextEdit* editor = new QTextEdit(parent);
editor->setMinimumHeight(120);
return editor;
}
else
{
return ChoiceCreatorDelegate::createEditor(parent, option, index);
}
}
示例6: setupTabs
//----------------------------------------------------------------------------
void DynamicEditor::setupTabs(QDomDocument *elmerDefs, const QString &Section, int ID)
{
// Clear:
//-------
this->ID = ID;
hash.clear();
QLayout *layout = this->layout();
if(layout != NULL) {
QLayoutItem *item;
while((item = layout->takeAt(0)) != 0)
delete item;
if(tabWidget != NULL) {
tabWidget->clear();
delete tabWidget;
}
delete layout;
}
// Get root element of elmerDefs:
//-------------------------------
root = elmerDefs->documentElement();
tabWidget = new QTabWidget;
//tabWidget->setTabShape(QTabWidget::Triangular);
tabWidget->setUsesScrollButtons(true);
tabWidget->setElideMode(Qt::ElideNone);
all_stuff = root.firstChildElement("ALL");
element = root.firstChildElement("PDE");
tabs = 0;
while(!element.isNull()) {
name = element.firstChildElement("Name");
QGridLayout *grid = new QGridLayout;
int params = 0;
for( int iter=0; iter<2; iter++ )
{
if ( iter==0 ) {
if ( name.text().trimmed() == "General" ) continue;
section = all_stuff.firstChildElement(Section);
} else {
section = element.firstChildElement(Section);
}
param = section.firstChildElement("Parameter");
// ML: Added argument "Parameter" for nextSiblingElement(), 5. August 2010:
for( ; !param.isNull(); param=param.nextSiblingElement("Parameter"), params++ ) {
// label
QString widget_type = param.attribute("Widget","Edit");
QString widget_enabled = param.attribute("Enabled","True");
QString widget_visible = param.attribute("Visible","True");
QString paramType = param.firstChildElement("Type").text().trimmed();
QString labelName = param.firstChildElement("Name").text().trimmed();
QString sifName = param.firstChildElement("SifName").text().trimmed();
if ( sifName == "" ) sifName = labelName;
QString paramDefault = param.firstChildElement("DefaultValue").text().trimmed();
QString whatis = param.firstChildElement("Whatis").text().trimmed();
QString statusTip = param.firstChildElement("StatusTip").text().trimmed();
QString fullName = "/"+name.text().trimmed()+"/"+Section+"/"+labelName+"/"+QString::number(ID);
h.widget = NULL;
if ( widget_type == "Edit" ) {
DynLineEdit *edit = new DynLineEdit;
h.widget = edit->lineEdit;
edit->lineEdit->setText(paramDefault);
edit->name = fullName;
connect(edit->lineEdit, SIGNAL(returnPressed()),
edit, SLOT(editSlot()));
connect(edit->lineEdit, SIGNAL(textChanged(QString)),
this, SLOT(textChangedSlot(QString)));
} else if (widget_type == "TextEdit") {
QTextEdit *textEdit = new QTextEdit;
// set height to 5..8 lines of current font:
QFont currentFont = textEdit->currentFont();
QFontMetrics fontMetrics(currentFont);
int fontHeight = fontMetrics.height();
textEdit->setMinimumHeight(5*fontHeight);
textEdit->setMaximumHeight(8*fontHeight);
h.widget = textEdit;
} else if ( widget_type == "Combo" ) {
QComboBox *combo = new QComboBox;
h.widget = combo;
// combo->setObjectName(labelName); // removed 30. sept. 2008, ML
int count = 0, active=0;
QDomElement item = param.firstChildElement("Item");
for( ; !item.isNull(); item=item.nextSiblingElement("Item") ) {
QString itemType = item.attribute( "Type", "" );
//.........这里部分代码省略.........
示例7: initialize
void PlotDataFitFunctionWidget::initialize() {
QProcessorWidget::initialize();
QGridLayout* mainLayout = new QGridLayout(this);
QLabel* label = new QLabel(this);
label->setText(QString(tr("Fitting Function",0)));
label->setAlignment(Qt::AlignHCenter);
QFont font = label->font();
font.setBold(true);
font.setPointSize(14);
label->setFont(font);
mainLayout->addWidget(label,0,0,1,3);
widgetVector_.push_back(label);
label = new QLabel(this);
label->setText(QString(tr("Function:",0)));
label->setFixedWidth(100);
mainLayout->addWidget(label,1,0,1,1);
widgetVector_.push_back(label);
QTextEdit* textedit = new QTextEdit(QString(tr("No FitFunction Selected",0)),this);
textedit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
textedit->setReadOnly(true);
textedit->setMaximumHeight(200);
textedit->setMinimumHeight(20);
mainLayout->addWidget(textedit,1,1,1,2);
widgetVector_.push_back(textedit);
label = new QLabel(this);
label->setText(QString(tr("Fittingcolumn:",0)));
label->setFixedWidth(100);
mainLayout->addWidget(label,2,0,1,1);
widgetVector_.push_back(label);
label = new QLabel(this);
label->setText(QString(tr("Column-Value",0)));
mainLayout->addWidget(label,2,1,1,1);
widgetVector_.push_back(label);
label = new QLabel(this);
label->setText(QString(tr("MSE:",0)));
label->setFixedWidth(100);
mainLayout->addWidget(label,3,0,1,1);
widgetVector_.push_back(label);
label = new QLabel(this);
label->setText(QString(tr("MSE-Value",0)));
mainLayout->addWidget(label,3,1,1,1);
widgetVector_.push_back(label);
delete proxyModel_;
proxyModel_ = new PlotDataExtendedTableModel(NULL, std::vector<std::pair<int,std::string> >(0), this);
table_ = new ExtendedTable(this);
table_->setModel(proxyModel_);
table_->setSortingEnabled(false);
table_->verticalHeader()->hide();
table_->resizeColumnsToContents();
table_->setMinimumHeight(150);
mainLayout->addWidget(table_, 4, 0, 1, 3);
table_->setContextMenuPolicy(Qt::CustomContextMenu);
table_->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(table_,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(tableContextMenu(const QPoint&)));
QObject::connect(table_->horizontalHeader(),SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(tableContextMenu(const QPoint&)));
setLayout(mainLayout);
for (size_t i = 1; i < widgetVector_.size(); ++i) {
widgetVector_[i]->setVisible(false);
}
//show();
initialized_ = true;
}