Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] How to move a splitter divider manually

[Solved] How to move a splitter divider manually

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    julio jerez
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • J Offline
      J Offline
      julio jerez
      wrote on last edited by
      #2

      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.
      Awesome

      Here the fixes Slot code
      @void alchemediaVerticalSpliter::OnSpliterMove(int pos, int index)
      {
      if (!m_updating) {
      m_updating = true;

      moveSplitter(pos, index);
      m_updating = false;
      }
      }@

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved