mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 06:20:53 +01:00
Title block template editor: now write the preview width to application settings.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1538 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -377,6 +377,8 @@ void QETTitleBlockTemplateEditor::initMenus() {
|
||||
Initialize layouts and widgets
|
||||
*/
|
||||
void QETTitleBlockTemplateEditor::initWidgets() {
|
||||
QSettings &settings = QETApp::settings();
|
||||
|
||||
// undo list on the right
|
||||
undo_stack_ = new QUndoStack(this);
|
||||
undo_view_ = new QUndoView(undo_stack_);
|
||||
@@ -391,6 +393,11 @@ void QETTitleBlockTemplateEditor::initWidgets() {
|
||||
// WYSIWYG editor as central widget
|
||||
template_edition_area_scene_ = new QGraphicsScene(this);
|
||||
template_edition_area_view_ = new TitleBlockTemplateView(template_edition_area_scene_);
|
||||
bool conv_ok;
|
||||
int conf_preview_width = settings.value("titleblocktemplateeditor/preview_width", -1).toInt(&conv_ok);
|
||||
if (conv_ok && conf_preview_width != -1) {
|
||||
template_edition_area_view_ -> setPreviewWidth(conf_preview_width);
|
||||
}
|
||||
setCentralWidget(template_edition_area_view_);
|
||||
|
||||
// cell edition widget at the bottom
|
||||
@@ -422,6 +429,12 @@ void QETTitleBlockTemplateEditor::initWidgets() {
|
||||
this,
|
||||
SLOT(pushGridUndoCommand(TitleBlockTemplateCommand *))
|
||||
);
|
||||
connect(
|
||||
template_edition_area_view_,
|
||||
SIGNAL(previewWidthChanged(int,int)),
|
||||
this,
|
||||
SLOT(savePreviewWidthToApplicationSettings(int, int))
|
||||
);
|
||||
connect(undo_stack_, SIGNAL(cleanChanged(bool)), this, SLOT(updateEditorTitle()));
|
||||
}
|
||||
|
||||
@@ -753,3 +766,13 @@ TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLoc
|
||||
void QETTitleBlockTemplateEditor::quit() {
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
Save the new preview width to application settings
|
||||
@param former_preview_width Unused, former preview width
|
||||
@param new_preview_width New preview width
|
||||
*/
|
||||
void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings(int former_preview_width, int new_preview_width) {
|
||||
Q_UNUSED(former_preview_width)
|
||||
QETApp::settings().setValue("titleblocktemplateeditor/preview_width", new_preview_width);
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ class QETTitleBlockTemplateEditor : public QETMainWindow {
|
||||
bool saveAsFile();
|
||||
void setReadOnly(bool);
|
||||
void quit();
|
||||
void savePreviewWidthToApplicationSettings(int, int);
|
||||
|
||||
private slots:
|
||||
TitleBlockTemplateLocation getTitleBlockTemplateLocationFromUser(const QString & = QString(), bool existing_only = true);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "templatecommands.h"
|
||||
#include "templatecellsset.h"
|
||||
#include "dimensionwidget.h"
|
||||
#include "qetapp.h"
|
||||
#include "qeticons.h"
|
||||
#define ROW_OFFSET 2
|
||||
#define COL_OFFSET 1
|
||||
@@ -758,12 +757,15 @@ void TitleBlockTemplateView::setReadOnly(bool read_only) {
|
||||
*/
|
||||
void TitleBlockTemplateView::setPreviewWidth(int width) {
|
||||
if (preview_width_ == width) return;
|
||||
int former_preview_width = preview_width_;
|
||||
preview_width_ = width;
|
||||
if (tbgrid_) {
|
||||
applyColumnsWidths();
|
||||
updateTotalWidthLabel();
|
||||
//adjustSceneRect();
|
||||
centerOn(form_);
|
||||
/// TODO center again the preview()
|
||||
}
|
||||
emit(previewWidthChanged(former_preview_width, preview_width_));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,6 +69,7 @@ class TitleBlockTemplateView : public QGraphicsView {
|
||||
void splitSelectedCell();
|
||||
void refresh();
|
||||
void changePreviewWidth();
|
||||
void setPreviewWidth(int);
|
||||
void updateLayout();
|
||||
void rowsDimensionsChanged();
|
||||
void columnsDimensionsChanged();
|
||||
@@ -93,11 +94,11 @@ class TitleBlockTemplateView : public QGraphicsView {
|
||||
signals:
|
||||
void selectedCellsChanged(QList<TitleBlockCell *>);
|
||||
void gridModificationRequested(TitleBlockTemplateCommand *);
|
||||
void previewWidthChanged(int, int);
|
||||
|
||||
private:
|
||||
QList<QAction *> rowsActions() const;
|
||||
QList<QAction *> columnsActions() const;
|
||||
void setPreviewWidth(int);
|
||||
void updateTotalWidthLabel();
|
||||
void requestGridModification(TitleBlockTemplateCommand *);
|
||||
int lastContextMenuCellIndex() const;
|
||||
|
||||
Reference in New Issue
Block a user