コード例 #1
0
void ClangDiagnosticConfigsSelectionWidget::connectToClangDiagnosticConfigsDialog(QPushButton *button)
{
    connect(button, &QPushButton::clicked, [this]() {
        ClangDiagnosticConfigsWidget *widget = new ClangDiagnosticConfigsWidget(currentConfigId());
        widget->layout()->setMargin(0);
        QDialog dialog;
        dialog.setWindowTitle(ClangDiagnosticConfigsWidget::tr("Diagnostic Configurations"));
        dialog.setLayout(new QVBoxLayout);
        dialog.layout()->addWidget(widget);
        auto *buttonsBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
        dialog.layout()->addWidget(buttonsBox);
        connect(buttonsBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
        connect(buttonsBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);

        const bool previousEnableLowerClazyLevels = codeModelSettings()->enableLowerClazyLevels();
        connect(&dialog, &QDialog::accepted, [widget, previousEnableLowerClazyLevels]() {
            QSharedPointer<CppCodeModelSettings> settings = codeModelSettings();
            const ClangDiagnosticConfigs oldDiagnosticConfigs
                    = settings->clangCustomDiagnosticConfigs();
            const ClangDiagnosticConfigs currentDiagnosticConfigs = widget->customConfigs();
            if (oldDiagnosticConfigs != currentDiagnosticConfigs
                 || previousEnableLowerClazyLevels != codeModelSettings()->enableLowerClazyLevels()) {
                const ClangDiagnosticConfigsModel configsModel(currentDiagnosticConfigs);
                if (!configsModel.hasConfigWithId(settings->clangDiagnosticConfigId()))
                    settings->resetClangDiagnosticConfigId();
                settings->setClangCustomDiagnosticConfigs(currentDiagnosticConfigs);
                settings->toSettings(Core::ICore::settings());
            }
        });
        dialog.exec();
    });
}
コード例 #2
0
ファイル: userfilters.cpp プロジェクト: ForNeVeR/leechcraft
	void UserFilters::on_Paste__released ()
	{
		auto edit = new QPlainTextEdit ();

		QDialog dia (this);
		dia.setWindowTitle (tr ("Paste rules"));
		dia.resize (600, 400);
		dia.setLayout (new QVBoxLayout ());
		dia.layout ()->addWidget (new QLabel (tr ("Paste your custom rules here:")));
		dia.layout ()->addWidget (edit);
		auto box = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
		dia.layout ()->addWidget (box);
		connect (box,
				SIGNAL (accepted ()),
				&dia,
				SLOT (accept ()));
		connect (box,
				SIGNAL (rejected ()),
				&dia,
				SLOT (reject ()));

		if (dia.exec () != QDialog::Accepted)
			return;

		AddMulti (Model_, edit->toPlainText ());
	}
コード例 #3
0
	void OpenSettingsDialog (Util::XmlSettingsDialog *xsd, const QString& name)
	{
		QDialog dia;
		dia.setWindowTitle (name);

		dia.setLayout (new QVBoxLayout ());
		dia.layout ()->addWidget (xsd);

		auto box = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
		QObject::connect (box,
				SIGNAL (accepted ()),
				&dia,
				SLOT (accept ()));
		QObject::connect (box,
				SIGNAL (rejected ()),
				&dia,
				SLOT (reject ()));
		QObject::connect (box,
				SIGNAL (accepted ()),
				xsd,
				SLOT (accept ()));
		QObject::connect (box,
				SIGNAL (rejected ()),
				xsd,
				SLOT (reject ()));
		dia.layout ()->addWidget (box);

		dia.exec ();
		xsd->setParent (0);
	}
コード例 #4
0
void QgsPropertyOverrideButton::showAssistant()
{
  //first step - try to convert any existing expression to a transformer if one doesn't
  //already exist
  if ( !mProperty.transformer() )
  {
    ( void )mProperty.convertToTransformer();
  }

  QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
  QgsPropertyAssistantWidget *widget = new QgsPropertyAssistantWidget( panel, mDefinition, mProperty, mVectorLayer );
  widget->registerExpressionContextGenerator( mExpressionContextGenerator );
  widget->setSymbol( mSymbol ); // we only show legend preview in dialog version

  if ( panel && panel->dockMode() )
  {
    connect( widget, &QgsPropertyAssistantWidget::widgetChanged, this, [this, widget]
    {
      widget->updateProperty( this->mProperty );
      mExpressionString = this->mProperty.asExpression();
      mFieldName = this->mProperty.field();
      updateSiblingWidgets( isActive() );
      this->emit changed();
    } );

    connect( widget, &QgsPropertyAssistantWidget::panelAccepted, this, [ = ] { updateGui(); } );

    panel->openPanel( widget );
    return;
  }
  else
  {
    // Show the dialog version if not in a panel
    QDialog *dlg = new QDialog( this );
    QString key = QStringLiteral( "/UI/paneldialog/%1" ).arg( widget->panelTitle() );
    QgsSettings settings;
    dlg->restoreGeometry( settings.value( key ).toByteArray() );
    dlg->setWindowTitle( widget->panelTitle() );
    dlg->setLayout( new QVBoxLayout() );
    dlg->layout()->addWidget( widget );
    QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
    connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
    connect( buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject );
    connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsPropertyOverrideButton::showHelp );
    dlg->layout()->addWidget( buttonBox );

    if ( dlg->exec() == QDialog::Accepted )
    {
      widget->updateProperty( mProperty );
      mExpressionString = mProperty.asExpression();
      mFieldName = mProperty.field();
      widget->acceptPanel();
      updateSiblingWidgets( isActive() );
      updateGui();

      emit changed();
    }
    settings.setValue( key, dlg->saveGeometry() );
  }
}
コード例 #5
0
ファイル: main.cpp プロジェクト: jesper/ilineedit
int main(int argc, char *argv[])
{
  QApplication app(argc, argv);
  
  QDialog *dia = new QDialog;
  dia->setLayout(new QBoxLayout(QBoxLayout::TopToBottom, dia));

  dia->layout()->addWidget(new iLineEdit("First Name", dia));
  dia->layout()->addWidget(new iLineEdit("Last Name", dia));
  dia->layout()->addWidget(new QPushButton("Profit!", dia));
  
  dia->show();
  
  return app.exec();
}
コード例 #6
0
void QgsGeometryCheckerResultTab::showCheckMessages()
{
  if ( !mChecker->getMessages().isEmpty() )
  {
    QDialog dialog;
    dialog.setLayout( new QVBoxLayout() );
    dialog.layout()->addWidget( new QLabel( tr( "The following checks reported errors:" ) ) );
    dialog.layout()->addWidget( new QPlainTextEdit( mChecker->getMessages().join( "\n" ) ) );
    QDialogButtonBox* bbox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal );
    dialog.layout()->addWidget( bbox );
    connect( bbox, SIGNAL( accepted() ), &dialog, SLOT( accept() ) );
    connect( bbox, SIGNAL( rejected() ), &dialog, SLOT( reject() ) );
    dialog.setWindowTitle( tr( "Check errors occurred" ) );
    dialog.exec();
  }
}
コード例 #7
0
    void addView()
    {
        // the new View we want to add:
        osgViewer::View* view = new osgViewer::View();

        // a widget to hold our view:
        QWidget* viewWidget = new osgEarth::QtGui::ViewWidget(view);

        // a dialog to hold the view widget:
        QDialog* win = new QDialog(this);
        win->setModal( false );
        win->setLayout( new QHBoxLayout() );
        win->layout()->addWidget( viewWidget );
        int x = osgEarth::Random().next( 1024 );
        int y = osgEarth::Random().next( 768 );
        win->setGeometry( x, y, 640, 480 );
        win->show();

        // set up the view
        view->setCameraManipulator( new osgEarth::Util::EarthManipulator );
        view->setSceneData( _scene.get() );  
        view->getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);

        // add it to the composite viewer.
        _viewer.addView( view );
    }
