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. What is the purpose of: if (object == header())
Forum Updated to NodeBB v4.3 + New Features

What is the purpose of: if (object == header())

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 270 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.
  • J Offline
    J Offline
    jlinkels
    wrote on last edited by jlinkels
    #1

    I am trying to understand the Qt Event filtering. Currently working on this function.

    bool KrInterDetailedView::eventFilter(QObject *object, QEvent *event)
    {
        if (object == header()) {
            if (event->type() == QEvent::ContextMenu) {
                auto *me = dynamic_cast<QContextMenuEvent *>(event);
                showContextMenu(me->globalPos());
                return true;
            } else if (event->type() == QEvent::Resize) {
                recalculateColumnSizes();
                return false;
            }
        }
        return false;
    }
    

    It is a part of Krusader file manager

    Apparently there is a check if object is equal to header(). But what IS header()?

    In gdb I cannot evaluate the function. Nor can I find any method in the QObject documentation.

    Obviously, googling for "QObject header" does not return many useful results.

    M 1 Reply Last reply
    0
    • J jlinkels

      I am trying to understand the Qt Event filtering. Currently working on this function.

      bool KrInterDetailedView::eventFilter(QObject *object, QEvent *event)
      {
          if (object == header()) {
              if (event->type() == QEvent::ContextMenu) {
                  auto *me = dynamic_cast<QContextMenuEvent *>(event);
                  showContextMenu(me->globalPos());
                  return true;
              } else if (event->type() == QEvent::Resize) {
                  recalculateColumnSizes();
                  return false;
              }
          }
          return false;
      }
      

      It is a part of Krusader file manager

      Apparently there is a check if object is equal to header(). But what IS header()?

      In gdb I cannot evaluate the function. Nor can I find any method in the QObject documentation.

      Obviously, googling for "QObject header" does not return many useful results.

      M Offline
      M Offline
      mpergand
      wrote on last edited by
      #2

      But what IS header()?

      class KrInterDetailedView : public QTreeView, public KrInterView

      QHeaderView *QTreeView::header() const

      J 1 Reply Last reply
      0
      • M mpergand

        But what IS header()?

        class KrInterDetailedView : public QTreeView, public KrInterView

        QHeaderView *QTreeView::header() const

        J Offline
        J Offline
        jlinkels
        wrote on last edited by
        #3

        @mpergand Thank you.

        1 Reply Last reply
        0
        • J jlinkels has marked this topic as solved on

        • Login

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