Some refactoring, bug fix

This commit is contained in:
Matthias Koefferlein
2025-09-08 19:30:07 +02:00
parent 20a3dbeaf8
commit e2b5c29131
8 changed files with 28 additions and 21 deletions
@@ -379,7 +379,7 @@ bool
EditorServiceBase::key_event (unsigned int key, unsigned int buttons)
{
if (is_active () && key == Qt::Key_Tab && buttons == 0) {
focus_page_open (focus_page ());
focus_page_open ();
return true;
} else {
return false;
@@ -387,8 +387,9 @@ EditorServiceBase::key_event (unsigned int key, unsigned int buttons)
}
int
EditorServiceBase::focus_page_open (EditorOptionsPage *fp)
EditorServiceBase::focus_page_open ()
{
auto fp = focus_page ();
return fp ? fp->show () : 0;
}
@@ -414,7 +415,7 @@ EditorServiceBase::show_error (tl::Exception &ex)
}
void
EditorServiceBase::focus_page_enter ()
EditorServiceBase::focus_page_open ()
{
// .. nothing yet ..
}
+7 -7
View File
@@ -265,6 +265,13 @@ public:
// The default implementation does nothing
}
/**
* @brief Gets called when the focus page opens
*
* The default implementation will call fp->show() and return its return value.
*/
virtual int focus_page_open ();
#if defined(HAVE_QT)
/**
* @brief Gets the editor options pages associated with this plugin
@@ -275,13 +282,6 @@ public:
* @brief Gets the focus page or 0 if there is none
*/
lay::EditorOptionsPage *focus_page ();
/**
* @brief Gets called when the focus page opens
*
* The default implementation will call fp->show() and return its return value.
*/
virtual int focus_page_open (EditorOptionsPage *fp);
#endif
private:
+1 -1
View File
@@ -121,7 +121,7 @@ MoveService::key_event (unsigned int key, unsigned int buttons)
}
int
MoveService::focus_page_open (EditorOptionsPage * /*fp*/)
MoveService::focus_page_open ()
{
// This method is called on "Tab" by "key_event". "fp" is null as we don't have a focus page registered.
if (is_active () && dispatcher ()) {
+1 -1
View File
@@ -56,7 +56,7 @@ private:
virtual bool key_event (unsigned int key, unsigned int buttons);
virtual void drag_cancel ();
virtual void deactivated ();
int focus_page_open (EditorOptionsPage *fp);
int focus_page_open ();
bool handle_click (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction);