Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 14, 2025

Overview

This PR adds a new option in the plugin settings that allows users to display the modelling and visualisation components in separate dock widgets instead of tabs within a single dock. By default, the plugin maintains its existing behavior (single dock with tabs) for backward compatibility.

Changes

New Setting

  • Added separate_dock_widgets boolean setting to PlgSettingsStructure (defaults to False)
  • Added checkbox in QGIS Settings → LoopStructural: "Use separate dock widgets for modelling and visualisation"

Implementation

The plugin now reads the setting during initialization and creates dock widgets accordingly:

Default Mode (separate_dock_widgets = False)

  • Creates a single dock widget titled "Loop" with modelling and visualisation tabs
  • Existing behavior is preserved

Separate Mode (separate_dock_widgets = True)

  • Creates two independent dock widgets:
    • "Loop - Modelling"
    • "Loop - Visualisation"
  • Both docks are initially tabbed together but can be positioned independently
  • Provides better flexibility for complex workflows and multi-monitor setups

Technical Details

Modified Files:

  • loopstructural/toolbelt/preferences.py - Added setting field
  • loopstructural/gui/dlg_settings.ui - Added checkbox control
  • loopstructural/gui/dlg_settings.py - Added load/save logic
  • loopstructural/gui/loop_widget.py - Added accessor methods for child widgets
  • loopstructural/plugin_main.py - Implemented conditional dock creation logic and cleanup
  • tests/qgis/test_plg_preferences.py - Added test coverage

The implementation uses accessor methods (get_modelling_widget() and get_visualisation_widget()) to extract child widgets from LoopWidget and place them in separate docks when the option is enabled.

Usage

  1. Open Settings → Options in QGIS
  2. Navigate to LoopStructural section
  3. Check "Use separate dock widgets for modelling and visualisation"
  4. Click OK or Apply
  5. Restart QGIS or reload the plugin for changes to take effect

The setting change requires plugin reinitialization since dock widgets are created during initGui(), which is standard QGIS behavior.

Benefits

  • Flexibility: Users can choose their preferred layout
  • Screen Real Estate: Better workspace optimization, especially on multi-monitor setups
  • Workflow Support: Independent positioning of modelling and visualisation panels
  • Backward Compatible: Existing users see no change unless they enable the option

Testing

  • ✅ Python syntax validation passed for all modified files
  • ✅ Test coverage added for the new setting
  • ✅ Follows existing code patterns and style
  • ✅ Proper cleanup implemented for both dock configurations

Resolves the request to provide an option for separate dock widgets while maintaining backward compatibility with the existing single-dock-with-tabs interface.

Original prompt

In the plugin there are two tabs modelling and visualisation. Please add an option that allows the two tabs to be represented by separate dock widgets in QGIS, this should be an option in the plugins settings. By default the plugin should have both widgets in the same dock.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: lachlangrose <7371904+lachlangrose@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option for separate dock widgets in QGIS Add option for separate dock widgets for modelling and visualisation Oct 14, 2025
Copilot AI requested a review from lachlangrose October 14, 2025 06:52
@lachlangrose lachlangrose marked this pull request as ready for review October 14, 2025 09:56
@lachlangrose lachlangrose merged commit 7e511a3 into main Oct 14, 2025
3 checks passed
@lachlangrose lachlangrose deleted the copilot/add-dock-widgets-option branch October 14, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants