mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 22:00:35 +01:00
Implemented QETMainWindow::firstActivation, used it to fit view when editing an element.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1573 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1116,6 +1116,14 @@ void QETElementEditor::closeEvent(QCloseEvent *qce) {
|
|||||||
} else qce -> ignore();
|
} else qce -> ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
*/
|
||||||
|
void QETElementEditor::firstActivation(QEvent *event) {
|
||||||
|
Q_UNUSED(event)
|
||||||
|
if (ce_view) ce_view -> zoomFit();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remplit la liste des parties
|
Remplit la liste des parties
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ class QETElementEditor : public QETMainWindow {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
|
virtual void firstActivation(QEvent *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupActions();
|
void setupActions();
|
||||||
|
|||||||
@@ -24,7 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
QETMainWindow::QETMainWindow(QWidget *widget, Qt::WindowFlags flags) :
|
QETMainWindow::QETMainWindow(QWidget *widget, Qt::WindowFlags flags) :
|
||||||
QMainWindow(widget, flags),
|
QMainWindow(widget, flags),
|
||||||
display_toolbars_(0)
|
display_toolbars_(0),
|
||||||
|
first_activation_(true)
|
||||||
{
|
{
|
||||||
initCommonActions();
|
initCommonActions();
|
||||||
initCommonMenus();
|
initCommonMenus();
|
||||||
@@ -144,6 +145,15 @@ void QETMainWindow::checkToolbarsmenu() {
|
|||||||
bool QETMainWindow::event(QEvent *e) {
|
bool QETMainWindow::event(QEvent *e) {
|
||||||
if (e -> type() == QEvent::WindowStateChange) {
|
if (e -> type() == QEvent::WindowStateChange) {
|
||||||
updateFullScreenAction();
|
updateFullScreenAction();
|
||||||
|
} else if (first_activation_ && e -> type() == QEvent::WindowActivate) {
|
||||||
|
firstActivation(e);
|
||||||
|
first_activation_ = false;
|
||||||
}
|
}
|
||||||
return(QMainWindow::event(e));
|
return(QMainWindow::event(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Base implementation of firstActivation (does nothing).
|
||||||
|
*/
|
||||||
|
void QETMainWindow::firstActivation(QEvent *) {
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ class QETMainWindow : public QMainWindow {
|
|||||||
QAction *actionForMenu(QMenu *);
|
QAction *actionForMenu(QMenu *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *);
|
virtual bool event(QEvent *);
|
||||||
|
virtual void firstActivation(QEvent *);
|
||||||
|
|
||||||
// slots
|
// slots
|
||||||
public slots:
|
public slots:
|
||||||
@@ -57,5 +58,6 @@ class QETMainWindow : public QMainWindow {
|
|||||||
QMenu *help_menu_; ///< Help menu
|
QMenu *help_menu_; ///< Help menu
|
||||||
QMenu *display_toolbars_; ///< Show/hide toolbars/docks
|
QMenu *display_toolbars_; ///< Show/hide toolbars/docks
|
||||||
QHash<QMenu *, QAction *> menu_actions_; ///< Store actions retrieved when inserting menus
|
QHash<QMenu *, QAction *> menu_actions_; ///< Store actions retrieved when inserting menus
|
||||||
|
bool first_activation_; ///< Used to detect whether the window is activated for the first time
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ QETTitleBlockTemplateEditor::QETTitleBlockTemplateEditor(QWidget *parent) :
|
|||||||
opened_from_file_(false),
|
opened_from_file_(false),
|
||||||
read_only_(false),
|
read_only_(false),
|
||||||
duplicate_(false),
|
duplicate_(false),
|
||||||
first_activation_(true),
|
|
||||||
tb_template_(0),
|
tb_template_(0),
|
||||||
logo_manager_(0)
|
logo_manager_(0)
|
||||||
{
|
{
|
||||||
@@ -108,15 +107,12 @@ bool QETTitleBlockTemplateEditor::canClose() {
|
|||||||
/**
|
/**
|
||||||
@param event Object describing the received event.
|
@param event Object describing the received event.
|
||||||
*/
|
*/
|
||||||
bool QETTitleBlockTemplateEditor::event(QEvent *event) {
|
void QETTitleBlockTemplateEditor::firstActivation(QEvent *event) {
|
||||||
if (first_activation_ && event -> type() == QEvent::WindowActivate) {
|
Q_UNUSED(event)
|
||||||
if (duplicate_ && !opened_from_file_ && location_.parentCollection()) {
|
if (duplicate_ && !opened_from_file_ && location_.parentCollection()) {
|
||||||
// this editor is supposed to duplicate its current location
|
// this editor is supposed to duplicate its current location
|
||||||
QTimer::singleShot(250, this, SLOT(duplicateCurrentLocation()));
|
QTimer::singleShot(250, this, SLOT(duplicateCurrentLocation()));
|
||||||
}
|
|
||||||
first_activation_ = false;
|
|
||||||
}
|
}
|
||||||
return(QETMainWindow::event(event));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class QETTitleBlockTemplateEditor : public QETMainWindow {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool canClose();
|
bool canClose();
|
||||||
bool event(QEvent *);
|
virtual void firstActivation(QEvent *);
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user