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 Error message
Forum Updated to NodeBB v4.3 + New Features

QT Error message

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 651 Views 2 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
    Prathamesh
    wrote on last edited by
    #1

    exactMatch(self, str): first argument of unbound method must have type 'QRegExp'

    I am getting this error after writing following line in my code : -

    regexp = QRegExp.exactMatch(self, tag).

    What is wrong with this?

    jsulmJ 1 Reply Last reply
    0
    • P Prathamesh

      exactMatch(self, str): first argument of unbound method must have type 'QRegExp'

      I am getting this error after writing following line in my code : -

      regexp = QRegExp.exactMatch(self, tag).

      What is wrong with this?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Prathamesh said in QT Error message:

      What is wrong with this?

      exactMatch is NOT a static method...

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

      P 1 Reply Last reply
      2
      • jsulmJ jsulm

        @Prathamesh said in QT Error message:

        What is wrong with this?

        exactMatch is NOT a static method...

        P Offline
        P Offline
        Prathamesh
        wrote on last edited by
        #3

        @jsulm What should I use for exact string matching?

        KroMignonK jsulmJ 2 Replies Last reply
        0
        • P Prathamesh

          @jsulm What should I use for exact string matching?

          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by
          #4

          @Prathamesh said in QT Error message:

          What should I use for exact string matching?

          You have to create a QRegExp() instance, then you can use exactMatch().

          According to documentation https://doc.qt.io/qtforpython-5/PySide2/QtCore/QRegExp.html (I think you are using python):

          rx = QRegExp("*.txt")
          rx.setPatternSyntax(QRegExp.Wildcard)
          rx.exactMatch("README.txt")        # returns True
          rx.exactMatch("welcome.txt.bak")   # returns False
          

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          1 Reply Last reply
          1
          • P Prathamesh

            @jsulm What should I use for exact string matching?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Prathamesh These are actually Python basics (has nothing to do with Qt):

            regexp = QRegExp("YOUR_REGULAR_EXPRESSION_HERE")
            result = regexp.exactMatch(tag)
            

            You should also use https://doc.qt.io/qt-5/qregularexpression.html instead of QRegExp.

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

            P 1 Reply Last reply
            1
            • jsulmJ jsulm

              @Prathamesh These are actually Python basics (has nothing to do with Qt):

              regexp = QRegExp("YOUR_REGULAR_EXPRESSION_HERE")
              result = regexp.exactMatch(tag)
              

              You should also use https://doc.qt.io/qt-5/qregularexpression.html instead of QRegExp.

              P Offline
              P Offline
              Prathamesh
              wrote on last edited by
              #6

              @jsulm ok, i am new to both python and Qt as well.

              artwawA 1 Reply Last reply
              0
              • P Prathamesh

                @jsulm ok, i am new to both python and Qt as well.

                artwawA Offline
                artwawA Offline
                artwaw
                wrote on last edited by
                #7

                @Prathamesh I believe I cautioned you three or four times (in the thread you titled "Problem with/in QTreeview" or similar) that QRegExp is obsolete and much better effects you can have with QRegularExpression which you should use anyway...

                For more information please re-read.

                Kind Regards,
                Artur

                P 1 Reply Last reply
                1
                • artwawA artwaw

                  @Prathamesh I believe I cautioned you three or four times (in the thread you titled "Problem with/in QTreeview" or similar) that QRegExp is obsolete and much better effects you can have with QRegularExpression which you should use anyway...

                  P Offline
                  P Offline
                  Prathamesh
                  wrote on last edited by
                  #8

                  @artwaw Yeah ,but my problem is how to set regexp? If I use QRegExp, I can do it by using self.filter_proxy_model.setFilterRegExp(regexp) <-- this way.

                  If I use QRegularExpression ,then I have to go for setRegularExpression() method if I understood it correctly. But this method is not available with our qt version. That is why I am looking for an alternatives.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Hi,

                    This means that you are using Qt 4. Be aware that this version has reached end of life a long time ago so you should be careful what you implement with that.

                    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
                    1

                    • Login

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