dialog_utils.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "dialog_utils.h"
00014
00015
00016 #include <qgroupbox.h>
00017 #include <qlayout.h>
00018 #include <qlabel.h>
00019 #include <qlineedit.h>
00020 #include <kinputdialog.h>
00021
00022
00023 #include "uml.h"
00024 #include "umlwidget.h"
00025
00026 namespace Dialog_Utils {
00027
00028 QLineEdit* makeLabeledEditField(QGroupBox *containingBox, QGridLayout *layout, int row,
00029 QLabel * &label, const QString& labelText,
00030 QLineEdit * &editField,
00031 const QString& editFieldText )
00032 {
00033 label = new QLabel(labelText, containingBox);
00034 layout->addWidget(label, row, 0);
00035 editField = new QLineEdit(editFieldText, containingBox);
00036 layout->addWidget(editField, row, 1 );
00037 label->setBuddy(editField);
00038 return editField;
00039 }
00040
00041
00042 void askNameForWidget(UMLWidget * &targetWidget, const QString& dialogTitle,
00043 const QString& dialogPrompt, const QString& defaultName) {
00044
00045 bool pressedOK = false;
00046
00047 QString name = KInputDialog::getText(dialogTitle, dialogPrompt, defaultName, &pressedOK, UMLApp::app());
00048
00049 if (pressedOK) {
00050 targetWidget->setName(name);
00051 } else {
00052 targetWidget->cleanup();
00053 delete targetWidget;
00054 targetWidget = NULL;
00055 }
00056 }
00057
00058
00059 }
00060
This file is part of the documentation for umbrello Version 3.1.0.