It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, Matthias!
Is there are way to change main window title via environment variable/command-line option/scripting (adding arbitrary suffix to KLayout <version>
)? Our application may launch multiple instances of KLayout, so it'll be easier to differentiate them. Currently tab title is added, but in our case all tabs in session are created by same code, so duplicating description in each tab would be overkill as well as complicate switching between multiple tabs when scrolling would be necessary.
Comments
Hi Eugene,
basically you can change the window title this way:
This works because pya.MainWindow inherits QMainWindow. However, the title is reset when KLayout loads a new file or the tab is changed. So that's not a permanent solution.
Best regards,
Matthias
Hi, Matthias!
Thank you for explanations! Looks like doable after some work :-)
On other thought it'll be good idea to specify such string in session, so it could be used after KLayout re-launch.
Hi, Matthias!
I embedded necessary data to layout's user properties and then change title in
MainWindow.on_current_view_changed
andCellView.on_active_cellview_changed
handlers by calling same function. This works fine in former case, but not in later. Looks like title set inCellView.on_active_cellview_changed
is overridden by standard one after notification call.Hi, Matthias!
I dug into code and found that
MainWindow::current_view_changed
generate event after title update, butLayoutView::active_cellview_changed
emittitle_changed
event for empty title afteractive_cellview_changed_event
.By the word,
LayoutView::active_cellview_changed_with_index_event
seems to be unused.Hi Eugene,
yes, the title patch is just temporary. It's using the underlying Qt object directly.
I don't think it's basically possible to capture all cases when the title is overwritten, so either you install a timer that periodically resets the title (ugly) or a custom main window title is introduced as a native feature.
Matthias