本文整理汇总了C++中QLayout::setSizeConstraint方法的典型用法代码示例。如果您正苦于以下问题:C++ QLayout::setSizeConstraint方法的具体用法?C++ QLayout::setSizeConstraint怎么用?C++ QLayout::setSizeConstraint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLayout
的用法示例。
在下文中一共展示了QLayout::setSizeConstraint方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
valveDialog::valveDialog(unit *theValve, bool first, QWidget *parent) :
QDialog(parent),
ui(new Ui::valveDialog)
{
ui->setupUi(this);
setWindowTitle("Define the valve");
myUnit = theValve;
if(myUnit->idunit == 62)//throttle
ui->thermoBox->hide();
else if(myUnit->idunit == 63)//thermo
ui->throttleBox->hide();
if(myUnit->idunit==63)
{
if(spnumber>3)
{
for(int i =0;i<spnumber;i++)
{
if(i!=myUnit->myNodes[0]->ndum-1&&i!=myUnit->myNodes[1]->ndum-1&&i!=myUnit->myNodes[2]->ndum-1)
ui->sensorBox->insertItem(0,QString::number(i+1));
}
}
else
ui->sensorBox->insertItem(0,"N/A");
}
if(!first)
{
ui->coefLine->setText(QString::number(myUnit->ht,'g',4));
ui->lawLine->setText(QString::number(myUnit->devl,'g',4));
if(myUnit->idunit==63)
{
ui->temperatureLine->setText(QString::number(myUnit->devg,'g',4));
ui->temperatureUnitLine->setText(globalpara.unitname_temperature);
int foundIndex = 0;
for(int i = 0; i < ui->sensorBox->count();i++)
{
if(int(myUnit->devl)==ui->sensorBox->itemText(i).toInt())
foundIndex = i;
}
ui->sensorBox->setCurrentIndex(foundIndex);
}
}
QLayout *mainLayout = layout();
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
QRegExp regExp("[-.0-9]+$");
QRegExpValidator *regExpValidator = new QRegExpValidator(regExp,this);
ui->coefLine->setValidator(regExpValidator);
ui->lawLine->setValidator(regExpValidator);
ui->temperatureLine->setValidator(regExpValidator);
}
示例2: MainArea
MainWindow::MainWindow()
{
m_main = new MainArea();
QGraphicsView* view = new QGraphicsView(m_main, this);
view->setOptimizationFlags( QGraphicsView::DontClipPainter |
QGraphicsView::DontSavePainterState |
QGraphicsView::DontAdjustForAntialiasing );
// view->setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
view->setCacheMode( QGraphicsView::CacheBackground );
view->setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
view->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
setCentralWidget(view);
setupActions();
#ifndef Q_OS_QNX
QLayout* l = layout();
Q_ASSERT(l);
l->setSizeConstraint(QLayout::SetFixedSize);
// setup status bar
KStatusBar* bar = statusBar();
Q_ASSERT(bar);
m_time_label = new QLabel("");
bar->addPermanentWidget(m_time_label);
m_balls_label = new QLabel("");
bar->addWidget(m_balls_label);
// bar->setItemAlignment(STATUSBAR_BALLS, Qt::AlignLeft);
#endif
connect(m_main, SIGNAL(changeGameTime(int)), this, SLOT(setGameTime(int)));
connect(m_main, SIGNAL(changeBallNumber(int)), this, SLOT(setBallNumber(int)));
connect(m_main, SIGNAL(changeState(bool)), this, SLOT(changeState(bool)));
connect(m_main, SIGNAL(pause(bool)), this, SLOT(pause(bool)));
#ifndef Q_OS_QNX
stateChanged("playing", KXMLGUIClient::StateReverse);
#endif
connect(m_main, SIGNAL(starting()), this, SLOT(newGame()));
connect(m_main, SIGNAL(gameOver(int)), this, SLOT(gameOver(int)));
#ifndef Q_OS_QNX
KGameDifficulty::init(this, this, SLOT(difficultyChanged(KGameDifficulty::standardLevel)));
KGameDifficulty::setRestartOnChange(KGameDifficulty::RestartOnChange);
KGameDifficulty::addStandardLevel(KGameDifficulty::Easy);
KGameDifficulty::addStandardLevel(KGameDifficulty::Medium);
KGameDifficulty::addStandardLevel(KGameDifficulty::Hard);
KGameDifficulty::setLevel(KGameDifficulty::standardLevel(KollisionConfig::gameDifficulty()));
#endif
#ifdef Q_OS_QNX
//setMinimumSize(m_main->sceneRect().size().toSize());
#endif
}
示例3: setup
void WWidgetGroup::setup(QDomNode node, const SkinContext& context) {
setContentsMargins(0, 0, 0, 0);
// Set background pixmap if available
if (context.hasNode(node, "BackPath")) {
setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")));
}
QLayout* pLayout = NULL;
if (context.hasNode(node, "Layout")) {
QString layout = context.selectString(node, "Layout");
if (layout == "vertical") {
pLayout = new QVBoxLayout();
pLayout->setSpacing(0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->setAlignment(Qt::AlignCenter);
} else if (layout == "horizontal") {
pLayout = new QHBoxLayout();
pLayout->setSpacing(0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->setAlignment(Qt::AlignCenter);
}
}
if (pLayout && context.hasNode(node, "SizeConstraint")) {
QMap<QString, QLayout::SizeConstraint> constraints;
constraints["SetDefaultConstraint"] = QLayout::SetDefaultConstraint;
constraints["SetFixedSize"] = QLayout::SetFixedSize;
constraints["SetMinimumSize"] = QLayout::SetMinimumSize;
constraints["SetMaximumSize"] = QLayout::SetMaximumSize;
constraints["SetMinAndMaxSize"] = QLayout::SetMinAndMaxSize;
constraints["SetNoConstraint"] = QLayout::SetNoConstraint;
QString sizeConstraintStr = context.selectString(node, "SizeConstraint");
if (constraints.contains(sizeConstraintStr)) {
pLayout->setSizeConstraint(constraints[sizeConstraintStr]);
} else {
qDebug() << "Could not parse SizeConstraint:" << sizeConstraintStr;
}
}
if (pLayout) {
setLayout(pLayout);
}
}
示例4: QDialog
tableSelectParaDialog::tableSelectParaDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::tableSelectParaDialog)
{
ui->setupUi(this);
setWindowFlags(Qt::Tool);
setWindowModality(Qt::ApplicationModal);
setWindowTitle("Setup new table");
inputModel = new QStringListModel;
outputModel = new QStringListModel;
ui->inputList->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->outputList->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->runssb->setValue(10);
QLayout *mainLayout = layout();
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
}
示例5: regExp
altervDialog::altervDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::altervDialog)
{
ui->setupUi(this);
ui->enterValueGB->setDisabled(true);
ui->firstRowSB->setValue(1);
ui->lastRowSB->setValue(alvRowCount);
ui->enterValueCB->setChecked(true);
ui->firstValueLE->setText(QString::number(0));
ui->lastValueLE->setText(QString::number(0));
QRegExp regExp("[-.0-9]+$");
QRegExpValidator *regExpValidator = new QRegExpValidator(regExp,this);
ui->firstValueLE->setValidator(regExpValidator);
ui->lastValueLE->setValidator(regExpValidator);
setWindowFlags(Qt::Tool);
QLayout *mainLayout = layout();
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
}
示例6: regExp
editUnitDialog::editUnitDialog(unit* myUnit, QWidget *parent):
QDialog(parent),ui(new Ui::editUnitDialog)
{
ui->setupUi(this);
tempUnit = myUnit;
setWindowFlags(Qt::Tool);
setWindowModality(Qt::ApplicationModal);
setWindowTitle("Component Parameters");
QString label;
label.append("Please define parameters for component #");
label.append(QString::number(tempUnit->nu));
label.append(" ,a ");
label.append(tempUnit->unitName);
if(tempUnit->idunit==31||tempUnit->idunit==32||tempUnit->idunit==33)
ui->DevBox->hide();
ui->titleLabel->setText(label);
ui->methodValueUnit->setText("");
ui->HTBox->setStyleSheet("QGroupBox{ background-color:rgb(144, 202, 119); border: 1px solid black; }");
ui->PinchBox->setStyleSheet("QGroupBox{ background-color:rgb(129, 198, 221); border: 1px solid black; }");
ui->DevBox->setStyleSheet("QGroupBox{ background-color:rgb(233, 182, 77); border: 1px solid black; }");
ui->COPBox->setStyleSheet("QGroupBox{ background-color:rgb(228, 135, 67); border: 1px solid black; }");
ui->mergeBox->setStyleSheet("QGroupBox{ background-color:rgb(255, 102, 102); border: 1px solid black; }");
QLayout *mainLayout = layout();
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
switch(tempUnit->iht)
{
case(0):
{
ui->HeatSpecifiedButton->setChecked(true);
ui->methodValueUnit->setText(globalpara.unitname_heatquantity);
break;
}case(1):
{
ui->UAButton->setChecked(true);
ui->methodValueUnit->setText(globalpara.unitname_UAvalue);
break;
}case(2):
{
ui->NTUButton->setChecked(true);
ui->methodValueUnit->setText("");
break;
}case(3):
{
ui->EFFButton->setChecked(true);
ui->methodValueUnit->setText("");
break;
}case(4):
{
ui->CATButton->setChecked(true);
ui->methodValueUnit->setText(globalpara.unitname_temperature);
break;
}case(5):
{
ui->LMTDButton->setChecked(true);
ui->methodValueUnit->setText(globalpara.unitname_temperature);
break;
}case(6):
{
ui->skipMethodButton->setChecked(true);
break;
}
}
ui->htLineEdit->setText(QString::number(tempUnit->ht,'g',4));
switch(tempUnit->ipinch)
{
case(-1):
{
ui->ColdEndButton->setChecked(true);
break;
}case(1):
{
ui->HotEndButton->setChecked(true);
break;
}case(0):
{
ui->progDecideButton->setChecked(true);
break;
}
}
ui->devlLineEdit->setText(QString::number(tempUnit->devl));
ui->devgLineEdit->setText(QString::number(tempUnit->devg));
switch(tempUnit->icop)
{
case(-1):
{
ui->DenominatorButton->setChecked(true);
break;
}case(1):
{
ui->NumeratorButton->setChecked(true);
break;
//.........这里部分代码省略.........
示例7: p
KSSH::KSSH(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
QLayout *lay;
lay = layout();
if (lay)
lay->setSizeConstraint(QLayout::SetFixedSize);
opt = false;
mopt = false;
editorF->hide();
QSize s = size();
QPoint p(s.width(), s.height());
QPoint po = pos();
QDesktopWidget *d = QApplication::desktop();
int w = d->width(); // returns desktop width
int h = d->height (); // returns desktop height
int x = 0, y = 0;
if ((p + po).x()>w)
po.setX(x = w-p.x());
if ((p + po).y()>h)
po.setY(y = h-p.y());
if (x<0)
po.setX(0);
if (y<0)
po.setY(0);
move(po);
optionsGB->hide();
moreF->hide();
adjustSize();
compUser = new KCompletion();
userCB->setCompletionObject(compUser);
compHost = new KCompletion();
hostCB->setCompletionObject(compHost);
hostCB->setFocus();
connect(hostCB, SIGNAL(editTextChanged(const QString&)), this, SLOT(userFor(const QString&)));
connect(compHost, SIGNAL(match(const QString&)), this, SLOT(userFor(const QString&)));
userCB->insertItem(1, "");
hostCB->insertItem(2, "");
loadHosts();
loadOptions("DefaultConfig");
connect(aboutPB, SIGNAL(clicked()), this, SLOT(about()));
connect(optionsPB, SIGNAL(clicked()), this, SLOT(options()));
connect(morePB, SIGNAL(clicked()), this, SLOT(moreOptions()));
connect(hostTB, SIGNAL(clicked()), this, SLOT(hostEditor()));
connect(userTB, SIGNAL(clicked()), this, SLOT(userEditor()));
connect(cancelPB, SIGNAL(clicked()), this, SLOT(cancelEditor()));
connect(okPB, SIGNAL(clicked()), this, SLOT(okEditor()));
connect(connectPB, SIGNAL(clicked()), this, SLOT(ssh()));
connect(savePB, SIGNAL(clicked()), this, SLOT(saveAsDefault()));
connect(quitPB, SIGNAL(clicked()), this, SLOT(exitHandler()));
KConfigGroup general_group = KGlobal::config()->group("General");
int fi = hostCB->findText(general_group.readEntry("LastHost"));
if (fi)
hostCB->setCurrentIndex(fi);
int def = KGlobalSettings::completionMode();
int mode = general_group.readEntry("HostCompletionMode", def);
hostCB->setCompletionMode((KGlobalSettings::Completion) mode);
mode = general_group.readEntry("UserCompletionMode", def);
userCB->setCompletionMode((KGlobalSettings::Completion)mode);
setWindowIcon(KIcon("kssh.png"));
}