[Solved] How to move a splitter divider manually
-
I am trying to make a four ways splitter typically use in many graphic packages and editors.
Basically I have a vertical Splitter with two horizontal splitters as children.
The horizontal splitter has a Signal/Slot pair that is meant to control it sibling.
Basically when eh uses drag the divider on the left I want that the right spliter move by the same amount.
This the slot code@void alchemediaVerticalSpliter::OnSpliterMove(int pos, int index)
{
if (!m_updating) {
m_updating = true;alchemediaCanvas* const myParent = (alchemediaCanvas*) parent();
if (myParent->m_leftPane == this) {
myParent->m_rightPane->moveSplitter(pos, index);
} else {
myParent->m_leftPane->moveSplitter(pos, index);
}
m_updating = false;
}
}@
And this is the signal connection@alchemediaCanvas::alchemediaCanvas(QWidget* const parent)
:QSplitter (Qt::Horizontal, parent)
{
m_leftPane = new alchemediaVerticalSpliter (this);
m_rightPane = new alchemediaVerticalSpliter (this);addWidget(m_leftPane);
addWidget(m_rightPane);connect (m_leftPane, SIGNAL (splitterMoved(int, int)), m_rightPane, SLOT (OnSpliterMove(int, int)));
connect (m_rightPane, SIGNAL (splitterMoved(int, int)), m_leftPane, SLOT (OnSpliterMove(int, int)));
}@
I do get the signal, however the function moveSplitter(pos, index);
Does not do anything, and I cannot find any other function that suggest it moves the devider.How can I do that, please
-
Oh I am sorry for the stupid question
I wire the signal incorrently, I wroter again liek this and now it works like a cham.
AwesomeHere the fixes Slot code
@void alchemediaVerticalSpliter::OnSpliterMove(int pos, int index)
{
if (!m_updating) {
m_updating = true;moveSplitter(pos, index);
m_updating = false;
}
}@