Skip to content

Support double‑click resizing on editor splitter#4341

Merged
sunderme merged 7 commits intotexstudio-org:masterfrom
octaeder:editSplitter
Feb 22, 2026
Merged

Support double‑click resizing on editor splitter#4341
sunderme merged 7 commits intotexstudio-org:masterfrom
octaeder:editSplitter

Conversation

@octaeder
Copy link
Copy Markdown
Contributor

This PR implements an easy‑to‑execute action that sets both editors to the same size (horizontally and vertically).

editSplitter

Note: Due to Qt’s limitations regarding double‑clicking on splitters, a custom event handler is used.

painter.fillRect(event->rect(), StyleHelper::borderColor());
}

void MiniSplitterHandle::mouseReleaseEvent(QMouseEvent *event)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qt knows mouseDoubleClickEvent with simplifies the code

qint64 now = QDateTime::currentMSecsSinceEpoch();
if (now - m_lastReleaseTime < QApplication::doubleClickInterval()) {
auto *sp = static_cast<MiniSplitter*>(splitter());
if (sp && sp->property("editorSplitter").toBool()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the should be not some "client specific" code in the class.
Minisplitter is helper class for GUI.
If you want to activate doubleClick resizing, it should be named as such.
Typically that should be a direct attribute and not a general property.

if (now - m_lastReleaseTime < QApplication::doubleClickInterval()) {
auto *sp = static_cast<MiniSplitter*>(splitter());
if (sp && sp->property("editorSplitter").toBool()) {
sp->setSizes(QList<int>() << 1 << 1);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to adapted to the specific client use case.
less than entries should be impeded by the splitter being invisisble, but more than two seem feasible.

@sunderme
Copy link
Copy Markdown
Member

General remark: does any other program use this approach ?

@octaeder
Copy link
Copy Markdown
Contributor Author

General remark: does any other program use this approach ?

NP++ does exactly the same, FreeCommander does the same with its two explorer windows. Others, like VSC and Qt Creater, maximize or restore panels with double-clicks.

@octaeder
Copy link
Copy Markdown
Contributor Author

I think that the existing minisplitter property is currently unused.
Before removing it, I’d like to confirm whether it still serves a purpose (e.g. for stylesheets or legacy behavior).
If it’s safe to remove, I can include that in this PR as well.

@octaeder
Copy link
Copy Markdown
Contributor Author

Thanks for clarifying details. What remains from my side is answering my question (if you like) regarding setProperty("minisplitter", true); in the MiniSplitter constructors.

@sunderme
Copy link
Copy Markdown
Member

I think that the existing minisplitter property is currently unused. Before removing it, I’d like to confirm whether it still serves a purpose (e.g. for stylesheets or legacy behavior). If it’s safe to remove, I can include that in this PR as well.

It is used in manhattanstyle.cpp (line 209)

@sunderme sunderme merged commit cecbc7f into texstudio-org:master Feb 22, 2026
8 checks passed
@sunderme
Copy link
Copy Markdown
Member

thanks

@octaeder octaeder deleted the editSplitter branch February 22, 2026 18:14
@octaeder
Copy link
Copy Markdown
Contributor Author

@sunderme Please test if it works for you (may depend on window manager etc.). After pulling from upstream and building again I see the same strange behavior which let me drop Qt's mouseDoubleClickEvent.

@octaeder
Copy link
Copy Markdown
Contributor Author

to clarify: After moving the splitter out of center, nothing happens with a double-click.I need a second one.

@octaeder
Copy link
Copy Markdown
Contributor Author

Among all available styles, only Adwaita and Orion are affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants