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.
Forum Update on Monday, May 27th 2025

Sort Model regExp Error.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 512 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.
  • P Offline
    P Offline
    Pada_
    wrote on 2 May 2019, 09:23 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?

    J 1 Reply Last reply 2 May 2019, 11:56
    0
    • V Offline
      V Offline
      VRonin
      wrote on 2 May 2019, 11:41 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 2 May 2019, 23:44
      4
      • P Pada_
        2 May 2019, 09:23

        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?

        J Offline
        J Offline
        JonB
        wrote on 2 May 2019, 11:56 last edited by JonB 5 Feb 2019, 11:59
        #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
        • V VRonin
          2 May 2019, 11:41
          • 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 2 May 2019, 23:44 last edited by
          #4

          @VRonin
          @JonB

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

          1 Reply Last reply
          0
          • V Offline
            V Offline
            VRonin
            wrote on 3 May 2019, 07:20 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

            1/5

            2 May 2019, 09:23

            • Login

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