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

Whats a QObject?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 811 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.
  • M Offline
    M Offline
    MokJ
    wrote on last edited by
    #1

    yeah thats my question.
    What are the objects or class could be called QObjects ?
    Can we say QTcpSOcket is a QObject ?
    Whenever I search for a QObject , search engine shows me QObject as a class.
    I want to know what object(s ) can be called a QObject?

    Taz742T jsulmJ 2 Replies Last reply
    0
    • M MokJ

      yeah thats my question.
      What are the objects or class could be called QObjects ?
      Can we say QTcpSOcket is a QObject ?
      Whenever I search for a QObject , search engine shows me QObject as a class.
      I want to know what object(s ) can be called a QObject?

      Taz742T Offline
      Taz742T Offline
      Taz742
      wrote on last edited by Taz742
      #2

      Welcome @MokJ
      QObject is the base class for the other Qt classes.
      QTcpSocket, QWidget as well as and every Qt class is QObject.

      Also if you want to use Qt SIGNAL & SLOT, QObject must be parent of your class.

      Do what you want.

      1 Reply Last reply
      3
      • M MokJ

        yeah thats my question.
        What are the objects or class could be called QObjects ?
        Can we say QTcpSOcket is a QObject ?
        Whenever I search for a QObject , search engine shows me QObject as a class.
        I want to know what object(s ) can be called a QObject?

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

        @MokJ To add to @Taz742 If you have a class A and a class B which inherits from A then you can say that any instance of B is an A. This is how inheritance in object oriented languages works.

        class Car
        {
        };
        
        class BMW : public Car
        {
        };
        
        BMW b;
        

        In this example b is a BMW AND a Car.

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

        1 Reply Last reply
        3
        • M Offline
          M Offline
          MokJ
          wrote on last edited by
          #4

          @Taz742 and @jsulm thanks very much...
          For clearing my doubt.

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

            Hi,

            One very important correction: NOT all classes from the Qt framework are QObject based. That wouldn't make sense at all.

            Such classes include: QString, QRegularExpression, QGraphicsItem etc.

            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
            6

            • Login

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