本文整理汇总了C++中QDialog::setSizeGripEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::setSizeGripEnabled方法的具体用法?C++ QDialog::setSizeGripEnabled怎么用?C++ QDialog::setSizeGripEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::setSizeGripEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLabel
void tst_QLayout::task193350_sizeGrip()
{
QDialog dialog;
dialog.setSizeGripEnabled(true);
QVBoxLayout* layout = new QVBoxLayout(&dialog);
layout->setAutoAdd(true);
new QLabel("Label", &dialog);
dialog.show();
QCOMPARE(layout->indexOf(qFindChild<QSizeGrip *>(&dialog)),-1);
}
示例2: setSizeGripEnabled
void NWidgetPrototype::setSizeGripEnabled(bool enabled)
{
QDialog *dialog = qscriptvalue_cast<QDialog *>(thisObject());
if (dialog)
dialog->setSizeGripEnabled(enabled);
}
示例3: glCreateShaderObjectARB
bool
ShaderFactory::loadShader(GLhandleARB &progObj,
QString shaderString)
{
GLhandleARB fragObj = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
glAttachObjectARB(progObj, fragObj);
GLhandleARB vertObj = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
glAttachObjectARB(progObj, vertObj);
{ // vertObj
QString qstr;
qstr = "varying vec3 pointpos;\n";
qstr += "void main(void)\n";
qstr += "{\n";
qstr += " // Transform vertex position into homogenous clip-space.\n";
qstr += " gl_FrontColor = gl_Color;\n";
qstr += " gl_BackColor = gl_Color;\n";
qstr += " gl_Position = ftransform();\n";
qstr += " gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;\n";
qstr += " gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;\n";
qstr += " gl_TexCoord[2] = gl_TextureMatrix[2] * gl_MultiTexCoord2;\n";
qstr += " gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n";
qstr += " pointpos = gl_Vertex.xyz;\n";
qstr += "}\n";
int len = qstr.length();
char *tbuffer = new char[len+1];
sprintf(tbuffer, qstr.toLatin1().data());
const char *sstr = tbuffer;
glShaderSourceARB(vertObj, 1, &sstr, NULL);
delete [] tbuffer;
GLint compiled = -1;
glCompileShaderARB(vertObj);
glGetObjectParameterivARB(vertObj,
GL_OBJECT_COMPILE_STATUS_ARB,
&compiled);
if (!compiled)
{
GLcharARB str[1000];
GLsizei len;
glGetInfoLogARB(vertObj,
(GLsizei) 1000,
&len,
str);
QMessageBox::information(0,
"Error : Vertex Shader",
str);
return false;
}
}
{ // fragObj
int len = shaderString.length();
char *tbuffer = new char[len+1];
sprintf(tbuffer, shaderString.toLatin1().data());
const char *sstr = tbuffer;
glShaderSourceARB(fragObj, 1, &sstr, NULL);
delete [] tbuffer;
GLint compiled = -1;
glCompileShaderARB(fragObj);
glGetObjectParameterivARB(fragObj,
GL_OBJECT_COMPILE_STATUS_ARB,
&compiled);
if (!compiled)
{
GLcharARB str[1000];
GLsizei len;
glGetInfoLogARB(fragObj,
(GLsizei) 1000,
&len,
str);
//-----------------------------------
// display error
//qApp->beep();
QString estr;
QStringList slist = shaderString.split("\n");
for(int i=0; i<slist.count(); i++)
estr += QString("%1 : %2\n").arg(i+1).arg(slist[i]);
QTextEdit *tedit = new QTextEdit();
tedit->insertPlainText("-------------Error----------------\n\n");
tedit->insertPlainText(str);
tedit->insertPlainText("\n-----------Shader---------------\n\n");
tedit->insertPlainText(estr);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(tedit);
QDialog *showError = new QDialog();
showError->setWindowTitle("Error in Fragment Shader");
showError->setSizeGripEnabled(true);
showError->setModal(true);
//.........这里部分代码省略.........
示例4: Compare
void ImageComparator::Compare( QString const&filepath, QImage const &img )
{
QSettings sett(SettingsValues::filename(),QSettings::IniFormat);
sett.beginGroup(SettingsValues::comparatorGroupName());
QString goldenPath = sett.value(SettingsValues::goldenPathValueName(), SettingsValues::goldenPathDefault()).toString() + "/";
QString diffPath = sett.value(SettingsValues::diffPathValueName(), SettingsValues::diffPathDefault()).toString() + "/";
sett.endGroup();
QFileInfo info(filepath);
QString const samplePath = goldenPath + info.fileName();
if(!QFile::exists(samplePath))
{
QMessageBox::critical(NULL, "Error!", QString("Golden image \"%1\" does not exist!").arg(samplePath));
return;
}
QImage sample(samplePath);
sample = sample.convertToFormat(QImage::Format_ARGB32_Premultiplied);
if(sample.isNull())
{
QMessageBox::critical(NULL, "Error!", QString("Could not open file \"%1\"!").arg(samplePath));
return;
}
if(sample.size() != img.size())
{
QMessageBox::critical(NULL, "Error!", QString("Sample and current images have different sizes!"));
return;
}
unsigned long long accum = 0;
int sx = sample.width();
int sy = sample.height();
int bpl = sample.bytesPerLine();
QImage diffImg(sample.size(), QImage::Format_ARGB32);
for (int y = 0; y < sy; ++y) {
for (int x = 0; x < sx; ++x)
{
for (int c = 0; c < 3; ++c)
{
unsigned idx = y * bpl + (x << 2) + c;
uchar diff = abs((int)sample.constBits()[idx] - (int)img.constBits()[idx]);
diffImg.bits()[idx] = diff;
accum += diff;
}
diffImg.bits()[y * bpl + (x << 2) + 3] = sample.bits()[y * bpl + (x << 2) + 3];
}
}
QString const diffName = diffPath + info.fileName();
QDir diffDir(diffPath);
if(!diffDir.exists(diffPath))
{
if(!QDir(diffPath + "/..").mkpath(diffDir.dirName()))
{
QMessageBox::critical(NULL, "Error!", QString("Could not create diff folder \"%1\"!").arg(diffPath));
return;
}
}
if(!diffImg.save(diffName, info.suffix().toAscii().data()))
{
QMessageBox::critical(NULL, "Error!", QString("Could not save the difference image \"%1\"!").arg(diffName));
return;
}
double diff = ((double)accum / (img.size().width() * img.size().height() * 3) * 100.0 / 255.0);
QDialog dlg;
Ui::ImgDifferenceDialog ui;
ui.setupUi(&dlg);
dlg.setModal(true);
dlg.setSizeGripEnabled(false);
dlg.layout()->setSizeConstraint( QLayout::SetFixedSize );
ui.label->setText(QString("The difference is: %1").arg(diff, 0, 'f', 2));
QPixmap pxmp = QPixmap::fromImage(diffImg);
QRect r = ui.frame->frameRect();
if(r.width() < pxmp.width())
pxmp = pxmp.scaledToWidth(r.width(), Qt::SmoothTransformation);
if(r.height() < pxmp.height())
pxmp = pxmp.scaledToHeight(r.height(), Qt::SmoothTransformation);
//ui.differenceLabel->resize(pxmp.size());
ui.differenceLabel->setPixmap(pxmp);
dlg.exec();
}
示例5: preferencesDialog
void ActionZone::preferencesDialog() {
QSettings settings("otter", "dict");
QDialog * dialog = new QDialog();
QPushButton * okButton = new QPushButton("OK", dialog);
connect(okButton, SIGNAL(clicked()), dialog, SLOT(accept()));
QPushButton * cancelButton = new QPushButton("Cancel", dialog);
connect(cancelButton, SIGNAL(clicked()), dialog, SLOT(reject()));
QBoxLayout * buttonLayout = new QHBoxLayout();
buttonLayout->addWidget(okButton);
buttonLayout->addWidget(cancelButton);
QLabel * dictionaryCountLabel = new QLabel("Number of dictionaries", dialog);
QComboBox * dictionaryCountCombo = new QComboBox(dialog);
dictionaryCountCombo->addItem("1");
dictionaryCountCombo->addItem("2");
dictionaryCountCombo->addItem("3");
dictionaryCountCombo->addItem("4");
dictionaryCountCombo->addItem("5");
dictionaryCountCombo->setCurrentIndex(resultViewers_.size() - 1);
QLabel * pluginDirectoryLabel = new QLabel("Directory with plugins", dialog);
QLineEdit * pluginDirectory = new QLineEdit(dialog);
{
QString directories;
settings.beginGroup("application");
int size = settings.beginReadArray("plugindirectory");
for (int i = 0; i < size; i++) {
settings.setArrayIndex(i);
QString dir = settings.value("directory").toString();
if (dir.isEmpty()) {
continue;
}
directories += dir + ":";
}
pluginDirectory->setText(directories);
settings.endArray();
settings.endGroup();
}
QLabel * reloadInfoLabel = new QLabel(
"OtterDict needs to be restarted to apply the changes.", dialog);
reloadInfoLabel->setWordWrap(true);
reloadInfoLabel->setFrameShape(QFrame::StyledPanel);
QGridLayout * preferencesLayout = new QGridLayout(dialog);
preferencesLayout->setSizeConstraint(QLayout::SetFixedSize);
preferencesLayout->addWidget(dictionaryCountLabel, 0, 0, Qt::AlignRight);
preferencesLayout->addWidget(dictionaryCountCombo, 0, 1, Qt::AlignLeft);
preferencesLayout->addWidget(pluginDirectoryLabel, 1, 0, Qt::AlignRight);
preferencesLayout->addWidget(pluginDirectory, 1, 1, Qt::AlignLeft);
preferencesLayout->addWidget(reloadInfoLabel, 2, 0, 1, 2, Qt::AlignHCenter);
preferencesLayout->addLayout(buttonLayout, 3, 0, 1, 2, Qt::AlignHCenter);
dialog->setSizeGripEnabled(false);
dialog->setWindowTitle("OtterDict preferences");
QDialog::DialogCode retCode = (QDialog::DialogCode)dialog->exec();
if (retCode == QDialog::Rejected) {
return;
}
int dictionaryCount = dictionaryCountCombo->currentIndex() + 1;
settings.setValue("mainwindow/dictionarycount", dictionaryCount);
// Write the application settings.
settings.beginGroup("application");
// Write the plugin directories.
{
settings.beginWriteArray("plugindirectory");
QStringList dirs = pluginDirectory->text().split(":", QString::SkipEmptyParts);
QStringList::iterator e = dirs.end();
int idx;
QStringList::iterator i;
for (idx = 0, i = dirs.begin(); i != e; ++i, idx++) {
settings.setArrayIndex(idx);
settings.setValue("directory", *i);
}
settings.endArray();
}
settings.endGroup();
}