Esempio n. 1
0
PrimeDialog::PrimeDialog(QWidget* parent) :
    QDialog(parent) {

    QPalette pe;
    pe.setColor(QPalette::WindowText,Qt::blue);
    QLabel* remindLabel = new QLabel;
    remindLabel->setText(QString(tr("请给定一个大数")));
    QLabel* primeLabel = new QLabel(tr("大数:"));
    primeLabel->setPalette(pe);
    primeEdit = new QLineEdit;
    showLabel = new QLabel;

    QGridLayout* gridLayout = new QGridLayout;
    gridLayout->addWidget(remindLabel,  0, 0, 1, 4);
    gridLayout->addWidget(primeLabel,   1, 0, 1, 1, Qt::AlignLeft);
    gridLayout->addWidget(primeEdit,    1, 1, 1, 3);
    gridLayout->addWidget(showLabel,    2, 0, 1, 4);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    buttonBox->button(QDialogButtonBox::Ok)->setText(CALCULATE);
    buttonBox->button(QDialogButtonBox::Cancel)->setText(CANCEL);
    buttonBox->setCenterButtons(true);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QVBoxLayout* dlgLayout = new QVBoxLayout;
    dlgLayout->setMargin(10);
    dlgLayout->addLayout(gridLayout);
    dlgLayout->addStretch(40);
    dlgLayout->addWidget(buttonBox);
    this->setLayout(dlgLayout);
    this->setFixedSize(300,200);
    this->setWindowTitle(PRIME_TEST);
}
Esempio n. 2
0
void AboutDialog::displayFile(const QString &fileName, const QString &title)
{
    QDialog *dialog = new QDialog(this);
    QLayout *layout = new QVBoxLayout(dialog);
    QTextEdit *textEdit = new QTextEdit(dialog);
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, dialog);

    textEdit->setStyleSheet(QLatin1String("font-family: monospace"));

    QFile file(fileName);
    if (file.open(QIODevice::ReadOnly)) {
        QString text = QTextStream(&file).readAll();
        textEdit->setPlainText(text);
    }

    textEdit->setReadOnly(true);
    connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(close()));
    buttonBox->setCenterButtons(true);
    layout->addWidget(textEdit);
    layout->addWidget(buttonBox);
    layout->setMargin(6);

    dialog->setLayout(layout);
    dialog->setWindowTitle(title);
    dialog->setWindowFlags(Qt::Sheet);
    dialog->resize(600, 350);
    dialog->exec();
}
Esempio n. 3
0
void MainWindow::showAboutDialog()
{
    QDialog dlg(0, Qt::Dialog);
    QVBoxLayout* layout = new QVBoxLayout();
    QLabel* text = new QLabel(
        "<table align=\"center\"><tr>"
        "<td><img source=\":/bigIcon.png\" align=\"center\"/></td>"
        "<td><h1 align=\"center\">Iceberg</h1><p align=\"center\">Version " ICEBERG_VERSION "</p></td>"
        "</tr></table>"
        "<p>Distributed under GPLv2, source code available at <a href=\"http://www.github.com/hugopl/Iceberg\">GitHub</a>!</p>"
        "<p>Copyright (c) 2003 Frerich Raabe &lt;[email protected]><br>"
        "Copyright (c) 2003,2004 Stephan Kulow &lt;[email protected]><br>"
        "Copyright (c) 2003,2004 Cornelius Schumacher &lt;[email protected]><br>"
        "Copyright (c) 2011, 2012 Hugo Parente Lima &lt;[email protected]><br>"
        "Copyright (c) 2011, 2012 Anselmo L. S. Melo &lt;[email protected]><br>"
        "Copyright (c) 2011, 2012 Luis Gabriel Lima &lt;[email protected]><br>"
        "Copyright (c) 2011, 2012 Luciano Miguel Wolf &lt;[email protected]></p>");
    text->setOpenExternalLinks(true);
    layout->addWidget(text);
    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal);
    buttonBox->setCenterButtons(true);
    layout->addWidget(buttonBox);
    connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), &dlg, SLOT(close()));
    dlg.setLayout(layout);
    dlg.exec();
}
Esempio n. 4
0
void CDialogChooseData::buildDialog()
{
  QVBoxLayout* v1 = new QVBoxLayout();
  QGridLayout* g1 = new QGridLayout();

  QLabel* l1 = new QLabel(tr("Select the data flow from the current list"));
  QLabel* filter = new QLabel(tr("filter"));
  QLineEdit* edit = new QLineEdit();
  connect(edit, SIGNAL(textChanged(QString)), this, SLOT(changeRegExp(QString)));
  QPushButton* button = new QPushButton(QIcon(":/create.png"), tr("Add..."));
  connect(button, SIGNAL(pressed()), this, SLOT(onClickAddButton()));
  
  m_table = new QTableView();
  buildTableWidget(m_table);
  connect(m_table,SIGNAL(doubleClicked(QModelIndex)), this, SLOT(applyModification()));
  
  QDialogButtonBox* dlgButton = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal);
  dlgButton->setCenterButtons(false);
  
  connect(dlgButton, SIGNAL(accepted()), this, SLOT(applyModification()));
  connect(dlgButton, SIGNAL(rejected()), this, SLOT(reject()));
  
  v1->addWidget(l1);
  g1->addWidget(filter, 0, 0);
  g1->addWidget(edit, 0, 1);
  g1->addWidget(button, 0, 2);
  v1->addLayout(g1);
  v1->addWidget(m_table);
  v1->addWidget(dlgButton);
 
  setLayout(v1);
}
SectorExportOptionsDialog::SectorExportOptionsDialog(QWidget *parent) : QDialog(parent)
{
    QGridLayout *layout = new QGridLayout(this);
    layout->setMargin(12);
    QLabel *l = new QLabel("Export shortest paths only",this);
    l->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    QLabel *l1 = new QLabel("Consider paths with garden planets only",this);
    l1->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    this->setWindowTitle("Export sector options");
    this->chkDirectRoutesOnly = new QCheckBox(this);
    this->chkGardenRoutesOnly = new QCheckBox(this);

    l->setMargin(6);
    l1->setMargin(6);
    this->chkDirectRoutesOnly->setChecked(true);
    this->chkGardenRoutesOnly->setChecked(false);

    layout->addWidget(l,0,0);
    layout->addWidget(this->chkDirectRoutesOnly,0,1);
    layout->addWidget(l1,1,0);
    layout->addWidget(this->chkGardenRoutesOnly,1,1);

    QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    bb->setCenterButtons(true);
    connect(bb,&QDialogButtonBox::accepted,this, &QDialog::accept);
    connect(bb,&QDialogButtonBox::rejected,this, &QDialog::reject);
    layout->addWidget(bb,2,0,1,2);

}
Esempio n. 6
0
/*!
    Constructs an UiSelectSignalDialog with the given \a parent.
*/
UiSelectSignalDialog::UiSelectSignalDialog(QWidget *parent) :
    QDialog(parent),
    mDigitalSignalsMap(),
    mAnalogSignalsMap()
{
    mAnalyzersBox = NULL;

    setWindowTitle(tr("Add Signal or Analyzer"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    // Deallocation:
    //   formLayout will be re-parented when calling verticalLayout->addLayout
    //   which means that it will be deleted when UiSimulatorConfigDialog is
    //   deleted.
    QFormLayout* formLayout = new QFormLayout;
    formLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);

    CaptureDevice* device = DeviceManager::instance().activeDevice()
            ->captureDevice();

    // digital signals
    QList<int> s = device->unusedDigitalIds();
    if (s.size() > 0) {
        formLayout->addRow(tr("Digital signals: "), createDigitalSignalBox(s));
    }


    // analog signals
    s = device->unusedAnalogIds();
    if (s.size() > 0) {
        formLayout->addRow(tr("Analog signals: "), createAnalogSignalBox(s));
    }

    // analyzers
    mAnalyzersBox = createAnalyzerBox();
    formLayout->addRow(tr("Analyzers: "), mAnalyzersBox);

    // Deallocation:
    //   Ownership is transfered to UiSelectSignalDialog when calling
    //   setLayout below.
    QVBoxLayout* verticalLayout = new QVBoxLayout();

    // Deallocation: "Qt Object trees" (See UiMainWindow)
    QDialogButtonBox* bottonBox = new QDialogButtonBox(
                QDialogButtonBox::Ok|QDialogButtonBox::Cancel,
                Qt::Horizontal,
                this);
    bottonBox->setCenterButtons(true);

    connect(bottonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(bottonBox, SIGNAL(rejected()), this, SLOT(reject()));

    verticalLayout->addLayout(formLayout);
    verticalLayout->addWidget(bottonBox);


    setLayout(verticalLayout);
}
Esempio n. 7
0
ScoresDialog::ScoresDialog(QWidget* parent)
: QDialog(parent), m_row(-1) {
	setWindowTitle(tr("High Scores"));

	// Load default name
	m_default_name = QSettings().value("Scores/DefaultName").toString();
	if (m_default_name.isEmpty()) {
#if defined(Q_OS_UNIX)
		passwd* pws = getpwuid(geteuid());
		if (pws) {
			m_default_name = pws->pw_gecos;
			if (m_default_name.isEmpty()) {
				m_default_name = pws->pw_name;
			}
		}
#elif defined(Q_OS_WIN32)
		WCHAR buffer[UNLEN + 1];
		DWORD count = sizeof(buffer);
		if (GetUserName(buffer, &count)) {
			m_default_name = QString::fromStdWString(buffer);
		}
#endif
	}

	// Create score widgets
	m_scores_layout = new QGridLayout;
	m_scores_layout->setSpacing(12);
	m_scores_layout->setColumnStretch(1, 1);
	m_scores_layout->addWidget(new QLabel(tr("<b>Name</b>"), this), 0, 1, Qt::AlignCenter);
	m_scores_layout->addWidget(new QLabel(tr("<b>Score</b>"), this), 0, 2, Qt::AlignCenter);
	m_scores_layout->addWidget(new QLabel(tr("<b>Date</b>"), this), 0, 3, Qt::AlignCenter);
	m_scores_layout->addWidget(new QLabel(tr("<b>Timer</b>"), this), 0, 4, Qt::AlignCenter);

	Qt::Alignment alignments[4] = { Qt::AlignLeft, Qt::AlignRight, Qt::AlignRight, Qt::AlignHCenter };
	for (int r = 0; r < 10; ++r) {
		m_score_labels[r][0] = new QLabel(tr("#%1").arg(r + 1), this);
		m_scores_layout->addWidget(m_score_labels[r][0], r + 1, 0, Qt::AlignRight | Qt::AlignVCenter);
		for (int c = 1; c < 5; ++c) {
			m_score_labels[r][c] = new QLabel("-", this);
			m_scores_layout->addWidget(m_score_labels[r][c], r + 1, c, alignments[c - 1] | Qt::AlignVCenter);
		}
	}

	load();

	m_username = new QLineEdit(this);
	m_username->hide();
	connect(m_username, SIGNAL(editingFinished()), this, SLOT(editingFinished()));

	// Lay out dialog
	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this);
	buttons->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons));
	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));

	QVBoxLayout* layout = new QVBoxLayout(this);
	layout->addLayout(m_scores_layout);
	layout->addWidget(buttons);
}
QDialogButtonBox* PreferencesDialog::createButtonBox()
{
	QDialogButtonBox* buttonBox = new QDialogButtonBox(Qt::Horizontal);
	buttonBox->setCenterButtons(true);

	QPushButton* okButton = buttonBox->addButton("OK", QDialogButtonBox::AcceptRole);
	QPushButton* cancelButton = buttonBox->addButton("Cancel", QDialogButtonBox::RejectRole);
	connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
	okButton->setMinimumSize(72, 28);
	cancelButton->setMinimumSize(72, 28);

	return buttonBox;
}
Esempio n. 9
0
FilterDialog::FilterDialog(QHash<int, QString> captions, QWidget *parent, Qt::WindowFlags f)
	:QDialog(parent, f), m_captions(captions)
{
	model = new QStandardItemModel(this);
	model->setColumnCount(ColumnCount);

	filterView = new QTableView(this);
	filterView->setModel(model);
	filterView->setItemDelegate(new FilterDelegate(m_captions, filterView));

	actionAdd = new QAction(this);
	actionAdd->setIcon(QIcon(":share/images/add.png"));
	connect(actionAdd, SIGNAL(triggered()), this, SLOT(add()));

	addButton = new QToolButton(this);
	addButton->setDefaultAction(actionAdd);
	addButton->setAutoRaise(true);

	actionRemove = new QAction(this);
	actionRemove->setIcon(QIcon(":share/images/remove.png"));
	connect(actionRemove, SIGNAL(triggered()), this, SLOT(remove()));

	removeButton = new QToolButton(this);
	removeButton->setDefaultAction(actionRemove);
	removeButton->setAutoRaise(true);

	QHBoxLayout *buttonsLayout = new QHBoxLayout();
	buttonsLayout->addWidget(addButton);
	buttonsLayout->addWidget(removeButton);
	buttonsLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Preferred));

	QVBoxLayout *viewLayout = new QVBoxLayout();
	viewLayout->addLayout(buttonsLayout);
	viewLayout->addWidget(filterView);

	QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
													 Qt::Horizontal,
													 this);
	buttons->setCenterButtons(true);
	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));

	QVBoxLayout *mainLayout = new QVBoxLayout();
	mainLayout->addLayout(viewLayout);
	mainLayout->addWidget(buttons);
	setLayout(mainLayout);

	loadSettings();
	retranslateStrings();
}
Esempio n. 10
0
ChooseFileDlg::ChooseFileDlg(QWidget *parent)
	: QDialog(parent)
{
	new QVBoxLayout(this);

	QPushButton *upload = new QPushButton(tr("Choose file to upload..."), this);
	connect(upload, SIGNAL(clicked(bool)), this, SLOT(onFileSelect(bool)));
	layout()->addWidget(upload);

	QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
	buttons->setCenterButtons(true);
	connect(buttons, &QDialogButtonBox::accepted, this, [this]() {
		done(QDialog::Accepted);
	});
	connect(buttons, &QDialogButtonBox::rejected, this, [this]() {
		done(QDialog::Rejected);
	});
	layout()->addWidget(buttons);
}
// --------------------------------------------------------------------------
void voAnalysisParameterEditorWidgetPrivate::init()
{
  Q_Q(voAnalysisParameterEditorWidget);

  q->setWindowTitle("Run analysis - Parameters");

  QVBoxLayout * verticalLayout = new QVBoxLayout();
  verticalLayout->setMargin(0);
  q->setLayout(verticalLayout);

  // Editor
  this->AnalysisParameterEditor = new QtTreePropertyBrowser(q);
  this->AnalysisParameterEditor->setPropertiesWithoutValueMarked(true);
  this->AnalysisParameterEditor->setRootIsDecorated(true);
  this->AnalysisParameterEditor->setHeaderVisible(false);

  verticalLayout->addWidget(this->AnalysisParameterEditor);

  // ButtonBox
  QDialogButtonBox * dialogButton =
      new QDialogButtonBox(QDialogButtonBox::Reset | QDialogButtonBox::Ok | QDialogButtonBox::Apply);
  dialogButton->setCenterButtons(true);
  verticalLayout->addWidget(dialogButton);

  this->ApplyButton = dialogButton->button(QDialogButtonBox::Apply);
  this->ResetButton = dialogButton->button(QDialogButtonBox::Reset);
  this->OkButton = dialogButton->button(QDialogButtonBox::Ok);
  this->ApplyButton->setText("Update");
  this->OkButton->setText("Clone");

  QObject::connect(this->ApplyButton, SIGNAL(clicked()), q, SLOT(updateAnalysis()));
  QObject::connect(this->ResetButton, SIGNAL(clicked()), q, SLOT(reset()));
  QObject::connect(this->OkButton, SIGNAL(clicked()), q, SLOT(cloneAnalysis()));

  this->setButtonsEnabled(false);
}