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 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) ??

    Gojir4G jsulmJ 2 Replies Last reply
    0
    • P Pada_

      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) ??

      Gojir4G Offline
      Gojir4G Offline
      Gojir4
      wrote on 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_

        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) ??

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on 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
        4
        • jsulmJ jsulm

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

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

          @jsulm

          QRegularExpression is not setting sortModel..

          jsulmJ 1 Reply Last reply
          0
          • P Pada_

            @jsulm

            QRegularExpression is not setting sortModel..

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on 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
            0
            • jsulmJ jsulm

              @Pada_ said in Qt QRegExp not work ..:

              QRegularExpression is not setting sortModel..

              What do you mean?

              P Offline
              P Offline
              Pada_
              wrote on 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
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on 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
                2
                • SGaistS SGaist

                  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 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
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 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