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. Presenting horizontally scrollable text with label
Forum Updated to NodeBB v4.3 + New Features

Presenting horizontally scrollable text with label

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 460 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.
  • M Offline
    M Offline
    MS_GX
    wrote on last edited by MS_GX
    #1

    PySide2, Qt5

    I need to present genomic sequences which are very long (see image one). I have to present many of them. They are very similar, with a few differences (red characters, image 2).

    Now I want a fixed label (left text field in image 1, "Seq....."). On the right the sequences are presented and are horizontally scrollable. The labels should always be shown in their full length. So no horizontal scrollbar on the label text field.

    Image1:
    GGraphicsScene.png

    Image 2, If I scroll horizontally it looks like this:
    QGraphicsScene2.png

    I have the following questions:

    1. I implemented this with two QGraphicsScene widgets. Is this the right way to do it? Or would you tackle this problem in a different way? They are placed in the same layout by the way.

    2. I want the two text fields to be "fused". So I want the same behaviour, but the gap in between should be gone. But the labels ("Seq...") have to be static in place.

    3. I implemented zooming which works fine. One problem I have is that the left QGraphicsView will correctly increase its size when zooming in, but keep the width when zooming out and hence stay too big regarding width. I did it this way:

    self.view_labels.setFixedWidth(self.view_labels.scene().width())
    
    1. As soon as I have fixed the problems above I want to make sure that both text fields are vertically scrollable if there is too much text in the right field which fits into the text field. So there should be one scrollbar on the right scrolling both text fields synchronously.
    JonBJ 1 Reply Last reply
    0
    • M MS_GX

      PySide2, Qt5

      I need to present genomic sequences which are very long (see image one). I have to present many of them. They are very similar, with a few differences (red characters, image 2).

      Now I want a fixed label (left text field in image 1, "Seq....."). On the right the sequences are presented and are horizontally scrollable. The labels should always be shown in their full length. So no horizontal scrollbar on the label text field.

      Image1:
      GGraphicsScene.png

      Image 2, If I scroll horizontally it looks like this:
      QGraphicsScene2.png

      I have the following questions:

      1. I implemented this with two QGraphicsScene widgets. Is this the right way to do it? Or would you tackle this problem in a different way? They are placed in the same layout by the way.

      2. I want the two text fields to be "fused". So I want the same behaviour, but the gap in between should be gone. But the labels ("Seq...") have to be static in place.

      3. I implemented zooming which works fine. One problem I have is that the left QGraphicsView will correctly increase its size when zooming in, but keep the width when zooming out and hence stay too big regarding width. I did it this way:

      self.view_labels.setFixedWidth(self.view_labels.scene().width())
      
      1. As soon as I have fixed the problems above I want to make sure that both text fields are vertically scrollable if there is too much text in the right field which fits into the text field. So there should be one scrollbar on the right scrolling both text fields synchronously.
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @MS_GX
      I don't know whether you have a good reason for doing this via "two QGraphicsScene widgets"; you may have, perhaps for the zooming, perhaps for the column headers. I don't know about gfx scene widgets. But I will say the following, as possible food for thought.

      This looks like just a plain QTableView/QTableWidget. That has "horizontal headers", which is what your label column is. You can have the non-header area horizontally scrollable, for the sequences. (You can also reduce the gap between label & data.) You can also vertically scroll that. The advantage is that you don't have to worry about "syncing" the vertical scroll between two separate vertical widgets, it will scroll both. You also get the "keep vertical column headers in place" when scrolling vertically.

      Or, there is the Frozen Column Example to do the label column as "frozen" in place in a different way, still in a QTableView.

      As I say, you'll have to investigate whether this would allow the operations you want on items.

      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