mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 08:10:52 +01:00
Desormais, lors du drag'n drop d'un element depuis le panel d'element, la pixmap accrochee au pointeur est reduite si elle depasse une certaine taille.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@859 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -35,6 +35,18 @@
|
|||||||
*/
|
*/
|
||||||
#define ENABLE_PANEL_DND_CHECKS
|
#define ENABLE_PANEL_DND_CHECKS
|
||||||
|
|
||||||
|
/*
|
||||||
|
Largeur maximale, en pixels, de la pixmap accrochee au pointeur de la
|
||||||
|
souris
|
||||||
|
*/
|
||||||
|
#define QET_MAX_DND_PIXMAP_WIDTH 500
|
||||||
|
|
||||||
|
/*
|
||||||
|
Hauteur maximale, en pixels, de la pixmap accrochee au pointeur de la
|
||||||
|
souris
|
||||||
|
*/
|
||||||
|
#define QET_MAX_DND_PIXMAP_HEIGHT 375
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param parent Le QWidget parent du panel d'appareils
|
@param parent Le QWidget parent du panel d'appareils
|
||||||
@@ -439,8 +451,21 @@ void ElementsPanel::startDrag(Qt::DropActions supportedActions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// accrochage d'une pixmap representant l'appareil au pointeur
|
// accrochage d'une pixmap representant l'appareil au pointeur
|
||||||
drag -> setPixmap(temp_elmt -> pixmap());
|
QPixmap elmt_pixmap(temp_elmt -> pixmap());
|
||||||
drag -> setHotSpot(temp_elmt -> hotspot());
|
QPoint elmt_hotspot(temp_elmt -> hotspot());
|
||||||
|
|
||||||
|
// ajuste la pixmap si celle-ci est trop grande
|
||||||
|
QPoint elmt_pixmap_size(elmt_pixmap.width(), elmt_pixmap.height());
|
||||||
|
if (elmt_pixmap.width() > QET_MAX_DND_PIXMAP_WIDTH || elmt_pixmap.height() > QET_MAX_DND_PIXMAP_HEIGHT) {
|
||||||
|
elmt_pixmap = elmt_pixmap.scaled(QET_MAX_DND_PIXMAP_WIDTH, QET_MAX_DND_PIXMAP_HEIGHT, Qt::KeepAspectRatio);
|
||||||
|
elmt_hotspot = QPoint(
|
||||||
|
elmt_hotspot.x() * elmt_pixmap.width() / elmt_pixmap_size.x(),
|
||||||
|
elmt_hotspot.y() * elmt_pixmap.height() / elmt_pixmap_size.y()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
drag -> setPixmap(elmt_pixmap);
|
||||||
|
drag -> setHotSpot(elmt_hotspot);
|
||||||
|
|
||||||
// suppression de l'appareil temporaire
|
// suppression de l'appareil temporaire
|
||||||
delete temp_elmt;
|
delete temp_elmt;
|
||||||
|
|||||||
Reference in New Issue
Block a user