Results 1 to 2 of 2

Thread: [Qt4] - Moving Widget...

  1. #1
    Join Date
    Jan 2006
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default [Qt4] - Moving Widget...

    Hi!
    When I set mask from pixmap to widget, this widget not moving more then 512x411
    Pixmap have transparent areas.

    pict.cpp
    Qt Code:
    1. #include <QApplication>
    2. #include <QtGui>
    3. #include <QtCore>
    4.  
    5. class MoveMe : public QWidget
    6. {
    7. public:
    8. MoveMe( QWidget *parent=0, Qt::WFlags f=0)
    9. :QWidget(parent, f) {}
    10.  
    11. protected:
    12. void mousePressEvent( QMouseEvent *);
    13. void mouseMoveEvent( QMouseEvent *);
    14. private:
    15. QPoint clickPos;
    16. };
    17.  
    18. void MoveMe::mousePressEvent( QMouseEvent *e )
    19. {
    20. clickPos = e->pos();
    21. }
    22.  
    23. void MoveMe::mouseMoveEvent( QMouseEvent *e )
    24. {
    25. qDebug()<<e->globalPos()-clickPos;
    26. move( e->globalPos() - clickPos );
    27. }
    28.  
    29. int main( int argc, char **argv )
    30. {
    31. QApplication a( argc, argv );
    32. MoveMe w;
    33. QPixmap pixmap("pict.png");
    34. w.setMask(pixmap.mask());
    35. w.show();
    36. return a.exec();
    37. }
    To copy to clipboard, switch view to plain text mode 

    pict.pro
    Qt Code:
    1. TEMPLATE = app
    2. TARGET = pict
    3. CONFIG += release
    4. SOURCES = pict.cpp
    To copy to clipboard, switch view to plain text mode 

    How I can move widget over all desktop?
    Thx!

    PS: SuSE 9.3, KDE 3.4.0 level "B", Qt 4.1.3
    PSS: sorry for my English, my native language is Russian

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Qt4] - Moving Widget...

    How big is the widget itself? I mean the widget, not the pixmap it contains.

Similar Threads

  1. [QT4] Saving a widget state
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 1st May 2006, 14:31
  2. Replies: 4
    Last Post: 24th March 2006, 22:50
  3. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16
  4. advanced split widget
    By vitaly in forum Qt Programming
    Replies: 10
    Last Post: 24th January 2006, 20:00
  5. [qt4] QScrollArea corner widget?
    By sertrem in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2006, 21:42

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.