Corrections et amleiorations sur le widget ExportProperties :

* stretch et marges en trop
  * modification du titre du cadre
  * emission d'un signal lors de la modification d'un option de rendu
  * ajout d'un mode "Impression", plus generiques, avec moins d'options affichees


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@757 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2009-10-03 23:54:07 +00:00
parent 8b49a0fcef
commit 10d7577419
3 changed files with 31 additions and 5 deletions

View File

@@ -210,6 +210,7 @@ ExportConfigPage::ExportConfigPage(QWidget *parent) : ConfigPage(parent) {
horiz_line -> setFrameShape(QFrame::HLine); horiz_line -> setFrameShape(QFrame::HLine);
vlayout1 -> addWidget(horiz_line); vlayout1 -> addWidget(horiz_line);
vlayout1 -> addWidget(epw); vlayout1 -> addWidget(epw);
vlayout1 -> addStretch();
// activation du layout // activation du layout
setLayout(vlayout1); setLayout(vlayout1);

View File

@@ -81,6 +81,22 @@ void ExportPropertiesWidget::setExportProperties(const ExportProperties &export_
} }
} }
/**
Passe le widget en mode Impression ou en mode Export. Le mode Impression
n'affiche pas autant d'options que le mode Export.
@param mode true pour utiliser le widget en mode impression, false pour
l'utiliser en mode export
*/
void ExportPropertiesWidget::setPrintingMode(bool mode) {
dirpath_label -> setVisible(!mode);
dirpath -> setVisible(!mode);
button_browse -> setVisible(!mode);
format_label -> setVisible(!mode);
format -> setVisible(!mode);
export_border -> setVisible(!mode);
export_elements -> setVisible(!mode);
}
/** /**
Slot demandant a l'utilisateur de choisir un dossier Slot demandant a l'utilisateur de choisir un dossier
*/ */
@@ -101,10 +117,11 @@ void ExportPropertiesWidget::slot_chooseADirectory() {
void ExportPropertiesWidget::build() { void ExportPropertiesWidget::build() {
// le dialogue est un empilement vertical d'elements // le dialogue est un empilement vertical d'elements
QVBoxLayout *vboxLayout = new QVBoxLayout(); QVBoxLayout *vboxLayout = new QVBoxLayout();
vboxLayout -> setContentsMargins(0, 0, 0, 0);
/* le dialogue comprend une ligne permettant d'indiquer un chemin de dossier (hboxLayout) */ /* le dialogue comprend une ligne permettant d'indiquer un chemin de dossier (hboxLayout) */
QHBoxLayout *hboxLayout = new QHBoxLayout(); QHBoxLayout *hboxLayout = new QHBoxLayout();
QLabel *dirpath_label = new QLabel(tr("Dossier cible :"), this); dirpath_label = new QLabel(tr("Dossier cible :"), this);
dirpath = new QLineEdit(this); dirpath = new QLineEdit(this);
QCompleter *completer = new QCompleter(this); QCompleter *completer = new QCompleter(this);
completer -> setModel(new QDirModel(completer)); completer -> setModel(new QDirModel(completer));
@@ -119,7 +136,8 @@ void ExportPropertiesWidget::build() {
/* une ligne permettant de choisir le format (hboxLayout1) */ /* une ligne permettant de choisir le format (hboxLayout1) */
QHBoxLayout *hboxLayout1 = new QHBoxLayout(); QHBoxLayout *hboxLayout1 = new QHBoxLayout();
hboxLayout1 -> addWidget(new QLabel(tr("Format :"), this)); format_label = new QLabel(tr("Format :"), this);
hboxLayout1 -> addWidget(format_label);
hboxLayout1 -> addWidget(format = new QComboBox(this)); hboxLayout1 -> addWidget(format = new QComboBox(this));
format -> addItem(tr("PNG (*.png)"), "PNG"); format -> addItem(tr("PNG (*.png)"), "PNG");
format -> addItem(tr("JPEG (*.jpg)"), "JPG"); format -> addItem(tr("JPEG (*.jpg)"), "JPG");
@@ -128,10 +146,9 @@ void ExportPropertiesWidget::build() {
hboxLayout1 -> addStretch(); hboxLayout1 -> addStretch();
vboxLayout -> addLayout(hboxLayout1); vboxLayout -> addLayout(hboxLayout1);
/* un cadre permettant de specifier les options de l'image finale */ /* un cadre permettant de specifier les options de l'image finale */
QGroupBox *groupbox_options = new QGroupBox(tr("Options")); QGroupBox *groupbox_options = new QGroupBox(tr("Options de rendu", "groupbox title"));
QGridLayout *optionshlayout = new QGridLayout(groupbox_options); QGridLayout *optionshlayout = new QGridLayout(groupbox_options);
// Choix de la zone du schema a exporter // Choix de la zone du schema a exporter
@@ -164,7 +181,6 @@ void ExportPropertiesWidget::build() {
optionshlayout -> addWidget(draw_colored_conductors, 3, 0); optionshlayout -> addWidget(draw_colored_conductors, 3, 0);
vboxLayout -> addWidget(groupbox_options); vboxLayout -> addWidget(groupbox_options);
vboxLayout -> addStretch();
setLayout(vboxLayout); setLayout(vboxLayout);
@@ -184,4 +200,9 @@ void ExportPropertiesWidget::build() {
// emission de signaux lors du changement de format et lors du changement de zone exportee // emission de signaux lors du changement de format et lors du changement de zone exportee
connect(format, SIGNAL(currentIndexChanged(int)), this, SIGNAL(formatChanged())); connect(format, SIGNAL(currentIndexChanged(int)), this, SIGNAL(formatChanged()));
connect(exported_content_choices, SIGNAL(buttonClicked(QAbstractButton *)), this, SIGNAL(exportedAreaChanged())); connect(exported_content_choices, SIGNAL(buttonClicked(QAbstractButton *)), this, SIGNAL(exportedAreaChanged()));
connect(draw_grid, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
connect(draw_border, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
connect(draw_inset, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
connect(draw_terminals, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
connect(draw_colored_conductors, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
} }

View File

@@ -38,6 +38,7 @@ class ExportPropertiesWidget : public QWidget {
public: public:
void setExportProperties(const ExportProperties &); void setExportProperties(const ExportProperties &);
ExportProperties exportProperties() const; ExportProperties exportProperties() const;
void setPrintingMode(bool);
public slots: public slots:
void slot_chooseADirectory(); void slot_chooseADirectory();
@@ -45,6 +46,7 @@ class ExportPropertiesWidget : public QWidget {
signals: signals:
void formatChanged(); void formatChanged();
void exportedAreaChanged(); void exportedAreaChanged();
void optionChanged();
// methodes privees // methodes privees
private: private:
@@ -52,8 +54,10 @@ class ExportPropertiesWidget : public QWidget {
// attributs // attributs
private: private:
QLabel *dirpath_label;
QLineEdit *dirpath; QLineEdit *dirpath;
QPushButton *button_browse; QPushButton *button_browse;
QLabel *format_label;
QComboBox *format; QComboBox *format;
QCheckBox *draw_grid; QCheckBox *draw_grid;
QCheckBox *draw_border; QCheckBox *draw_border;