Results 1 to 6 of 6

Thread: Problem with QLabel & mouseEvent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    33
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Problem with QLabel & mouseEvent

    hi,

    i've got a problem with a QLabel. I want to receive a mousePressEvent only inside the label.

    Qt Code:
    1. void MainWindow::mousePressEvent(QMouseEvent* event) {
    2. ...
    3. }
    To copy to clipboard, switch view to plain text mode 


    works fine, but

    Qt Code:
    1. void imageLabel::mousePressEvent(QMouseEvent* event) {
    2. ..
    3. }
    To copy to clipboard, switch view to plain text mode 


    doesn't work and the compiler tells me that imageLabel was not declared. But i declared it with

    Qt Code:
    1. imageLabel = new QLabel;
    To copy to clipboard, switch view to plain text mode 


    and put

    Qt Code:
    1. QLabel* imageLabel;
    To copy to clipboard, switch view to plain text mode 


    in the public section of the header.

    imageLabel should be able to receive mouseEvents, so am i using mousePressEvent in the wrong way or is there anything else i misunderstood
    Last edited by wysota; 26th May 2007 at 11:50. Reason: changed tags

Similar Threads

  1. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  2. 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
  •  
Qt is a trademark of The Qt Company.