mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Add highlight item on drag element (test it)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2644 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -97,6 +97,10 @@ ElementsPanel::ElementsPanel(QWidget *parent) :
|
|||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
setElementsCache(QETApp::collectionCache());
|
setElementsCache(QETApp::collectionCache());
|
||||||
|
|
||||||
|
// Init ptr of item treeview
|
||||||
|
it_ = 0;
|
||||||
|
it_prev_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,6 +135,11 @@ bool ElementsPanel::selectedItemIsWritable() const {
|
|||||||
@return la collection, la categorie ou l'element selectionne(e)
|
@return la collection, la categorie ou l'element selectionne(e)
|
||||||
*/
|
*/
|
||||||
ElementsCollectionItem *ElementsPanel::selectedItem() const {
|
ElementsCollectionItem *ElementsPanel::selectedItem() const {
|
||||||
|
// change color of drag element
|
||||||
|
if(it_prev_) {
|
||||||
|
it_prev_->setBackgroundColor(0, Qt::white);
|
||||||
|
}
|
||||||
|
|
||||||
ElementsLocation selected_location(selectedElementLocation());
|
ElementsLocation selected_location(selectedElementLocation());
|
||||||
if (!selected_location.isNull()) {
|
if (!selected_location.isNull()) {
|
||||||
return(QETApp::collectionItem(selected_location));
|
return(QETApp::collectionItem(selected_location));
|
||||||
@@ -199,6 +208,17 @@ void ElementsPanel::dragMoveEvent(QDragMoveEvent *e) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Change color on mouse over
|
||||||
|
it_ = itemAt(e -> pos());
|
||||||
|
if(it_prev_){
|
||||||
|
if(it_ != it_prev_){
|
||||||
|
it_->setBackgroundColor(0, Qt::cyan);
|
||||||
|
it_prev_->setBackgroundColor(0, Qt::white);
|
||||||
|
it_prev_ = it_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else it_prev_ = it_;
|
||||||
|
|
||||||
e -> accept();
|
e -> accept();
|
||||||
/// @todo mettre en valeur le lieu de depot
|
/// @todo mettre en valeur le lieu de depot
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,5 +121,6 @@ class ElementsPanel : public GenericPanel {
|
|||||||
int loading_progress_; ///< used to track the loading progress of elements collections
|
int loading_progress_; ///< used to track the loading progress of elements collections
|
||||||
bool first_reload_; ///< used to distinguish the first time this panel is reloaded
|
bool first_reload_; ///< used to distinguish the first time this panel is reloaded
|
||||||
QString filter_; ///< Currently applied filter
|
QString filter_; ///< Currently applied filter
|
||||||
|
QTreeWidgetItem *it_prev_, *it_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user