本文整理汇总了C++中QDialog::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::size方法的具体用法?C++ QDialog::size怎么用?C++ QDialog::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveState
//-----------------------------------------------------------------------------
void ctkSettings::saveState(const QDialog& dialog, const QString& key)
{
this->beginGroup(key);
this->setValue("Position", dialog.pos());
this->setValue("Size", dialog.size());
this->endGroup();
}
示例2: display
void CGraphicBuildingTile::display(QList<QString> _toDisplay)
{
QDialog* infoDialog = new QDialog;//(dynamic_cast<QWidget*>(this->parent()));
QVBoxLayout* newLayout = new QVBoxLayout();
int q=0;
QScrollArea* scrolArea = new QScrollArea(dynamic_cast<QWidget*>(this->parent()));
for(int i=0;i<_toDisplay.count();i++)
{ QLabel* newLabel = new QLabel(_toDisplay.at(i));
newLabel->setFixedWidth(280);
newLabel->setMinimumHeight(22);
newLabel->setStyleSheet("border: 1px solid black");
newLayout->addWidget(newLabel);
q++;
}
QPalette pal;
pal.setColor(QPalette::Background,QColor(230,200,167));
infoDialog->setFixedWidth(330);
infoDialog->setMinimumHeight(30+22*q);
infoDialog->setLayout(newLayout);
infoDialog->setAutoFillBackground(true);
infoDialog->setPalette(pal);
infoDialog->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog);
scrolArea->setWidget(infoDialog);
scrolArea->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog);
scrolArea->setMaximumHeight(infoDialog->size().height()+2);
scrolArea->setWindowTitle(QString("Info about"));
scrolArea->show();
}
示例3: performAction
QUndoCommand* PropertiesExtension::performAction(QAction *action,
GLWidget *widget)
{
QUndoCommand *undo = 0;
PropertiesModel *model;
PropertiesView *view;
QDialog *dialog = new QDialog(qobject_cast<QWidget *>(parent()));
QVBoxLayout *layout = new QVBoxLayout(dialog);
dialog->setLayout(layout);
// Don't show whitespace around the PropertiesView
layout->setSpacing(0);
layout->setContentsMargins(0,0,0,0);
int i = action->data().toInt();
switch (i) {
case AtomPropIndex: // atom properties
// model will be deleted in PropertiesView::hideEvent using deleteLater().
model = new PropertiesModel(PropertiesModel::AtomType);
model->setMolecule(m_molecule);
// view will delete itself in PropertiesView::hideEvent using deleteLater().
view = new PropertiesView(PropertiesView::AtomType, dialog);
connect(m_molecule, SIGNAL( atomAdded(Atom*) ),
model, SLOT( atomAdded(Atom*) ));
connect(m_molecule, SIGNAL( atomRemoved(Atom*) ),
model, SLOT( atomRemoved(Atom*) ));
break;
case BondPropIndex: // bond properties
// model will be deleted in PropertiesView::hideEvent using deleteLater().
model = new PropertiesModel(PropertiesModel::BondType);
model->setMolecule( m_molecule );
// view will delete itself in PropertiesView::hideEvent using deleteLater().
view = new PropertiesView(PropertiesView::BondType, widget);
connect(m_molecule, SIGNAL( bondAdded(Bond*) ),
model, SLOT( bondAdded(Bond*) ));
connect(m_molecule, SIGNAL( bondRemoved(Bond*) ),
model, SLOT( bondRemoved(Bond*) ));
break;
case AnglePropIndex: // angle properties
// model will be deleted in PropertiesView::hideEvent using deleteLater().
model = new PropertiesModel(PropertiesModel::AngleType);
model->setMolecule( m_molecule );
// view will delete itself in PropertiesView::hideEvent using deleteLater().
view = new PropertiesView(PropertiesView::AngleType, widget);
break;
case TorsionPropIndex: // torsion properties
// model will be deleted in PropertiesView::hideEvent using deleteLater().
model = new PropertiesModel(PropertiesModel::TorsionType);
model->setMolecule( m_molecule );
// view will delete itself in PropertiesView::hideEvent using deleteLater().
view = new PropertiesView(PropertiesView::TorsionType, widget);
break;
/*case CartesianIndex: // cartesian editor
// m_angleModel will be deleted in PropertiesView::hideEvent using deleteLater().
model = new PropertiesModel(PropertiesModel::CartesianType);
model->setMolecule( m_molecule );
// m_view will delete itself in PropertiesView::hideEvent using deleteLater().
view = new PropertiesView(PropertiesView::CartesianType, widget);
connect(m_molecule, SIGNAL(atomAdded(Atom*)), model, SLOT( atomAdded(Atom*)));
connect(m_molecule, SIGNAL(atomRemoved(Atom*)), model, SLOT(atomRemoved(Atom*)));
break;*/
case ConformerIndex: // conformers
// model will be deleted in PropertiesView::hideEvent using deleteLater().
model = new PropertiesModel(PropertiesModel::ConformerType, dialog);
model->setMolecule( m_molecule );
// view will delete itself in PropertiesView::hideEvent using deleteLater().
view = new PropertiesView(PropertiesView::ConformerType, dialog);
break;
default:
delete dialog;
layout = 0; // deleted as a child of the dialog
return 0;
}
connect(m_molecule, SIGNAL(moleculeChanged()), model, SLOT(moleculeChanged()));
connect(m_molecule, SIGNAL( updated() ), model, SLOT( updateTable() ));
QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(model);
proxyModel->setDynamicSortFilter(true);
proxyModel->setSortLocaleAware(true);
// this role will received direct floating-point numbers from the model
proxyModel->setSortRole(Qt::UserRole);
view->setMolecule( m_molecule );
view->setWidget( widget );
view->setModel( proxyModel );
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->resizeColumnsToContents();
layout->addWidget(view);
dialog->setWindowTitle(view->windowTitle());
QSize dialogSize = dialog->size();
double width = view->horizontalHeader()->length()+view->verticalHeader()->width()+5;
if (model->rowCount() < 10) { // no scrollbar
dialogSize.setHeight(view->horizontalHeader()->height()+model->rowCount()*30+5);
dialogSize.setWidth(width);
} else { // scrollbar is needed
dialogSize.setHeight(width/1.618);
dialogSize.setWidth(width+view->verticalScrollBar()->width());
}
dialog->resize(dialogSize);
//.........这里部分代码省略.........