IPFreely
13th June 2006, 08:16
Hi!
When I set mask from pixmap to widget, this widget not moving more then 512x411
Pixmap have transparent areas.
pict.cpp
#include <QApplication>
#include <QtGui>
#include <QtCore>
class MoveMe : public QWidget
{
public:
MoveMe( QWidget *parent=0, Qt::WFlags f=0)
:QWidget(parent, f) {}
protected:
void mousePressEvent( QMouseEvent *);
void mouseMoveEvent( QMouseEvent *);
private:
QPoint clickPos;
};
void MoveMe::mousePressEvent( QMouseEvent *e )
{
clickPos = e->pos();
}
void MoveMe::mouseMoveEvent( QMouseEvent *e )
{
qDebug()<<e->globalPos()-clickPos;
move( e->globalPos() - clickPos );
}
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MoveMe w;
QPixmap pixmap("pict.png");
w.setMask(pixmap.mask());
w.show();
return a.exec();
}
pict.pro
TEMPLATE = app
TARGET = pict
CONFIG += release
SOURCES = pict.cpp
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 :)
When I set mask from pixmap to widget, this widget not moving more then 512x411
Pixmap have transparent areas.
pict.cpp
#include <QApplication>
#include <QtGui>
#include <QtCore>
class MoveMe : public QWidget
{
public:
MoveMe( QWidget *parent=0, Qt::WFlags f=0)
:QWidget(parent, f) {}
protected:
void mousePressEvent( QMouseEvent *);
void mouseMoveEvent( QMouseEvent *);
private:
QPoint clickPos;
};
void MoveMe::mousePressEvent( QMouseEvent *e )
{
clickPos = e->pos();
}
void MoveMe::mouseMoveEvent( QMouseEvent *e )
{
qDebug()<<e->globalPos()-clickPos;
move( e->globalPos() - clickPos );
}
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MoveMe w;
QPixmap pixmap("pict.png");
w.setMask(pixmap.mask());
w.show();
return a.exec();
}
pict.pro
TEMPLATE = app
TARGET = pict
CONFIG += release
SOURCES = pict.cpp
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 :)