Support double‑click resizing on editor splitter#4341
Support double‑click resizing on editor splitter#4341sunderme merged 7 commits intotexstudio-org:masterfrom
Conversation
src/minisplitter.cpp
Outdated
| painter.fillRect(event->rect(), StyleHelper::borderColor()); | ||
| } | ||
|
|
||
| void MiniSplitterHandle::mouseReleaseEvent(QMouseEvent *event) |
There was a problem hiding this comment.
qt knows mouseDoubleClickEvent with simplifies the code
src/minisplitter.cpp
Outdated
| qint64 now = QDateTime::currentMSecsSinceEpoch(); | ||
| if (now - m_lastReleaseTime < QApplication::doubleClickInterval()) { | ||
| auto *sp = static_cast<MiniSplitter*>(splitter()); | ||
| if (sp && sp->property("editorSplitter").toBool()) { |
There was a problem hiding this comment.
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.
src/minisplitter.cpp
Outdated
| if (now - m_lastReleaseTime < QApplication::doubleClickInterval()) { | ||
| auto *sp = static_cast<MiniSplitter*>(splitter()); | ||
| if (sp && sp->property("editorSplitter").toBool()) { | ||
| sp->setSizes(QList<int>() << 1 << 1); |
There was a problem hiding this comment.
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.
|
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. |
|
I think that the existing minisplitter property is currently unused. |
then I'll address the mouseReleaseEvent
|
Thanks for clarifying details. What remains from my side is answering my question (if you like) regarding |
It is used in manhattanstyle.cpp (line 209) |
|
thanks |
|
@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. |
|
to clarify: After moving the splitter out of center, nothing happens with a double-click.I need a second one. |
|
Among all available styles, only Adwaita and Orion are affected. |
This PR implements an easy‑to‑execute action that sets both editors to the same size (horizontally and vertically).
Note: Due to Qt’s limitations regarding double‑clicking on splitters, a custom event handler is used.