本文整理汇总了C++中QTextEdit::setMaximumHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::setMaximumHeight方法的具体用法?C++ QTextEdit::setMaximumHeight怎么用?C++ QTextEdit::setMaximumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::setMaximumHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: QWidget
ScrollBarSettingsEditor::ScrollBarSettingsEditor(QWidget *parent)
: QWidget(parent),
ui(new Ui::ScrollBarSettingsForm),
m_verticalScrollbar(new QtMaterialScrollBar),
m_horizontalScrollbar(new QtMaterialScrollBar)
{
QVBoxLayout *layout = new QVBoxLayout;
setLayout(layout);
QWidget *widget = new QWidget;
layout->addWidget(widget);
QWidget *canvas = new QWidget;
canvas->setStyleSheet("QWidget { background: white; }");
layout->addWidget(canvas);
ui->setupUi(widget);
layout->setContentsMargins(20, 20, 20, 20);
layout = new QVBoxLayout;
canvas->setLayout(layout);
canvas->setMaximumHeight(400);
QTextEdit *edit = new QTextEdit;
edit->setText("<p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p><p>The distinction between the subjects of syntax and semantics has its origin in the study of natural languages.</p>");
edit->setLineWrapMode(QTextEdit::NoWrap);
edit->update();
edit->setMaximumHeight(200);
edit->setVerticalScrollBar(m_verticalScrollbar);
edit->setHorizontalScrollBar(m_horizontalScrollbar);
//m_verticalScrollbar->setHideOnMouseOut(false);
//m_horizontalScrollbar->setHideOnMouseOut(false);
m_horizontalScrollbar->setOrientation(Qt::Horizontal);
layout->addWidget(edit);
layout->setAlignment(edit, Qt::AlignHCenter);
setupForm();
}
示例3: 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", "" );
//.........这里部分代码省略.........
示例4: 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;
}