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. Entry and exit signal syntax for qlistwidget[solved]
Forum Updated to NodeBB v4.3 + New Features

Entry and exit signal syntax for qlistwidget[solved]

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.7k 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.
  • T Offline
    T Offline
    tanmay2227
    wrote on last edited by
    #1

    i am trying to implement a slot for whenever the mouse enters the vicinity of a list . but all the tries i have attempted have failed so far can you please tell me what is the correct syntax.

    i want a function to perform whenever the cursor enters the list it performs a particular function and when it leaves it shuts the function.

    i can implement the entered signal but there is no signal for leaving the list

    Tanmay Priyadarshi

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tanmay2227
      wrote on last edited by
      #2

      do i have to use mouse events only cant i work with only signals for this

      Tanmay Priyadarshi

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

        Hi,

        You can reimplement the mouseEnterEvent and mouseLeaveEvent and emit a signal from there

        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
        0
        • T Offline
          T Offline
          tanmay2227
          wrote on last edited by
          #4

          thanks that is working in my application but when i try to implement it in a custom widget its showing the the event to be undefined

          Tanmay Priyadarshi

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tanmay2227
            wrote on last edited by
            #5

            bool MyList::eventFilter(QObject* object, QEvent* event )
            {
            if (object==this)
            {
            if(event==QEvent::Enter)
            {
            for(int i=1;i<count();i++)
            {

                        setRowHidden(i,false);
                    }
                    setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
                    setMaximumHeight(60);
                }
                if(event->type()==QEvent::Leave)
                {
                    for(int i=0;i<count()-1;i++)
                    {
                       setRowHidden(i,true);
                    }
                    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
                    setMaximumHeight(60);
                    setMaximumHeight(20);
                }
            }
            return false;
            

            }


            i am implementing a class subclassing a qlistwidget


            C:\Qt\Qt5.0.1\Tools\QtCreator\bin\MyListPlugin\mylist.cpp:21: error: C2027: use of undefined type 'QEvent'
            '
            C:\Qt\Qt5.0.1\Tools\QtCreator\bin\MyListPlugin\mylist.cpp:21: error: C2227: left of '->type' must point to class/struct/union/generic type


            why is that
            cant events be implemented with widgets

            Tanmay Priyadarshi

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tanmay2227
              wrote on last edited by
              #6

              thanks its working now .
              it seems i have to work with qwidgets class when subclassing for qwidget
              thank you sgaist

              Tanmay Priyadarshi

              1 Reply Last reply
              0

              • Login

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