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. Invalid use of non-static member function
QtWS25 Last Chance

Invalid use of non-static member function

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 2.0k 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.
  • J Offline
    J Offline
    Jeronimo
    wrote on last edited by A Former User
    #1

    Hi i am doing one little example to capture some pictures improved by me.
    QPixmap captura;
    captura = QScreen::grabWindow(QApplication::desktop()->winId());
    But show me this:
    invalid use of non-static member function

    I think QApplication::desktop()->winId() is outdate?
    Bye.

    K 1 Reply Last reply
    0
    • K Offline
      K Offline
      kenchan
      wrote on last edited by
      #2

      grabWindow is not a static function of QScreen. hence the error.

      you need to get the screen from the application object and then grab it.

      J 1 Reply Last reply
      3
      • J Jeronimo

        Hi i am doing one little example to capture some pictures improved by me.
        QPixmap captura;
        captura = QScreen::grabWindow(QApplication::desktop()->winId());
        But show me this:
        invalid use of non-static member function

        I think QApplication::desktop()->winId() is outdate?
        Bye.

        K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        @Jeronimo
        To add to @kenchan here is a link to QScreen documentation and there is actually an example available.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        2
        • K kenchan

          grabWindow is not a static function of QScreen. hence the error.

          you need to get the screen from the application object and then grab it.

          J Offline
          J Offline
          Jeronimo
          wrote on last edited by Jeronimo
          #4

          Solved thx for the documentation!

          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