mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 22:00:35 +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() {
|
void QETElementEditor::slot_open() {
|
||||||
// demande le chemin virtuel de l'element a ouvrir a l'utilisateur
|
// 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;
|
if (location.isNull()) return;
|
||||||
QETElementEditor *cee = new QETElementEditor();
|
QETElementEditor *cee = new QETElementEditor();
|
||||||
cee -> fromLocation(location);
|
cee -> fromLocation(location);
|
||||||
@@ -918,7 +918,7 @@ bool QETElementEditor::slot_save() {
|
|||||||
*/
|
*/
|
||||||
bool QETElementEditor::slot_saveAs() {
|
bool QETElementEditor::slot_saveAs() {
|
||||||
// demande une localisation a l'utilisateur
|
// demande une localisation a l'utilisateur
|
||||||
ElementsLocation location = ElementDialog::getSaveElementLocation();
|
ElementsLocation location = ElementDialog::getSaveElementLocation(this);
|
||||||
if (location.isNull()) return(false);
|
if (location.isNull()) return(false);
|
||||||
|
|
||||||
// tente l'enregistrement
|
// tente l'enregistrement
|
||||||
|
|||||||
@@ -28,16 +28,18 @@
|
|||||||
Construit un dialogue permettant d'ouvrir un element
|
Construit un dialogue permettant d'ouvrir un element
|
||||||
@param mode Mode du dialogue
|
@param mode Mode du dialogue
|
||||||
@see ElementDialog::Mode
|
@see ElementDialog::Mode
|
||||||
|
@param parentWidget QWidget parent
|
||||||
@param parent QObject parent
|
@param parent QObject parent
|
||||||
|
|
||||||
*/
|
*/
|
||||||
ElementDialog::ElementDialog(uint mode, QObject *parent) :
|
ElementDialog::ElementDialog(uint mode, QWidget *parentWidget, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
mode_(mode),
|
mode_(mode),
|
||||||
buttons_(0),
|
buttons_(0),
|
||||||
list_(0),
|
list_(0),
|
||||||
textfield_(0)
|
textfield_(0)
|
||||||
{
|
{
|
||||||
dialog_ = new QDialog();
|
dialog_ = new QDialog(parentWidget);
|
||||||
dialog_ -> setWindowModality(Qt::WindowModal);
|
dialog_ -> setWindowModality(Qt::WindowModal);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
dialog_ -> setWindowFlags(Qt::Sheet);
|
dialog_ -> setWindowFlags(Qt::Sheet);
|
||||||
@@ -95,48 +97,54 @@ ElementDialog::ElementDialog(uint mode, QObject *parent) :
|
|||||||
Destructeur
|
Destructeur
|
||||||
*/
|
*/
|
||||||
ElementDialog::~ElementDialog() {
|
ElementDialog::~ElementDialog() {
|
||||||
|
dialog_ -> setParent(0);
|
||||||
delete dialog_;
|
delete dialog_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Affiche un dialogue permettant a l'utilisateur de selectionner une categorie existant deja
|
Affiche un dialogue permettant a l'utilisateur de selectionner une categorie existant deja
|
||||||
|
@param parentWidget QWidget parent
|
||||||
@return le chemin virtuel de cette categorie
|
@return le chemin virtuel de cette categorie
|
||||||
*/
|
*/
|
||||||
ElementsLocation ElementDialog::getExistingCategoryLocation() {
|
ElementsLocation ElementDialog::getExistingCategoryLocation(QWidget *parentWidget) {
|
||||||
return(ElementDialog::execConfiguredDialog(ElementDialog::OpenCategory));
|
return(ElementDialog::execConfiguredDialog(ElementDialog::OpenCategory, parentWidget));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Affiche un dialogue permettant a l'utilisateur de selectionner une nouvelle categorie
|
Affiche un dialogue permettant a l'utilisateur de selectionner une nouvelle categorie
|
||||||
|
@param parentWidget QWidget parent
|
||||||
@return le chemin virtuel de cette categorie
|
@return le chemin virtuel de cette categorie
|
||||||
*/
|
*/
|
||||||
ElementsLocation ElementDialog::getNewCategoryLocation() {
|
ElementsLocation ElementDialog::getNewCategoryLocation(QWidget *parentWidget) {
|
||||||
return(ElementDialog::execConfiguredDialog(ElementDialog::SaveCategory));
|
return(ElementDialog::execConfiguredDialog(ElementDialog::SaveCategory, parentWidget));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Affiche un dialogue permettant a l'utilisateur de selectionner un element a ouvrir
|
Affiche un dialogue permettant a l'utilisateur de selectionner un element a ouvrir
|
||||||
|
@param parentWidget QWidget parent
|
||||||
@return le chemin virtuel de cet element
|
@return le chemin virtuel de cet element
|
||||||
*/
|
*/
|
||||||
ElementsLocation ElementDialog::getOpenElementLocation() {
|
ElementsLocation ElementDialog::getOpenElementLocation(QWidget *parentWidget) {
|
||||||
return(ElementDialog::execConfiguredDialog(ElementDialog::OpenElement));
|
return(ElementDialog::execConfiguredDialog(ElementDialog::OpenElement, parentWidget));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Affiche un dialogue permettant a l'utilisateur de selectionner un element (existant ou non)
|
Affiche un dialogue permettant a l'utilisateur de selectionner un element (existant ou non)
|
||||||
qu'il souhaite enregistrer
|
qu'il souhaite enregistrer
|
||||||
|
@param parentWidget QWidget parent
|
||||||
@return le chemin virtuel de cet element
|
@return le chemin virtuel de cet element
|
||||||
*/
|
*/
|
||||||
ElementsLocation ElementDialog::getSaveElementLocation() {
|
ElementsLocation ElementDialog::getSaveElementLocation(QWidget *parentWidget) {
|
||||||
return(ElementDialog::execConfiguredDialog(ElementDialog::SaveElement));
|
return(ElementDialog::execConfiguredDialog(ElementDialog::SaveElement, parentWidget));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Lance un dialogue selon la configuration mode
|
Lance un dialogue selon la configuration mode
|
||||||
@param mode Mode du dialogue
|
@param mode Mode du dialogue
|
||||||
|
@param parentWidget QWidget parent
|
||||||
*/
|
*/
|
||||||
ElementsLocation ElementDialog::execConfiguredDialog(int mode) {
|
ElementsLocation ElementDialog::execConfiguredDialog(int mode, QWidget *parentWidget) {
|
||||||
ElementDialog element_dialog(mode);
|
ElementDialog element_dialog(mode, parentWidget);
|
||||||
element_dialog.exec();
|
element_dialog.exec();
|
||||||
return(element_dialog.location());
|
return(element_dialog.location());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class ElementDialog : public QObject {
|
|||||||
|
|
||||||
// constructeurs, destructeur
|
// constructeurs, destructeur
|
||||||
public:
|
public:
|
||||||
ElementDialog(uint = ElementDialog::OpenElement, QObject * = 0);
|
ElementDialog(uint = ElementDialog::OpenElement, QWidget * = 0, QObject * = 0);
|
||||||
virtual ~ElementDialog();
|
virtual ~ElementDialog();
|
||||||
private:
|
private:
|
||||||
ElementDialog(const ElementDialog &);
|
ElementDialog(const ElementDialog &);
|
||||||
@@ -51,13 +51,13 @@ class ElementDialog : public QObject {
|
|||||||
public:
|
public:
|
||||||
int exec();
|
int exec();
|
||||||
ElementsLocation location() const;
|
ElementsLocation location() const;
|
||||||
static ElementsLocation getExistingCategoryLocation();
|
static ElementsLocation getExistingCategoryLocation(QWidget * = 0);
|
||||||
static ElementsLocation getNewCategoryLocation();
|
static ElementsLocation getNewCategoryLocation(QWidget * = 0);
|
||||||
static ElementsLocation getOpenElementLocation();
|
static ElementsLocation getOpenElementLocation(QWidget * = 0);
|
||||||
static ElementsLocation getSaveElementLocation();
|
static ElementsLocation getSaveElementLocation(QWidget * = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static ElementsLocation execConfiguredDialog(int);
|
static ElementsLocation execConfiguredDialog(int, QWidget * = 0);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void locationChanged(const ElementsLocation &);
|
void locationChanged(const ElementsLocation &);
|
||||||
|
|||||||
Reference in New Issue
Block a user