Results 1 to 3 of 3

Thread: Qt Splitter signals slots (how to do a quad view)

  1. #1
    Join Date
    Feb 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt Splitter signals slots (how to do a quad view)

    Hi,

    I'm trying to use signals and slots to make one splitter move as another splitter is moved. Basically I'm trying to tie two splitters together so that if one is moved left or right, the other one mirrors it's actions.

    I have 4 areas, imagine a 2x2 setup. I have a horizontal splitter separating the top 2 "boxes/windows" from the bottom 2 "boxes/windows" and have 2 vertical splitters separating the 2 "boxes/windows" on top from each other, and the two "boxes//windows" on the bottom from each other. When I move one of the vertical splitters, I want the other one to move too. I couldn't find a slot in QtDesigner for a splitter for it's coordinates.

    Any help would be greatly appreciated.

    here is my .ui file, just cut and paste it in a file called QuadSplitter.ui and you can load it into QtDesigner:
    __________________________________________________ ____________________________________
    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
    <class>Form</class>
    <widget class="QWidget" name="Form">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>923</width>
    <height>809</height>
    </rect>
    </property>
    <property name="windowTitle">
    <string>Form</string>
    </property>
    <layout class="QGridLayout" name="gridLayout">
    <item row="0" column="0">
    <widget class="QSplitter" name="splitter_3">
    <property name="frameShadow">
    <enum>QFrame::Raised</enum>
    </property>
    <property name="orientation">
    <enum>Qt::Vertical</enum>
    </property>
    <widget class="QSplitter" name="splitter_2">
    <property name="frameShadow">
    <enum>QFrame::Raised</enum>
    </property>
    <property name="orientation">
    <enum>Qt::Horizontal</enum>
    </property>
    <widget class="QScrollArea" name="scrollArea">
    <property name="widgetResizable">
    <bool>true</bool>
    </property>
    <widget class="QWidget" name="scrollAreaWidgetContents">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>422</width>
    <height>366</height>
    </rect>
    </property>
    </widget>
    </widget>
    <widget class="QScrollArea" name="scrollArea_2">
    <property name="widgetResizable">
    <bool>true</bool>
    </property>
    <widget class="QWidget" name="scrollAreaWidgetContents_2">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>469</width>
    <height>366</height>
    </rect>
    </property>
    </widget>
    </widget>
    </widget>
    <widget class="QSplitter" name="splitter">
    <property name="frameShadow">
    <enum>QFrame::Raised</enum>
    </property>
    <property name="orientation">
    <enum>Qt::Horizontal</enum>
    </property>
    <widget class="QScrollArea" name="scrollArea_3">
    <property name="widgetResizable">
    <bool>true</bool>
    </property>
    <widget class="QWidget" name="scrollAreaWidgetContents_3">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>422</width>
    <height>411</height>
    </rect>
    </property>
    </widget>
    </widget>
    <widget class="QScrollArea" name="scrollArea_4">
    <property name="widgetResizable">
    <bool>true</bool>
    </property>
    <widget class="QWidget" name="scrollAreaWidgetContents_4">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>469</width>
    <height>411</height>
    </rect>
    </property>
    </widget>
    </widget>
    </widget>
    </widget>
    </item>
    </layout>
    </widget>
    <resources/>
    <connections/>
    </ui>
    Last edited by ZarehG; 2nd March 2010 at 17:54.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Qt Splitter signals slots (how to do a quad view)

    What's about QSplitter::splitterMoved() and the parameter index, which is the "x coordinate". Designer is a great tool, but sometimes you have to handle signal and slots in your c++ code yourself...

  3. #3
    Join Date
    Feb 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Splitter signals slots (how to do a quad view)

    Yes, that was the answer. As you pointed out it doesn't seem doable from QtDesigner.

    thank you Lykurg,
    Zareh

Similar Threads

  1. about signals and slots
    By Sandip in forum Qt Programming
    Replies: 9
    Last Post: 15th July 2008, 16:02
  2. Signals and Slots
    By 83.manish in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2008, 10:31
  3. Replies: 5
    Last Post: 21st November 2007, 20:38
  4. help with signals and slots
    By superutsav in forum Qt Programming
    Replies: 3
    Last Post: 4th May 2006, 12:49
  5. Signals and Slots in dll
    By ankurjain in forum Qt Programming
    Replies: 8
    Last Post: 29th March 2006, 08:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.