当前位置: 首页>>代码示例>>C++>>正文


C++ QDialog::setLayout方法代码示例

本文整理汇总了C++中QDialog::setLayout方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::setLayout方法的具体用法?C++ QDialog::setLayout怎么用?C++ QDialog::setLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDialog的用法示例。


在下文中一共展示了QDialog::setLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: aboutLicense

void MainWindow::aboutLicense() {
    QDialog *dialog = new QDialog( this );

    QFile file( ":/GPL" );
    if(!file.open( QIODevice::ReadOnly | QIODevice::Text ))
        qCritical( "GPL LicenseFile not found" );

    QTextStream out ( &file );
    out.setFieldAlignment ( QTextStream::AlignCenter );

    QTextEdit *qteLicense = new QTextEdit ( dialog );
        qteLicense->setText ( out.readAll ());
        qteLicense->setReadOnly ( 1 );
    QPushButton *qpbClose = new QPushButton ( IconLoader::Load( "window-close" ), tr( "&Close" ), dialog );
        connect( qpbClose, SIGNAL( clicked()), dialog, SLOT( deleteLater()));

    qglDialog = new QGridLayout( dialog );
        qglDialog->addWidget( qteLicense, 0, 0 );
        qglDialog->addWidget( qpbClose, 1, 0, Qt::AlignRight );

        dialog->setLayout( qglDialog);
        dialog->setWindowTitle( "GNU General Public License" );
        dialog->setFixedSize( 550, 400 );
        dialog->exec();
}
开发者ID:Azd325,项目名称:simba,代码行数:25,代码来源:mainwindow.cpp

示例2: openAboutDialogue

void MainWindow::openAboutDialogue()
{
    QString message = "<b>Flocus 0.1.0 (opensource)</b><br><br>"
            "Flocus stands for <b>F</b>ull needle <b>LOC</b>alization in <b>U</b>ltra<b>S</b>ound images.<br><br>"
            "Flocus applies various image processing algorithms <br>to data acquired by a SonixTouch ultrasound machine.<br><br>"
            "This project is included in the CAMI labex.";

    QString title = "About Flocus";
    QDialog *msg = new QDialog(this);
    msg->setWindowTitle(title);
    QVBoxLayout *layoutMsg = new QVBoxLayout;

    QLabel *iconLabel = new QLabel;
    QImage icon("../../fig/flocus_icon.png");
    iconLabel->setPixmap(QPixmap::fromImage(icon));
    iconLabel->setAlignment(Qt::AlignCenter);
    layoutMsg->addWidget(iconLabel);

    QLabel *text = new QLabel;
    text->setText(message);
    text->setAlignment(Qt::AlignCenter);
    layoutMsg->addWidget(text);

    QPushButton *buttonOK = new QPushButton("OK");
    buttonOK->setMaximumWidth(50);
    layoutMsg->addWidget(buttonOK,0,Qt::AlignCenter);

    msg->setLayout(layoutMsg);

    connect(buttonOK,SIGNAL(clicked()),msg,SLOT(accept()));

    msg->exec();
}
开发者ID:KDemeul,项目名称:Flocus,代码行数:33,代码来源:mainwindow.cpp

示例3: about

void MainWindow::about()
{
    QLabel *label = new QLabel;
    QLabel *pix   = new QLabel;
    label->setText(tr("<p><b>关于</b></p> "
                      "<p>版本:    1.0</p>"
                      "<p>库:      Qt 4.8.1</p>"
                      "<p>数据库:  Sqlite</p>"
                      "<p>作者:    唐昊</p> "
                      "<p>Email:thddaniel92gmail.com</p>"));
    pix->setPixmap(QPixmap("images/money.png"));
    QToolButton *btn = new QToolButton;
    btn->setMinimumSize(60,40);
    btn->setText(tr("关闭"));
    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(pix);
    layout->addWidget(label);
    QHBoxLayout *layout2 = new QHBoxLayout;
    //layout2->addStretch(12);
    layout2->addWidget(btn,Qt::AlignHCenter);
    //layout2->addStretch(12);
    QVBoxLayout *layout3 = new QVBoxLayout;
    layout3->addLayout(layout);
    layout3->addLayout(layout2);
    QDialog *dlg = new QDialog;
    connect(btn,SIGNAL(clicked()),dlg,SLOT(close()));
    dlg->setWindowTitle(tr("关于"));
    dlg->setAttribute(Qt::WA_DeleteOnClose);
    dlg->setLayout(layout3);
    dlg->exec();


}
开发者ID:thddaniel,项目名称:QT,代码行数:33,代码来源:mainwindow.cpp

示例4: Menu

