本文整理汇总了C++中QPlainTextEdit::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QPlainTextEdit::setSizePolicy方法的具体用法?C++ QPlainTextEdit::setSizePolicy怎么用?C++ QPlainTextEdit::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPlainTextEdit
的用法示例。
在下文中一共展示了QPlainTextEdit::setSizePolicy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
// Load the Periodic Table translations
QPointer <QTranslator> ptTranslator = QPeriodicTable::createTranslator();
if (ptTranslator)
qApp->installTranslator(ptTranslator);
// Construct Periodic Table
PeriodicTableView* periodicTable = new PeriodicTableView;
periodicTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QMainWindow *window = new QMainWindow();
window->setWindowTitle("Periodic System of D.I.Mendeleyev");
QWidget *widget = new QWidget;
QHBoxLayout *layout = new QHBoxLayout(widget);
widget->setLayout(layout);
QPlainTextEdit *elementInfo = new QPlainTextEdit;
elementInfo->setReadOnly(true);
elementInfo->setPlainText("Click on element to get the information about it");
elementInfo->setMaximumHeight(periodicTable->height());
elementInfo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
layout->addWidget(periodicTable);
layout->addWidget(elementInfo);
window->setCentralWidget(widget);
PeriodicTableWatcher *watcher = new PeriodicTableWatcher(periodicTable, elementInfo);
window->show();
app.exec();
delete periodicTable;
delete elementInfo;
delete window;
return 0;
}
示例2: setWindowTitle
db_error_dialog::db_error_dialog(const QString error) : m_error_text(error)
{
setWindowTitle(tr("Database error"));
QVBoxLayout* layout = new QVBoxLayout(this);
setMinimumWidth(400); // reasonable minimum
QPlainTextEdit* label = new QPlainTextEdit;
label->setPlainText(error);
label->setReadOnly(true);
label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
label->setFrameShape(QFrame::Box);
label->setFrameShadow(QFrame::Raised);
layout->addWidget(label);
m_btn_group = new QButtonGroup(this);
QButtonGroup* g = m_btn_group;
QRadioButton* btn1 = new QRadioButton(tr("Continue"));
g->addButton(btn1, 1);
btn1->setChecked(true);
QRadioButton* btn2 = new QRadioButton(tr("Try to reconnect"));
g->addButton(btn2, 2);
QRadioButton* btn3 = new QRadioButton(tr("Quit application"));
g->addButton(btn3, 3);
layout->addWidget(btn1);
layout->addWidget(btn2);
layout->addWidget(btn3);
QPushButton* btn_OK = new QPushButton(tr("OK"));
btn_OK->setDefault(true);
QPushButton* copy_btn = new QPushButton(tr("Copy"));
QDialogButtonBox* buttonBox = new QDialogButtonBox(Qt::Horizontal);
buttonBox->addButton(copy_btn, QDialogButtonBox::ActionRole);
buttonBox->addButton(btn_OK, QDialogButtonBox::AcceptRole);
layout->addWidget(buttonBox);
connect(copy_btn, SIGNAL(clicked()), this, SLOT(copy_error()));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(this, SIGNAL(accepted()), this, SLOT(handle_error()));
}