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. Sort Model regExp Error.
Qt 6.11 is out! See what's new in the release blog

Sort Model regExp Error.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.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.
  • P Offline
    P Offline
    Pada_
    wrote on last edited by
    #1

    QRegExp regExp (regExpStr, Qt :: CaseInsensitive, QRegExp :: RegExp2);
    sortModel-> setFilterRegExp (regExp);

    Is used.

    I want to create a regExp that contains A in regExpStr but not B.

    So I did A | [^ (B)] but it does not respond. What should I do?

    JonBJ 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2
      • use QRegularExpression instread of QRegExp
      • https://www.regular-expressions.info/lookaround.html

      If the above is not enough use 2 separate proxys one for the A part and this one for the not B part

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      P 1 Reply Last reply
      4
      • P Pada_

        QRegExp regExp (regExpStr, Qt :: CaseInsensitive, QRegExp :: RegExp2);
        sortModel-> setFilterRegExp (regExp);

        Is used.

        I want to create a regExp that contains A in regExpStr but not B.

        So I did A | [^ (B)] but it does not respond. What should I do?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @Pada_ said in Sort Model regExp Error.:

        [^ (B)]

        That means: not one of the characters: space, (, B, ). Probably nothing like what you want. And the | for "or" does not correspond to "contains A in regExpStr but not B." Might be simpler to follow @VRonin's suggestion of two separate proxies.

        1 Reply Last reply
        4
        • VRoninV VRonin
          • use QRegularExpression instread of QRegExp
          • https://www.regular-expressions.info/lookaround.html

          If the above is not enough use 2 separate proxys one for the A part and this one for the not B part

          P Offline
          P Offline
          Pada_
          wrote on last edited by
          #4

          @VRonin
          @JonB

          I do not know what it means to use two proxies.

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            Your current program:
            source model -> QSortFilterProxyModel with "A | [^ (B)]" as filter ->view

            what we are suggesting:
            source model -> QSortFilterProxyModel with "A" as filter -> NegativeSortFilterProxyModel with "B" as a filter ->view

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            4

            • Login

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