本文整理汇总了C++中QDialog::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::exec方法的具体用法?C++ QDialog::exec怎么用?C++ QDialog::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newScreen
void CprogManage::newScreen()
{
//QTreeWidgetItem *curItem;
//QTreeWidgetItem *parentItem;
QString QStr;
int i,size;//,type,index;
int max = 0,tmp;
if(verifyPSW() EQ 0)
return;
/*
CinputPSWDialog *pswInput = new CinputPSWDialog(this);
//pswInput->setOkButtonText(tr("确定"));
pswInput->exec();
*/
QStr = "screen";//QStr + "/" + QString(tr("area"));
settings.beginGroup(QStr);
QStringList groups = settings.childGroups(); //area列表
size = groups.size();
for(i = 0; i < size; i ++)
{
tmp = groups.at(i).toInt();
if(tmp > max)
max=tmp;
}
max++;
//初始化分区属性
settings.beginGroup(fixWidthNumber(max));
settings.setValue("screenIndex", 1);//value("screenIndex").toString()
settings.setValue("checkState", true);
settings.setValue("spaceWidth", 1);
settings.setValue("dotWidth", 2);
settings.endGroup();
settings.endGroup();
//
QTreeWidgetItem* item = new QTreeWidgetItem(treeWidget,QStringList(QString::number(size + 1)+tr("屏幕")));
item->setData(0, Qt::UserRole, QVariant(QStr + "/" + fixWidthNumber(max)));
item->setCheckState(0, Qt::Checked);
QIcon icon = getTypeIcon(SCREEN_PROPERTY);
item->setIcon(0,icon);
treeWidget->addTopLevelItem(item);
/*CMdiSubWindow * subWin =*/
_newScreen(QString::number(size + 1) + tr("屏幕"), 0, 0, DEF_SCN_WIDTH, DEF_SCN_HEIGHT,1, 2, DEF_SCN_COLOR);
w->screenArea->screenItem = item;
w->progManage->treeWidget->setCurrentItem(item);
//---------------
QString str = w->screenArea->getCurrentScreenStr(); //当前屏幕str
QDialog *facParaWin = new QDialog(this);
QHBoxLayout *hLayout = new QHBoxLayout(facParaWin);
facParaWin->setWindowTitle(tr("新建屏幕"));
CcomTest *comTest = new CcomTest(facParaWin);
CfacScreenProperty *facScreenProperty = new CfacScreenProperty(NEW_SCN, comTest, facParaWin);
//facScreenProperty->setSettingsToWidget(str);
hLayout->addWidget(facScreenProperty);
hLayout->addWidget(comTest);
facParaWin->setLayout(hLayout);
facParaWin->setAttribute(Qt::WA_DeleteOnClose);
connect(facScreenProperty->endButton, SIGNAL(clicked()), facParaWin, SLOT(close()));
facParaWin->exec();
//--------------------
//判断参数是否被加载,没有被加载则删除已经生成的窗口
settings.beginGroup(str);
settings.beginGroup("facPara");
int setFlag = settings.value("setFlag").toInt(); //是否加载设置了屏幕参数?
settings.endGroup();
settings.endGroup();
if(setFlag EQ 0) //没有加载参数则删除上面建的屏幕
{
w->progManage->_deleteItem(0); //删除上面创建的屏幕
}
//读取屏幕参数
//getScreenParaFromSettings(QStr + "/" + QString::number(max), Screen_Para);
/*
else
{
//subWin->resize(width + 8, height + 34);//setGeometry(0,0, width +8, height + 34);
subWin->setFixedSize(width + 8, height + 34);
}*/
}
示例2: ajouterInscription
void DossierEditeur::ajouterInscription()
{
try
{
QDialog* window = new QDialog(this);
QGridLayout* lay = new QGridLayout;
QPushButton* ok = new QPushButton("Ok");
QComboBox *ListeUV= new QComboBox(this);
QComboBox *ListeCursus= new QComboBox(this);
QComboBox *ListeResultat= new QComboBox(this);
QComboBox *ListeSaison= new QComboBox(this);
QLineEdit *Annee= new QLineEdit(this);
QLabel* UVLabel= new QLabel("UV : ",this);
QLabel* cursusLabel= new QLabel("Cursus : ",this);
QLabel* resultatLabel= new QLabel("Note : ",this);
QLabel* saisonLabel= new QLabel("Saison : ",this);
QLabel* anneeLabel = new QLabel("Année : ",this);
window->setFixedSize(300, 400);
UV** uvs = UVManager::getInstance().getUVs();
for(unsigned int i=0;i<UVManager::getInstance().getNbUV(); i++)
{
ListeUV->addItem(uvs[i]->getCode());
}
for(Note n = first; n <= last; n = Note(n+1))
ListeResultat->addItem(NoteToString(n));
for(int i = 0; i < FormationManager::getInstance().getTaille(); i++)
ListeCursus->addItem(FormationManager::getInstance().getElement(i).getCode());
ListeSaison->addItem("Automne");
ListeSaison->addItem("Printemps");
lay->addWidget(UVLabel,0,0);
lay->addWidget(cursusLabel,1,0);
lay->addWidget(resultatLabel,2,0);
lay->addWidget(saisonLabel,3,0);
lay->addWidget(anneeLabel,4,0);
lay->addWidget(ListeUV,0,1);
lay->addWidget(ListeCursus,1,1);
lay->addWidget(ListeResultat,2,1);
lay->addWidget(ListeSaison,3,1);
lay->addWidget(Annee,4,1);
lay->addWidget(ok,5,1,Qt::AlignHCenter);
window->setLayout(lay);
connect(ok,SIGNAL(clicked()),window,SLOT(accept()));
window->exec();
if(window->result())
{
if(Annee->text().isEmpty())
throw UTProfilerException("Ne laissez pas l'année vide !");
UV& uv = UVManager::getInstance().getUV(ListeUV->currentText());
Semestre s(StringToSaison(ListeSaison->currentText()),Annee->text().toUInt());
Dossier::getInstance().ajouterInscription(uv,StringToNote(ListeResultat->currentText()),s,ListeCursus->currentText());
QMessageBox::information(this,"Ajout d'une inscription", QString("Ajout de la catégorie ")+ListeUV->currentText()+" réussie.");
dossier->setRowCount(Dossier::getInstance().getTaille());
QTableWidgetItem *monItem = new QTableWidgetItem(ListeUV->currentText());
dossier->setItem(Dossier::getInstance().getTaille() -1,0,monItem);
monItem = new QTableWidgetItem(s.FormeContracte());
dossier->setItem(Dossier::getInstance().getTaille() -1,1,monItem);
monItem = new QTableWidgetItem(ListeResultat->currentText());
dossier->setItem(Dossier::getInstance().getTaille() -1,2,monItem);
monItem = new QTableWidgetItem(ListeCursus->currentText());
dossier->setItem(Dossier::getInstance().getTaille() -1,3,monItem);
}
}
catch(UTProfilerException& e)
{
QMessageBox::warning(this, "Ajout d'inscription", e.getInfo());
}
}
示例3: dialog
//.........这里部分代码省略.........
switch (m_Type)
{
case MTDetailEdit::DetailEditTypeNym: m_pDetailPane = new MTNymDetails(this, *this); break;
case MTDetailEdit::DetailEditTypeContact: m_pDetailPane = new MTContactDetails(this, *this); break;
case MTDetailEdit::DetailEditTypeServer: m_pDetailPane = new MTServerDetails(this, *this); break;
case MTDetailEdit::DetailEditTypeAsset: m_pDetailPane = new MTAssetDetails(this, *this); break;
case MTDetailEdit::DetailEditTypeAccount:
m_pDetailPane = new MTAccountDetails(this, *this);
// -------------------------------------------
connect(m_pDetailPane, SIGNAL(DefaultAccountChanged(QString, QString)),
m_pMoneychanger, SLOT (setDefaultAccount(QString, QString)));
// -------------------------------------------
// connect(m_pDetailPane, SIGNAL(cashBalanceChanged()),
// m_pMoneychanger, SLOT (onCashBalanceChanged()));
// // -------------------------------------------
// connect(m_pDetailPane, SIGNAL(acctBalanceChanged()),
// m_pMoneychanger, SLOT (onAcctBalanceChanged()));
// // -------------------------------------------
break;
default:
qDebug() << "MTDetailEdit::dialog: MTDetailEdit::DetailEditTypeError";
return;
}
// -------------------------------------------
m_pDetailPane->SetOwnerPointer(*this);
// -------------------------------------------
m_pDetailLayout = new QVBoxLayout;
m_pDetailLayout->addWidget(m_pDetailPane);
m_pDetailPane ->setContentsMargins(1,1,1,1);
m_pDetailLayout->setContentsMargins(1,1,1,1);
// ----------------------------------
pTab1->setLayout(m_pDetailLayout);
// ----------------------------------
int nCustomTabCount = m_pDetailPane->GetCustomTabCount();
if (nCustomTabCount > 0)
{
for (int ii = 0; ii < nCustomTabCount; ii++)
{
QWidget * pTab = m_pDetailPane->CreateCustomTab(ii);
// ----------------------------------
if (NULL != pTab)
{
pTab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
pTab->setContentsMargins(5, 5, 5, 5);
QString qstrTabName = m_pDetailPane->GetCustomTabName(ii);
m_pTabWidget->addTab(pTab, qstrTabName);
}
// ----------------------------------
}
}
// -----------------------------------------------
QGridLayout * pGridLayout = new QGridLayout;
pGridLayout->addWidget(m_pTabWidget);
pGridLayout->setContentsMargins(0,0,0,0);
m_pTabWidget->setTabPosition(QTabWidget::South);
// ----------------------------------
ui->widget->setContentsMargins(1,1,1,1);
// ----------------------------------
ui->widget->setLayout(pGridLayout);
// ----------------------------------
} // first run.
// -------------------------------------------
RefreshRecords();
// -------------------------------------------
// if (m_map.size() < 1)
// on_addButton_clicked();
// -------------------------------------------
if (bIsModal)
{
QDialog theDlg;
theDlg.setWindowTitle(this->windowTitle());
// theDlg.installEventFilter(this);
QVBoxLayout * pLayout = new QVBoxLayout;
pLayout->addWidget(this);
theDlg.setLayout(pLayout);
theDlg.setWindowFlags(Qt::Tool); // A hack so it will show the close button.
theDlg.exec();
pLayout->removeWidget(this);
}
else
{
this->installEventFilter(this);
show();
setFocus();
}
// -------------------------------------------
}
示例4: getDirectory
QString AddImagesDialog::getDirectory(const QStringList &fileNames, const QString &defaultDirectory)
{
QDialog *dialog = new QDialog(Core::ICore::dialogParent());
dialog->setMinimumWidth(480);
QString result;
QString directory = defaultDirectory;
dialog->setModal(true);
dialog->setWindowFlags(dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint);
dialog->setWindowTitle(QCoreApplication::translate("AddImageToResources","Add Resources"));
QTableWidget *table = createFilesTable(fileNames);
table->setParent(dialog);
QGridLayout *mainLayout = new QGridLayout(dialog);
mainLayout->addWidget(table, 0, 0, 1, 4);
QComboBox *directoryComboBox = createDirectoryComboBox(defaultDirectory);
auto setDirectoryForComboBox = [directoryComboBox, &directory](const QString &newDir) {
if (directoryComboBox->findText(newDir) < 0)
directoryComboBox->addItem(newDir);
directoryComboBox->setCurrentText(newDir);
directory = newDir;
};
QObject::connect(directoryComboBox, &QComboBox::currentTextChanged, dialog, [&directory](const QString &text){
directory = text;
});
QPushButton *browseButton = new QPushButton(QCoreApplication::translate("AddImageToResources", "&Browse..."), dialog);
QObject::connect(browseButton, &QPushButton::clicked, dialog, [setDirectoryForComboBox, &directory]() {
const QString newDir = QFileDialog::getExistingDirectory(Core::ICore::dialogParent(),
QCoreApplication::translate("AddImageToResources", "Target Directory"),
directory);
if (!newDir.isEmpty())
setDirectoryForComboBox(newDir);
});
mainLayout->addWidget(new QLabel(QCoreApplication::translate("AddImageToResources", "In directory:")), 1, 0);
mainLayout->addWidget(directoryComboBox, 1, 0, 1, 3);
mainLayout->addWidget(browseButton, 1, 3, 1 , 1);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel);
mainLayout->addWidget(buttonBox, 3, 2, 1, 2);
QObject::connect(buttonBox, &QDialogButtonBox::accepted, dialog, [dialog](){
dialog->accept();
dialog->deleteLater();
});
QObject::connect(buttonBox, &QDialogButtonBox::rejected, dialog, [dialog, &directory](){
dialog->reject();
dialog->deleteLater();
directory = QString();
});
QObject::connect(dialog, &QDialog::accepted, [&directory, &result](){
result = directory;
});
dialog->exec();
return result;
}
示例5: slotOpenExample
void GettingStartedWelcomePageWidget::slotOpenExample()
{
QAction *action = qobject_cast<QAction*>(sender());
if (!action)
return;
QString helpFile = action->property(HelpPathPropertyName).toString();
QString proFile = action->property(ExamplePathPropertyName).toString();
QString qmlMainFileName;
bool isQmlProject = false;
if (action->dynamicPropertyNames().contains(QmlMainFileName)) {
qmlMainFileName = action->property(QmlMainFileName).toString();
isQmlProject = true;
}
QStringList files;
QFileInfo proFileInfo(proFile);
// If the Qt is a distro Qt on Linux, it will not be writable, hence compilation will fail
if (!proFileInfo.isWritable())
{
QDialog d;
QGridLayout *lay = new QGridLayout(&d);
QLabel *descrLbl = new QLabel;
d.setWindowTitle(tr("Copy Project to writable Location?"));
descrLbl->setTextFormat(Qt::RichText);
descrLbl->setWordWrap(true);
descrLbl->setText(tr("<p>The project you are about to open is located in the "
"write-protected location:</p><blockquote>%1</blockquote>"
"<p>Please select a writable location below and click \"Copy Project and Open\" "
"to open a modifiable copy of the project or click \"Keep Project and Open\" "
"to open the project in location.</p><p><b>Note:</b> You will not "
"be able to alter or compile your project in the current location.</p>")
.arg(QDir::toNativeSeparators(proFileInfo.dir().absolutePath())));
lay->addWidget(descrLbl, 0, 0, 1, 2);
QLabel *txt = new QLabel(tr("&Location:"));
Utils::PathChooser *chooser = new Utils::PathChooser;
txt->setBuddy(chooser);
chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
QSettings *settings = Core::ICore::instance()->settings();
chooser->setPath(settings->value(
QString::fromLatin1("General/ProjectsFallbackRoot"), QDir::homePath()).toString());
lay->addWidget(txt, 1, 0);
lay->addWidget(chooser, 1, 1);
QDialogButtonBox *bb = new QDialogButtonBox;
connect(bb, SIGNAL(accepted()), &d, SLOT(accept()));
connect(bb, SIGNAL(rejected()), &d, SLOT(reject()));
QPushButton *copyBtn = bb->addButton(tr("&Copy Project and Open"), QDialogButtonBox::AcceptRole);
copyBtn->setDefault(true);
bb->addButton(tr("&Keep Project and Open"), QDialogButtonBox::RejectRole);
lay->addWidget(bb, 2, 0, 1, 2);
connect(chooser, SIGNAL(validChanged(bool)), copyBtn, SLOT(setEnabled(bool)));
if (d.exec() == QDialog::Accepted) {
QString exampleDirName = proFileInfo.dir().dirName();
QString toDir = chooser->path();
settings->setValue(QString::fromLatin1("General/ProjectsFallbackRoot"), toDir);
QDir toDirWithExamplesDir(toDir);
if (toDirWithExamplesDir.cd(exampleDirName)) {
toDirWithExamplesDir.cdUp(); // step out, just to not be in the way
QMessageBox::warning(topLevelWidget(), tr("Warning"),
tr("The specified location already exists. "
"Please specify a valid location."),
QMessageBox::Ok, QMessageBox::NoButton);
return;
} else {
QDir from = proFileInfo.dir();
from.cdUp();
copyRecursive(from, toDir, exampleDirName);
// set vars to new location
proFileInfo = QFileInfo(toDir + '/'+ exampleDirName + '/' + proFileInfo.fileName());
proFile = proFileInfo.absoluteFilePath();
}
}
}
QString tryFile;
files << proFile;
if (isQmlProject) {
tryFile = proFileInfo.path() + '/' + "/main.qml";
if(!QFile::exists(tryFile))
tryFile = proFileInfo.path() + "/qml/" + qmlMainFileName + ".qml";
// legacy qmlproject case
if(!QFile::exists(tryFile))
tryFile = proFileInfo.path() + '/' + qmlMainFileName + ".qml";
if(QFile::exists(tryFile))
files << tryFile;
} else {
tryFile = proFileInfo.path() + "/main.cpp";
if(!QFile::exists(tryFile))
tryFile = proFileInfo.path() + '/' + proFileInfo.baseName() + ".cpp";
}
Core::ICore::instance()->openFiles(files, static_cast<Core::ICore::OpenFilesFlags>(Core::ICore::SwitchMode | Core::ICore::StopOnLoadFail));
if (!tryFile.isEmpty() && Core::EditorManager::instance()->hasEditor(tryFile) && !helpFile.isEmpty())
slotOpenContextHelpPage(helpFile);
}
示例6: compareDisp
void AppWin::compareDisp()
{
QString item,cstr;
int i, pos, p1, p2, n, d, comp, idx;
bool ok, comparable;
Ui::DCompareDisp ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
// set up the data
for (i=0; i<tabWidget->count(); i++) {
item = plotWidget[i]->FName;
// only the file name is printed
item = QDir::current().relativeFilePath(item);
ui.plot1->addItem(item);
ui.plot2->addItem(item);
}
dialog->exec();
ok = dialog->result()==QDialog::Accepted;
if (ok) {
p1 = ui.plot1->currentRow();
p2 = ui.plot2->currentRow();
if (p1==p2) {
msgInfo(info_CompareSamePlots);
return;
}
comp = EDGE * ui.compEdge->isChecked() + SCREW * ui.compScrew->isChecked();
if (comp==EDGE)
cstr = QString(" (edge)");
else
cstr = QString(" (screw)");
// create a new widget
PltWin *pw = new PltWin(tabWidget);
*pw = *plotWidget[p1];
// set the plot-specific parameters
if (comp==EDGE)
pw->DispComponent = DIFF_EDGE;
else if (comp==SCREW)
pw->DispComponent = DIFF_SCREW;
pw->FName = tabWidget->tabText(p1) + " (-) " + tabWidget->tabText(p2) + cstr.toLatin1().data();
comparable = pw->CompareDisp(plotWidget[p2], comp);
if (!comparable) {
delete(pw);
msgError(err_CannotComparePlots);
return;
}
plotWidget.append(pw);
tabWidget->addTab(pw, pw->FName);
tabWidget->setCurrentIndex(tabWidget->count()-1);
tabWidget->show();
idx = tabWidget->currentIndex();
actFirstPlot->setEnabled(idx > 0);
actPrevPlot->setEnabled(idx > 0);
actNextPlot->setEnabled(idx < tabWidget->count()-1);
actLastPlot->setEnabled(idx < tabWidget->count()-1);
repaintStatusBar();
}
}
示例7: filesRenamed
void MainWindow::filesRenamed(int count, int successCount)
{
// QMessageBox *messageBox = new QMessageBox(this);
// messageBox->setWindowTitle("Visual Renamer");
// messageBox->setIconPixmap(QPixmap(":/resources/logo.png"));
// messageBox->addButton(QMessageBox::Ok);
if(count == successCount)
{
QDialog succesDialog;
QLabel *logoLabel = new QLabel(&succesDialog);
QLabel *messageLabel = new QLabel("All files have been\nrenamed successfully!", &succesDialog);
QLabel *succesLabel = new QLabel(&succesDialog);
QPushButton *okButton = new QPushButton("Ok");
succesDialog.setStyleSheet("QFrame#add_files_frame {"
"border: 3px dashed rgb(220, 220, 220);"
"border-radius: 24px"
"}"
"QPushButton {"
"background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(245, 245, 245), stop:1 rgb(214, 214, 214));"
"border: 1px solid rgb(171, 171, 171);"
"border-radius: 5px"
"}"
"QPushButton:pressed {"
"background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(214, 214, 214), stop:1 rgb(230, 230, 230));"
"}"
"QWidget {"
"font: bold 13px \"Arial\";"
"color: rgb(58, 58, 58);"
"}");
logoLabel->setPixmap(QPixmap(":/resources/logo.png"));
succesLabel->setPixmap(QPixmap(":/resources/done.png"));
messageLabel->setMargin(10);
succesLabel->setMargin(10);
okButton->setFixedSize(150, 30);
QHBoxLayout *upperLayout = new QHBoxLayout;
QVBoxLayout *mainLayout = new QVBoxLayout(&succesDialog);
upperLayout->addWidget(logoLabel);
upperLayout->addWidget(messageLabel);
upperLayout->addWidget(succesLabel);
mainLayout->addLayout(upperLayout);
mainLayout->addWidget(okButton, 0, Qt::AlignHCenter);
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
connect(okButton, SIGNAL(clicked()), &succesDialog, SLOT(accept()));
succesDialog.exec();
}
else
{
QDialog failDialog;
QLabel *logoLabel = new QLabel(&failDialog);
QLabel *successMessageLabel = new QLabel(QString("%1 of %2 files have been\nrenamed successfully!").arg(successCount).arg(count), &failDialog);
QLabel *failMessageLabel = new QLabel(QString("ERROR: %1 of %2 files\nhave not been renamed.").arg(count-successCount).arg(count), &failDialog);
QLabel *succesLabel = new QLabel(&failDialog);
QLabel *failLabel = new QLabel(&failDialog);
QPushButton *okButton = new QPushButton("Ok");
failDialog.setStyleSheet("QFrame#add_files_frame {"
"border: 3px dashed rgb(220, 220, 220);"
"border-radius: 24px"
"}"
"QPushButton {"
"background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(245, 245, 245), stop:1 rgb(214, 214, 214));"
"border: 1px solid rgb(171, 171, 171);"
"border-radius: 5px"
"}"
"QPushButton:pressed {"
"background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(214, 214, 214), stop:1 rgb(230, 230, 230));"
"}"
"QWidget {"
"font: bold 13px \"Arial\";"
"color: rgb(58, 58, 58);"
"}");
logoLabel->setPixmap(QPixmap(":/resources/logo.png"));
succesLabel->setPixmap(QPixmap(":/resources/done.png"));
failLabel->setPixmap(QPixmap(":/resources/fail.png"));
okButton->setFixedSize(150, 30);
QVBoxLayout *messagesLayout = new QVBoxLayout;
messagesLayout->addWidget(successMessageLabel);
messagesLayout->addWidget(failMessageLabel);
messagesLayout->setMargin(0);
messagesLayout->setSpacing(0);
QVBoxLayout *imagesLayout = new QVBoxLayout;
imagesLayout->addWidget(succesLabel);
imagesLayout->addWidget(failLabel);
imagesLayout->setMargin(0);
//.........这里部分代码省略.........
示例8: ManipShow
void MainWindow::ManipShow()
{
QDialog *settings;
QLabel *heightLabel, *widthLabel, *rotateLabel, *modeLabel, *methodLabel;
QPushButton *confirmButton;
QGridLayout *layout;
settings = new QDialog;
settings->setWindowTitle(tr("设置"));
settings->setWindowIcon(QIcon("://icon/settingsIcon.png"));
heightLabel = new QLabel(settings);
QPixmap heightPix("://icon/heightIcon.png");
heightLabel->setPixmap(heightPix);
widthLabel = new QLabel(settings);
QPixmap widthPix("://icon/widthIcon.png");
widthLabel->setPixmap(widthPix);
rotateLabel = new QLabel(settings);
QPixmap rotatePix("://icon/rotateIcon.png");
rotateLabel->setPixmap(rotatePix);
modeLabel = new QLabel(settings);
QPixmap modelPix("://icon/cropIcon.png");
modeLabel->setPixmap(modelPix);
methodLabel = new QLabel(settings);
QPixmap methodPix("://icon/interIcon.png");
methodLabel->setPixmap(methodPix);
heightEdit = new QLineEdit(settings);
heightEdit->setText("1");
widthEdit = new QLineEdit(settings);
widthEdit->setText("1");
rotateEdit = new QLineEdit(settings);
rotateEdit->setText("0");
modeSelect = new QComboBox(settings);
modeSelect->insertItem(0, tr("Crop"));
modeSelect->insertItem(1, tr("Loose"));
methodSelect = new QComboBox(settings);
methodSelect->insertItem(0, tr("NearestNeighbor"));
methodSelect->insertItem(1, tr("Bilinear"));
methodSelect->insertItem(2, tr("Bicubic"));
confirmButton = new QPushButton(settings);
confirmButton->setText(tr("确定"));
QObject::connect(confirmButton, SIGNAL(clicked()), this, SLOT(StartManipulate()));
layout = new QGridLayout;
layout->addWidget(heightLabel, 0, 0);
layout->addWidget(widthLabel, 1, 0);
layout->addWidget(rotateLabel, 2, 0);
layout->addWidget(modeLabel, 3, 0);
layout->addWidget(methodLabel, 4, 0);
layout->addWidget(heightEdit, 0, 1);
layout->addWidget(widthEdit, 1, 1);
layout->addWidget(rotateEdit, 2, 1);
layout->addWidget(modeSelect, 3, 1);
layout->addWidget(methodSelect, 4, 1);
layout->addWidget(confirmButton, 5, 0, 1, 2);
settings->setLayout(layout);
settings->exec();
}
示例9: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QApplication::setOrganizationName(_S("Majister"));
QApplication::setApplicationName(_S("jPos"));
qRegisterMetaType<SyncState>("SyncState");
// Имя файла логов
logFileName.clear();
// Настройки базы - SQLite
QString mainBase = _S("db.sqlite3");
QString dbDriver = _S("QSQLITE");
QString dbUser;
QString dbPass;
QString dbOptions;
QString executeModule;
QString executeParams;
QString styleFileName;
bool stylefree = false;
// Уровни лога, 1- только ошибки, 2 - основные действия, 3 - отладка каждого чиха
int loglevel = 1;
// Обнулить файл логов
bool newlog = false;
bool resetSettings = false;
bool showHelp = false;
bool saveSources = false;
QStringList args = QCoreApplication::arguments();
for (int i = 1; i < args.count(); ++i)
{
QString value = args.at(i);
if (value == _S("--logfile") && i < args.count())
{
logFileName = args.at(++i);
continue;
}
if (value == _S("--loglevel") && i < args.count())
{
loglevel = args.at(++i).toInt();
continue;
}
if (value == _S("--newlog"))
{
newlog = true;
continue;
}
if (value == _S("--driver") && i < args.count())
{
dbDriver = args.at(++i);
continue;
}
if (value == _S("--user") && i < args.count())
{
dbUser = args.at(++i);
continue;
}
if (value == _S("--password") && i < args.count())
{
dbPass = args.at(++i);
continue;
}
if (value == _S("--resetsettings"))
{
resetSettings = true;
continue;
}
if (value == _S("--stylefree"))
{
stylefree = true;
continue;
}
if (value == _S("--istyle") && i < args.count())
{
styleFileName = args.at(++i);
continue;
}
if (value == _S("--version"))
{
qDebug() << _T("jPOS версия от %1 %2").arg(BUILDDATE).arg(BUILDTIME);
return 0;
}
if (value == _S("--help"))
{
showHelp = true;
break; // all other params not matter
}
if (value == _S("--sources"))
{
saveSources = true;
//.........这里部分代码省略.........
示例10: changeAttributSommetGraphe
void Fenetre::changeAttributSommetGraphe(GrapheColore* graph)
{
vector<SommetColore*> listeSommets=graph->getListeSommets();
//Création d'une boîte de dialogue
QDialog fenDiag;
//Boutons OK et Annuler
QHBoxLayout *layoutButton=new QHBoxLayout;
QPushButton *okFenDiag=new QPushButton("&OK");
QPushButton *cancFenDiag=new QPushButton("&Annuler");
layoutButton->addWidget(okFenDiag);
layoutButton->addWidget(cancFenDiag);
connect(okFenDiag, SIGNAL(clicked()), &fenDiag, SLOT(accept()));
connect(cancFenDiag, SIGNAL(clicked()), &fenDiag, SLOT(reject()));
//Création de la liste des sommets
QComboBox *boxSommets=new QComboBox;
for (int i = 0 ; i < listeSommets.size(); i++){
boxSommets->addItem(listeSommets[i]->getNom());
}
//Ajout de tout ça à la fenêtre de dialogue
QVBoxLayout *layoutFenetre=new QVBoxLayout;
layoutFenetre->addWidget(boxSommets);
layoutFenetre->addLayout(layoutButton);
fenDiag.setLayout(layoutFenetre);
//On affiche la fenêtre
fenDiag.setVisible(true);
fenDiag.setModal(true);
//On traîte la demande
if(fenDiag.exec()){ //Si on a cliqué sur ok !
int currentIndex=boxSommets->currentIndex();
SommetColore *sommetModif=listeSommets[currentIndex];
//On demande ce qu'on veut modifier à ce sommet
QDialog fenDiag2;
//On réutilise les mêmes boutons qu'avant
disconnect(okFenDiag, SIGNAL(clicked()), &fenDiag, SLOT(accept()));
disconnect(cancFenDiag, SIGNAL(clicked()), &fenDiag, SLOT(reject()));
connect(okFenDiag, SIGNAL(clicked()), &fenDiag2, SLOT(accept()));
connect(cancFenDiag, SIGNAL(clicked()), &fenDiag2, SLOT(reject()));
QComboBox *boxOptions=new QComboBox;
QStringList options;
options<<"Modifier le nom du sommet"<<"Modifier la forme du sommet"<<"Modifier la couleur du sommet";
boxOptions->addItems(options);
QVBoxLayout *layoutFenetre2=new QVBoxLayout;
layoutFenetre->removeItem(layoutButton);
layoutFenetre2->addWidget(boxOptions);
layoutFenetre2->addLayout(layoutButton);
fenDiag2.setLayout(layoutFenetre2);
fenDiag2.setVisible(true);
fenDiag2.setModal(true);
if(fenDiag2.exec()){
switch(boxOptions->currentIndex()){
case 0 : {
modifSommetNom(sommetModif);
graph->notifyArete(sommetModif);
redessinerComboArc();
break;
} case 1 : {
modifSommetForme(sommetModif);
break;
} case 2 : {
modifSommetCouleur(sommetModif);
break;
}
}
}
}
}
示例11: filterDialog
void TopicPublisherROS::filterDialog(bool)
{
auto all_topics = RosIntrospectionFactory::get().getTopicList();
if( all_topics.empty() ) return;
QDialog* dialog = new QDialog();
dialog->setWindowTitle("Select topics to be published");
dialog->setMinimumWidth(350);
QVBoxLayout* vertical_layout = new QVBoxLayout();
QFormLayout* grid_layout = new QFormLayout();
std::map<std::string, QCheckBox*> checkbox;
QFrame* frame = new QFrame;
auto publish_sim_time = new QRadioButton("Keep original timestamp and publish [/clock]");
auto publish_real_time = new QRadioButton("Overwrite timestamp [std_msgs/Header/stamp]");
QPushButton* select_button = new QPushButton("Select all");
QPushButton* deselect_button = new QPushButton("Deselect all");
publish_sim_time->setChecked( _publish_clock );
publish_sim_time->setFocusPolicy(Qt::NoFocus);
publish_sim_time->setToolTip("Publish the topic [/clock].\n"
"You might want to set rosparam use_sim_time = true" );
publish_real_time->setChecked( !_publish_clock );
publish_real_time->setFocusPolicy(Qt::NoFocus);
publish_real_time->setToolTip("Pretend it is a new message.\n"
"The timestamp of the original message will be overwritten"
"with ros::Time::Now()");
select_button->setFocusPolicy(Qt::NoFocus);
deselect_button->setFocusPolicy(Qt::NoFocus);
for (const auto& topic: all_topics)
{
auto cb = new QCheckBox(dialog);
auto filter_it = _topics_to_publish.find( *topic );
if( filter_it == _topics_to_publish.end() )
{
cb->setChecked( true );
}
else{
cb->setChecked( filter_it->second );
}
cb->setFocusPolicy(Qt::NoFocus);
grid_layout->addRow( new QLabel( QString::fromStdString(*topic)), cb);
checkbox.insert( std::make_pair(*topic, cb) );
connect( select_button, &QPushButton::pressed, [cb](){ cb->setChecked(true);} );
connect( deselect_button, &QPushButton::pressed, [cb](){ cb->setChecked(false);} );
}
frame->setLayout(grid_layout);
QScrollArea* scrollArea = new QScrollArea;
scrollArea->setWidget(frame);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QHBoxLayout* select_buttons_layout = new QHBoxLayout;
select_buttons_layout->addWidget( select_button );
select_buttons_layout->addWidget( deselect_button );
vertical_layout->addWidget( publish_sim_time );
vertical_layout->addWidget( publish_real_time );
vertical_layout->addWidget(scrollArea);
vertical_layout->addLayout(select_buttons_layout);
vertical_layout->addWidget( buttons );
connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
dialog->setLayout(vertical_layout);
auto result = dialog->exec();
if(result == QDialog::Accepted)
{
_topics_to_publish.clear();
for(const auto& it: checkbox )
{
_topics_to_publish.insert( {it.first, it.second->isChecked() } );
}
//remove already created publisher if not needed anymore
for (auto it = _publishers.begin(); it != _publishers.end(); /* no increment */)
{
const std::string& topic_name = it->first;
if( !toPublish(topic_name) )
{
it = _publishers.erase(it);
}
else{
it++;
}
}
_publish_clock = publish_sim_time->isChecked();
if( _publish_clock )
//.........这里部分代码省略.........
示例12: 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();
}
示例13: createIMProtocolWidget
void QtIMAccountSettings::createIMProtocolWidget(QWidget* parent, QtEnumIMProtocol::IMProtocol imProtocol)
{
QDialog * imAccountTemplateWindow = new QDialog(parent);
_ui = new Ui::IMAccountTemplate();
_ui->setupUi(imAccountTemplateWindow);
switch (imProtocol) {
case QtEnumIMProtocol::IMProtocolMSN: {
_imAccountPlugin = new QtMSNSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolMYSPACE: {
_imAccountPlugin = new QtMySpaceSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolFacebook: {
_imAccountPlugin = new QtFacebookSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolTwitter: {
_imAccountPlugin = new QtTwitterSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolSkype: {
_imAccountPlugin = new QtSkypeSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolYahoo: {
_imAccountPlugin = new QtYahooSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolAIM: {
_imAccountPlugin = new QtAIMSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolICQ: {
_imAccountPlugin = new QtICQSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolJabber: {
_imAccountPlugin = new QtJabberSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolGoogleTalk: {
_imAccountPlugin = new QtGoogleTalkSettings(_userProfile, _imAccount, imAccountTemplateWindow);
break;
}
case QtEnumIMProtocol::IMProtocolVoxOx:
assert(false); //VOXOX - JRT - 2009.07.01 - if we got here, then some one changed QtEnumIMProtocol.
break;
default:
LOG_FATAL("unknown IM protocol=" + String::fromNumber(imProtocol));
}
SAFE_CONNECT_RECEIVER(_ui->saveButton, SIGNAL(clicked()), _imAccountPlugin, SLOT(checkAndSave()));
SAFE_CONNECT_RECEIVER(_ui->cancelButton, SIGNAL(clicked()), imAccountTemplateWindow, SLOT(reject()));
QWidget * imProtocolWidget = _imAccountPlugin->getWidget();
QString styleSheet("QLabel,QCheckBox{color:#343434;}");
imProtocolWidget->setStyleSheet(styleSheet);
Widget::createLayout(_ui->settingsGroupBox)->addWidget(imProtocolWidget);
_ui->settingsGroupBox->setTitle(imProtocolWidget->windowTitle());
imAccountTemplateWindow->setWindowTitle(imProtocolWidget->windowTitle());
imAccountTemplateWindow->exec();
}
示例14: actionExport_to_callback
void SvgCanvas::actionExport_to_callback()
{
QDialog dialog;
ExportToDialog export_to_dialog;
export_to_dialog.setupUi(&dialog);
QListWidget *list = export_to_dialog.formats_listWidget;
QListWidgetItem *item;
//Pixmaps formats
QList<QByteArray> formats=QImageWriter::supportedImageFormats();
for(int i=0;i<formats.size();i++)
{
QString text(formats[i]);
item=new QListWidgetItem(text,list);
item->setData(1,QVariant(PIXMAP));
}
//Vector formats
formats= QPicture::outputFormats();
for(int i=0;i<formats.size();i++)
{
QString text(formats[i]);
item=new QListWidgetItem(text,list);
item->setData(1,QVariant(PICTURE));
}
item=new QListWidgetItem("ps",list);
item->setData(1,QVariant(PRINTER));
item=new QListWidgetItem("pdf",list);
item->setData(1,QVariant(PDF));
item=new QListWidgetItem("svg",list);
item->setData(1,QVariant(SVG));
int ok=dialog.exec();
if(ok==QDialog::Rejected) return;
item =list->currentItem();
int format=item->data(1).toInt();
QPainter plot;
switch(format)
{
case PIXMAP:
{
bool ok;
int h, w = QInputDialog::getInteger(this, tr("Width"), tr("Width:"), 300, 0, 2147483647, 1, &ok);
if(!ok) return;
h=QInputDialog::getInteger(this, tr("Height"), tr("Height:"), 200, 0, 2147483647, 1, &ok);
if(!ok) return;
QString s = QFileDialog::getSaveFileName(this, "Choose a filename to save");
if(s.isEmpty()) return;
QImage image(w,h,QImage::Format_RGB32);
plot.begin(&image);
svg_plot->renderer()->render(&plot);
plot.end();
image.save(s,item->data(0).toString().toLocal8Bit().data());
}
break;
case PICTURE:
{
bool ok;
int h, w = QInputDialog::getInteger(this, tr("Width"), tr("Width:"), 300, 0, 2147483647, 1, &ok);
if(!ok) return;
h=QInputDialog::getInteger(this, tr("Height"), tr("Height:"), 200, 0, 2147483647, 1, &ok);
if(!ok) return;
QString s = QFileDialog::getSaveFileName(this, "Choose a filename to save");
if(s.isEmpty()) return;
QPicture image;
const QRect r(0,0,w,h);
image.setBoundingRect(r);
plot.begin(&image);
svg_plot->renderer()->render(&plot);
plot.end();
image.save(s,item->data(0).toString().toLocal8Bit().data());
}
break;
case PRINTER:
{
QPrinter p;
QPrintDialog printDialog(&p, this);
if (printDialog.exec() != QDialog::Accepted) return;
plot.begin(&p);
svg_plot->renderer()->render(&plot);
plot.end();
}
break;
case PDF:
{
QPrinter p;
QPrintDialog printDialog(&p, this);
p.setOutputFormat(QPrinter::PdfFormat);
if (printDialog.exec() != QDialog::Accepted) return;
plot.begin(&p);
svg_plot->renderer()->render(&plot);
plot.end();
}
break;
case SVG:
{
//.........这里部分代码省略.........
示例15: openStreams
bool Port::openStreams(QString fileName, bool append, QString &error)
{
bool ret = false;
QDialog *optDialog;
QProgressDialog progress("Opening Streams", "Cancel", 0, 0, mainWindow);
OstProto::StreamConfigList streams;
AbstractFileFormat *fmt = AbstractFileFormat::fileFormatFromFile(fileName);
if (fmt == NULL)
goto _fail;
if ((optDialog = fmt->openOptionsDialog()))
{
int ret;
optDialog->setParent(mainWindow, Qt::Dialog);
ret = optDialog->exec();
optDialog->setParent(0, Qt::Dialog);
if (ret == QDialog::Rejected)
goto _user_opt_cancel;
}
progress.setAutoReset(false);
progress.setAutoClose(false);
progress.setMinimumDuration(0);
progress.show();
mainWindow->setDisabled(true);
progress.setEnabled(true); // to override the mainWindow disable
connect(fmt, SIGNAL(status(QString)),&progress,SLOT(setLabelText(QString)));
connect(fmt, SIGNAL(target(int)), &progress, SLOT(setMaximum(int)));
connect(fmt, SIGNAL(progress(int)), &progress, SLOT(setValue(int)));
connect(&progress, SIGNAL(canceled()), fmt, SLOT(cancel()));
fmt->openStreamsOffline(fileName, streams, error);
qDebug("after open offline");
while (!fmt->isFinished())
qApp->processEvents();
qDebug("wait over for offline operation");
if (!fmt->result())
goto _fail;
// process any remaining events posted from the thread
for (int i = 0; i < 10; i++)
qApp->processEvents();
if (!append)
{
int n = numStreams();
progress.setLabelText("Deleting existing streams...");
progress.setRange(0, n);
for (int i = 0; i < n; i++)
{
if (progress.wasCanceled())
goto _user_cancel;
deleteStreamAt(0);
progress.setValue(i);
if (i % 32 == 0)
qApp->processEvents();
}
}
progress.setLabelText("Constructing new streams...");
progress.setRange(0, streams.stream_size());
for (int i = 0; i < streams.stream_size(); i++)
{
if (progress.wasCanceled())
goto _user_cancel;
newStreamAt(mStreams.size(), &streams.stream(i));
progress.setValue(i);
if (i % 32 == 0)
qApp->processEvents();
}
_user_cancel:
emit streamListChanged(mPortGroupId, mPortId);
_user_opt_cancel:
ret = true;
_fail:
progress.close();
mainWindow->setEnabled(true);
recalculateAverageRates();
return ret;
}