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. Qt QRegExp not work ..
Forum Updated to NodeBB v4.3 + New Features

Qt QRegExp not work ..

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 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 27 Jun 2018, 05:10 last edited by
    #1

    QString filterA = "numAttribute";
    QString filterB = "textAttribute";
    QString filterC = QString("%1|%2").arg(filterA),arg(filterB);

    QRegExp regExp(filterA | filterB, Qt::CaseInsensitive, QRegExp::Wildcard);
    this not work.

    QRegExp regExp(filterC, Qt::CaseInsensitive, QRegExp::Wildcard);
    this not work.

    how use, filterA or filterB filer in listModel(treeModel) ??

    G J 2 Replies Last reply 27 Jun 2018, 06:06
    0
    • P Pada_
      27 Jun 2018, 05:10

      QString filterA = "numAttribute";
      QString filterB = "textAttribute";
      QString filterC = QString("%1|%2").arg(filterA),arg(filterB);

      QRegExp regExp(filterA | filterB, Qt::CaseInsensitive, QRegExp::Wildcard);
      this not work.

      QRegExp regExp(filterC, Qt::CaseInsensitive, QRegExp::Wildcard);
      this not work.

      how use, filterA or filterB filer in listModel(treeModel) ??

      G Offline
      G Offline
      Gojir4
      wrote on 27 Jun 2018, 06:06 last edited by
      #2

      @Pada_ Hi,

      You are using your RegExp in Wildcard mode.
      try

      QRegExp regExp(filterC, Qt::CaseInsensitive, QRegExp::RegExp);
      //or
      QRegExp regExp(filterC, Qt::CaseInsensitive, QRegExp::RegExp2); //greedy quantifier
      
      1 Reply Last reply
      3
      • P Pada_
        27 Jun 2018, 05:10

        QString filterA = "numAttribute";
        QString filterB = "textAttribute";
        QString filterC = QString("%1|%2").arg(filterA),arg(filterB);

        QRegExp regExp(filterA | filterB, Qt::CaseInsensitive, QRegExp::Wildcard);
        this not work.

        QRegExp regExp(filterC, Qt::CaseInsensitive, QRegExp::Wildcard);
        this not work.

        how use, filterA or filterB filer in listModel(treeModel) ??

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 27 Jun 2018, 06:23 last edited by
        #3

        @Pada_ To add to @Gojir4 : you should use QRegularExpression, QRegExp is deprecated.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        P 1 Reply Last reply 5 Jul 2018, 06:10
        4
        • J jsulm
          27 Jun 2018, 06:23

          @Pada_ To add to @Gojir4 : you should use QRegularExpression, QRegExp is deprecated.

          P Offline
          P Offline
          Pada_
          wrote on 5 Jul 2018, 06:10 last edited by
          #4

          @jsulm

          QRegularExpression is not setting sortModel..

          J 1 Reply Last reply 5 Jul 2018, 06:20
          0
          • P Pada_
            5 Jul 2018, 06:10

            @jsulm

            QRegularExpression is not setting sortModel..

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 5 Jul 2018, 06:20 last edited by
            #5

            @Pada_ said in Qt QRegExp not work ..:

            QRegularExpression is not setting sortModel..

            What do you mean?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            P 1 Reply Last reply 5 Jul 2018, 06:23
            0
            • J jsulm
              5 Jul 2018, 06:20

              @Pada_ said in Qt QRegExp not work ..:

              QRegularExpression is not setting sortModel..

              What do you mean?

              P Offline
              P Offline
              Pada_
              wrote on 5 Jul 2018, 06:23 last edited by
              #6

              @jsulm

              QRegularExpression regExp ("text");

              sortModel-> setFilterRegExp (regexp);

              Can not be set in the model.

              lineedit
              A, B

              I want to filter only A or B and show it in sortModel ....

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 5 Jul 2018, 06:47 last edited by
                #7

                Hi,

                What exactly are you try to filter on your model ?
                You should give examples of what you have and what you expect.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                P 1 Reply Last reply 5 Jul 2018, 06:49
                2
                • S SGaist
                  5 Jul 2018, 06:47

                  Hi,

                  What exactly are you try to filter on your model ?
                  You should give examples of what you have and what you expect.

                  P Offline
                  P Offline
                  Pada_
                  wrote on 5 Jul 2018, 06:49 last edited by
                  #8

                  @SGaist

                  Hello..

                  An attribute is a name and a value.

                  If you write the value of the attribute name = attribute

                  I want to show it in sortModel.

                  Even if you do not use the name of an attribute,

                  or

                  Even if you do not use the value of the attribute,

                  I want to show something similar (containing).

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 5 Jul 2018, 10:29 last edited by
                    #9

                    What is "attribute" for you ?

                    Again, please provide concrete examples.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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