void GameBoard::Menu()
{
    QDialog *menu = new QDialog;
    QLabel *texto = new QLabel;
    QLabel *title = new QLabel("<b><big>Atalhos</big></b>");

    QFile *config = new QFile("/home/vinicius/svn/unball/estrategia/visualization/Visualization Last Version/Visualization_last/Tabela.txt"); //Colocar o diretório ao qual se encontra o arquivo Tabela.txt

    if(!config->open(QFile::ReadOnly | QFile::Text))
    {
        return;
    }
    QTextStream mOut(config);
    QString mTexto = mOut.readAll();


    texto->setText(mTexto);

    QVBoxLayout *lay =new QVBoxLayout;
    lay->addWidget(title);
    lay->addWidget(texto);

    menu->setLayout(lay);
    menu->show();

    config->flush();
    mOut.flush();
    config->close();

}
开发者ID:unball,项目名称:ieee-very-small-2012,代码行数:30,代码来源:gameboard.cpp

示例5: diffToPrevious

void VcsEventWidgetPrivate::diffToPrevious()
{
    KDevelop::VcsEvent ev = m_logModel->eventForIndex( m_contextIndex );
    KDevelop::VcsRevision prev = KDevelop::VcsRevision::createSpecialRevision(KDevelop::VcsRevision::Previous);
    KDevelop::VcsJob* job = m_iface->diff( m_url, prev, ev.revision() );

    VcsDiffWidget* widget = new VcsDiffWidget( job );
    widget->setRevisions( prev, ev.revision() );
    QDialog* dlg = new QDialog( q );

    widget->connect(widget, &VcsDiffWidget::destroyed, dlg, &QDialog::deleteLater);

    dlg->setWindowTitle( i18n("Difference To Previous") );

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
    auto mainWidget = new QWidget;
    QVBoxLayout *mainLayout = new QVBoxLayout;
    dlg->setLayout(mainLayout);
    mainLayout->addWidget(mainWidget);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    dlg->connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept);
    dlg->connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
    mainLayout->addWidget(widget);
    mainLayout->addWidget(buttonBox);

    dlg->show();
}
开发者ID:mali,项目名称:kdevplatform,代码行数:29,代码来源:vcseventwidget.cpp

示例6: slt_loadingStart

void JBlockerMainWindow::slt_loadingStart()
{
    this->statusBar()->showMessage(tr("LOADING MESSAGES ..."));
    // QMessageBox::information(this, QString(), QString("PROGRAM NEED TO LOAD MESSAGES"), QMessageBox::Ok);
    /* Create dialog */
    QDialog dialog;
    dialog.setWindowTitle(tr("Account Selection"));
    QHBoxLayout* layout = new QHBoxLayout();
    /* Label for dialog */
    QLabel* dialogLabel = new QLabel(tr("Select An Account:"));
    layout->addWidget(dialogLabel, 0, Qt::AlignHCenter);
    /* Combo box for selecting account */
    QComboBox* accountComboBox = new QComboBox();
    accountComboBox->setFixedWidth(280);
    /* Get account name list from message core */
    accountComboBox->addItems(p_messageCore->getAccountNameList());
    layout->addWidget(accountComboBox, 0, Qt::AlignHCenter);
    /* Button for dialog */
    QPushButton* dialogButton = new QPushButton(tr("Confirm"));
    layout->addWidget(dialogButton, 0, Qt::AlignHCenter);
    dialog.setLayout(layout);
    QObject::connect(dialogButton, SIGNAL(clicked()), &dialog, SLOT(accept()));
    dialog.exec();
    if(dialog.result())
    {
        /* Set selected account id */
        p_messageCore->setSelectedAccountId(accountComboBox->currentIndex());
    }

    this->statusBar()->addPermanentWidget(p_progressBar, 0);
    p_progressBar->setValue(0);
    p_progressBar->show();
    /* Core runs */
    p_messageCore->run();
}
开发者ID:biyu,项目名称:PlayGround,代码行数:35,代码来源:JBlockerMainWindow.cpp

示例7: main

