mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Il est desormais possible de specifier un widget parent pour les dialogues de la classe ElementDialog
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@734 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -803,7 +803,7 @@ void QETElementEditor::slot_new() {
|
||||
*/
|
||||
void QETElementEditor::slot_open() {
|
||||
// demande le chemin virtuel de l'element a ouvrir a l'utilisateur
|
||||
ElementsLocation location = ElementDialog::getOpenElementLocation();
|
||||
ElementsLocation location = ElementDialog::getOpenElementLocation(this);
|
||||
if (location.isNull()) return;
|
||||
QETElementEditor *cee = new QETElementEditor();
|
||||
cee -> fromLocation(location);
|
||||
@@ -918,7 +918,7 @@ bool QETElementEditor::slot_save() {
|
||||
*/
|
||||
bool QETElementEditor::slot_saveAs() {
|
||||
// demande une localisation a l'utilisateur
|
||||
ElementsLocation location = ElementDialog::getSaveElementLocation();
|
||||
ElementsLocation location = ElementDialog::getSaveElementLocation(this);
|
||||
if (location.isNull()) return(false);
|
||||
|
||||
// tente l'enregistrement
|
||||
|
||||
@@ -28,16 +28,18 @@
|
||||
Construit un dialogue permettant d'ouvrir un element
|
||||
@param mode Mode du dialogue
|
||||
@see ElementDialog::Mode
|
||||
@param parentWidget QWidget parent
|
||||
@param parent QObject parent
|
||||
|
||||
*/
|
||||
ElementDialog::ElementDialog(uint mode, QObject *parent) :
|
||||
ElementDialog::ElementDialog(uint mode, QWidget *parentWidget, QObject *parent) :
|
||||
QObject(parent),
|
||||
mode_(mode),
|
||||
buttons_(0),
|
||||
list_(0),
|
||||
textfield_(0)
|
||||
{
|
||||
dialog_ = new QDialog();
|
||||
dialog_ = new QDialog(parentWidget);
|
||||
dialog_ -> setWindowModality(Qt::WindowModal);
|
||||
#ifdef Q_WS_MAC
|
||||
dialog_ -> setWindowFlags(Qt::Sheet);
|
||||
@@ -95,48 +97,54 @@ ElementDialog::ElementDialog(uint mode, QObject *parent) :
|
||||
Destructeur
|
||||
*/
|
||||
ElementDialog::~ElementDialog() {
|
||||
dialog_ -> setParent(0);
|
||||
delete dialog_;
|
||||
}
|
||||
|
||||
/**
|
||||
Affiche un dialogue permettant a l'utilisateur de selectionner une categorie existant deja
|
||||
@param parentWidget QWidget parent
|
||||
@return le chemin virtuel de cette categorie
|
||||
*/
|
||||
ElementsLocation ElementDialog::getExistingCategoryLocation() {
|
||||
return(ElementDialog::execConfiguredDialog(ElementDialog::OpenCategory));
|
||||
ElementsLocation ElementDialog::getExistingCategoryLocation(QWidget *parentWidget) {
|
||||
return(ElementDialog::execConfiguredDialog(ElementDialog::OpenCategory, parentWidget));
|
||||
}
|
||||
|
||||
/**
|
||||
Affiche un dialogue permettant a l'utilisateur de selectionner une nouvelle categorie
|
||||
@param parentWidget QWidget parent
|
||||
@return le chemin virtuel de cette categorie
|
||||
*/
|
||||
ElementsLocation ElementDialog::getNewCategoryLocation() {
|
||||
return(ElementDialog::execConfiguredDialog(ElementDialog::SaveCategory));
|
||||
ElementsLocation ElementDialog::getNewCategoryLocation(QWidget *parentWidget) {
|
||||
return(ElementDialog::execConfiguredDialog(ElementDialog::SaveCategory, parentWidget));
|
||||
}
|
||||
|
||||
/**
|
||||
Affiche un dialogue permettant a l'utilisateur de selectionner un element a ouvrir
|
||||
@param parentWidget QWidget parent
|
||||
@return le chemin virtuel de cet element
|
||||
*/
|
||||
ElementsLocation ElementDialog::getOpenElementLocation() {
|
||||
return(ElementDialog::execConfiguredDialog(ElementDialog::OpenElement));
|
||||
ElementsLocation ElementDialog::getOpenElementLocation(QWidget *parentWidget) {
|
||||
return(ElementDialog::execConfiguredDialog(ElementDialog::OpenElement, parentWidget));
|
||||
}
|
||||
|
||||
/**
|
||||
Affiche un dialogue permettant a l'utilisateur de selectionner un element (existant ou non)
|
||||
qu'il souhaite enregistrer
|
||||
@param parentWidget QWidget parent
|
||||
@return le chemin virtuel de cet element
|
||||
*/
|
||||
ElementsLocation ElementDialog::getSaveElementLocation() {
|
||||
return(ElementDialog::execConfiguredDialog(ElementDialog::SaveElement));
|
||||
ElementsLocation ElementDialog::getSaveElementLocation(QWidget *parentWidget) {
|
||||
return(ElementDialog::execConfiguredDialog(ElementDialog::SaveElement, parentWidget));
|
||||
}
|
||||
|
||||
/**
|
||||
Lance un dialogue selon la configuration mode
|
||||
@param mode Mode du dialogue
|
||||
@param parentWidget QWidget parent
|
||||
*/
|
||||
ElementsLocation ElementDialog::execConfiguredDialog(int mode) {
|
||||
ElementDialog element_dialog(mode);
|
||||
ElementsLocation ElementDialog::execConfiguredDialog(int mode, QWidget *parentWidget) {
|
||||
ElementDialog element_dialog(mode, parentWidget);
|
||||
element_dialog.exec();
|
||||
return(element_dialog.location());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class ElementDialog : public QObject {
|
||||
|
||||
// constructeurs, destructeur
|
||||
public:
|
||||
ElementDialog(uint = ElementDialog::OpenElement, QObject * = 0);
|
||||
ElementDialog(uint = ElementDialog::OpenElement, QWidget * = 0, QObject * = 0);
|
||||
virtual ~ElementDialog();
|
||||
private:
|
||||
ElementDialog(const ElementDialog &);
|
||||
@@ -51,13 +51,13 @@ class ElementDialog : public QObject {
|
||||
public:
|
||||
int exec();
|
||||
ElementsLocation location() const;
|
||||
static ElementsLocation getExistingCategoryLocation();
|
||||
static ElementsLocation getNewCategoryLocation();
|
||||
static ElementsLocation getOpenElementLocation();
|
||||
static ElementsLocation getSaveElementLocation();
|
||||
static ElementsLocation getExistingCategoryLocation(QWidget * = 0);
|
||||
static ElementsLocation getNewCategoryLocation(QWidget * = 0);
|
||||
static ElementsLocation getOpenElementLocation(QWidget * = 0);
|
||||
static ElementsLocation getSaveElementLocation(QWidget * = 0);
|
||||
|
||||
private:
|
||||
static ElementsLocation execConfiguredDialog(int);
|
||||
static ElementsLocation execConfiguredDialog(int, QWidget * = 0);
|
||||
|
||||
private slots:
|
||||
void locationChanged(const ElementsLocation &);
|
||||
|
||||
Reference in New Issue
Block a user