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. Best choice for a long String GUI handling?
Forum Updated to NodeBB v4.3 + New Features

Best choice for a long String GUI handling?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 2.2k 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.
  • R Offline
    R Offline
    Rhadel
    wrote on last edited by
    #1

    I need to show information in my GUI. This is a very long String (a chromosome's nucleotid sequence: AGGCTATGCA....), thounsands of characters.
    Also, I need to show several of these Strings aligned one under the other:

    CHROMO 1 | ACGGTACCTAGAGCTTA
    CHROMO 2 | ATGGTACCTAGAGCTTA
    (...)

    The user should select a column (He can select a "letter" position, the full column).

    Whats the best Widget to show this long information and make some basic manipulation (select columns, replace some "letter" in a sequence..).

    Thank you for your advices.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      for column selection I suggest you to use TableWidget or TreeWidget (depending of your app architecture you could use Views instead of Widgets).

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rhadel
        wrote on last edited by
        #3

        Hi mcosta, thank you for your advice.

        I ve already tried with my own TableView, but It causes a laggy performance. Maybe Tables are not designed for a such function, included TableWidget, isnt? TreeWidget is faster? I dunno if TreeWidget provides a confortable navigation for so long String. Mmm

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bootchk
          wrote on last edited by
          #4

          Use a SimpleText inside a View that scrolls? The SimpleText's QDocument will tell you what index (which you can convert to column with a little math) of the text a mouse click is in. Set the layout width of the Document so that it wraps at the length of the longer sequence. Sorry, I don't have the details.

          Isn't there some other open source code that displays aligned sequences, from which you can get ideas?

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rhadel
            wrote on last edited by
            #5

            Heya bootchk, and ty for your reply.

            I've not understood what you mean with QDocument. Maybe several QTextEdit inside a QWidget, is that?

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bootchk
              wrote on last edited by
              #6

              Yes.

              (Sorry for the confusion. I use a QGraphicsScene. I should have said QGraphicsTextItem or QTextEdit instead of "simple text".) Both QGTI and QTextEdit are similar: they have a document() method to get the QTextDocument. That has a documentLayout() method to get a QTextLayout. That has a lineForTextPosition() method to get a line (at a cursor position). And so forth, you can determine the line and "column" in that line, where the user puts the visual cursor, or even using mouse event coords (as I recall.) The object model of the various classes (Document, Layout, etc) is not easy to understand, but it is not unusual, it has been used for a long time.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Rhadel
                wrote on last edited by
                #7

                Ok, I use now a QTextEdit. I thought It's a better idea use just one QTextEdit, and every line (row) will be occuped for a chromosome. I setted Vertical Scroll as "always", but I cannot force an String to occupe only one line.

                EDIT------

                Ok, now I use lineWrapMode = no wrap.

                My problem now is: how to set a new line: chromosomes are now written at the same line.

                *Anyway: * QTextEdit is still low performance when I load more than 10 - 12 chromosomes. Some others applications, even if they seem a bit "old" in terms of GUI, can move this amount of data. Maybe another Widget faster?

                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