int main(int argc,char *argv[])
{
    if (argc < 1)
        return 1;
    const QString skinFile = QString::fromUtf8(argv[1]);
    QApplication app(argc,argv);
    QMainWindow mw;

    DeviceSkinParameters params;
    QString errorMessage;
    if (!params.read(skinFile, DeviceSkinParameters::ReadAll, &errorMessage)) {
	qWarning() << errorMessage;
	return 1;
    }
    DeviceSkin ds(params, &mw);
    // View Dialog
    QDialog *dialog = new QDialog();
    QHBoxLayout *dialogLayout = new QHBoxLayout();
    dialog->setLayout(dialogLayout);
    QDialogButtonBox *dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    QObject::connect(dialogButtonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
    QObject::connect(dialogButtonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
    dialogLayout->addWidget(dialogButtonBox);
    dialog->setFixedSize(params.screenSize());
    dialog->setParent(&ds, Qt::SubWindow);
    dialog->setAutoFillBackground(true);
    ds.setView(dialog);

    QObject::connect(&ds, SIGNAL(popupMenu()), &mw, SLOT(close()));
    QObject::connect(&ds, SIGNAL(skinKeyPressEvent(int,QString,bool)), &mw, SLOT(close()));
    mw.show();
    return app.exec();
}
开发者ID:hkahn,项目名称:qt5-qttools-nacl,代码行数:33,代码来源:deviceskin.cpp

示例8: 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();
    }
}
开发者ID:fw4spl-org,项目名称:fw4spl,代码行数:30,代码来源:TagValueConfigurableSplitter.cpp

示例9: showDelete

void UserFiles::showDelete(QList<QString> deleteInformation)
{
    QDialog *deleteDialog = new QDialog;
    QVBoxLayout *deleteLayout = new QVBoxLayout;
    QLabel *information = new QLabel;
    QPushButton *ok = new QPushButton("Ok");

    QString path = deleteInformation.at(0);
    QString name = deleteInformation.at(1);
    QString status = deleteInformation.at(2);

    if(status == "0") information->setText("Arquivo deletado com sucesso!");
    if(status == "1") information->setText("Voce nao esta logado!");
    if(status == "2") information->setText("Ocorreu erro no servidor!");

    deleteLayout->addWidget(information);
    deleteLayout->addWidget(ok);
    deleteDialog->setLayout(deleteLayout);

    connect(ok,SIGNAL(clicked()),deleteDialog,SLOT(close()));

    deleteDialog->exec();

    listWidget->removeItemWidget(currentFile);

}
开发者ID:Schwarzenegger,项目名称:SDsy,代码行数:26,代码来源:userfiles.cpp

示例10: OpenSettingsDialog

	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);
	}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例11: QDialog

void Fix8Log::aboutSlot()
{

    QDialog *aboutDialog = new QDialog();
    QVBoxLayout *aboutLayout = new QVBoxLayout(0);

    QDialogButtonBox *dialogButtonBox = new QDialogButtonBox();

    dialogButtonBox->addButton(QDialogButtonBox::Ok);
    connect(dialogButtonBox,SIGNAL(clicked(QAbstractButton*)),
            aboutDialog,SLOT(close()));

    QQuickView *aboutView = new QQuickView(QUrl("qrc:qml/helpAbout.qml"));
    QQuickItem *qmlObject = aboutView->rootObject();
    qmlObject->setProperty("color",aboutDialog->palette().color(QPalette::Window));
    qmlObject->setProperty("bgColor",aboutDialog->palette().color(QPalette::Window));
    qmlObject->setProperty("version",QString::number(Globals::version));

    aboutView->setResizeMode(QQuickView::SizeRootObjectToView);

    QWidget *aboutWidget = QWidget::createWindowContainer(aboutView,0);
    aboutWidget->setPalette(aboutDialog->palette());
    aboutWidget->setAutoFillBackground(false);
    aboutDialog->setLayout(aboutLayout);

    aboutLayout->addWidget(aboutWidget,1);
    aboutLayout->addWidget(dialogButtonBox,0);
    aboutDialog->resize(500,400);
    aboutDialog->setWindowTitle(GUI::Globals::appName);
    aboutDialog->exec();
    aboutDialog->deleteLater();

}
开发者ID:DBoo,项目名称:fix8logviewer,代码行数:33,代码来源:fix8logSlots.cpp

示例12: about

void MainWindow::about()
{
   QDialog *aboutdialog = new QDialog();
   int pSize = aboutdialog->font().pointSize();
   aboutdialog->setWindowTitle("About");
   aboutdialog->setFixedSize(pSize*27,pSize*17);

   QVBoxLayout *templayout = new QVBoxLayout();
   templayout->setMargin(5);

   QLabel *projectname = new QLabel(QString(APP_NAME) +"\t"+ QString(APP_VERSION));
   projectname->setFrameStyle(QFrame::Box | QFrame::Raised);
   projectname->setAlignment(Qt::AlignCenter);
   QLabel *projectauthors = new QLabel(QString(APP_DESIGNER) + "\n\nBMSTU\n\nNovember of 2015");
   projectauthors->setWordWrap(true);
   projectauthors->setAlignment(Qt::AlignCenter);
   QLabel *hyperlink = new QLabel("<a href='mailto:[email protected]?subject=Pointmetry'>Contact us at [email protected]");
   hyperlink->setOpenExternalLinks(true);
   hyperlink->setAlignment(Qt::AlignCenter);

   templayout->addWidget(projectname);
   templayout->addWidget(projectauthors);
   templayout->addWidget(hyperlink);

   aboutdialog->setLayout(templayout);
   aboutdialog->exec();

   delete hyperlink;
   delete projectauthors;
   delete projectname;
   delete templayout;
   delete aboutdialog;
}
开发者ID:pi-null-mezon,项目名称:Interview,代码行数:33,代码来源:mainwindow.cpp

