Results 1 to 3 of 3

Thread: Strange problem with events on Unix

  1. #1
    Join Date
    Sep 2006
    Posts
    12
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Strange problem with events on Unix

    Hi,

    I am implementing plain text editor using QTextEdit.
    I have reimplemented MousePressEvent to make sure that ALT and CONTROL buttons are pressed simultaneously during mouse press event.

    This is working fine on windows environment. But the same is not working fine on UNIX environment.

    On UNIX the following condition is not being true even though all the criterias are met.

    "(me->state() & Qt::AltButton) && (me->state() & Qt::ControlButton)" is not being identified on unix.

    Following is the code snippet.

    I am calling processMousePressEvent function once mousePressEvent Occurs.
    void Editor:rocessMousePressEvent( QMouseEvent *me )
    {

    // Control comes here
    //With the key press of Alt and Control button only the selection of text can happen
    if( (me->state() & Qt::AltButton) && (me->state() & Qt::ControlButton) )
    {
    m_bCopyColumn = true;
    }
    else
    m_bCopyColumn = false;
    }

    The above code is working very well on windows.

    I wonder how QT is behaving differently on UNIX and Windows.

    Please give some suggestions.

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Strange problem with events on Unix

    Maybe you don't press alt but meta key?

  3. #3
    Join Date
    Jan 2006
    Location
    Russia
    Posts
    50
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Strange problem with events on Unix

    from Qt's manual (a part of the description of QMouseEvent::state () method ) :

    This value is mainly interesting for QEvent::MouseMove; for the other cases, button() is more useful.

Similar Threads

  1. Strange Problem with JPEG Support on win XP
    By caligula in forum Installation and Deployment
    Replies: 3
    Last Post: 18th September 2006, 10:36
  2. Problem with receiving events from QDateEdit
    By gunhelstr in forum Qt Programming
    Replies: 4
    Last Post: 20th April 2006, 11:21
  3. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.