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. Same view 'lay out' for 2 QTableViews

Same view 'lay out' for 2 QTableViews

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.9k Views
  • 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.
  • T Offline
    T Offline
    TaxiRobin
    wrote on last edited by
    #1

    Hi,

    At the moment, I have 2 tables. 1 table (name it fileTableView) containts a couple of columns and rows containing data. The second table (call it selectionTableView) has the selected data of the first table (fileTableView).

    Now the two tables are aligned horizontal. First you have the fileTableView and beneath that, you have the selectionTableView. Both table views show the exact same columns. For example a column "File Name". When you now change the geometries of the column File Name, for example the width of the column (by dragging the mouse), the same column File Name in the selectionTableView must also change it's geometries. So that I get exactly two of the same table views but with one table containing the selected data from the first table.

    Now, I've tried a couple of things, like for example using a signal that get's emitted when changing the header widths: QHeaderView::sectionResized(), but this signal just doesn't get emitted!

    I've connected it with the following code:

    @QObject::connect(m_fileTableView->horizontalHeader(),SIGNAL(sectionResized(int,int,int)),m_selectionTableView,SLOT(onSectionResized(int,int,int)));@

    The onSectionResized is defined as a public slot with the following code:

    @QHeaderView* selectionHeader = m_selectionTableView->horizontalHeader();
    if(selectionHeader)
    return selectionHeader->resizeSection(index, newSize);
    else
    return ;@

    While debugging I've found out that the signal doesn't get emitted for the simple reason that the slot onSectionResized never gets called...

    So what happens now is that the data in bot tables get's its updates but the columns width's in both tables aren't 'linked'.

    Does anyone has a clue why my signal doesn't work or is there another method?

    Greetings,
    Robin

    -- They Call Him Machete!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Do you get some statements on the command line /debugger output window for the connect statement? Perhaps, there is a problem.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TaxiRobin
        wrote on last edited by
        #3

        No, just checked. I've got no warnings or special statements from the debugger output.

        -- They Call Him Machete!

        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