示例13: proxyAuthenticationRequired

 void MapNetwork::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
 {
     qDebug() << "Proxy Aut req" << proxy.hostName() << &authenticator;
     QDialog dialog;
     QGridLayout layout;
     QLabel username, password;
     username.setText("Username:");
     password.setText("Password:");
     layout.addWidget(&username, 0, 0);
     layout.addWidget(&password, 1, 0);
     QLineEdit user, pass;
     pass.setEchoMode(QLineEdit::Password);
     connect(&user, SIGNAL(returnPressed()), &dialog, SLOT(accept()));
     connect(&pass, SIGNAL(returnPressed()), &dialog, SLOT(accept()));
     layout.addWidget(&user, 0, 1);
     layout.addWidget(&pass, 1, 1);
     QPushButton button;
     button.setText("OK");
     connect(&button, SIGNAL(clicked()), &dialog, SLOT(accept()));
     layout.addWidget(&button, 2, 0, 1, 2, Qt::AlignCenter);
     dialog.setLayout(&layout);
     dialog.exec();
     authenticator->setUser(user.text());
     authenticator->setPassword(pass.text());
 }
开发者ID:x0b1t,项目名称:qmapcontrol,代码行数:25,代码来源:mapnetwork.cpp

示例14: QDialogButtonBox

QDialog *MainWindow::createNewFileDialog(QSpinBox *width, QSpinBox *height,
        QCheckBox *transparentBackground)
{
    QDialog *dialog = new QDialog;
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
            QDialogButtonBox::Cancel);
    QVBoxLayout *layout = new QVBoxLayout;

    QHBoxLayout *layout_1 = new QHBoxLayout;
    QLabel *label_1 = new QLabel(tr("Width"));
    width->setMaximum(800000);
    width->setValue(800);
    width->setSuffix("px");
    layout_1->addWidget(label_1);
    layout_1->addWidget(width);

    QHBoxLayout *layout_2 = new QHBoxLayout;
    QLabel *label_2 = new QLabel(tr("Height"));
    height->setMaximum(600000);
    height->setValue(600);
    height->setSuffix("px");
    layout_2->addWidget(label_2);
    layout_2->addWidget(height);

    layout->addLayout(layout_1);
    layout->addLayout(layout_2);
    layout->addWidget(transparentBackground);
    layout->addWidget(buttonBox);
    connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
    dialog->setLayout(layout);
    return dialog;
}
开发者ID:ogorodnikoff2012,项目名称:Paint,代码行数:33,代码来源:mainwindow.cpp

示例15: zeitanzeige

void gesamtbild::zeitanzeige(/*int dora, int hin, int may*/)
{
			qWarning() << "Zeit";


			QDialog *zeitw = new QDialog(this);
			QVBoxLayout layout(zeitw);
			QLabel *anzeige = new QLabel(tr("Time: Day %1,").arg(GAMEDATA->gametime().day()).append(QString("%1 hours").arg(GAMEDATA->gametime().hour())), zeitw);

// 			anzeige->setText(anzeige->text().append(QString(", %2 Uhr %3").arg( gameview->stunde, gameview->minute)));gameview->stunde
// 			qWarning() << anzeige->text().append(QString(", %2 Uhr %3").arg( gameview->stunde, gameview->minute));

			QPushButton *ok = new QPushButton("Ok",zeitw);
			ok->move(50, 50);
			layout.addWidget(anzeige);
			layout.addWidget(ok);
// 			zeitw->setGeometry(width()/2,height()/2,200,100);
			zeitw->setLayout(&layout);
			zeitw->setAutoFillBackground(true);
			zeitw->move(gameview->width()/2,gameview->height()/2);
  			zeitw->raise();
			zeitw->show();

			connect(ok, SIGNAL(clicked()), gameview, SLOT(endePause()));
			connect(ok, SIGNAL(clicked()), zeitw, SLOT(close()));
			connect(ok, SIGNAL(clicked()), zeitw, SLOT(deleteLater()));
}
开发者ID:schdorm,项目名称:openhanse-old,代码行数:27,代码来源:gb_spiel.cpp


注:本文中的QDialog::setLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。