本文整理汇总了C++中QDialog::setMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::setMinimumWidth方法的具体用法?C++ QDialog::setMinimumWidth怎么用?C++ QDialog::setMinimumWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::setMinimumWidth方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configureWithGUI
void TagValueConfigurableSplitter::configureWithGUI()
{
QDialog* dialog = new QDialog(qApp->activeWindow());
dialog->setWindowTitle(QString("Configure"));
QVBoxLayout* mainLayout = new QVBoxLayout();
dialog->setLayout(mainLayout);
dialog->setMinimumWidth(500);
// Create tag selectors
::fwDicomIOFilterQt::widget::QTagSelectorWidget* tagSelector =
new ::fwDicomIOFilterQt::widget::QTagSelectorWidget();
tagSelector->setTagValue(m_tag);
mainLayout->addWidget(tagSelector);
// Create buttons
QDialogButtonBox* buttonBox = new QDialogButtonBox(dialog);
mainLayout->addWidget(buttonBox);
QPushButton* okButton = buttonBox->addButton(QDialogButtonBox::Ok);
QPushButton* cancelButton = buttonBox->addButton(QDialogButtonBox::Cancel);
QObject::connect(okButton, SIGNAL(clicked(void)), dialog, SLOT(accept(void)));
QObject::connect(cancelButton, SIGNAL(clicked(void)), dialog, SLOT(reject(void)));
int result = dialog->exec();
if(result == QDialog::Accepted)
{
m_tag = tagSelector->getTag();
}
}
示例2: main
int main( int argc, char** argv ) {
QApplication app( argc, argv );
QDialog startDialog;
startDialog.setMinimumWidth( 200 );
startDialog.show();
return app.exec();
}
示例3: operator
void MeanSquaredErrorOp::operator()(const imagein::Image* image, const std::map<const imagein::Image*, std::string>& imgList) {
QDialog* dialog = new QDialog();
dialog->setWindowTitle(qApp->translate("Operations", "Compare to..."));
dialog->setMinimumWidth(180);
QFormLayout* layout = new QFormLayout();
dialog->setLayout(layout);
QString currentImgName = QString(imgList.find(image)->second.c_str());
ImageListBox* imageBox = new ImageListBox(dialog, image, imgList);
layout->insertRow(0, qApp->translate("Operations", "Compare %1 to : ").arg(currentImgName), imageBox);
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, dialog);
layout->insertRow(1, buttonBox);
QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
if(code!=QDialog::Accepted) {
return;
}
const Image* sndImg = imageBox->currentImage();
unsigned int maxWidth = min(image->getWidth(), sndImg->getWidth());
unsigned int maxHeight = min(image->getHeight(), sndImg->getHeight());
unsigned int maxChannel = min(image->getNbChannels(), sndImg->getNbChannels());
double mse = 0, me = 0;
for(unsigned int c = 0; c < maxChannel; ++c) {
for(unsigned int j = 0; j < maxHeight; ++j) {
for(unsigned int i = 0; i < maxWidth; ++i) {
int deviation = image->getPixel(i, j, c) - sndImg->getPixel(i, j, c);
mse += deviation*deviation;
me += abs(deviation);
}
}
}
mse = mse / static_cast<double>(maxChannel * maxWidth * maxHeight);
me = me / static_cast<double>(maxChannel * maxWidth * maxHeight);
QString text = qApp->translate("MeanSquareErrorOp", "Mean squarred error : %1 (mean error : %2)");
text = text.arg(mse, 0, 'f', 2);
text = text.arg(me, 0, 'f', 2);
this->outText(text.toStdString());
outText("-------------------------------------------");
}
示例4: operator
void PlugOperation::operator()(const genericinterface::ImageWindow* currentWnd, const std::vector<const genericinterface::ImageWindow*>& imgWndList) {
if(this->needCurrentImg()) {
if(_doubleCurrentImg) {
const DoubleImageWindow* diw = dynamic_cast<const DoubleImageWindow*>(currentWnd);
if(diw ==NULL) return;
*_currentDblImg = *diw->getImage();
}
else {
const StandardImageWindow* siw = dynamic_cast<const StandardImageWindow*>(currentWnd);
if(siw == NULL) return;
*_currentStdImg = *siw->getImage();
}
}
if(_inputs.size()>0) {
QDialog* dialog = new QDialog();
dialog->setWindowTitle(qApp->translate("PlugOperation", "Parameters"));
dialog->setMinimumWidth(160);
QVBoxLayout* layout = new QVBoxLayout();
dialog->setLayout(layout);
for(vector<Input*>::iterator it = _inputs.begin(); it < _inputs.end(); ++it) {
(*it)->fillDialog(dialog, currentWnd, imgWndList);
}
QPushButton *okButton = new QPushButton(qApp->translate("PlugOperation", "Validate"), dialog);
okButton->setDefault(true);
layout->addWidget(okButton);
QObject::connect(okButton, SIGNAL(clicked()), dialog, SLOT(accept()));
QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
cout << code << endl;
if(code!=QDialog::Accepted) {
return;
}
for(vector<Input*>::iterator it = _inputs.begin(); it < _inputs.end(); ++it) {
(*it)->pickValue();
}
}
this->operation();
}
示例5: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setApplicationName(app.translate("main", "RssPanel"));
#ifdef Q_WS_MAC
app.setCursorFlashTime(0);
#endif
if (int error = enableNetworkProxying())
return error;
QDialog dialog;
RssPanel *rssPanel = new RssPanel;
QDialogButtonBox *buttonBox = new QDialogButtonBox;
QPushButton *quitButton = buttonBox->addButton(
app.translate("main", "&Quit"),
QDialogButtonBox::AcceptRole);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(rssPanel, 1);
layout->addWidget(buttonBox);
dialog.setLayout(layout);
dialog.setWindowTitle(app.applicationName());
dialog.setMinimumWidth(450);
QString url("http://newsrss.bbc.co.uk/rss/"
"newsonline_uk_edition/technology/rss.xml");
if (argc > 1) {
url = argv[1];
if (!url.startsWith("http://"))
url.prepend("http://");
}
rssPanel->setUrl(QUrl(url));
QObject::connect(quitButton, SIGNAL(clicked()),
&dialog, SLOT(accept()));
dialog.show();
return app.exec();
}
示例6: 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;
}
示例7: buttonContextMenu
void LaunchPad::buttonContextMenu(const QPoint& /*pos*/)
{
QAbstractButton* btn = static_cast<QAbstractButton*>(sender());
int id = mButtons.id(btn);
QDialog dialog;
QGridLayout layout(&dialog);
QLabel* label;
int row = 0; // Count layout rows
label = new QLabel(tr("Name"));
label->setAlignment(Qt::AlignRight);
layout.addWidget(label, row, 0);
QLineEdit name(btn->text());
name.setToolTip(tr("Button caption"));
layout.addWidget(&name, row++, 1);
layout.setColumnStretch(1, 1);
label = new QLabel(tr("Tip"));
label->setAlignment(Qt::AlignRight);
layout.addWidget(label, row, 0);
QLineEdit tip(btn->toolTip());
tip.setToolTip(tr("Button tool tip"));
tip.setCursorPosition(0);
layout.addWidget(&tip, row++, 1, 1, 2);
layout.setColumnStretch(2, 3);
label = new QLabel(tr("Command"));
label->setAlignment(Qt::AlignRight);
layout.addWidget(label, row, 0);
QLineEdit command(mCommands.at(id));
//QTextEdit command(mCommands.at(id));
command.setCursorPosition(0);
command.setToolTip(tr("Available Tags are: %1").arg("[Provider] [Symbol] [Market] "
"[FiId] [MarketId]"));
layout.addWidget(&command, row++, 1, 1, 2); // Spawn over two colums...
// layout.setColumnStretch(2, 2); // ...and take more space
label = new QLabel(tr("Symbol Type"));
label->setAlignment(Qt::AlignRight);
layout.addWidget(label, row, 0);
// QLineEdit symbolType(mSymbolTypes.at(id));
QComboBox symbolType;
symbolType.setToolTip(tr("Witch type has to be [Symbol]. When empty is called once with any symbol\n"
"(You should not use [Symbol] in this case at the command)"));
SymbolTypeTuple* st = mFilu->getSymbolTypes(Filu::eAllTypes);
if(st)
{
while(st->next()) symbolType.addItem(st->caption());
}
symbolType.addItem("");
symbolType.setCurrentIndex(symbolType.findText(mSymbolTypes.at(id)));
layout.addWidget(&symbolType, row, 1);
QCheckBox allMarkets(tr("All Markets"));
allMarkets.setToolTip(tr("Call multiple times with all markets by 'Symbol Type'"));
allMarkets.setChecked(mMultis.at(id));
layout.addWidget(&allMarkets, row++, 2);
// Add an empty row to take unused space
layout.addWidget(new QWidget, row, 1);
layout.setRowStretch(row++, 2);
// Build the button line
QDialogButtonBox dlgBtns(QDialogButtonBox::Save | QDialogButtonBox::Discard);
QPushButton* db = dlgBtns.button(QDialogButtonBox::Discard);
dlgBtns.addButton(db, QDialogButtonBox::RejectRole);
connect(&dlgBtns, SIGNAL(accepted()), &dialog, SLOT(accept()));
connect(&dlgBtns, SIGNAL(rejected()), &dialog, SLOT(reject()));
DialogButton* remove = new DialogButton(tr("&Remove"), -1);
remove->setToolTip(tr("Remove button"));
dlgBtns.addButton(remove, QDialogButtonBox::ActionRole);
connect(remove, SIGNAL(clicked(int)), &dialog, SLOT(done(int)));
DialogButton* add = new DialogButton(tr("&Add"), 2);
add->setToolTip(tr("Copy to new button"));
dlgBtns.addButton(add, QDialogButtonBox::ActionRole);
connect(add, SIGNAL(clicked(int)), &dialog, SLOT(done(int)));
layout.addWidget(&dlgBtns, row, 1, 1, 2);
dialog.setWindowTitle(tr("LaunchPad - Edit button '%1'").arg(btn->text()));
dialog.setMinimumWidth(350);
switch (dialog.exec())
{
case 0: // Discard
return;
break;
case -1: // Remove
{
int ret = QMessageBox::warning(&dialog
, tr("LaunchPad - Last chance to keep your data")
, tr("Are you sure to delete button <b>'%1'</b> with all your work<b>?</b>")
.arg(btn->text())
, QMessageBox::Yes | QMessageBox::No
, QMessageBox::No);
//.........这里部分代码省略.........
示例8: 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 )
//.........这里部分代码省略.........
示例9: operator
void RandomImgOp::operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&) {
QDialog* dialog = new QDialog(qApp->activeWindow());
dialog->setWindowTitle(qApp->translate("RandomImgOp", "Parameters"));
dialog->setMinimumWidth(180);
QFormLayout* layout = new QFormLayout(dialog);
QGroupBox* radioGroup = new QGroupBox(qApp->translate("RandomImgOp", "Image type"), dialog);
QRadioButton* intButton = new QRadioButton(qApp->translate("RandomImgOp", "8-bit integer"));
QRadioButton* floatButton = new QRadioButton(qApp->translate("RandomImgOp", "Floating point"));
QHBoxLayout* radioLayout = new QHBoxLayout(radioGroup);
radioLayout->addWidget(intButton);
radioLayout->addWidget(floatButton);
intButton->setChecked(true);
layout->insertRow(0, radioGroup);
QSpinBox* widthBox = new QSpinBox(dialog);
widthBox->setRange(0, 65536);
widthBox->setValue(512);
layout->insertRow(1, qApp->translate("RandomImgOp", "Width : "), widthBox);
QSpinBox* heightBox = new QSpinBox(dialog);
heightBox->setRange(0, 65536);
heightBox->setValue(512);
layout->insertRow(2, qApp->translate("RandomImgOp", "Height : "), heightBox);
QSpinBox* channelBox = new QSpinBox(dialog);
channelBox->setRange(1, 4);
channelBox->setValue(3);
layout->insertRow(3, qApp->translate("RandomImgOp", "Number of channels : "), channelBox);
QWidget* intRangeWidget = new QWidget(dialog);
QHBoxLayout* intRangeLayout = new QHBoxLayout(intRangeWidget);
QSpinBox* intMinBox = new QSpinBox(dialog);
QSpinBox* intMaxBox = new QSpinBox(dialog);
intMinBox->setRange(0, 255);
intMaxBox->setRange(0, 255);
intMinBox->setValue(0);
intMaxBox->setValue(255);
intRangeLayout->addWidget(new QLabel(qApp->translate("RandomImgOp", "Range : ")));
intRangeLayout->addWidget(intMinBox);
intRangeLayout->addWidget(new QLabel(qApp->translate("RandomImgOp", " to ")));
intRangeLayout->addWidget(intMaxBox);
layout->insertRow(4, intRangeWidget);
QWidget* floatRangeWidget = new QWidget(dialog);
QHBoxLayout* floatRangeLayout = new QHBoxLayout(floatRangeWidget);
QDoubleSpinBox* floatMinBox = new QDoubleSpinBox(dialog);
QDoubleSpinBox* floatMaxBox = new QDoubleSpinBox(dialog);
floatMinBox->setValue(0.0);
floatMaxBox->setValue(1.0);
floatMinBox->setRange(-65536, 65536);
floatMaxBox->setRange(-65536, 65536);
floatRangeLayout->addWidget(new QLabel(qApp->translate("RandomImgOp", "Range : ")));
floatRangeLayout->addWidget(floatMinBox);
floatRangeLayout->addWidget(new QLabel(qApp->translate("RandomImgOp", " to ")));
floatRangeLayout->addWidget(floatMaxBox);
layout->insertRow(5, floatRangeWidget);
floatRangeWidget->hide();
layout->setSizeConstraint(QLayout::SetFixedSize);
QObject::connect(intButton, SIGNAL(toggled(bool)), intRangeWidget, SLOT(setVisible(bool)));
QObject::connect(floatButton, SIGNAL(toggled(bool)), floatRangeWidget, SLOT(setVisible(bool)));
QPushButton *okButton = new QPushButton(qApp->translate("Operations", "Validate"), dialog);
okButton->setDefault(true);
layout->addWidget(okButton);
QObject::connect(okButton, SIGNAL(clicked()), dialog, SLOT(accept()));
QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
if(code!=QDialog::Accepted) {
return;
}
if(intButton->isChecked()) {
Image* resImg = new Image(widthBox->value(), heightBox->value(), channelBox->value());
RandomLib::Random random;
for(unsigned int c = 0; c < resImg->getNbChannels(); ++c) {
for(unsigned int j = 0; j < resImg->getHeight(); ++j) {
for(unsigned int i = 0; i < resImg->getWidth(); ++i) {
Image::depth_t value = random.IntegerC<Image::depth_t>(intMinBox->value(), intMaxBox->value());
// Image::depth_t value = 256. * (rand() / (RAND_MAX + 1.));;
resImg->setPixel(i, j, c, value);
}
}
}
this->outImage(resImg, qApp->translate("Operations", "Random image").toStdString());
}
else if(floatButton->isChecked()) {
Image_t<double>* resImg = new Image_t<double>(widthBox->value(), heightBox->value(), channelBox->value());
RandomLib::Random random;
for(unsigned int c = 0; c < resImg->getNbChannels(); ++c) {
for(unsigned int j = 0; j < resImg->getHeight(); ++j) {
for(unsigned int i = 0; i < resImg->getWidth(); ++i) {
double min = floatMinBox->value();
double max = floatMaxBox->value();
//.........这里部分代码省略.........