コード例 #8
0
void QgsGeometryCheckerResultTab::finalize()
{
  ui.tableWidgetErrors->setSortingEnabled( true );
  if ( !mChecker->getMessages().isEmpty() )
  {
    QDialog dialog;
    dialog.setLayout( new QVBoxLayout() );
    dialog.layout()->addWidget( new QLabel( tr( "The following checks reported errors:" ) ) );
    dialog.layout()->addWidget( new QPlainTextEdit( mChecker->getMessages().join( QStringLiteral( "\n" ) ) ) );
    QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal );
    dialog.layout()->addWidget( bbox );
    connect( bbox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept );
    connect( bbox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject );
    dialog.setWindowTitle( tr( "Check Errors Occurred" ) );
    dialog.exec();
  }
}
コード例 #9
0
void AboutDialog::largeLogo(){
	QDialog * d = new QDialog(0);
	d->setAttribute(Qt::WA_DeleteOnClose);
	d->setLayout(new QHBoxLayout(d));
	QLabel *l = new QLabel(d);
	l->setPixmap(QPixmap(":/images/splash_large.png"));
	d->layout()->addWidget(l);
	d->setWindowTitle("TeXstudio");
	d->exec();
}
コード例 #10
0
ファイル: UtmpWebView.cpp プロジェクト: 2life/BrowserCore
void UtmpWebView::SetFrameWindow(int flag)
{
    switch(flag)
    {
        case 0:
            this->close();
            break;
        case 1:
            this->showMinimized();
            break;
        case 2:
        {
            //全局也就只能有一个
            QDialog* d = new QDialog(this,(Qt::WindowMinimizeButtonHint|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint));
            d->setAttribute(Qt::WA_DeleteOnClose, true);
            QWebInspector* wi = new QWebInspector(d);
            wi->setPage(this->page());
            d->setLayout(new QVBoxLayout());
            d->layout()->setMargin(0);
            d->layout()->addWidget(wi);
            d->show();
            d->resize(600,350);
            break;
        }
        case 3:
        {
            QMessageBox::StandardButton rb = QMessageBox::information(NULL, "from QT", "这是网页让QT弹出的对话框", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
            if(rb == QMessageBox::Yes)
            {
                //这样直接调用,执行速度异常慢
                //this->page()->mainFrame()->evaluateJavaScript("Ext.Msg.alert('from ext','这是QT让网页弹出的对话框');");
                this->page()->mainFrame()->evaluateJavaScript("testFun();");
            }
            break;
        }
        case 4:
        {
            this->reload();
        }
    }
}
コード例 #11
0
void ctkCmdLineModuleExplorerShowXmlAction::run()
{
  QDialog* dialog = new QDialog();
  try
  {
    dialog->setWindowTitle(this->ModuleRef.description().title());
  }
  catch (const ctkCmdLineModuleXmlException&)
  {
    dialog->setWindowTitle(this->ModuleRef.location().toString());
  }

  dialog->setLayout(new QVBoxLayout());

  QHBoxLayout* buttonLayout = new QHBoxLayout();
  buttonLayout->addStretch(1);
  QPushButton* closeButton = new QPushButton(tr("Close"), dialog);
  buttonLayout->addWidget(closeButton);

  QTextEdit* textEdit = new QTextEdit(dialog);
  textEdit->setPlainText(this->ModuleRef.rawXmlDescription().data());

  QLabel* statusLabel = new QLabel(dialog);
  statusLabel->setWordWrap(true);
  if (this->ModuleRef.xmlValidationErrorString().isEmpty())
  {
    statusLabel->setText(tr("No validation errors."));
  }
  else
  {
    statusLabel->setText(this->ModuleRef.xmlValidationErrorString());
  }
  dialog->layout()->addWidget(statusLabel);
  dialog->layout()->addWidget(textEdit);
  dialog->layout()->addItem(buttonLayout);

  connect(closeButton, SIGNAL(clicked()), dialog, SLOT(close()));

  dialog->resize(800, 600);
  dialog->show();
}
コード例 #12
0
ファイル: util.cpp プロジェクト: AlexWMF/leechcraft
	bool RunFormDialog (QWidget *widget)
	{
		QDialog *dialog (new QDialog ());
		dialog->setWindowTitle (widget->windowTitle ());
		dialog->setLayout (new QVBoxLayout ());
		dialog->layout ()->addWidget (widget);
		QDialogButtonBox *box = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
		dialog->layout ()->addWidget (box);
		QObject::connect (box,
				SIGNAL (accepted ()),
				dialog,
				SLOT (accept ()));
		QObject::connect (box,
				SIGNAL (rejected ()),
				dialog,
				SLOT (reject ()));

		const bool result = dialog->exec () == QDialog::Accepted;
		dialog->deleteLater ();
		return result;
	}
コード例 #13
0
QString CustomExecutableRunConfiguration::executable() const
{
    QString exec;
    if (QDir::isRelativePath(m_executable)) {
        Environment env = project()->environment(project()->activeBuildConfiguration());
        exec = env.searchInPath(m_executable);
    } else {
        exec = m_executable;
    }

    if (!QFileInfo(exec).exists()) {
        // Oh the executable doesn't exists, ask the user.
        QWidget *confWidget = const_cast<CustomExecutableRunConfiguration *>(this)->configurationWidget();
        QDialog dialog;
        dialog.setLayout(new QVBoxLayout());
        dialog.layout()->addWidget(new QLabel("Could not find the executable, please specify one."));
        dialog.layout()->addWidget(confWidget);
        QDialogButtonBox *dbb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
        connect(dbb, SIGNAL(accepted()), &dialog, SLOT(accept()));
        connect(dbb, SIGNAL(rejected()), &dialog, SLOT(reject()));
        dialog.layout()->addWidget(dbb);

        QString oldExecutable = m_executable;
        QString oldWorkingDirectory = m_workingDirectory;
        QStringList oldCmdArguments = m_cmdArguments;
        
        if (dialog.exec()) {
            return executable();
        } else {
            CustomExecutableRunConfiguration *that = const_cast<CustomExecutableRunConfiguration *>(this);
            that->m_executable = oldExecutable;
            that->m_workingDirectory = oldWorkingDirectory;
            that->m_cmdArguments = oldCmdArguments;
            emit that->changed();
            return QString::null;
        }
    }
    return exec;
}
コード例 #14
0
QDialog *PrincipalFormPlugin::dialogFromWidget(QWidget* w)
{
    closeEater *ce = new closeEater;
    w->installEventFilter( ce );

    QDialog *d = new QDialog;
    d->setLayout( new QHBoxLayout );
    d->layout()->addWidget( w );

    QObject::connect( ce,SIGNAL(close()),d,SLOT(close()) );
    QObject::connect( d,SIGNAL(destroyed()),w,SLOT(deleteLater()) );
    QObject::connect( w,SIGNAL(destroyed()),ce,SLOT(deleteLater()) );
    return d;
}
コード例 #15
0
ファイル: vobjectwidget.cpp プロジェクト: gilgil1973/vdream90
bool VOptionable::optionDoAll(QWidget* parent)
{
  QDialog* dialog = this->optionCreateDlg(parent);
  this->optionAddWidget(dialog->layout());
  bool res = this->optionShowDlg(dialog);
  if (res)
  {
    this->optionSaveDlg(dialog);
  }
  //
  // do not delete dialog.
  // dialog is automatically deleted when parent is delete.
  //
  // delete dialog;
  return res;
}
コード例 #16
0
ファイル: mainwindow.cpp プロジェクト: api-dev/BAS
void MainWindow::ShowDatabase()
{
    if(!_DatabaseAdmin)
    {
        _DatabaseAdmin = new DatabaseAdmin();
        _DatabaseAdmin->SetDatabaseConnector(_DataBaseConnector);
    }


    QDialog d;
    QHBoxLayout *l = new QHBoxLayout(&d);
    l->setMargin(0);
    d.setLayout(l);
    d.resize(_DatabaseAdmin->width(),_DatabaseAdmin->height());
    d.layout()->addWidget(_DatabaseAdmin);

    _DatabaseAdmin->Show();
    d.exec();
    _DatabaseAdmin->setParent(0);
    if(Ask)
        Ask->show();

}
コード例 #17
0
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();

}